{"id":32146601,"url":"https://github.com/cpageler93/api-client","last_synced_at":"2025-10-21T08:15:17.367Z","repository":{"id":40550351,"uuid":"255834538","full_name":"cpageler93/api-client","owner":"cpageler93","description":"Easy HTTP Client for Swift","archived":false,"fork":false,"pushed_at":"2022-05-03T03:04:28.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-03T23:39:22.682Z","etag":null,"topics":["async-http-client","http","http-client","swift","vapor"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cpageler93.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-15T07:10:24.000Z","updated_at":"2020-07-20T15:48:50.000Z","dependencies_parsed_at":"2022-08-09T22:51:14.320Z","dependency_job_id":null,"html_url":"https://github.com/cpageler93/api-client","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/cpageler93/api-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpageler93%2Fapi-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpageler93%2Fapi-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpageler93%2Fapi-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpageler93%2Fapi-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cpageler93","download_url":"https://codeload.github.com/cpageler93/api-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpageler93%2Fapi-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280225904,"owners_count":26293906,"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-10-21T02:00:06.614Z","response_time":58,"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-http-client","http","http-client","swift","vapor"],"created_at":"2025-10-21T08:15:14.501Z","updated_at":"2025-10-21T08:15:17.362Z","avatar_url":"https://github.com/cpageler93.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# APIClient\n\n![Swift](https://img.shields.io/badge/Swift-5.2-orange.svg?style=flat)\n![Xcode](https://img.shields.io/badge/Xcode-11-blue.svg?style=flat)\n[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/cpageler93/api-client/blob/master/LICENSE)\n[![Twitter: @cpageler93](https://img.shields.io/badge/contact-@cpageler93-blue.svg?style=flat)](https://twitter.com/cpageler93)\n\n`APIClient` is an easy to use HTTP Client for Swift based on [swift-server/async-http-client](https://github.com/swift-server/async-http-client)..\n\n## Usage Example (GitHub)\n\n\n### Call your APIs like this\n\n```swift\nlet githubClient = TestGitHubClient()\nlet repos = try githubClient.user.repositories(owner: \"cpageler93\").wait()\n```\n\n### GitHub API Client (simplified)\n\n```swift\nimport Foundation\nimport NIO\nimport NIOHTTP1\nimport APIClient\n\n\n// Define your clients routes\n\nclass TestGitHubClient: APIClient {\n\n    public var user: UserRoutes!\n\n    init() {\n        super.init(baseURL: URL(string: \"https://api.github.com\")!)\n        user = UserRoutes(apiHandler: self.handler)\n    }\n\n}\n\n// Define single routes\n\nstruct UserRoutes {\n\n    let apiHandler: APIRouteHandler\n\n    func repositories(owner: String) -\u003e EventLoopFuture\u003c[Repository]\u003e {\n        return apiHandler.get(\"/users/\\(owner)/repos\", headers: apiHandler.githubHeader())\n    }\n\n}\n\n\n// Codable DTOs\n\nstruct Repository: Codable {\n\n    var id: Int\n    var name: String?\n    var fullName: String?\n\n}\n\n\n// Header Helper\n\nprivate extension APIRouteHandler {\n\n    func githubHeader() -\u003e HTTPHeaders {\n        return headers([\"User-Agent\": \"Swift GitHub Client\"])\n    }\n\n}\n\n```\n\n## Need Help?\n\nPlease [submit an issue](https://github.com/cpageler93/api-client/issues) on GitHub or contact me via Mail or Twitter.\n\n## License\n\nThis project is licensed under the terms of the MIT license. See the [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpageler93%2Fapi-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcpageler93%2Fapi-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpageler93%2Fapi-client/lists"}