{"id":31065731,"url":"https://github.com/nikolainobadi/swiftrestkit","last_synced_at":"2025-09-15T16:55:58.437Z","repository":{"id":301693331,"uuid":"981866504","full_name":"nikolainobadi/SwiftRESTKit","owner":"nikolainobadi","description":"Lightweight Swift package for building type-safe RESTful URLRequest objects with headers, query params, and JSON body support.","archived":false,"fork":false,"pushed_at":"2025-05-12T19:20:04.000Z","size":9,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-28T09:12:15.162Z","etag":null,"topics":["json","rest-api","swift","swift-package","urlrequest"],"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/nikolainobadi.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,"zenodo":null}},"created_at":"2025-05-12T02:50:31.000Z","updated_at":"2025-06-11T20:34:55.000Z","dependencies_parsed_at":"2025-06-29T04:31:42.966Z","dependency_job_id":null,"html_url":"https://github.com/nikolainobadi/SwiftRESTKit","commit_stats":null,"previous_names":["nikolainobadi/swiftrestkit"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nikolainobadi/SwiftRESTKit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolainobadi%2FSwiftRESTKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolainobadi%2FSwiftRESTKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolainobadi%2FSwiftRESTKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolainobadi%2FSwiftRESTKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikolainobadi","download_url":"https://codeload.github.com/nikolainobadi/SwiftRESTKit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolainobadi%2FSwiftRESTKit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275289709,"owners_count":25438494,"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-09-15T02:00:09.272Z","response_time":75,"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":["json","rest-api","swift","swift-package","urlrequest"],"created_at":"2025-09-15T16:55:55.079Z","updated_at":"2025-09-15T16:55:58.425Z","avatar_url":"https://github.com/nikolainobadi.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftRESTKit\n\n![Swift](https://badgen.net/badge/swift/6.0%2B/purple)\n[![Platform](https://img.shields.io/badge/platforms-macOS%20%7C%20iOS-blue)]()\n![License](https://img.shields.io/badge/license-MIT-lightgrey)\n\n## Overview\n\n**SwiftRESTKit** is a lightweight Swift package for building type-safe `URLRequest` objects using a composable and testable API. It simplifies RESTful request construction for GET, DELETE, POST, PUT, and PATCH operations, with support for custom headers, query parameters, and JSON body encoding.\n\n\n## Features\n\n- Build RESTful `URLRequest`s with ease\n- Strongly-typed header support (`Accept`, `Content-Type`, `Authorization`, and custom)\n- Support for query parameters, JSON-encoded bodies, timeout intervals, and cache policies\n\n\n## Installation\n\nTo use **SwiftRESTKit** in your SwiftPM project, add the following to your `Package.swift`:\n\n```swift\n.package(url: \"https://github.com/nikolainobadi/SwiftRESTKit\", from: \"1.0.0\")\n```\n\nThen add `\"SwiftRESTKit\"` as a dependency to your target:\n\n```swift\n.product(name: \"SwiftRESTKit\", package: \"SwiftRESTKit\")\n```\n\n## Usage\n\n### Build a GET request:\n\n```swift\nlet request = try RestRequestBuilder.buildGET(\n    baseURL: URL(string: \"https://example.com\")!,\n    path: \"search\",\n    query: [\"q\": \"Swift\"],\n    headers: HTTPRequestHeaders(authorization: \"Bearer token\")\n)\n```\n\n### Build a POST request with JSON body:\n\n```swift\nlet request = try RestRequestBuilder.buildWrite(\n    baseURL: URL(string: \"https://example.com\")!,\n    path: \"users\",\n    method: .post,\n    body: [\"name\": \"Jane Doe\"],\n    headers: HTTPRequestHeaders(contentType: .json)\n)\n```\n\n## Architecture Notes\n\nThe core logic is encapsulated in:\n\n- `RestRequestBuilder`: Public API for request construction\n- `HTTPRequestHeaders`: Struct to encapsulate standard and custom headers\n- `HTTPWriteMethod`: Enum for POST, PUT, and PATCH\n- `RequestBuilderError`: Custom error enum for URL formation issues\n\nPrivate helpers are used internally to ensure testability and reusability of components.\n\n\n## About This Project\n\nSwiftRESTKit was created as part of a personal effort to review REST fundamentals before starting a new engineering apprenticeship. It helped reinforce practical concepts like request construction, HTTP methods, and header management while building a reusable, testable foundation for future networking work.\n\nThe project emphasizes readability, modularity, and Swift-native design patterns.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request on [GitHub](https://github.com/nikolainobadi/SwiftRESTKit).\n\n## License\n\nThis project is licensed under the MIT License. See [LICENSE](https://github.com/nikolainobadi/SwiftRESTKit/blob/main/LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikolainobadi%2Fswiftrestkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikolainobadi%2Fswiftrestkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikolainobadi%2Fswiftrestkit/lists"}