{"id":18162807,"url":"https://github.com/zunda-pixel/http-client","last_synced_at":"2025-04-07T05:23:47.454Z","repository":{"id":252550734,"uuid":"840746731","full_name":"zunda-pixel/http-client","owner":"zunda-pixel","description":"HTTPClient protocol for Swift","archived":false,"fork":false,"pushed_at":"2024-10-29T07:17:57.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T07:17:55.797Z","etag":null,"topics":["swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zunda-pixel.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-10T15:03:09.000Z","updated_at":"2024-10-29T07:19:09.000Z","dependencies_parsed_at":"2025-02-13T09:46:58.603Z","dependency_job_id":null,"html_url":"https://github.com/zunda-pixel/http-client","commit_stats":null,"previous_names":["zunda-pixel/http-client"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zunda-pixel%2Fhttp-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zunda-pixel%2Fhttp-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zunda-pixel%2Fhttp-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zunda-pixel%2Fhttp-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zunda-pixel","download_url":"https://codeload.github.com/zunda-pixel/http-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247596494,"owners_count":20964109,"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":["swift"],"created_at":"2024-11-02T10:05:19.792Z","updated_at":"2025-04-07T05:23:47.431Z","avatar_url":"https://github.com/zunda-pixel.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTTPClient\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fzunda-pixel%2Fhttp-client%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/zunda-pixel/http-client)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fzunda-pixel%2Fhttp-client%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/zunda-pixel/http-client)\n\nHTTPClient protocol for API Client Library\n\n```swift\nimport HTTPClient\nimport HTTPClientFoundation\nimport Foundation\n\nlet api = GitHubAPI(\n  token: \u003c#GITHUB_TOKEN#\u003e,\n  httpClient: .urlSession(.shared)\n)\n\nlet user = api.user(id: \u003c#user_id#\u003e)\n\nstruct GitHubAPI\u003cHTTPClient: HTTPClientProtocol\u003e {\n  let token: String\n  let httpClient: HTTPClient\n\n  func user(id: String) async throws -\u003e User {\n    let request = HTTPRequest(\n      method: .get,\n      url: url,\n      headerFields: [\n        .authorization: token\n      ]\n    )\n    let (data, response) = try await httpClient.execut(request, body: nil)\n    let user = try JSONDecoder().decode(User.self, from: data)\n    return user\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzunda-pixel%2Fhttp-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzunda-pixel%2Fhttp-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzunda-pixel%2Fhttp-client/lists"}