{"id":1647,"url":"https://github.com/dbsystel/DBNetworkStack","last_synced_at":"2025-08-02T04:32:03.716Z","repository":{"id":12968057,"uuid":"69956799","full_name":"dbsystel/DBNetworkStack","owner":"dbsystel","description":"DBNetworkStack is a network abstraction for fetching request and mapping them to model objects","archived":false,"fork":false,"pushed_at":"2024-11-25T13:38:30.000Z","size":5113,"stargazers_count":36,"open_issues_count":5,"forks_count":5,"subscribers_count":8,"default_branch":"develop","last_synced_at":"2025-07-08T09:55:39.346Z","etag":null,"topics":[],"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/dbsystel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","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":"2016-10-04T11:00:29.000Z","updated_at":"2024-12-11T23:28:48.000Z","dependencies_parsed_at":"2022-11-28T10:34:27.761Z","dependency_job_id":"374a5f37-0d8f-4602-9086-89de1bf4fe4b","html_url":"https://github.com/dbsystel/DBNetworkStack","commit_stats":{"total_commits":431,"total_committers":11,"mean_commits":39.18181818181818,"dds":"0.23665893271461713","last_synced_commit":"e204e62923af5acf05ab3b1890aef963799b6387"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/dbsystel/DBNetworkStack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbsystel%2FDBNetworkStack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbsystel%2FDBNetworkStack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbsystel%2FDBNetworkStack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbsystel%2FDBNetworkStack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbsystel","download_url":"https://codeload.github.com/dbsystel/DBNetworkStack/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbsystel%2FDBNetworkStack/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334615,"owners_count":24233793,"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-08-02T02:00:12.353Z","response_time":74,"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":[],"created_at":"2024-01-05T20:15:52.251Z","updated_at":"2025-08-02T04:32:03.423Z","avatar_url":"https://github.com/dbsystel.png","language":"Swift","readme":"# DBNetworkStack\n\n[![Build Status](https://travis-ci.org/dbsystel/DBNetworkStack.svg?branch=develop)](https://travis-ci.org/dbsystel/DBNetworkStack)\n[![codebeat badge](https://codebeat.co/badges/e438e768-249d-4e9f-8dd8-32928537740e)](https://codebeat.co/projects/github-com-dbsystel-dbnetworkstack-develop)\n[![codecov](https://codecov.io/gh/dbsystel/DBNetworkStack/branch/develop/graph/badge.svg)](https://codecov.io/gh/dbsystel/DBNetworkStack)\n[![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)\n\n|           | Main Features                  |\n| --------- | ------------------------------ |\n| 🛡        | Typed network resources        |\n| \u0026#127968; | Value oriented architecture |\n| 🔀        | Exchangeable implementations   |\n| 🚄        | Extendable API                 |\n| 🎹        | Composable Features            |\n| \u0026#9989;   | Fully unit tested              |\n| 📕   | [Documented here](https://dbsystel.github.io/DBNetworkStack/)             |\n\nThe idea behind this project comes from this [talk.objc.io article](https://talk.objc.io/episodes/S01E01-networking).\n\n## Basic Demo\nLets say you want to fetch a ``html`` string.\n\nFirst you have to create a service, by providing a network access. You can use URLSession out of the box or provide your own custom solution by implementing  ```NetworkAccess```.\n\n```swift\n\nlet networkAccess = URLSession(configuration: .default)\nlet networkService = BasicNetworkService(networkAccess: networkAccess)\n\n```\n\nCreate a resource with a request to fetch your data.\n\n```swift\n\nlet url = URL(staticString: \"https://httpbin.org\")\nlet request = URLRequest(path: \"/\", baseURL: url, HTTPMethod: .GET)\nlet resource = Resource(request: request, parse: { String(data: $0, encoding: .utf8) })\n\n```\nRequest your resource and handle the result\n```swift\nnetworkService.request(resource, onCompletion: { htmlText in\n    print(htmlText)\n}, onError: { error in\n    //Handle errors\n})\n\n```\n\n## Load types conforming to Swift-`Decodable`\n```swift\nstruct IPOrigin: Decodable {\n    let origin: String\n}\n\nlet url = URL(staticString: \"https://www.httpbin.org\")\nlet request = URLRequest(path: \"ip\", baseURL: url)\n\nlet resource = Resource\u003cIPOrigin\u003e(request: request, decoder: JSONDecoder())\n\nnetworkService.request(resource, onCompletion: { origin in\n    print(origin)\n}, onError: { error in\n    //Handle errors\n})\n```\n\n## Accessing HTTPResponse\n\nRequest your resource and handle the result \u0026 http response. This is similar to just requesting a resulting model.\n```swift\nnetworkService.request(resource, onCompletionWithResponse: { origin, response in\n    print(origin, response)\n}, onError: { error in\n    //Handle errors\n})\n```\n\n## Protocol oriented architecture / Exchangability\n\nThe following table shows all the protocols and their default implementations.\n\n| Protocol                         | Default Implementation |\n| -------------------------------- | ---------------------- |\n| ```NetworkAccess```     | ```URLSession```     |\n| ```NetworkService```    | ```BasicNetworkService```   |\n| ```NetworkTask```    | ```URLSessionTask``` |\n\n## Composable Features\n\n| Class                         | Feature |\n| -------------------------------- | ---------------------- |\n| ```RetryNetworkService```        | Retrys requests after a given delay when an error meets given criteria. |\n| ```ModifyRequestNetworkService```        | Modify matching requests. Can be used to add auth tokens or API Keys  |\n| ```NetworkServiceMock```        | Mocks a NetworkService. Can be use during unit tests  |\n\n## Requirements\n\n- iOS 9.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+\n\n## Installation\n\n### Swift Package Manager\n\n[SPM](https://swift.org/package-manager/) is integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.\n\nSpecify the following in your `Package.swift`:\n\n```swift\n.package(url: \"https://github.com/dbsystel/DBNetworkStack\", from: \"2.1.0\"),\n```\n\n## Contributing\nFeel free to submit a pull request with new features, improvements on tests or documentation and bug fixes. Keep in mind that we welcome code that is well tested and documented.\n\n## Contact\nLukas Schmidt ([Mail](mailto:lukas.la.schmidt@deutschebahn.com), [@lightsprint09](https://twitter.com/lightsprint09)), \nChristian Himmelsbach ([Mail](mailto:christian.himmelsbach@deutschebahn.com))\n\n## License\nDBNetworkStack is released under the MIT license. See LICENSE for details.\n","funding_links":[],"categories":["Networking"],"sub_categories":["Video","Other free courses"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbsystel%2FDBNetworkStack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbsystel%2FDBNetworkStack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbsystel%2FDBNetworkStack/lists"}