{"id":15561268,"url":"https://github.com/barredewe/moyanetworkclient","last_synced_at":"2025-04-23T22:25:29.017Z","repository":{"id":62448047,"uuid":"145674217","full_name":"BarredEwe/MoyaNetworkClient","owner":"BarredEwe","description":"NetworkClient based on Moya","archived":false,"fork":false,"pushed_at":"2020-10-13T18:50:05.000Z","size":5128,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-23T10:19:11.108Z","etag":null,"topics":["asynchronous","cache","clean","future","layer","moya","network","protocol","requests","sugar","swift"],"latest_commit_sha":null,"homepage":"","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/BarredEwe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-22T07:40:45.000Z","updated_at":"2023-10-20T00:28:35.000Z","dependencies_parsed_at":"2022-11-01T23:03:13.039Z","dependency_job_id":null,"html_url":"https://github.com/BarredEwe/MoyaNetworkClient","commit_stats":null,"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BarredEwe%2FMoyaNetworkClient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BarredEwe%2FMoyaNetworkClient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BarredEwe%2FMoyaNetworkClient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BarredEwe%2FMoyaNetworkClient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BarredEwe","download_url":"https://codeload.github.com/BarredEwe/MoyaNetworkClient/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242254176,"owners_count":20097531,"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","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":["asynchronous","cache","clean","future","layer","moya","network","protocol","requests","sugar","swift"],"created_at":"2024-10-02T16:06:52.874Z","updated_at":"2025-03-06T17:31:49.354Z","avatar_url":"https://github.com/BarredEwe.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"Images/Logo.png\" width=700\u003e\n\u003c/p\u003e\n\n\u003cH4 align=\"center\"\u003e\nSimple Swift Requests\n\u003c/H4\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cbr\u003e\n\u003ca href=\"https://github.com/BarredEwe/MoyaNetworkClient/releases/latest\"\u003e\u003cimg alt=\"CocoaPods\" src=\"https://img.shields.io/cocoapods/v/MoyaNetworkClient.svg\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://developer.apple.com/swift\"\u003e\u003cimg alt=\"Swift5\" src=\"https://img.shields.io/badge/language-Swift5-orange.svg\"/\u003e\u003c/a\u003e \n\u003ca href=\"https://cocoapods.org/pods/MoyaNetworkClient\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/cocoapods/l/MoyaNetworkClient.svg\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://developer.apple.com/\"\u003e\u003cimg alt=\"Platform\" src=\"https://img.shields.io/badge/platform-iOS-green.svg\"/\u003e\u003c/a\u003e\n\u003cbr/\u003e\n\u003ca href=\"https://www.codefactor.io/repository/github/barredewe/moyanetworkclient\"\u003e\u003cimg src=\"https://www.codefactor.io/repository/github/barredewe/moyanetworkclient/badge\" alt=\"CodeFactor\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://travis-ci.com/BarredEwe/MoyaNetworkClient\"\u003e\u003cimg src=\"https://travis-ci.com/BarredEwe/MoyaNetworkClient.svg?branch=master\" alt=\"CodeFactor\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/apple/swift-package-manage\"\u003e\u003cimg src=\"https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg\" alt=\"Swift Package Manager\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n## Introduction\n\nMoyaNC is an abstraction over abstraction (thanks to [Moya](https://github.com/Moya/Moya) 🖤🖤🖤) allowing you not to worry about the data mapping layer and just use your requests. The Codable protocol is used for JSON data mapping, all that is needed is to comply with this protocol and specify the type! Additionally, there is the ability to easily and simply cache any requests.\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first. After some setup, using MoyaNC is really simple. You can access an API like this:\n\n```swift\nclient = DefaultMoyaNC()\n\n// type 'Test' must be Codable\nclient.request(.zen) { (result: Result\u003cTest\u003e) in\n    switch result {\n    case let .success(test):\n        // do something with the finished object\n    case let .failure(error):\n        // do something with error\n    }\n}\n```\nThat's a basic example. Many API requests need parameters.\n\n## Extensions\n\nMoya provides extensions for:\n- **Cache**: Allows you to cache request data using a flexible caching policy. \nNeed to add `pod 'MoyaNetworkClient/Cache'` to the Podfile.\n- **FutureResult**: A Future is used to retrieve the result of a concurrent, asynchronous operation. It is a key building block in asynchronous, non-blocking code. \nNeed to add `pod 'MoyaNetworkClient/Future'` to the Podfile.\n\n### Cache\n\nA simple example to use caching requests:\n\nDefinition of caching at the API level:\n```swift\nenum TestAPI {\n    case .zen\n}\n\nextension TestAPI: MoyaTargetType, CacheTarget {\n    var cachePolicy: MoyaCachePolicy {\n        return .returnCacheDataElseLoad\n    }\n}\n```\nDefinition of caching at the request level:\n```swift\nclient = DefaultMoyaNC()\n\nclient.request(.zen, cache: .returnCacheDataElseLoad)\n```\n\n### FutureResult\n\nHere is an example of the kinds of complex logic possible with Futures:\n\n```swift\nclient = DefaultMoyaNC()\n\n// type 'Test' must be Codable\nclient.request(.zen)\n    .observeSuccess { (test: Test) in /* do something with the finished object */ }\n    .observeError { error in /* do something with error */) }\n    .execute()\n```\n\n## Installation\n### CocoaPods\n\nFor MoyaNetworkClient, use the following entry in your Podfile:\n\n```rb\npod 'MoyaNetworkClient'\n```\n\nThen run `pod install`.\n\nIn any file you'd like to use Moya in, don't forget to\nimport the framework with `import MoyaNetworkClient`.\n\n### Swift Package Manager\n\nTo integrate using Apple's Swift package manager, add the following as a dependency to your `Package.swift`:\n\n```swift\n.package(url: \"https://github.com/BarredEwe/MoyaNetworkClient.git\", .upToNextMajor(from: \"1.0.0\"))\n```\n\nand then specify `\"MoyaNetworkClient\"` as a dependency of the Target in which you wish to use MoyaNetworkClient.\n\n### Migration Guides\n\n**MoyaNC 3.0**:\n- Now the validation of the request occurs by the standard Moya parameter `var validationType: ValidationType`\n\n## Author\n\nBarredEwe, barredEwe@gmail.com\n\n## License\n\nMoyaNC is released under an MIT license. See License for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarredewe%2Fmoyanetworkclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarredewe%2Fmoyanetworkclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarredewe%2Fmoyanetworkclient/lists"}