{"id":32151627,"url":"https://github.com/therakiburkhan/rkapiservice","last_synced_at":"2026-02-19T02:02:20.516Z","repository":{"id":47355403,"uuid":"489275225","full_name":"TheRakiburKhan/RKAPIService","owner":"TheRakiburKhan","description":"RKAPIService is a simple and handy API Service utilizes swift concurrency aka async/await","archived":false,"fork":false,"pushed_at":"2025-06-25T16:42:40.000Z","size":77,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-21T10:50:34.287Z","etag":null,"topics":["async-await","ios","macos","rest-api","swift","swift6","urlsession"],"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/TheRakiburKhan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-05-06T08:25:07.000Z","updated_at":"2025-06-25T16:42:03.000Z","dependencies_parsed_at":"2023-11-15T19:28:23.913Z","dependency_job_id":"486262b1-f9de-47e6-b54e-faf08a7a5349","html_url":"https://github.com/TheRakiburKhan/RKAPIService","commit_stats":{"total_commits":30,"total_committers":3,"mean_commits":10.0,"dds":0.06666666666666665,"last_synced_commit":"fd15b26de2ff43905c68ada31d51832d6d67f309"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/TheRakiburKhan/RKAPIService","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheRakiburKhan%2FRKAPIService","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheRakiburKhan%2FRKAPIService/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheRakiburKhan%2FRKAPIService/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheRakiburKhan%2FRKAPIService/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheRakiburKhan","download_url":"https://codeload.github.com/TheRakiburKhan/RKAPIService/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheRakiburKhan%2FRKAPIService/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29600847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T00:59:38.239Z","status":"online","status_checked_at":"2026-02-19T02:00:07.702Z","response_time":117,"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":["async-await","ios","macos","rest-api","swift","swift6","urlsession"],"created_at":"2025-10-21T10:48:24.928Z","updated_at":"2026-02-19T02:02:20.499Z","avatar_url":"https://github.com/TheRakiburKhan.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RKAPIService\n\n[![Coding time tracker](https://wakatime.com/badge/github/TheRakiburKhan/RKAPIService.svg)](https://wakatime.com/badge/github/TheRakiburKhan/RKAPIService)\n![Platforms Support](https://img.shields.io/badge/Platforms-iOS%20%7C%20macOS-blue)\n![License](https://img.shields.io/badge/License-MIT-blue)\n![Swift Package Manager](https://img.shields.io/badge/SPM-Compatible-green)\n![Cocoapod](https://img.shields.io/badge/pod-Incompatible-red)\n![Carthage](https://img.shields.io/badge/carthage-Incompatible-red)\n![Swift Version](https://img.shields.io/badge/Swift-5-red)\n![iOS Version](https://img.shields.io/badge/iOS-11-blue)\n![macOS Version](https://img.shields.io/badge/macOS-10.13-blue)\n![watchOS Version](https://img.shields.io/badge/watchOS-4-blue)\n![tvOS Version](https://img.shields.io/badge/tvOS-11-blue)\n\n`RKAPIService` uses Combine publishers or Swift's native concurrency *\"async/await\"*  and performs simple Restful API operations. Apple offers `URLSession` async/await API's only above *iOS 15.0*, *macOS 12.0*, *watchOS 8.0* and *tvOS 15.0* but swift concurrency is supported from *iOS 13.0*, *macOS 10.15*, *watchOS 6.0* and *tvOS 13.0*. `RKAPIService` let's developer utilize those `URLSession` *async/await* operations down to *iOS 13.0*, *macOS 10.15*, *watchOS 6.0* or *tvOS 13.0*\n\n***N.B: Currently we support `URLSession.dataTask` only. Rest is coming soon.***\n\n## Table of Contents\n\n- [System Requirments](#system-requirments)\n- [Installations](#installations)\n- [Usage](#usages)\n    - [For iOS 13.0+, macOS 10.15+, watchOS 6.0+ or tvOS 13.0+](#for-iOS-1300,macOS-1015,watchOS-6000-or-tvOS-1300)\n    - [For iOS 11.0+ and macOS 10.13+](#for-ios-110-and-macos-1013)\n- [Helper](#helper)\n- [Author](#author)\n- [Lisence](#license)\n- [Changelog](#changelog)\n\n## System Requirments\n\nRKAPIService requires \n\n- iOS 11.0 or above\n- macOS 10.13 or above\n- watchOS 4.0 or above\n- tvOS 11.0 or above\n- XCode 12.0 or above\n\n## Installations\n\nRKAPIService is available through [Swift Package Manager](https://swift.org/package-manager/). To install\nit, simply follow the steps:\n\n- In Xcode, select File \u003e Swift Packages \u003e Add Package Dependency.\n- Follow the prompts using the URL for this repository\n```\nhttps://github.com/TheRakiburKhan/RKAPIService.git\n```\n- Select the `RKAPIService` - prefixed libraries you want to use\n\n#### OR\nAdd as a package dependency \n``` Swift\n.package(url: \"https://github.com/TheRakiburKhan/RKAPIService.git\", from: \"3.0.0\")\n```\n\n## Usage\n\n### For iOS 13.0+, macOS 10.15+, watchOS 6.0+ or tvOS 13.0+\n\n- Import `RKAPIService` \n\n- Create and instance of `RKAPIService`. Developer can also use the *shared* instance by typing `RKAPIService.shared`\n\n- Use `func fetchItemsByHTTPMethod(urlLink: URL?, httpMethod: HTTPMethod, body: Data?, additionalHeader: [HTTPHeader]?) async throws -\u003e NetworkResult\u003cData\u003e` for calling any `URLSession.dataTask` operations. This is a *Throwing* method.\n\n- Use `func fetchItemsByHTTPMethod(urlLink: URL?, httpMethod: HTTPMethod, body: Data?, additionalHeader: [HTTPHeader]?) -\u003e AnyPublisher\u003cNetworkResult\u003cData\u003e, Error\u003e` for calling any `URLSession.dataTask` operations via `Combine` Publishers. This is non *Throwing* method.\n\n- If the developer want's to do simple *HTTP GET* request then there is another dedicated API for that,\n`func fetchItems(urlLink: URL?, additionalHeader: [HTTPHeader]?) async throws -\u003e NetworkResult\u003cData\u003e`. This is a *Throwing* method.\n\nIf the developer want's to do simple *HTTP GET* request then there is another dedicated API for that, `func fetchItems(urlLink: URL?, additionalHeader: [HTTPHeader]?) -\u003e AnyPublisher\u003cNetworkResult\u003cData\u003e, Error\u003e`. This is non *Throwing* method.\n\n#### Example with async/await\n\n``` Swift\nimport Foundation\nimport RKAPIService\n\nfinal class DataFetchService {\n    let apiService = RKAPIService.shared\n    \n    //If you want to use any type of HTTP Request\n    func fetchDataWithBody(url: URL?, method: HTTPMethod, body: Data?, additionalHeader: [HTTPHeader]?) async {\n        do {\n            let reply = try await apiService.fetchItemsByHTTPMethod(urlLink: url, httpMethod: method, body: body, additionalHeader: additionalHeader)\n            \n            //Handle your data and response code however you like\n\n            //Printing Optional\u003cData\u003e\n            debugPrint(reply.data)\n\n            //Printing HTTPStatusCode\n            debugPrint(reply.response)\n\n        } catch(let error) {\n            // Handle any exception or Error\n        }\n    }\n\n    // If you want to use HTTP Get Request only\n    func fetchData(url: URL?, additionalHeader: [HTTPHeader]?) async {\n        do {\n            let reply = try await apiService.fetchItems(urlLink: url, additionalHeader: additionalHeader)\n            \n            //Handle your data and response code however you like\n\n            //Printing Optional\u003cData\u003e\n            debugPrint(reply.data)\n\n            //Printing HTTPStatusCode\n            debugPrint(reply.response)\n\n        } catch(let error) {\n            // Handle any exception or Error\n        }\n    }\n}\n```\n\n#### Example with Combine Publisher\n\n``` Swift\nimport Foundation\nimport Combine\nimport RKAPIService\n\nfinal class DataFetchService {\n    let apiService = RKAPIService.shared\n    let cancellable = Set\u003cAnyCancellable\u003e()\n    \n    //If you want to use any type of HTTP Request\n    func fetchDataWithBody(url: URL?, method: HTTPMethod, body: Data?, additionalHeader: [HTTPHeader]?) {\n        apiService.fetchItemsByHTTPMethod(urlLink: url, httpMethod: method, body: body, additionalHeader: additionalHeader)\n        //Receiving on Main Thread\n            .receive(on: DispatchQueue.main)\n            .sink { reply in\n                switch reply {\n                    case .finished:\n                        // After finishing a successful call\n                        break\n                    case .failure(let error):\n                        // Handle any exception or Error\n                        break\n                }\n            } receiveValue: { result in\n                //Handle your data and response code however you like\n                \n                //Printing Optional\u003cData\u003e\n                debugPrint(result.data)\n                \n                //Printing HTTPStatusCode\n                debugPrint(result.response)\n            }\n        \n    }\n    \n    // If you want to use HTTP Get Request only\n    func fetchData(url: URL?, additionalHeader: [HTTPHeader]?) {\n        apiService.fetchItems(urlLink: url, additionalHeader: additionalHeader)\n        //Receiving on Main Thread\n            .receive(on: DispatchQueue.main)\n            .sink { reply in\n                switch reply {\n                    case .finished:\n                        // After finishing a successful call\n                        break\n                    case .failure(let error):\n                        // Handle any exception or Error\n                        break\n                }\n            } receiveValue: { result in\n                //Handle your data and response code however you like\n                \n                //Printing Optional\u003cData\u003e\n                debugPrint(result.data)\n                \n                //Printing HTTPStatusCode\n                debugPrint(result.response)\n            }\n    }\n}\n\n```\n\n### For iOS 11.0+ and macOS 10.10+\n\n- Import `RKAPIService` \n\n- Create and instance of `RKAPIService`. Developer can also use the *shared* instance by typing `RKAPIService.shared`\n\n- Use `func fetchItems(urlLink: URL?, _ completion: @escaping (Result\u003cNetworkResult\u003cData\u003e, Error\u003e)-\u003e Void )` for calling any `URLSession.dataTask` operations. This is a *Throwing* method\n\n- If the developer want's to do simple *HTTP GET* request then there is another dedicated API for that,\n`func fetchItemsByHTTPMethod(urlLink: URL?, httpMethod: HTTPMethod, body: Data?, _ completion: @escaping (Result\u003cNetworkResult\u003cData\u003e, Error\u003e)-\u003e Void )`\n#### Example\n\n``` Swift\nimport Foundation\nimport RKAPIService\n\nfinal class DataFetchService {\n    let apiService = RKAPIService.shared\n    \n    //If you want to use any type of HTTP Request\n    func fetchDataWithBody(url: URL?, method: HTTPMethod, body: Data?, additionalHeader: [HTTPHeader]?) {\n        apiService.fetchItemsByHTTPMethod(urlLink: url, httpMethod: method, body: body, additionalHeader: additionalHeader) { result in\n            switch result {\n                case .success(let reply):\n                    //Handle your data and response code however you like\n                    \n                    //Printing Optional\u003cData\u003e\n                    debugPrint(reply.data)\n                    \n                    //Printing HTTPStatusCode\n                    debugPrint(reply.response)\n                    \n                case .failure(let error):\n                    // Handle any exception or Error\n                    debugPrint(error)\n                    \n            }\n        }\n    }\n\n    // If you want to use HTTP Get Request only\n    func fetchData(url: URL?, additionalHeader: [HTTPHeader]?) {\n         apiService.fetchItems(urlLink: url, additionalHeader: additionalHeader) { result in\n            switch result {\n                case .success(let reply):\n                    //Handle your data and response code however you like\n                    \n                    //Printing Optional\u003cData\u003e\n                    debugPrint(reply.data)\n                    \n                    //Printing HTTPStatusCode\n                    debugPrint(reply.response)\n                    \n                case .failure(let error):\n                    // Handle any exception or Error\n                    debugPrint(error)\n                    \n            }\n        }\n    }\n}\n```\n## Helper\nWhen working with network communication, `URL` is the primary component. A simple URLBuilder is included with this package to build `URL` properly and effortlessly.\n- `buildURL(scheme: String, baseURL: String, portNo: Int?, path: String?, queries: [URLQueryItem]?)` returns an `URL?`\n- `buildURL(string: String, filter: CharacterSet)` returns an `URL?`\n\n#### Example\nHere is an exapmple of building simple url of  [Swift Pacakge Manager](https://swift.org/package-manager) page link.\n``` Swift\nRKAPIHelper.buildURL(scheme: \"https\", baseURL: \"swift.org\", portNo: nil, path: \"/package-manager\", queries: nil)\n\nRKAPIHelper.buildURL(string: \"https://swift.org/package-manager\", filter: .urlQueryAllowed)\n```\n\n## Author\n\nRakibur Khan, contact me via [email](mailto:therakiburkhan@gmail.com) or visit my [website](http://therakiburkhan.me)\n\n## License\n\nThis package is licensed under MIT License. See the [LICENSE](LICENSE) file.\n\n## Changelog\n\nAll changes are loggedd in [CHANGELOG](CHANGELOG.md) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftherakiburkhan%2Frkapiservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftherakiburkhan%2Frkapiservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftherakiburkhan%2Frkapiservice/lists"}