{"id":1651,"url":"https://github.com/intelygenz/NetClient-iOS","last_synced_at":"2025-08-02T04:32:08.473Z","repository":{"id":62448917,"uuid":"88981511","full_name":"intelygenz/NetClient-iOS","owner":"intelygenz","description":"Versatile HTTP Networking in Swift","archived":true,"fork":false,"pushed_at":"2018-09-20T10:21:53.000Z","size":1631,"stargazers_count":121,"open_issues_count":1,"forks_count":13,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-07-08T21:17:44.869Z","etag":null,"topics":["alamofire","asynchronous","authentication","cache","framework","http","json","moya","networking","progress","request","response","stub","swift","swift-framework","swift-library","swift-package-manager","synchronous","task","urlsession"],"latest_commit_sha":null,"homepage":"https://intelygenz.github.io/NetClient-iOS/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/intelygenz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-21T12:28:27.000Z","updated_at":"2025-04-30T09:20:54.000Z","dependencies_parsed_at":"2022-11-01T23:17:07.894Z","dependency_job_id":null,"html_url":"https://github.com/intelygenz/NetClient-iOS","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/intelygenz/NetClient-iOS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intelygenz%2FNetClient-iOS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intelygenz%2FNetClient-iOS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intelygenz%2FNetClient-iOS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intelygenz%2FNetClient-iOS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intelygenz","download_url":"https://codeload.github.com/intelygenz/NetClient-iOS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intelygenz%2FNetClient-iOS/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334615,"owners_count":24233793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alamofire","asynchronous","authentication","cache","framework","http","json","moya","networking","progress","request","response","stub","swift","swift-framework","swift-library","swift-package-manager","synchronous","task","urlsession"],"created_at":"2024-01-05T20:15:52.342Z","updated_at":"2025-08-02T04:32:08.029Z","avatar_url":"https://github.com/intelygenz.png","language":"Swift","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/intelygenz/NetClient-iOS/raw/develop/Logo.png\"\u003e\n\u003c/p\u003e\n\n[![Twitter](https://img.shields.io/badge/contact-@intelygenz-0FABFF.svg?style=flat)](http://twitter.com/intelygenz)\n[![Version](https://img.shields.io/cocoapods/v/NetClient.svg?style=flat)](http://cocoapods.org/pods/NetClient)\n[![License](https://img.shields.io/cocoapods/l/NetClient.svg?style=flat)](http://cocoapods.org/pods/NetClient)\n[![Platform](https://img.shields.io/cocoapods/p/NetClient.svg?style=flat)](http://cocoapods.org/pods/NetClient)\n[![Swift](https://img.shields.io/badge/Swift-4-orange.svg?style=flat)](https://swift.org)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Swift Package Manager Compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-4BC51D.svg?style=flat)](https://github.com/apple/swift-package-manager)\n[![Build Status](https://travis-ci.org/intelygenz/NetClient-iOS.svg?branch=master)](https://travis-ci.org/intelygenz/NetClient-iOS)\n[![Help Contribute to Open Source](https://www.codetriage.com/intelygenz/netclient-ios/badges/users.svg)](https://www.codetriage.com/intelygenz/netclient-ios)\n\n**Net** is a versatile HTTP networking library written in Swift.\n\n## 🌟 Features\n\n- [x] URL / JSON / Property List Parameter Encoding\n- [x] Upload File / Data / Stream / Multipart Form Data\n- [x] Download File using Request or Resume Data\n- [x] Authentication with URLCredential\n- [x] Basic, Bearer and Custom Authorization Handling\n- [x] Default and Custom Cache Controls\n- [x] Default and Custom Content Types\n- [x] Upload and Download Progress Closures with Progress (only iOS \u003e= 11)\n- [x] cURL Command Debug Output\n- [x] Request and Response Interceptors\n- [x] Asynchronous and synchronous task execution\n- [x] Inference of response object type\n- [x] Network reachability\n- [x] TLS Certificate and Public Key Pinning\n- [x] Retry requests\n- [x] Codable / Decodable / Encodable protocols compatible (JSON / Property List)\n- [x] Customizable acceptable status codes range\n- [x] watchOS Compatible\n- [x] tvOS Compatible\n- [x] macOS Compatible\n- [x] [Alamofire](https://github.com/Alamofire/Alamofire) Implementation\n- [x] [Moya](https://github.com/Moya/Moya)Provider Extension\n- [x] [Kommander](https://github.com/intelygenz/Kommander-iOS) Extension\n- [x] [RxSwift](https://github.com/ReactiveX/RxSwift) Extension\n- [x] [Stub](https://en.wikipedia.org/wiki/Method_stub) Implementation\n\n## 📋 Requirements\n\n- iOS 8.0+ / macOS 10.9+ / tvOS 9.0+ / watchOS 2.0+\n- Xcode 9.0+\n- Swift 4.0+\n\n## 📲 Installation\n\nNet is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'NetClient'\n```\n\nFor Swift 3 compatibility use:\n\n```ruby\npod 'NetClient', '~\u003e 0.2'\n```\n\n#### Or you can install it with [Carthage](https://github.com/Carthage/Carthage):\n\n```ogdl\ngithub \"intelygenz/NetClient-iOS\"\n```\n\n#### Or install it with [Swift Package Manager](https://swift.org/package-manager/):\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/intelygenz/NetClient-iOS.git\")\n]\n```\n\n## 🐒 Usage\n\n### Build a NetRequest\n\n```swift\nimport Net\n\ndo {\n    let request = try NetRequest.builder(\"YOUR_URL\")!\n                .setAccept(.json)\n                .setCache(.reloadIgnoringLocalCacheData)\n                .setMethod(.PATCH)\n                .setTimeout(20)\n                .setJSONBody([\"foo\", \"bar\"])\n                .setContentType(.json)\n                .setServiceType(.background)\n                .setCacheControls([.maxAge(500)])\n                .setURLParameters([\"foo\": \"bar\"])\n                .setAcceptEncodings([.gzip, .deflate])\n                .setContentEncodings([.gzip])\n                .setBasicAuthorization(user: \"user\", password: \"password\")\n                .setHeaders([\"foo\": \"bar\"])\n                .build()\n} catch {\n    print(\"Request error: \\(error)\")\n}\n```\n\n### Request asynchronously\n\n```swift\nimport Net\n\nlet net = NetURLSession()\n\nnet.data(URL(string: \"YOUR_URL\")!).async { (response, error) in\n    do {\n        if let object: [AnyHashable: Any] = try response?.object() {\n            print(\"Response dictionary: \\(object)\")\n        } else if let error = error {\n            print(\"Net error: \\(error)\")\n        }\n    } catch {\n        print(\"Parse error: \\(error)\")\n    }\n}\n```\n\n### Request synchronously\n\n```swift\nimport Net\n\nlet net = NetURLSession()\n\ndo {\n    let object: [AnyHashable: Any] = try net.data(\"YOUR_URL\").sync().object()\n    print(\"Response dictionary: \\(object)\")\n} catch {\n    print(\"Error: \\(error)\")\n}\n```\n\n### Request from cache\n\n```swift\nimport Net\n\nlet net = NetURLSession()\n\ndo {\n    let object: [AnyHashable: Any] = try net.data(\"YOUR_URL\").cached().object()\n    print(\"Response dictionary: \\(object)\")\n} catch {\n    print(\"Error: \\(error)\")\n}\n```\n\n### Track progress\n\n```swift\nimport Net\n\nlet net = NetURLSession()\n\ndo {\n    let task = try net.data(\"YOUR_URL\").progress({ progress in\n        print(progress)\n    }).sync()\n} catch {\n    print(\"Error: \\(error)\")\n}\n```\n\n### Add interceptors for all requests\n\n```swift\nimport Net\n\nlet net = NetURLSession()\n\nnet.addRequestInterceptor { request in\n    request.addHeader(\"foo\", value: \"bar\")\n    request.setBearerAuthorization(token: \"token\")\n    return request\n}\n```\n\n### Retry requests\n\n```swift\nimport Net\n\nlet net = NetURLSession()\n\nnet.retryClosure = { response, _, _ in response?.statusCode == XXX }\n\ndo {\n    let task = try net.data(\"YOUR_URL\").retry({ response, error, retryCount in\n        return retryCount \u003c 2\n    }).sync()\n} catch {\n    print(\"Error: \\(error)\")\n}\n```\n\n## 🧙‍♂️ Codable\n\n### Encodable\n\n```swift\nimport Net\n\nlet request = NetRequest.builder(\"YOUR_URL\")!\n            .setJSONObject(Encodable())\n            .build()\n```\n\n### Decodable\n\n```swift\nimport Net\n\nlet net = NetURLSession()\n\ndo {\n    let object: Decodable = try net.data(\"YOUR_URL\").sync().decode()\n    print(\"Response object: \\(object)\")\n} catch {\n    print(\"Error: \\(error)\")\n}\n```\n\n## 🤝 Integrations\n\n### Love [Alamofire](https://github.com/Alamofire/Alamofire)?\n\n```ruby\npod 'NetClient/Alamofire'\n```\n\n```swift\nimport Net\n\nlet net = NetAlamofire()\n\n...\n```\n\n### Love [Moya](https://github.com/Moya/Moya)?\n\n```ruby\npod 'NetClient/Moya'\n```\n\n```swift\nimport Net\nimport Moya\n\nlet request = NetRequest(\"YOUR_URL\")!\nlet provider = MoyaProvider\u003cNetRequest\u003e()\nprovider.request(request) { result in\n    switch result {\n    case let .success(response):\n        print(\"Response: \\(response)\")\n    case let .failure(error):\n        print(\"Error: \\(error)\")\n    }\n}\n```\n\n### Love [Kommander](https://github.com/intelygenz/Kommander-iOS)?\n\n```ruby\npod 'NetClient/Kommander'\n```\n\n```swift\nimport Net\nimport Kommander\n\nlet net = NetURLSession()\nlet kommander = Kommander.default\n\nnet.data(URL(string: \"YOUR_URL\")!).execute(by: kommander, onSuccess: { object in\n    print(\"Response dictionary: \\(object as [AnyHashable: Any])\")\n}) { error in\n    print(\"Error: \\(String(describing: error?.localizedDescription))\")\n}\n\nnet.data(URL(string: \"YOUR_URL\")!).executeDecoding(by: kommander, onSuccess: { object in\n\tprint(\"Response object: \\(object as Decodable)\")\n}) { error in\n    print(\"Error: \\(String(describing: error?.localizedDescription))\")\n}\n```\n\n### Love [RxSwift](https://github.com/ReactiveX/RxSwift)?\n\n```ruby\npod 'NetClient/RxSwift'\n```\n\n```swift\nimport Net\nimport RxSwift\n\nlet request = NetRequest(\"YOUR_URL\")!\n_ = net.data(request).rx.response().observeOn(MainScheduler.instance).subscribe { print($0) }\n```\n\n### [Stub](https://en.wikipedia.org/wiki/Method_stub) Implementation\n\n```ruby\npod 'NetClient/Stub'\n```\n\n```swift\nimport Net\n\nlet net = NetStub()\n\nnet.asyncBehavior = .delayed(.main, .seconds(10)) // If you want to delay the response.\n\nnet.nextResult = .response(NetResponse.builder()....build())\n\n// Your test request here\n\nnet.nextResult = .error(.net(code: 500, message: \"Your network error.\", headers: ..., object: ..., underlying: ...))\n\n// Your test request here\n```\n\n## ❤️ Etc.\n\n* Contributions are very welcome.\n* Attribution is appreciated (let's spread the word!), but not mandatory.\n\n## 👨‍💻 Authors\n\n[alexruperez](https://github.com/alexruperez), alejandro.ruperez@intelygenz.com\n\n## 👮‍♂️ License\n\nNet is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":["Networking","Libs","Network","Network [🔝](#readme)"],"sub_categories":["Video","Network","Other free courses"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintelygenz%2FNetClient-iOS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintelygenz%2FNetClient-iOS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintelygenz%2FNetClient-iOS/lists"}