{"id":19693081,"url":"https://github.com/aunnnn/just","last_synced_at":"2026-05-15T04:02:57.546Z","repository":{"id":56917011,"uuid":"123717414","full_name":"aunnnn/Just","owner":"aunnnn","description":"A lightweight URLSession wrapper that does only GET and POST","archived":false,"fork":false,"pushed_at":"2018-07-08T17:16:54.000Z","size":69,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-30T02:34:11.012Z","etag":null,"topics":["ios","json","networking","swift","urlsession","wrapper"],"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/aunnnn.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":"2018-03-03T17:57:57.000Z","updated_at":"2018-07-08T17:16:55.000Z","dependencies_parsed_at":"2022-08-21T03:50:55.425Z","dependency_job_id":null,"html_url":"https://github.com/aunnnn/Just","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/aunnnn/Just","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aunnnn%2FJust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aunnnn%2FJust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aunnnn%2FJust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aunnnn%2FJust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aunnnn","download_url":"https://codeload.github.com/aunnnn/Just/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aunnnn%2FJust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33053144,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-15T02:00:06.351Z","response_time":103,"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":["ios","json","networking","swift","urlsession","wrapper"],"created_at":"2024-11-11T19:15:41.199Z","updated_at":"2026-05-15T04:02:57.523Z","avatar_url":"https://github.com/aunnnn.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Just\n![Travis](https://travis-ci.org/aunnnn/Just.svg?branch=master)\n[![codecov](https://codecov.io/gh/aunnnn/Just/branch/master/graph/badge.svg)](https://codecov.io/gh/aunnnn/Just)\n[![Version](https://img.shields.io/cocoapods/v/JustRequest.svg?style=flat)](http://cocoapods.org/pods/JustRequest)\n[![License](https://img.shields.io/cocoapods/l/JustRequest.svg?style=flat)](http://cocoapods.org/pods/JustRequest)\n[![Platform](https://img.shields.io/cocoapods/p/JustRequest.svg?style=flat)](http://cocoapods.org/pods/JustRequest)\n\nA lightweight URLSession wrapper just for GET and POST, because that's all we really need.\n\n## Features\n- [x] Lightweight\n- [x] GET\n- [x] POST (json or urlencoded)\n- [x] Decode JSON response to `T` using the new `Codable` ✨\n\n## Installation\n### CocoaPods\n```ruby\npod 'JustRequest'\n```\n\n### Manual\nJust download the code.\n\n## Requirements\niOS 8+, OSX 10.10+, Swift 4\n\n## Usage\n\n`Just` only has one API:\n```swift\npublic static func request(_ url: URL, method: HTTPMethod, parameters: Parameters?=nil, headers: HTTPHeaders?=nil, configurationBlock: URLRequestConfigurationBlock?=nil) -\u003e Request\n```\n\n*Don't forget to `import JustRequest`.*\n\n### To actually fires a request\nWith these two APIs you will get a `Request` instance, but no request is fired yet. Like `Alamofire`, you can fire that request by calling `request.responseData { ... }` (or `request.responseObject { ... }` using `Decodable`.)\n\n### To configure the default URLRequest\nProvide URLRequest configuration block:\n```swift\nJust.request(URL(string: \"https://api.github.com/users/aunnnn/repos\")!, method: .get, configurationBlock: { (request: URLRequest) -\u003e URLRequest in\n    var newReq = request\n    newReq.cachePolicy = .returnCacheDataElseLoad\n    return newReq\n})\n```\n\n## A suggested way to work with APIs\nOrganize a set of API with enum and use `Just.request`:\n\nFirst, make a base protocol for API service: \n```swift\nimport JustRequest\n\npublic protocol APIService {\n    var baseURL: URL { get }\n    var method: HTTPMethod  { get }\n    var path: String { get }\n    var parameters: [String: Any]? { get }\n    var headers: [String: String]? { get }\n}\n\nextension APIService {\n\n    /// Build `Request` for corresponding API.\n    var request: Request {\n        let url = baseURL.appendingPathComponent(path)\n        return Just.request(url, method: method, parameters: parameters, headers: headers)\n    }\n}\n```\nThen, make an enum for each service in your app that conforms to `APIService`:\n```swift\nenum GithubAPI: APIService {\n    case getUser(id: String)\n    case getRepos(...)\n    case deleteRepo(...)\n    \n    var baseURL: URL {\n        return URL(string: \"https://api.github.com\")!\n    }\n    \n    var method: HTTPMethod {\n        switch self {\n        case .getUser, .getRepo: \n            return .get\n        case .deleteRepo: \n            return .post(.json)\n        }\n    }\n    \n    var parameters: [String: Any]? { ...\n    \n    ...you get the idea\n}\n```\n\nTo use:\n```swift\nGithubAPI.getUser(id: \"123\").request.responseObject{  (result: Result\u003c[User]\u003e) in\n   switch result {\n   case .success(let users): print(users)\n   case .error(let error): print(error)\n   }\n}\n```\n\n*Note: It's important to explicitly specify `result: Result\u003c[User]\u003e` to help the compiler knows the model you are dealing with. With this, you can interact with `users` as `[User]`.*\n\n## Motivation\nMost apps use only interact with JSON API via simple `GET` and `POST`, so `Alamofire` can be an overkill. URLSession should be enough. \"But I can't remember how to use `URLSession`!\", then `Just` is for you.\n\n## Contribution\nPull requests are welcomed! No tests yet...\n\n## FAQ\n### Is this for me?\n`Just` is very limited. If you need a finer-grain control or performance optimization, you should use other libraries. This library is really for those who want to use simple `URLSession` but never remember how to use it. Please also note that there is no tests yet...\n\nYou could fork this and customize it to your needs.\n\n### Is this related to [JustHTTP](https://github.com/JustHTTP/Just)?\nTotally unrelated. Actually, I found them out the moment I finish coding this. A library with the same name doing almost the same thing! Still, checking the docs and you will notice quickly that our goals are very different.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faunnnn%2Fjust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faunnnn%2Fjust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faunnnn%2Fjust/lists"}