{"id":24902913,"url":"https://github.com/rhodgkins/swifthttpstatuscodes","last_synced_at":"2025-04-13T08:40:58.548Z","repository":{"id":25657231,"uuid":"29092695","full_name":"rhodgkins/SwiftHTTPStatusCodes","owner":"rhodgkins","description":"Swift enum wrapper for easier handling of HTTP status codes.","archived":false,"fork":false,"pushed_at":"2023-06-12T10:58:04.000Z","size":135,"stargazers_count":162,"open_issues_count":5,"forks_count":20,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-27T00:13:50.112Z","etag":null,"topics":["enum","http-status-code","ios","macos","swift","tvos","watchos"],"latest_commit_sha":null,"homepage":null,"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/rhodgkins.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":"2015-01-11T13:32:28.000Z","updated_at":"2024-01-14T22:06:03.000Z","dependencies_parsed_at":"2024-06-18T18:43:57.486Z","dependency_job_id":"05c91291-46ea-45be-aec5-dce9c5e80ade","html_url":"https://github.com/rhodgkins/SwiftHTTPStatusCodes","commit_stats":{"total_commits":129,"total_committers":2,"mean_commits":64.5,"dds":0.007751937984496138,"last_synced_commit":"a2c4f5f645dec3a5614ff82e391f44e22d778f87"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhodgkins%2FSwiftHTTPStatusCodes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhodgkins%2FSwiftHTTPStatusCodes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhodgkins%2FSwiftHTTPStatusCodes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhodgkins%2FSwiftHTTPStatusCodes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhodgkins","download_url":"https://codeload.github.com/rhodgkins/SwiftHTTPStatusCodes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248686278,"owners_count":21145461,"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":["enum","http-status-code","ios","macos","swift","tvos","watchos"],"created_at":"2025-02-01T22:17:48.246Z","updated_at":"2025-04-13T08:40:58.516Z","avatar_url":"https://github.com/rhodgkins.png","language":"Swift","readme":"# SwiftHTTPStatusCodes\n[![Build Status](https://travis-ci.org/rhodgkins/SwiftHTTPStatusCodes.svg?branch=master)](https://travis-ci.org/rhodgkins/SwiftHTTPStatusCodes)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Pod Version](http://img.shields.io/cocoapods/v/HTTPStatusCodes.svg)](http://cocoadocs.org/docsets/HTTPStatusCodes/)\n[![Pod Platform](http://img.shields.io/cocoapods/p/HTTPStatusCodes.svg)](http://cocoadocs.org/docsets/HTTPStatusCodes/)\n[![Pod License](http://img.shields.io/cocoapods/l/HTTPStatusCodes.svg)](http://opensource.org/licenses/MIT)\n\nSwift enum wrapper for easier handling of HTTP status codes. \n\nThe purpose of this library is to improve to clarify of code and remove the need for checking of status codes as numbers (`==200`), or as a range of values (`== 2xx`) - instead replacing it with descriptive enums.\n\nAll the [RF2616](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml) standard status codes are supported with a few added ones from the [Wikipedia page](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes).\n\nAs of version 3.0.0 of this framework, the list of status codes are directly generated from a [online IANA CSV](http://www.iana.org/assignments/http-status-codes/http-status-codes-1.csv). The [HTML page](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml) has a last updated field, and this is also mirrored in the header comments to identify which version this framework is currently using.\u003cbr/\u003e\nIf this library is out of date compared to this page please open an issue and I will update the list.\n\n## Usage\n\n### Swift versions support\n\n* Swift 5.1 - use version 3.3.2\n* Swift 5 - use version 3.3.1\n* Swift 4 - use version 3.3.0\n* Swift 3 - use version 3.1\n* Older versions - use version 3.0\n\n### Swift Package Manager\n\nAdd this package to the dependencies in your `Package.swift` file:\n\n```swift\n.package(url: \"https://github.com/rhodgkins/SwiftHTTPStatusCodes.git\", .upToNextMajor(from: \"3.0.0\"))\n```\n\n### Carthage\n\n`Cartfile`:\n```ogdl\ngithub \"rhodgkins/SwiftHTTPStatusCodes\" ~\u003e 3.3\n```\nSource code:\n```swift\nimport HTTPStatusCodes\n```\n\n### CocoaPods\n`Podfile`:\n```ruby\npod 'HTTPStatusCodes', '~\u003e 3.3.0'\n```\nSource code:\n\n```swift\nimport HTTPStatusCodes\n```\n\n### Manually\nOr drop in the Swift files inside the [`Sources folder`](https://github.com/rhodgkins/SwiftHTTPStatusCodes/tree/master/Sources) into your project.\n\n## Helper methods\n\nThere are `Bool` properties on the enum for checking if a status code is of a certain category:\n```swift\nisInformational\nisSuccess\nisRedirection\nisClientError\nisServerError\n```\n\nThere is also an extension on `HTTPURLResponse` to obtain a status code enum directly and to `init` with one:\n```swift\nvar statusCodeValue: HTTPStatusCode?\ninit?(url: URL, statusCode: HTTPStatusCode, httpVersion: String?, headerFields: [String : String]?)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhodgkins%2Fswifthttpstatuscodes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhodgkins%2Fswifthttpstatuscodes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhodgkins%2Fswifthttpstatuscodes/lists"}