[Add] RadarSDKMotion 3.19.7-beta.1
[CocoaPods.git] / Specs / d / 4 / 2 / CreatuNetwork / 0.2.1 / CreatuNetwork.podspec.json
blob777736c06b3923016a9607f1b405857a03b5034c
2   "name": "CreatuNetwork",
3   "version": "0.2.1",
4   "summary": "This is Network request library. depends upon RXSwift, RxXoxoa, Moya/RxSwift, ReachabilitySwift",
5   "description": "## Requirements\n- Swift 4 or higher\n- target IOS 10 or higher\n\n## Linked Library\n\n- Alamofire (4.7.0)\n- KeychainSwift (10.0.0)\n- Moya (11.0.1)\n- ReachabilitySwift (4.1.0)\n- Result (3.2.4)\n- RxCocoa (4.1.2)\n- RxSwift (4.1.2)\n\n## Installation\n\nCreatuNetwork is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'CreatuNetwork'\n```\n\n## Api Model\nIn you api add extention [ApiTargetType]()\n```Swift\n\nimport Foundation\nimport Moya\nimport CreatuNetwork\n\nenum UserApi {\n    case login([String: Any])\n        case logout([String: Any])\n            case register([String: Any])\n                }\n\n                extension UserApi: ApiTargetType {\n                    var checkTokenValidity: Bool {\n                        return false\n                    }\n\n                    var baseURL: URL {\n                        return URL(string: \"{{ YOUR-BASE-URL-HERE }}\")!\n                    }\n\n                    var path: String {\n                        switch self {\n                            case .register:\n                                return \"{{ REGISTER }}\"\n                                case .login:\n                                    return \"{{ LOGIN}}\"\n                                    case .logout:\n                                        return \"{{ LOGOUT }}\"\n                                        }\n                                        }\n\n                                        var method: Moya.Method {\n                                            switch self {\n                                                case .register,\n                                                    .login,\n                                                    .logout:\n                                                    return .post\n                                                    }\n                                                    }\n\n                                                    var sampleData: Data {\n                                                        return Data()\n                                                    }\n\n                                                    var task: Task {\n                                                        switch self {\n                                                            case .register(let parameters),\n                                                                .login(let parameters),\n                                                                .logout(let parameters):\n                                                                return .requestParameters(parameters: parameters, encoding: URLEncoding.default)\n                                                                }\n                                                                }\n\n                                                                var headers: [String: String]? {\n                                                                    return [\"Accept\": \"application/json\"]\n                                                                }\n\n                                                                var authTokenType: AuthHeaderType {\n                                                                    switch self {\n                                                                        case .login:\n                                                                            return .basic\n                                                                            case .register,\n                                                                                .logout:\n                                                                                return .bearer\n                                                                                }\n                                                                                }\n                                                                                }\n\n                                                                                ```\n\n                                                                                ## Request\n\n                                                                                - request\n                                                                                ```Swift\n                                                                                Network.request(UserApi.login([\"username\": \"{{ USERNAME }}\", \"password\": \"{{ PASSWORD }}\"])).subscribe(onNext: {(response) in\n                                                                                                                                                                                       debugPrint(response)\n                                                                                                                                                                                       }, onError: { (error) in\n                                                                                                                                                                                       debugPrint(error)\n                                                                                                                                                                                       }).disposed(by: bag)\n                                                                                                                                                                                       ```\n                                                                                                                                                                                       - network check\n                                                                                                                                                                                       ```Swift\n                                                                                                                                                                                       Network.available() -> Bool // true if netowk available\n                                                                                                                                                                                       ```\n                                                                                                                                                                                       ## Response\n                                                                                                                                                                                       - response model\n                                                                                                                                                                                       ```swift\n                                                                                                                                                                                       var shouldTokenRefresh = false // true if your token out of date and you need to refresh token\n                                                                                                                                                                                       var response: Any? // your response data\n                                                                                                                                                                                       var message: String? // error message\n                                                                                                                                                                                       var success = true // true if your request successfully completed\n                                                                                                                                                                                       ```\n\n                                                                                                                                                                                       ## For token based life cycle\n\n                                                                                                                                                                                       - if custom authorization header\n                                                                                                                                                                                       ```Swift\n                                                                                                                                                                                       Authorize.customHeader {get set}\n                                                                                                                                                                                       ```\n\n                                                                                                                                                                                       - get access token\n                                                                                                                                                                                       ```Swift\n                                                                                                                                                                                       Authorize.accessToken {get}\n                                                                                                                                                                                       ```\n                                                                                                                                                                                       - get refresh token\n                                                                                                                                                                                       ```Swift\n                                                                                                                                                                                       Authorize.refreshToken {get}\n                                                                                                                                                                                       ```\n\n                                                                                                                                                                                       - get authorize model\n                                                                                                                                                                                       ```Swift\n                                                                                                                                                                                       Authorize.authorizeModel { get }\n                                                                                                                                                                                       ```\n\n                                                                                                                                                                                       - set access token with client id and client secret\n                                                                                                                                                                                       ```Swift\n                                                                                                                                                                                       Authorize.setAccessToken(_ clientId: String, clientSecret: String) -> Bool\n                                                                                                                                                                                       ```\n\n                                                                                                                                                                                       - set accesstoken with token string\n                                                                                                                                                                                       ```Swift\n                                                                                                                                                                                       Authorize.setAccessToken(_ token: String) -> Bool\n                                                                                                                                                                                       ```\n\n                                                                                                                                                                                       - clear all authorize saved data\n                                                                                                                                                                                       ```Swift\n                                                                                                                                                                                       Authorize.clearSavedData() -> Bool\n                                                                                                                                                                                       ```\n\n                                                                                                                                                                                       - update authorize model\n                                                                                                                                                                                       ```Swift\n                                                                                                                                                                                       Authorize.updateAuthorize(_ authorize: AuthorizeModel) -> Bool\n                                                                                                                                                                                       ```\n\n                                                                                                                                                                                       - update authorize model with json\n                                                                                                                                                                                       ```Swift\n                                                                                                                                                                                       Authorize.updateAuthorize(_ authorize: [String: Any]) -> Bool\n                                                                                                                                                                                       ```",
6   "homepage": "https://github.com/mohansinghthagunna/CreatuNetwork",
7   "license": {
8     "type": "MIT",
9     "file": "LICENSE"
10   },
11   "authors": {
12     "mohansinghthagunna": "mohansingh_thagunna@outlook.com"
13   },
14   "source": {
15     "git": "https://github.com/mohansinghthagunna/CreatuNetwork.git",
16     "tag": "0.2.1"
17   },
18   "social_media_url": "https://twitter.com/sngmon",
19   "platforms": {
20     "ios": "10.0"
21   },
22   "swift_version": "4.0",
23   "source_files": "CreatuNetwork/**/*",
24   "dependencies": {
25     "RxSwift": [
27     ],
28     "RxCocoa": [
30     ],
31     "Moya/RxSwift": [
33     ],
34     "ReachabilitySwift": [
36     ]
37   }