{"id":22358771,"url":"https://github.com/darrarski/swiftendpoint","last_synced_at":"2025-07-30T12:32:02.127Z","repository":{"id":51332573,"uuid":"239208922","full_name":"darrarski/SwiftEndpoint","owner":"darrarski","description":"Lightweight library providing higher level of abstraction for implementing networking in iOS and macOS applications","archived":false,"fork":false,"pushed_at":"2021-05-14T19:24:16.000Z","size":20,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-30T21:42:26.838Z","etag":null,"topics":["combine-framework","endpoint","networking","swift","swift-package"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darrarski.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":"2020-02-08T21:46:48.000Z","updated_at":"2023-08-06T20:46:26.000Z","dependencies_parsed_at":"2022-09-24T21:32:25.866Z","dependency_job_id":null,"html_url":"https://github.com/darrarski/SwiftEndpoint","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrarski%2FSwiftEndpoint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrarski%2FSwiftEndpoint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrarski%2FSwiftEndpoint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrarski%2FSwiftEndpoint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darrarski","download_url":"https://codeload.github.com/darrarski/SwiftEndpoint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228133618,"owners_count":17874511,"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":["combine-framework","endpoint","networking","swift","swift-package"],"created_at":"2024-12-04T15:17:40.262Z","updated_at":"2024-12-04T15:17:40.876Z","avatar_url":"https://github.com/darrarski.png","language":"Swift","funding_links":["https://www.buymeacoffee.com/darrarski"],"categories":[],"sub_categories":[],"readme":"# 📦 SwiftEndpoint\n\n![Swift v5.1](https://img.shields.io/badge/swift-v5.1-orange.svg)\n![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-✓-green.svg)\n![platforms iOS macOS](https://img.shields.io/badge/platforms-iOS%20macOS-blue.svg)\n\n**SwiftEndpoint** is a lightweight library providing higher level of abstraction for implementing networking in iOS and macOS applications.\n\n## 🛠 Tech stack\n\n- [Swift](https://swift.org/) 5.1\n- [Xcode](https://developer.apple.com/xcode/) 11.3.1\n- [iOS](https://www.apple.com/pl/ios/) 13.0\n- [macOS](https://www.apple.com/pl/macos/) 10.15\n\n## 📝 Description\n\n**`Endpoint`** is a generic function that transforms some `Request` into some `Response` publisher:\n \n```swift\ntypealias Endpoint\u003cRequest, Response\u003e = (Request) -\u003e AnyPublisher\u003cResponse, Error\u003e\n```\n\n### 🧩 Foundation URL networking\n\nSet of helpers for building API clients based on the native [Foundation](https://developer.apple.com/documentation/foundation)'s networking.\n\n**`urlEndpoint`** function creates an `Endpoint` that uses Foundation's networking:\n\n```swift\nfunc urlEndpoint\u003cRequest, Response\u003e(\n  requestFactory: @escaping URLRequestFactory\u003cRequest\u003e,\n  publisherFactory: @escaping URLResponsePublisherFactory,\n  responseValidator: @escaping URLResponseValidator,\n  responseDecoder: @escaping URLResponseDecoder\u003cResponse\u003e\n) -\u003e Endpoint\u003cRequest, Response\u003e\n```\n\n**`URLRequestFactory\u003cRequest\u003e`** is a generic function that transforms some `Request` into `URLRequest`, optionally throwing an error:\n\n```swift\ntypealias URLRequestFactory\u003cRequest\u003e = (Request) throws -\u003e URLRequest\n```\n\n**`URLResponsePublisherFactory`** is a function that transforms `URLRequest` into `URLResponsePublisher`:\n\n```swift\ntypealias URLResponsePublisherFactory = (URLRequest) -\u003e URLResponsePublisher\n```\n\nConvenience extension allows to use `URLSession` as a `URLResponsePublisherFactory`:\n\n```swift\nextension URLSession {\n  var urlResponsePublisherFactory: URLResponsePublisherFactory { get }\n}\n```\n\n**`URLResponsePublisher`** is a combine publisher emitting network responses or failing with networking error:\n\n```swift\ntypealias URLResponsePublisher = AnyPublisher\u003c(data: Data, response: URLResponse), Error\u003e\n```\n\n**`URLResponseValidator`** is a function that validates response `Data` and `URLResponse`, optionally throwing validation error:\n\n```swift\ntypealias URLResponseValidator = (Data, URLResponse) throws -\u003e Void\n```\n\n**`URLResponseDecoder\u003cResponse\u003e`** is a generic function that transforms response `Data` and `URLResponse` into some `Response`, optionally throwing decoding error:\n\n```swift\ntypealias URLResponseDecoder\u003cResponse\u003e = (Data, URLResponse) throws -\u003e Response\n```\n\n## 🧰 Installation\n\n**SwiftEndpoint** is compatible with [Swift Package Manager](https://swift.org/package-manager/). You can add it as a dependency to your [Xcode project](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app) or [swift package](https://github.com/apple/swift-package-manager/blob/master/Documentation/Usage.md#defining-dependencies).\n\n## 🛠 Development\n\nRunning tests:\n\n```sh\nswift test\n```\n\nDeveloping in [Xcode](https://developer.apple.com/xcode/):\n\n```sh\nswift package generate-xcodeproj\nopen -a SwiftEndpoint.xcodeproj\n```\n\n## ☕️ Do you like the project?\n\n\u003ca href=\"https://www.buymeacoffee.com/darrarski\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" height=\"60\" width=\"217\" style=\"height: 60px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n\n## 📄 License\n\nCopyright © 2020 Dariusz Rybicki Darrarski\n\nLicense: [GNU GPLv3](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarrarski%2Fswiftendpoint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarrarski%2Fswiftendpoint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarrarski%2Fswiftendpoint/lists"}