├── .gitignore ├── .jazzy.yaml ├── .swift-version ├── .swiftlint.yml ├── .travis.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── Package.swift ├── README.md ├── Sources └── APIManager │ ├── APIAuthorization.swift │ ├── APIRequest.swift │ ├── APIReturnable.swift │ ├── APIService.swift │ ├── Dictionary.swift │ └── HTTP.swift ├── Tests ├── APIManagerTests │ ├── APIManagerTests.swift │ ├── Data.swift │ ├── JSON.swift │ ├── TestService.swift │ └── XCTestManifests.swift └── LinuxMain.swift └── docs ├── Classes.html ├── Classes ├── APIRequest.html ├── APIRequest │ ├── APIRequestError.html │ └── HTTPMethod.html ├── APIRequestCenter.html └── APIRequestToken.html ├── Enums.html ├── Enums ├── APIRequestError.html ├── APIRequestState.html ├── HTTPMethod.html └── Result.html ├── Extensions.html ├── Extensions ├── Dictionary.html ├── OperationQueue.html ├── URL.html └── URLRequest.html ├── Protocols.html ├── Protocols ├── APIAuthorization.html ├── APIReturnable.html └── APIService.html ├── Structs.html ├── Structs └── APIRequestCenter.html ├── Typealiases.html ├── badge.svg ├── css ├── highlight.css └── jazzy.css ├── docsets ├── APIManager.docset │ └── Contents │ │ ├── Info.plist │ │ └── Resources │ │ ├── Documents │ │ ├── Classes.html │ │ ├── Classes │ │ │ ├── APIRequest.html │ │ │ ├── APIRequest │ │ │ │ ├── APIRequestError.html │ │ │ │ └── HTTPMethod.html │ │ │ ├── APIRequestCenter.html │ │ │ └── APIRequestToken.html │ │ ├── Enums.html │ │ ├── Enums │ │ │ ├── APIRequestError.html │ │ │ ├── APIRequestState.html │ │ │ ├── HTTPMethod.html │ │ │ └── Result.html │ │ ├── Extensions.html │ │ ├── Extensions │ │ │ ├── Dictionary.html │ │ │ ├── OperationQueue.html │ │ │ ├── URL.html │ │ │ └── URLRequest.html │ │ ├── Protocols.html │ │ ├── Protocols │ │ │ ├── APIAuthorization.html │ │ │ ├── APIReturnable.html │ │ │ └── APIService.html │ │ ├── Structs.html │ │ ├── Structs │ │ │ └── APIRequestCenter.html │ │ ├── Typealiases.html │ │ ├── badge.svg │ │ ├── css │ │ │ ├── highlight.css │ │ │ └── jazzy.css │ │ ├── img │ │ │ ├── carat.png │ │ │ ├── dash.png │ │ │ ├── gh.png │ │ │ └── spinner.gif │ │ ├── index.html │ │ ├── js │ │ │ ├── jazzy.js │ │ │ ├── jazzy.search.js │ │ │ ├── jquery.min.js │ │ │ ├── lunr.min.js │ │ │ └── typeahead.jquery.js │ │ ├── search.json │ │ └── undocumented.json │ │ └── docSet.dsidx └── APIManager.tgz ├── img ├── carat.png ├── dash.png ├── gh.png └── spinner.gif ├── index.html ├── js ├── jazzy.js ├── jazzy.search.js ├── jquery.min.js ├── lunr.min.js └── typeahead.jquery.js ├── search.json └── undocumented.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | .swiftpm 40 | 41 | # CocoaPods 42 | # 43 | # We recommend against adding the Pods directory to your .gitignore. However 44 | # you should judge for yourself, the pros and cons are mentioned at: 45 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 46 | # 47 | # Pods/ 48 | 49 | # Carthage 50 | # 51 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 52 | # Carthage/Checkouts 53 | 54 | Carthage/Build 55 | 56 | # fastlane 57 | # 58 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 59 | # screenshots whenever they are needed. 60 | # For more information about the recommended setup visit: 61 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 62 | 63 | fastlane/report.xml 64 | fastlane/Preview.html 65 | fastlane/screenshots 66 | fastlane/test_output 67 | 68 | *.DS_Store 69 | .AppleDouble 70 | .LSOverride 71 | 72 | # Icon must end with two \r 73 | Icon 74 | 75 | 76 | # Thumbnails 77 | ._* 78 | 79 | # Files that might appear in the root of a volume 80 | .DocumentRevisions-V100 81 | .fseventsd 82 | .Spotlight-V100 83 | .TemporaryItems 84 | .Trashes 85 | .VolumeIcon.icns 86 | .com.apple.timemachine.donotpresent 87 | 88 | # Directories potentially created on remote AFP share 89 | .AppleDB 90 | .AppleDesktop 91 | Network Trash Folder 92 | Temporary Items 93 | .apdisk 94 | -------------------------------------------------------------------------------- /.jazzy.yaml: -------------------------------------------------------------------------------- 1 | 2 | module: APIManager 3 | module_version: 0.4.0 4 | 5 | author: rauhul 6 | author_url: https://rauhul.me 7 | github_url: https://github.com/rauhul/api-manager 8 | 9 | min_acl: private -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 5.0 2 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | disabled_rules: 2 | - line_length 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: swift 2 | os: osx 3 | osx_image: xcode10.1 4 | 5 | script: 6 | - swiftlint 7 | - swift build 8 | - swift test 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to this project will be documented in this file. 3 | 4 | ## [0.4.0](https://github.com/rauhul/api-manager/releases/tag/0.4.0) 5 | Released on 2020-1-4. 6 | 7 | #### Added 8 | - Swift 5.0+ support 9 | 10 | #### Removed 11 | - CocoaPods support 12 | 13 | 14 | ## [0.3.0](https://github.com/rauhul/api-manager/releases/tag/0.3.0) 15 | Released on 2018-1-6. 16 | 17 | #### Added 18 | - Completion callback returns modified Swift.Result in preparation for Swift 5.0 19 | - APIRequests subclass Operation to simplify dependency chaining and cancellation 20 | - Hosted documentation 21 | 22 | #### Fixed 23 | - APIService can provide parameters, bodies, headers common to all requests within the service 24 | - APIAuthorization can can provide parameters, bodies, headers specific to a request 25 | - HTTPParameters, HTTPBody, and HTTPHeaders are now optional instead of empty dictionaries 26 | - Updated documentation 27 | 28 | #### Removed 29 | - Success callback 30 | - Cancellation callback 31 | - Failure callback 32 | - APIRequestTokens, the APIRequest can be directly used 33 | 34 | 35 | ## [0.2.0](https://github.com/rauhul/api-manager/releases/tag/0.2.0) 36 | Released on 2018-1-10. 37 | 38 | #### Added 39 | - Failure callback uses swift error type instead of string 40 | - APIService to filter requests by HTTPResponseCode 41 | - APIRequestTokens and abillity to cancel requests 42 | - Cancellation callback 43 | 44 | #### Fixed 45 | - APIRequest retain cycle 46 | - Refactor APIService into APIRequest property 47 | - Potential race conditions 48 | 49 | ## [0.1.1](https://github.com/rauhul/api-manager/releases/tag/0.1.1) 50 | Released on 2017-10-18. 51 | 52 | #### Added 53 | - Added tests both through the xcproj and the swift cli 54 | 55 | #### Fixed 56 | - Access level bug causing implicit APIReturnable conformance for Codable objects to not be available outside of the APIManager module 57 | 58 | #### Removed 59 | - tvOS support 60 | 61 | ## [0.1.0](https://github.com/rauhul/api-manager/releases/tag/0.1.0) 62 | Released on 2017-10-2. 63 | 64 | #### Added 65 | - Swift 4.0 Support 66 | - Native object as return types for APIRequests 67 | 68 | #### Removed 69 | - JSON (alised to [String: Any]) as the default return type for APIRequests 70 | 71 | ## [0.0.5](https://github.com/rauhul/api-manager/releases/tag/0.0.5) 72 | Released on 2017-04-27. 73 | 74 | #### Added 75 | - tvOS support 76 | 77 | ## [0.0.4](https://github.com/rauhul/api-manager/releases/tag/0.0.4) 78 | Released on 2017-04-26. 79 | 80 | #### Added 81 | - CHANGLOG.md 82 | - Swift package manager support 83 | 84 | ## [0.0.3](https://github.com/rauhul/api-manager/releases/tag/0.0.3) 85 | Released on 2017-04-24. 86 | 87 | #### Added 88 | - README.md 89 | 90 | ## [0.0.2](https://github.com/rauhul/api-manager/releases/tag/0.0.2) 91 | Released on 2017-04-24. 92 | 93 | #### Added 94 | - Partial documention generated via jazzy 95 | 96 | #### Fixed 97 | - Init scope bug 98 | - Failure on non 200 HTTP response status codes 99 | 100 | ## [0.0.1](https://github.com/rauhul/api-manager/releases/tag/0.0.1) 101 | Released on 2017-04-22. 102 | 103 | #### Added 104 | - Initial release of APIManager. 105 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Please contribute using [Github Flow](https://guides.github.com/introduction/flow/). Create a branch, add commits, and [open a pull request](https://github.com/rauhul/api-manager/compare/). 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Rauhul Varma 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.0 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "APIManager", 8 | products: [ 9 | .library(name: "APIManager", targets: ["APIManager"]) 10 | ], 11 | targets: [ 12 | .target(name: "APIManager", dependencies: []), 13 | .testTarget(name: "APIManagerTests", dependencies: ["APIManager"]) 14 | ] 15 | ) 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # APIManager 2 | [![Swift Version](https://img.shields.io/badge/swift-v5.0-orange.svg)](https://github.com/apple/swift) 3 | [![Build Status](https://travis-ci.org/rauhul/api-manager.svg?branch=master)](https://travis-ci.org/rauhul/api-manager) 4 | [![Documentation Converage](https://raw.githubusercontent.com/rauhul/api-manager/master/docs/badge.svg?sanitize=true)](https://rauhul.me/api-manager/) 5 | [![Release Version](https://img.shields.io/badge/release-v0.4.0-ff69b4.svg)](https://github.com/rauhul/api-manager/releases) 6 | [![GitHub License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/rauhul/api-manager/master/LICENSE) 7 | 8 | APIManager is a framework for abstracting RESTful API requests. 9 | 10 | ## Requirements 11 | - Swift 5.0+ 12 | 13 | ### Notes 14 | - APIManager 0.3.0 is the last version that supports cocoapods 15 | - APIManager 0.3.0 is the last release with Swift 4.2 support 16 | - APIManager 0.0.5 is the last release with Swift 3 support 17 | 18 | ## Installation 19 | 20 | ### Swift Package Manager 21 | The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. 22 | 23 | Once you have your Swift package set up, adding APIManager as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`. 24 | 25 | ```swift 26 | dependencies: [ 27 | .Package(url: "https://github.com/rauhul/api-manager.git", from: "0.4.0") 28 | ] 29 | ``` 30 | 31 | ## Usage 32 | APIManager relies on users to create `APIServices` and `APIReturnable` types relevent to the RESTful APIs they are working with. `APIServices` contain descriptions of various endpoints that return their responses as native swift objects. 33 | 34 | ### Making an APIReturnable Type 35 | 36 | An APIReturnable Type only needs to conform to one method `init(from: Data) throws`. APIManager extends `Decodable` types to also be `APIReturnable`. An example implementation can be found below: 37 | 38 | ```swift 39 | extension APIReturnable where Self: Decodable { 40 | init(from data: Data) throws { 41 | self = try JSONDecoder().decode(Self.self, from: data) 42 | } 43 | } 44 | ``` 45 | 46 | ### Making an APIService 47 | An APIService is made up of 3 components. 48 | 49 | 1. A `baseURL`. Endpoints in this service will be postpended to this URL segment. As a result a baseURL will generally look like the root URL of the API the service communicates with. 50 | 51 | ```swift 52 | open class var baseURL: String { 53 | return "https://api.example.com" 54 | } 55 | ``` 56 | 57 | 2. `HTTPHeaders` to be sent alongside the `APIRequest`s made by the endpoints in your `APIService`. 58 | 59 | ```swift 60 | open class var headers: HTTPHeaders? { 61 | return [ 62 | "Content-Type": "application/json" 63 | ] 64 | } 65 | 66 | ``` 67 | 68 | 3. A set of RESTful api endpoints that you would like to use. These should be simple wrappers around the `APIRequest` constructor that can take in data (as `HTTPParameters` and/or `HTTPBody` as a json dictionary `[String: Any]`). For example if you would like to get user information by id, the endpoint may look like this: 69 | 70 | ```swift 71 | open class func getUser(byId id: Int) -> APIRequest { 72 | return APIRequest(service: Self, endpoint: "/users", params: ["id": id], body: nil, method: .GET) 73 | } 74 | 75 | ``` 76 | 77 | ### Using an APIService 78 | Now that you have an `APIService`, you can use it make RESTful API Requests. 79 | 80 | All the RESTful API endpoints we need to access should already be defined in our `APIService`, so using them is simply a matter of calling them. 81 | 82 | Using the example service above, we can make a request to get the User associated with the id 452398: 83 | 84 | ```swift 85 | let request = ExampleService.getUser(byId: 452398) 86 | ``` 87 | 88 | And subsecquently perform the `APIRequest` with: 89 | 90 | ```swift 91 | request.perform(withAuthorization: nil) 92 | ``` 93 | 94 | However, this leaves us unable to access the response nor potential error and additionally requires multiple lines to do what is really one action. Conveniently `APIManager` allows us to solve this problems with simple chaining syntax. We can specify success, cancellation, and failure blocks. This new request is seen below: 95 | 96 | ```swift 97 | ExampleService.getUser(byId: 452398) 98 | .onSuccess { (returnValue: ReturnType) in 99 | // Handle Success (Background thread) 100 | DispatchQueue.main.async { 101 | // Handle Success (main thread) 102 | } 103 | } 104 | .onFailure { (error) in 105 | // Handle Failure (Background thread) 106 | DispatchQueue.main.async { 107 | // Handle Failure (main thread) 108 | } 109 | } 110 | .perform(withAuthorization: nil) 111 | ``` 112 | 113 | ## Support 114 | Please [open an issue](https://github.com/rauhul/api-manager/issues/new) for support. 115 | 116 | ## Contributing 117 | Please contribute using [Github Flow](https://guides.github.com/introduction/flow/). Create a branch, add commits, and [open a pull request](https://github.com/rauhul/api-manager/compare/). 118 | 119 | ## License 120 | This project is licensed under the MIT License. For a full copy of this license take a look at the LICENSE file. 121 | -------------------------------------------------------------------------------- /Sources/APIManager/APIAuthorization.swift: -------------------------------------------------------------------------------- 1 | // 2 | // APIAuthorization.swift 3 | // APIManager 4 | // 5 | // Created by Rauhul Varma on 4/21/17. 6 | // Copyright © 2020 Rauhul Varma. All rights reserved. 7 | // 8 | 9 | /// `APIAuthorization` defines all the properties and methods a class must 10 | /// contain to be used as an authorization for an `APIRequest`. 11 | public protocol APIAuthorization { 12 | 13 | /// Configuration point for an `APIAuthorization` to inject additional 14 | /// parameters into a request. 15 | func parametersFor(request: APIRequest) -> HTTPParameters? 16 | /// Configuration point for an `APIAuthorization` to inject additional body 17 | /// components into a request. 18 | func bodyFor(request: APIRequest) -> HTTPBody? 19 | /// Configuration point for an `APIAuthorization` to inject additional 20 | /// headers into a request. 21 | func headersFor(request: APIRequest) -> HTTPHeaders? 22 | } 23 | 24 | public extension APIAuthorization { 25 | /// Placeholder implementation, returns nil. 26 | func parametersFor(request: APIRequest) -> HTTPParameters? { nil } 27 | /// Placeholder implementation, returns nil. 28 | func bodyFor(request: APIRequest) -> HTTPBody? { nil } 29 | /// Placeholder implementation, returns nil. 30 | func headersFor(request: APIRequest) -> HTTPHeaders? { nil } 31 | } 32 | -------------------------------------------------------------------------------- /Sources/APIManager/APIReturnable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // APIReturnable.swift 3 | // APIManager 4 | // 5 | // Created by Rauhul Varma on 10/29/17. 6 | // Copyright © 2020 Rauhul Varma. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Defines the methods required for an object to be returned by an `APIService` 12 | public protocol APIReturnable { 13 | 14 | /// Defines how to convert returned `Data` into an `APIReturnable` object 15 | init(from data: Data) throws 16 | } 17 | 18 | /// Extension to allow for `Decodable` objects to be intately `APIReturnable` 19 | public extension APIReturnable where Self: Decodable { 20 | 21 | /// Conversion from `Data` to a `Decodable` type using a `JSONDecoder` 22 | init(from data: Data) throws { 23 | self = try JSONDecoder().decode(Self.self, from: data) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Sources/APIManager/APIService.swift: -------------------------------------------------------------------------------- 1 | // 2 | // APIService.swift 3 | // APIManager 4 | // 5 | // Created by Rauhul Varma on 4/21/17. 6 | // Copyright © 2020 Rauhul Varma. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `APIService` defines all the properties and methods a class must contain to be used as a service in an `APIRequest`. 12 | /// 13 | /// A class that conforms to APIService should also define all the endpoints relevent to that service. 14 | /// 15 | /// An endpoint might look like: 16 | /// ``` 17 | /// open class func getUser(byId id: String) -> APIRequest { 18 | /// return APIRequest(endpoint: "/users", params: nil, body: ["id": id], method: .GET) 19 | /// } 20 | /// ``` 21 | public protocol APIService { 22 | 23 | /// The base URL for this `APIService`. 24 | /// 25 | /// Endpoints in this service will be postpended to this URL segment. As a result a baseURL will generally look like the root URL of the API the service communicates with. 26 | /// 27 | /// A baseURL might look like: ```https://api.example.com``` with endpoints like: ```/users``` or ```/schedule``` 28 | /// 29 | /// When interacting with more complicated APIs, it may be necessary to create subclasses of your service in order to maintain clean and readable code. In these cases the super-service should still have a baseURL as defined above. However the sub-services should have baseURLs of the form: 30 | /// 31 | /// ``` 32 | /// override open class var baseURL: String { 33 | /// return super.baseURL + "/users" 34 | /// } 35 | /// ``` 36 | static var baseURL: String { get } 37 | 38 | /// The `HTTPHeaders` to be sent alongside the `APIRequest`s made by the endpoints in this `APIService`. 39 | static var parameters: HTTPParameters? { get } 40 | 41 | /// The `HTTPHeaders` to be sent alongside the `APIRequest`s made by the endpoints in this `APIService`. 42 | static var body: HTTPBody? { get } 43 | 44 | /// The `HTTPHeaders` to be sent alongside the `APIRequest`s made by the endpoints in this `APIService`. 45 | static var headers: HTTPHeaders? { get } 46 | 47 | /// Offers an optional point for an `APIService` to determine what HTTPReponse status codes are valid. The default implementation marks any response with a status code in the range 200..<300 as valid. 48 | /// 49 | /// To change this behavior, simiply override this method and throw an APIRequestError.invalidHTTPReponse for any invalid response codes. 50 | static func validate(statusCode: Int) throws 51 | } 52 | 53 | /// Default implementations of APIService components 54 | public extension APIService { 55 | /// The `HTTPHeaders` to be sent alongside the `APIRequest`s made by the endpoints in this `APIService`. 56 | static var parameters: HTTPParameters? { nil } 57 | 58 | /// The `HTTPHeaders` to be sent alongside the `APIRequest`s made by the endpoints in this `APIService`. 59 | static var body: HTTPBody? { nil } 60 | 61 | /// The `HTTPHeaders` to be sent alongside the `APIRequest`s made by the endpoints in this `APIService`. 62 | static var headers: HTTPHeaders? { nil } 63 | 64 | /// Default implementation of validate that marks any response with a status code in the range 200..<300 as valid. 65 | static func validate(statusCode: Int) throws { 66 | if !(200..<300).contains(statusCode) { 67 | let description = HTTPURLResponse.localizedString(forStatusCode: statusCode) 68 | throw APIRequestError.invalidHTTPReponse(code: statusCode, description: description) 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Sources/APIManager/Dictionary.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Dictionary.swift 3 | // APIManager 4 | // 5 | // Created by Rauhul Varma on 1/5/19. 6 | // Copyright © 2020 Rauhul Varma. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | internal extension Dictionary { 12 | /// Initializes a dictionary by combining the contents of an arbitrary 13 | /// number of dictionaries. In the case of colliding keys, the last 14 | /// dictionary's value will be used. 15 | init(_ dictionarys: Dictionary?...) { 16 | self.init() 17 | for dictionary in dictionarys { 18 | guard let dictionary = dictionary else { continue } 19 | for (key, value) in dictionary { 20 | self[key] = value 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sources/APIManager/HTTP.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HTTP.swift 3 | // APIManager 4 | // 5 | // Created by Rauhul Varma on 4/21/17. 6 | // Copyright © 2020 Rauhul Varma. All rights reserved. 7 | // 8 | 9 | /// An `HTTPBody` is the data transmitted in an HTTP message immediately 10 | /// following the headers. Most HTTP requests with bodies use the `POST` or 11 | /// `PUT` `HTTPMethod`. 12 | public typealias HTTPBody = [String: Any] 13 | 14 | /// `HTTPcookies` are small pieces of data that a server sends to the client to 15 | /// store, to provide with future requests. 16 | public typealias HTTPCookies = [AnyHashable: Any] 17 | 18 | /// `HTTPHeaders` are components of the header section of request and response 19 | /// messages. They define the operating parameters of an `APIRequest`. 20 | public typealias HTTPHeaders = [String: String] 21 | 22 | /// Enumeration of available HTTP methods. 23 | public enum HTTPMethod: String { 24 | /// The GET method requests a representation of the specified resource. 25 | /// Requests using GET should only retrieve data. 26 | case GET 27 | /// The HEAD method asks for a response identical to that of a GET request, 28 | /// but without the response body. 29 | case HEAD 30 | /// The POST method is used to submit an entity to the specified resource, 31 | /// often causing a change in state or side effects on the server. 32 | case POST 33 | /// The PUT method replaces all current representations of the target 34 | /// resource with the request payload. 35 | case PUT 36 | /// The DELETE method deletes the specified resource. 37 | case DELETE 38 | /// The OPTIONS method is used to describe the communication options for the 39 | /// target resource. 40 | case OPTIONS 41 | /// The PATCH method is used to apply partial modifications to a resource. 42 | case PATCH 43 | } 44 | 45 | /// `HTTPParameters` are set of querys used to access specific data via an 46 | /// `APIRequest`. These parameters will be postpended to a url in the form 47 | /// `?key1=value1&key2=value...` etc. 48 | public typealias HTTPParameters = [String: String] 49 | -------------------------------------------------------------------------------- /Tests/APIManagerTests/APIManagerTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import APIManager 3 | 4 | class APIManagerTests: XCTestCase { 5 | 6 | func testGetRequest() { 7 | let complete = expectation(description: "Get request completion") 8 | 9 | TestService.get() 10 | .onCompletion { (result) in 11 | do { 12 | let json = try result.get().0 13 | let url = json.rawDictionary["url"] as? String 14 | XCTAssertEqual(url, "https://httpbin.org/get") 15 | } catch { 16 | XCTAssert(false, error.localizedDescription) 17 | } 18 | complete.fulfill() 19 | } 20 | .launch() 21 | 22 | waitForExpectations(timeout: 5.0, handler: nil) 23 | } 24 | 25 | func testPostRequest() { 26 | let complete = expectation(description: "Post request completion") 27 | 28 | TestService.post() 29 | .onCompletion { (result) in 30 | switch result { 31 | case .success(let json, _): 32 | let url = json.rawDictionary["url"] as? String 33 | XCTAssertEqual(url, "https://httpbin.org/post") 34 | complete.fulfill() 35 | 36 | case .failure(let error): 37 | XCTAssert(false, error.localizedDescription) 38 | complete.fulfill() 39 | 40 | } 41 | } 42 | .launch() 43 | 44 | waitForExpectations(timeout: 5.0, handler: nil) 45 | } 46 | 47 | func testHeadRequest() { 48 | let complete = expectation(description: "Head request completion") 49 | 50 | TestService.head() 51 | .onCompletion { (result) in 52 | switch result { 53 | case .success(let data, _): 54 | XCTAssertTrue(data.isEmpty) 55 | complete.fulfill() 56 | 57 | case .failure(let error): 58 | XCTAssert(false, error.localizedDescription) 59 | complete.fulfill() 60 | 61 | } 62 | } 63 | .launch() 64 | 65 | waitForExpectations(timeout: 5.0, handler: nil) 66 | } 67 | 68 | func testPutRequest() { 69 | let complete = expectation(description: "Put request completion") 70 | 71 | TestService.put() 72 | .onCompletion { (result) in 73 | switch result { 74 | case .success(let json, _): 75 | let url = json.rawDictionary["url"] as? String 76 | XCTAssertEqual(url, "https://httpbin.org/put") 77 | complete.fulfill() 78 | 79 | case .failure(let error): 80 | XCTAssert(false, error.localizedDescription) 81 | complete.fulfill() 82 | 83 | } 84 | } 85 | .launch() 86 | 87 | waitForExpectations(timeout: 5.0, handler: nil) 88 | } 89 | 90 | func testDeleteRequest() { 91 | let complete = expectation(description: "Delete request completion") 92 | 93 | TestService.delete() 94 | .onCompletion { (result) in 95 | switch result { 96 | case .success(let json, _): 97 | let url = json.rawDictionary["url"] as? String 98 | XCTAssertEqual(url, "https://httpbin.org/delete") 99 | complete.fulfill() 100 | 101 | case .failure(let error): 102 | XCTAssert(false, error.localizedDescription) 103 | complete.fulfill() 104 | 105 | } 106 | } 107 | .launch() 108 | 109 | waitForExpectations(timeout: 5.0, handler: nil) 110 | } 111 | 112 | func testOptionsRequest() { 113 | let complete = expectation(description: "Options request completion") 114 | 115 | TestService.options() 116 | .onCompletion { (result) in 117 | switch result { 118 | case .success(let data, _): 119 | XCTAssertTrue(data.isEmpty) 120 | complete.fulfill() 121 | 122 | case .failure(let error): 123 | XCTAssert(false, error.localizedDescription) 124 | complete.fulfill() 125 | 126 | } 127 | } 128 | .launch() 129 | 130 | waitForExpectations(timeout: 5.0, handler: nil) 131 | } 132 | 133 | func testPatchRequest() { 134 | let complete = expectation(description: "Patch request completion") 135 | 136 | TestService.patch() 137 | .onCompletion { (result) in 138 | switch result { 139 | case .success(let json, _): 140 | let url = json.rawDictionary["url"] as? String 141 | XCTAssertEqual(url, "https://httpbin.org/patch") 142 | complete.fulfill() 143 | 144 | case .failure(let error): 145 | XCTAssert(false, error.localizedDescription) 146 | complete.fulfill() 147 | 148 | } 149 | } 150 | .launch() 151 | 152 | waitForExpectations(timeout: 5.0, handler: nil) 153 | } 154 | 155 | static var allTests = [ 156 | ("Test GET Request", testGetRequest), 157 | ("Test POST Request", testPostRequest), 158 | ("Test HEAD Request", testHeadRequest), 159 | ("Test PUT Request", testPutRequest), 160 | ("Test Delete Request", testDeleteRequest), 161 | ("Test OPTIONS Request", testOptionsRequest), 162 | ("Test PATCH Request", testPatchRequest) 163 | ] 164 | 165 | } 166 | -------------------------------------------------------------------------------- /Tests/APIManagerTests/Data.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Data.swift 3 | // APIManagerTests 4 | // 5 | // Created by Rauhul Varma on 11/2/17. 6 | // Copyright © 2020 Rauhul Varma. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import APIManager 11 | 12 | extension Data: APIReturnable { 13 | public init(from: Data) throws { 14 | self = from 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Tests/APIManagerTests/JSON.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JSON.swift 3 | // APIManagerTests 4 | // 5 | // Created by Rauhul Varma on 11/2/17. 6 | // Copyright © 2020 Rauhul Varma. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import APIManager 11 | 12 | class JSON: APIReturnable { 13 | let rawDictionary: [String: Any] 14 | 15 | required init(from: Data) throws { 16 | let json = try JSONSerialization.jsonObject(with: from, options: []) 17 | if let json = json as? [String: Any] { 18 | rawDictionary = json 19 | } else { 20 | throw NSError(domain: "Conversion Error. Failed to convert data to json dictionary.", code: 1, userInfo: nil) 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Tests/APIManagerTests/TestService.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestService.swift 3 | // APIManager 4 | // 5 | // Created by Rauhul Varma on 11/2/17. 6 | // Copyright © 2020 Rauhul Varma. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import APIManager 11 | 12 | class TestService: APIService { 13 | 14 | static var baseURL: String = "https://httpbin.org" 15 | 16 | open class func get() -> APIRequest { 17 | return APIRequest(service: self, endpoint: "/get", method: .GET) 18 | } 19 | 20 | open class func post() -> APIRequest { 21 | return APIRequest(service: self, endpoint: "/post", method: .POST) 22 | } 23 | 24 | open class func head() -> APIRequest { 25 | return APIRequest(service: self, endpoint: "/get", method: .HEAD) 26 | } 27 | 28 | open class func put() -> APIRequest { 29 | return APIRequest(service: self, endpoint: "/put", method: .PUT) 30 | } 31 | 32 | open class func delete() -> APIRequest { 33 | return APIRequest(service: self, endpoint: "/delete", method: .DELETE) 34 | } 35 | 36 | open class func options() -> APIRequest { 37 | return APIRequest(service: self, endpoint: "/get", method: .OPTIONS) 38 | } 39 | 40 | open class func patch() -> APIRequest { 41 | return APIRequest(service: self, endpoint: "/patch", method: .PATCH) 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Tests/APIManagerTests/XCTestManifests.swift: -------------------------------------------------------------------------------- 1 | #if !canImport(ObjectiveC) 2 | import XCTest 3 | 4 | extension APIManagerTests { 5 | // DO NOT MODIFY: This is autogenerated, use: 6 | // `swift test --generate-linuxmain` 7 | // to regenerate. 8 | static let __allTests__APIManagerTests = [ 9 | ("testDeleteRequest", testDeleteRequest), 10 | ("testGetRequest", testGetRequest), 11 | ("testHeadRequest", testHeadRequest), 12 | ("testOptionsRequest", testOptionsRequest), 13 | ("testPatchRequest", testPatchRequest), 14 | ("testPostRequest", testPostRequest), 15 | ("testPutRequest", testPutRequest), 16 | ] 17 | } 18 | 19 | public func __allTests() -> [XCTestCaseEntry] { 20 | return [ 21 | testCase(APIManagerTests.__allTests__APIManagerTests), 22 | ] 23 | } 24 | #endif 25 | -------------------------------------------------------------------------------- /Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | import APIManagerTests 4 | 5 | var tests = [XCTestCaseEntry]() 6 | tests += APIManagerTests.__allTests() 7 | 8 | XCTMain(tests) 9 | -------------------------------------------------------------------------------- /docs/Classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Classes Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

APIManager 0.4.0 Docs (100% documented)

18 |

View on GitHub

19 |
20 |
21 |
22 | 27 |
28 |
29 | 97 |
98 |
99 |
100 |

Classes

101 |

The following classes are available globally.

102 | 103 |
104 |
105 |
106 |
    107 |
  • 108 |
    109 | 110 | 111 | 112 | APIRequest 113 | 114 |
    115 |
    116 |
    117 |
    118 |
    119 |
    120 |

    Base class for creating an APIRequest.

    121 |
    122 |

    Note

    123 | APIRequests should be created through a class that conforms to 124 | APIService. 125 | 126 |
    127 | 128 | See more 129 |
    130 |
    131 |

    Declaration

    132 |
    133 |

    Swift

    134 |
    open class APIRequest<ReturnType> : Operation where ReturnType : APIReturnable
    135 | 136 |
    137 |
    138 |
    139 |
    140 |
  • 141 |
142 |
143 |
144 |
145 | 149 |
150 |
151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /docs/Classes/APIRequest/APIRequestError.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | APIRequestError Enumeration Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

APIManager Docs (100% documented)

18 |
19 |
20 |
21 | 26 |
27 |
28 | 74 |
75 |
76 |
77 |

APIRequestError

78 |
79 |
80 |
public enum APIRequestError: Error
81 | 82 |
83 |
84 |

Enumeration of the Errors that can occur during an APIRequest.

85 | 86 |
87 |
88 |
89 |
    90 |
  • 91 |
    92 | 93 | 94 | 95 | invalidHTTPReponse 96 | 97 |
    98 |
    99 |
    100 |
    101 |
    102 |
    103 |

    occurs when an APIRequest gets a response with an invalid response code, additionally provides a decription of the error code

    104 | 105 |
    106 |
    107 |

    Declaration

    108 |
    109 |

    Swift

    110 |
    case invalidHTTPReponse(code: Int, description: String)
    111 | 112 |
    113 |
    114 |
    115 |
    116 |
  • 117 |
118 |
119 |
120 |
    121 |
  • 122 |
    123 | 124 | 125 | 126 | internalError 127 | 128 |
    129 |
    130 |
    131 |
    132 |
    133 |
    134 |

    occurs when an APIRequest encounters an inconsistancy it does not know how to handle, additionally provides a decription of the error

    135 | 136 |
    137 |
    138 |

    Declaration

    139 |
    140 |

    Swift

    141 |
    case internalError(description: String)
    142 | 143 |
    144 |
    145 |
    146 |
    147 |
  • 148 |
149 |
150 |
151 |
152 | 156 |
157 |
158 | 159 | 160 | 161 | -------------------------------------------------------------------------------- /docs/Classes/APIRequestCenter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | APIRequestCenter Class Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

19 | APIManager Docs 20 | (97% documented) 21 |

22 | 23 | 24 |
25 |
26 | 37 |
38 |
39 |
40 |
41 |
42 |

APIRequestCenter

43 |
44 |
45 |
public final class APIRequestCenter
46 | 47 |
48 |
49 |

Undocumented

50 | 51 |
52 |
53 |
54 |
    55 |
  • 56 |
    57 | 58 | 59 | 60 | queue 61 | 62 |
    63 |
    64 |
    65 |
    66 |
    67 |
    68 |

    Undocumented

    69 | 70 |
    71 |
    72 |

    Declaration

    73 |
    74 |

    Swift

    75 |
    public static let queue: OperationQueue
    76 | 77 |
    78 |
    79 |
    80 |
    81 |
  • 82 |
83 |
84 |
85 |
86 |
87 |
88 | 161 | 167 |
168 | 169 | 170 | 171 | -------------------------------------------------------------------------------- /docs/Extensions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Extensions Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

APIManager 0.4.0 Docs (100% documented)

18 |

View on GitHub

19 |
20 |
21 |
22 | 27 |
28 |
29 | 97 |
98 |
99 |
100 |

Extensions

101 |

The following extensions are available globally.

102 | 103 |
104 |
105 |
106 |
    107 |
  • 108 |
    109 | 110 | 111 | 112 | OperationQueue 113 | 114 |
    115 |
    116 |
    117 |
    118 |
    119 |
    120 | 121 | See more 122 |
    123 |
    124 |

    Declaration

    125 |
    126 |

    Swift

    127 |
    public extension OperationQueue
    128 | 129 |
    130 |
    131 |
    132 |
    133 |
  • 134 |
  • 135 |
    136 | 137 | 138 | 139 | Dictionary 140 | 141 |
    142 |
    143 |
    144 |
    145 |
    146 |
    147 | 148 | See more 149 |
    150 |
    151 |

    Declaration

    152 |
    153 |

    Swift

    154 |
    internal extension Dictionary
    155 | 156 |
    157 |
    158 |
    159 |
    160 |
  • 161 |
162 |
163 |
164 |
165 | 169 |
170 |
171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /docs/Extensions/Dictionary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Dictionary Extension Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

APIManager 0.4.0 Docs (100% documented)

18 |

View on GitHub

19 |
20 |
21 |
22 | 27 |
28 |
29 | 97 |
98 |
99 |
100 |

Dictionary

101 |
102 |
103 |
internal extension Dictionary
104 | 105 |
106 |
107 | 108 |
109 |
110 |
111 |
    112 |
  • 113 |
    114 | 115 | 116 | 117 | init(_:) 118 | 119 |
    120 |
    121 |
    122 |
    123 |
    124 |
    125 |

    Initializes a dictionary by combining the contents of an arbitrary 126 | number of dictionaries. In the case of colliding keys, the last 127 | dictionary’s value will be used.

    128 | 129 |
    130 |
    131 |

    Declaration

    132 |
    133 |

    Swift

    134 |
    init(_ dictionarys: Dictionary?...)
    135 | 136 |
    137 |
    138 |
    139 |
    140 |
  • 141 |
142 |
143 |
144 |
145 | 149 |
150 |
151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /docs/Extensions/OperationQueue.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OperationQueue Extension Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

APIManager 0.4.0 Docs (100% documented)

18 |

View on GitHub

19 |
20 |
21 |
22 | 27 |
28 |
29 | 97 |
98 |
99 |
100 |

OperationQueue

101 |
102 |
103 |
public extension OperationQueue
104 | 105 |
106 |
107 | 108 |
109 |
110 |
111 |
    112 |
  • 113 |
    114 | 115 | 116 | 117 | defaultAPIRequestQueue 118 | 119 |
    120 |
    121 |
    122 |
    123 |
    124 |
    125 |

    Default OperationQueue for running requests. Other queues can be used 126 | via APIRequest.launch(on:).

    127 | 128 |
    129 |
    130 |

    Declaration

    131 |
    132 |

    Swift

    133 |
    static let defaultAPIRequestQueue: OperationQueue
    134 | 135 |
    136 |
    137 |
    138 |
    139 |
  • 140 |
141 |
142 |
143 |
144 | 148 |
149 |
150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /docs/Extensions/URL.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | URL Extension Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

APIManager Docs (98% documented)

18 |
19 |
20 |
21 | 26 |
27 |
28 | 93 |
94 |
95 |
96 |

URL

97 |
98 |
99 |
struct URL : ReferenceConvertible, Equatable
100 | 101 |
102 |
103 |

Extension of Foundation.URL.

104 | 105 |
106 |
107 |
108 |
    109 |
  • 110 |
    111 | 112 | 113 | 114 | init(base:paramaters:) 115 | 116 |
    117 |
    118 |
    119 |
    120 |
    121 |
    122 |

    Initializer for creating a URL with a base string and optional URLParameters.

    123 | 124 |
    125 |
    126 |

    Declaration

    127 |
    128 |

    Swift

    129 |
    init?(base: String, paramaters: HTTPParameters?)
    130 | 131 |
    132 |
    133 |
    134 |
    135 |
  • 136 |
137 |
138 |
139 |
140 | 144 |
145 |
146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /docs/Extensions/URLRequest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | URLRequest Extension Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

APIManager Docs (98% documented)

18 |
19 |
20 |
21 | 26 |
27 |
28 | 93 |
94 |
95 |
96 |

URLRequest

97 |

Extension of Foundation.URL.

98 | 99 |
100 |
101 |
102 |
    103 |
  • 104 |
    105 | 106 | 107 | 108 | init(url:method:body:headers:) 109 | 110 |
    111 |
    112 |
    113 |
    114 |
    115 |
    116 |

    Initializer for creating a URLRequest with an HTTPMethod, HTTPBody, and HTTPHeaders.

    117 | 118 |
    119 |
    120 |

    Declaration

    121 |
    122 |

    Swift

    123 |
    init(url: URL, method: HTTPMethod, body: HTTPBody?, headers: HTTPHeaders?)
    124 | 125 |
    126 |
    127 |
    128 |
    129 |
  • 130 |
131 |
132 |
133 |
134 | 138 |
139 |
140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /docs/Structs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Structures Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

19 | APIManager Docs 20 | (91% documented) 21 |

22 | 23 | 24 |
25 |
26 | 37 |
38 |
39 |
40 |
41 |
42 |

Structures

43 |

The following structures are available globally.

44 | 45 |
46 |
47 |
48 |
    49 |
  • 50 |
    51 | 52 | 53 | 54 | APIRequestCenter 55 | 56 |
    57 |
    58 |
    59 |
    60 |
    61 |
    62 |

    Undocumented

    63 | 64 | See more 65 |
    66 |
    67 |

    Declaration

    68 |
    69 |

    Swift

    70 |
    public struct APIRequestCenter
    71 | 72 |
    73 |
    74 |
    75 |
    76 |
  • 77 |
78 |
79 |
80 |
81 |
82 |
83 | 161 | 167 |
168 | 169 | 170 | 171 | -------------------------------------------------------------------------------- /docs/Structs/APIRequestCenter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | APIRequestCenter Structure Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

19 | APIManager Docs 20 | (91% documented) 21 |

22 | 23 | 24 |
25 |
26 | 37 |
38 |
39 |
40 |
41 |
42 |

APIRequestCenter

43 |
44 |
45 |
public struct APIRequestCenter
46 | 47 |
48 |
49 |

Undocumented

50 | 51 |
52 |
53 |
54 |
    55 |
  • 56 |
    57 | 58 | 59 | 60 | queue 61 | 62 |
    63 |
    64 |
    65 |
    66 |
    67 |
    68 |

    Undocumented

    69 | 70 |
    71 |
    72 |

    Declaration

    73 |
    74 |

    Swift

    75 |
    public static let queue: OperationQueue
    76 | 77 |
    78 |
    79 |
    80 |
    81 |
  • 82 |
83 |
84 |
85 |
86 |
87 |
88 | 166 | 172 |
173 | 174 | 175 | 176 | -------------------------------------------------------------------------------- /docs/badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | documentation 17 | 18 | 19 | documentation 20 | 21 | 22 | 100% 23 | 24 | 25 | 100% 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /docs/css/highlight.css: -------------------------------------------------------------------------------- 1 | /* Credit to https://gist.github.com/wataru420/2048287 */ 2 | .highlight { 3 | /* Comment */ 4 | /* Error */ 5 | /* Keyword */ 6 | /* Operator */ 7 | /* Comment.Multiline */ 8 | /* Comment.Preproc */ 9 | /* Comment.Single */ 10 | /* Comment.Special */ 11 | /* Generic.Deleted */ 12 | /* Generic.Deleted.Specific */ 13 | /* Generic.Emph */ 14 | /* Generic.Error */ 15 | /* Generic.Heading */ 16 | /* Generic.Inserted */ 17 | /* Generic.Inserted.Specific */ 18 | /* Generic.Output */ 19 | /* Generic.Prompt */ 20 | /* Generic.Strong */ 21 | /* Generic.Subheading */ 22 | /* Generic.Traceback */ 23 | /* Keyword.Constant */ 24 | /* Keyword.Declaration */ 25 | /* Keyword.Pseudo */ 26 | /* Keyword.Reserved */ 27 | /* Keyword.Type */ 28 | /* Literal.Number */ 29 | /* Literal.String */ 30 | /* Name.Attribute */ 31 | /* Name.Builtin */ 32 | /* Name.Class */ 33 | /* Name.Constant */ 34 | /* Name.Entity */ 35 | /* Name.Exception */ 36 | /* Name.Function */ 37 | /* Name.Namespace */ 38 | /* Name.Tag */ 39 | /* Name.Variable */ 40 | /* Operator.Word */ 41 | /* Text.Whitespace */ 42 | /* Literal.Number.Float */ 43 | /* Literal.Number.Hex */ 44 | /* Literal.Number.Integer */ 45 | /* Literal.Number.Oct */ 46 | /* Literal.String.Backtick */ 47 | /* Literal.String.Char */ 48 | /* Literal.String.Doc */ 49 | /* Literal.String.Double */ 50 | /* Literal.String.Escape */ 51 | /* Literal.String.Heredoc */ 52 | /* Literal.String.Interpol */ 53 | /* Literal.String.Other */ 54 | /* Literal.String.Regex */ 55 | /* Literal.String.Single */ 56 | /* Literal.String.Symbol */ 57 | /* Name.Builtin.Pseudo */ 58 | /* Name.Variable.Class */ 59 | /* Name.Variable.Global */ 60 | /* Name.Variable.Instance */ 61 | /* Literal.Number.Integer.Long */ } 62 | .highlight .c { 63 | color: #999988; 64 | font-style: italic; } 65 | .highlight .err { 66 | color: #a61717; 67 | background-color: #e3d2d2; } 68 | .highlight .k { 69 | color: #000000; 70 | font-weight: bold; } 71 | .highlight .o { 72 | color: #000000; 73 | font-weight: bold; } 74 | .highlight .cm { 75 | color: #999988; 76 | font-style: italic; } 77 | .highlight .cp { 78 | color: #999999; 79 | font-weight: bold; } 80 | .highlight .c1 { 81 | color: #999988; 82 | font-style: italic; } 83 | .highlight .cs { 84 | color: #999999; 85 | font-weight: bold; 86 | font-style: italic; } 87 | .highlight .gd { 88 | color: #000000; 89 | background-color: #ffdddd; } 90 | .highlight .gd .x { 91 | color: #000000; 92 | background-color: #ffaaaa; } 93 | .highlight .ge { 94 | color: #000000; 95 | font-style: italic; } 96 | .highlight .gr { 97 | color: #aa0000; } 98 | .highlight .gh { 99 | color: #999999; } 100 | .highlight .gi { 101 | color: #000000; 102 | background-color: #ddffdd; } 103 | .highlight .gi .x { 104 | color: #000000; 105 | background-color: #aaffaa; } 106 | .highlight .go { 107 | color: #888888; } 108 | .highlight .gp { 109 | color: #555555; } 110 | .highlight .gs { 111 | font-weight: bold; } 112 | .highlight .gu { 113 | color: #aaaaaa; } 114 | .highlight .gt { 115 | color: #aa0000; } 116 | .highlight .kc { 117 | color: #000000; 118 | font-weight: bold; } 119 | .highlight .kd { 120 | color: #000000; 121 | font-weight: bold; } 122 | .highlight .kp { 123 | color: #000000; 124 | font-weight: bold; } 125 | .highlight .kr { 126 | color: #000000; 127 | font-weight: bold; } 128 | .highlight .kt { 129 | color: #445588; } 130 | .highlight .m { 131 | color: #009999; } 132 | .highlight .s { 133 | color: #d14; } 134 | .highlight .na { 135 | color: #008080; } 136 | .highlight .nb { 137 | color: #0086B3; } 138 | .highlight .nc { 139 | color: #445588; 140 | font-weight: bold; } 141 | .highlight .no { 142 | color: #008080; } 143 | .highlight .ni { 144 | color: #800080; } 145 | .highlight .ne { 146 | color: #990000; 147 | font-weight: bold; } 148 | .highlight .nf { 149 | color: #990000; } 150 | .highlight .nn { 151 | color: #555555; } 152 | .highlight .nt { 153 | color: #000080; } 154 | .highlight .nv { 155 | color: #008080; } 156 | .highlight .ow { 157 | color: #000000; 158 | font-weight: bold; } 159 | .highlight .w { 160 | color: #bbbbbb; } 161 | .highlight .mf { 162 | color: #009999; } 163 | .highlight .mh { 164 | color: #009999; } 165 | .highlight .mi { 166 | color: #009999; } 167 | .highlight .mo { 168 | color: #009999; } 169 | .highlight .sb { 170 | color: #d14; } 171 | .highlight .sc { 172 | color: #d14; } 173 | .highlight .sd { 174 | color: #d14; } 175 | .highlight .s2 { 176 | color: #d14; } 177 | .highlight .se { 178 | color: #d14; } 179 | .highlight .sh { 180 | color: #d14; } 181 | .highlight .si { 182 | color: #d14; } 183 | .highlight .sx { 184 | color: #d14; } 185 | .highlight .sr { 186 | color: #009926; } 187 | .highlight .s1 { 188 | color: #d14; } 189 | .highlight .ss { 190 | color: #990073; } 191 | .highlight .bp { 192 | color: #999999; } 193 | .highlight .vc { 194 | color: #008080; } 195 | .highlight .vg { 196 | color: #008080; } 197 | .highlight .vi { 198 | color: #008080; } 199 | .highlight .il { 200 | color: #009999; } 201 | -------------------------------------------------------------------------------- /docs/css/jazzy.css: -------------------------------------------------------------------------------- 1 | html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { 2 | background: transparent; 3 | border: 0; 4 | margin: 0; 5 | outline: 0; 6 | padding: 0; 7 | vertical-align: baseline; } 8 | 9 | body { 10 | background-color: #f2f2f2; 11 | font-family: Helvetica, freesans, Arial, sans-serif; 12 | font-size: 14px; 13 | -webkit-font-smoothing: subpixel-antialiased; 14 | word-wrap: break-word; } 15 | 16 | h1, h2, h3 { 17 | margin-top: 0.8em; 18 | margin-bottom: 0.3em; 19 | font-weight: 100; 20 | color: black; } 21 | 22 | h1 { 23 | font-size: 2.5em; } 24 | 25 | h2 { 26 | font-size: 2em; 27 | border-bottom: 1px solid #e2e2e2; } 28 | 29 | h4 { 30 | font-size: 13px; 31 | line-height: 1.5; 32 | margin-top: 21px; } 33 | 34 | h5 { 35 | font-size: 1.1em; } 36 | 37 | h6 { 38 | font-size: 1.1em; 39 | color: #777; } 40 | 41 | .section-name { 42 | color: gray; 43 | display: block; 44 | font-family: Helvetica; 45 | font-size: 22px; 46 | font-weight: 100; 47 | margin-bottom: 15px; } 48 | 49 | pre, code { 50 | font: 0.95em Menlo, monospace; 51 | color: #777; 52 | word-wrap: normal; } 53 | 54 | p code, li code { 55 | background-color: #eee; 56 | padding: 2px 4px; 57 | border-radius: 4px; } 58 | 59 | a { 60 | color: #0088cc; 61 | text-decoration: none; } 62 | 63 | ul { 64 | padding-left: 15px; } 65 | 66 | li { 67 | line-height: 1.8em; } 68 | 69 | img { 70 | max-width: 100%; } 71 | 72 | blockquote { 73 | margin-left: 0; 74 | padding: 0 10px; 75 | border-left: 4px solid #ccc; } 76 | 77 | .content-wrapper { 78 | margin: 0 auto; 79 | width: 980px; } 80 | 81 | header { 82 | font-size: 0.85em; 83 | line-height: 26px; 84 | background-color: #414141; 85 | position: fixed; 86 | width: 100%; 87 | z-index: 2; } 88 | header img { 89 | padding-right: 6px; 90 | vertical-align: -4px; 91 | height: 16px; } 92 | header a { 93 | color: #fff; } 94 | header p { 95 | float: left; 96 | color: #999; } 97 | header .header-right { 98 | float: right; 99 | margin-left: 16px; } 100 | 101 | #breadcrumbs { 102 | background-color: #f2f2f2; 103 | height: 27px; 104 | padding-top: 17px; 105 | position: fixed; 106 | width: 100%; 107 | z-index: 2; 108 | margin-top: 26px; } 109 | #breadcrumbs #carat { 110 | height: 10px; 111 | margin: 0 5px; } 112 | 113 | .sidebar { 114 | background-color: #f9f9f9; 115 | border: 1px solid #e2e2e2; 116 | overflow-y: auto; 117 | overflow-x: hidden; 118 | position: fixed; 119 | top: 70px; 120 | bottom: 0; 121 | width: 230px; 122 | word-wrap: normal; } 123 | 124 | .nav-groups { 125 | list-style-type: none; 126 | background: #fff; 127 | padding-left: 0; } 128 | 129 | .nav-group-name { 130 | border-bottom: 1px solid #e2e2e2; 131 | font-size: 1.1em; 132 | font-weight: 100; 133 | padding: 15px 0 15px 20px; } 134 | .nav-group-name > a { 135 | color: #333; } 136 | 137 | .nav-group-tasks { 138 | margin-top: 5px; } 139 | 140 | .nav-group-task { 141 | font-size: 0.9em; 142 | list-style-type: none; 143 | white-space: nowrap; } 144 | .nav-group-task a { 145 | color: #888; } 146 | 147 | .main-content { 148 | background-color: #fff; 149 | border: 1px solid #e2e2e2; 150 | margin-left: 246px; 151 | position: absolute; 152 | overflow: hidden; 153 | padding-bottom: 20px; 154 | top: 70px; 155 | width: 734px; } 156 | .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { 157 | margin-bottom: 1em; } 158 | .main-content p { 159 | line-height: 1.8em; } 160 | .main-content section .section:first-child { 161 | margin-top: 0; 162 | padding-top: 0; } 163 | .main-content section .task-group-section .task-group:first-of-type { 164 | padding-top: 10px; } 165 | .main-content section .task-group-section .task-group:first-of-type .section-name { 166 | padding-top: 15px; } 167 | .main-content section .heading:before { 168 | content: ""; 169 | display: block; 170 | padding-top: 70px; 171 | margin: -70px 0 0; } 172 | .main-content .section-name p { 173 | margin-bottom: inherit; 174 | line-height: inherit; } 175 | .main-content .section-name code { 176 | background-color: inherit; 177 | padding: inherit; 178 | color: inherit; } 179 | 180 | .section { 181 | padding: 0 25px; } 182 | 183 | .highlight { 184 | background-color: #eee; 185 | padding: 10px 12px; 186 | border: 1px solid #e2e2e2; 187 | border-radius: 4px; 188 | overflow-x: auto; } 189 | 190 | .declaration .highlight { 191 | overflow-x: initial; 192 | padding: 0 40px 40px 0; 193 | margin-bottom: -25px; 194 | background-color: transparent; 195 | border: none; } 196 | 197 | .section-name { 198 | margin: 0; 199 | margin-left: 18px; } 200 | 201 | .task-group-section { 202 | padding-left: 6px; 203 | border-top: 1px solid #e2e2e2; } 204 | 205 | .task-group { 206 | padding-top: 0px; } 207 | 208 | .task-name-container a[name]:before { 209 | content: ""; 210 | display: block; 211 | padding-top: 70px; 212 | margin: -70px 0 0; } 213 | 214 | .section-name-container { 215 | position: relative; 216 | display: inline-block; } 217 | .section-name-container .section-name-link { 218 | position: absolute; 219 | top: 0; 220 | left: 0; 221 | bottom: 0; 222 | right: 0; 223 | margin-bottom: 0; } 224 | .section-name-container .section-name { 225 | position: relative; 226 | pointer-events: none; 227 | z-index: 1; } 228 | .section-name-container .section-name a { 229 | pointer-events: auto; } 230 | 231 | .item { 232 | padding-top: 8px; 233 | width: 100%; 234 | list-style-type: none; } 235 | .item a[name]:before { 236 | content: ""; 237 | display: block; 238 | padding-top: 70px; 239 | margin: -70px 0 0; } 240 | .item code { 241 | background-color: transparent; 242 | padding: 0; } 243 | .item .token, .item .direct-link { 244 | padding-left: 3px; 245 | margin-left: 15px; 246 | font-size: 11.9px; 247 | transition: all 300ms; } 248 | .item .token-open { 249 | margin-left: 0px; } 250 | .item .discouraged { 251 | text-decoration: line-through; } 252 | .item .declaration-note { 253 | font-size: .85em; 254 | color: gray; 255 | font-style: italic; } 256 | 257 | .pointer-container { 258 | border-bottom: 1px solid #e2e2e2; 259 | left: -23px; 260 | padding-bottom: 13px; 261 | position: relative; 262 | width: 110%; } 263 | 264 | .pointer { 265 | background: #f9f9f9; 266 | border-left: 1px solid #e2e2e2; 267 | border-top: 1px solid #e2e2e2; 268 | height: 12px; 269 | left: 21px; 270 | top: -7px; 271 | -webkit-transform: rotate(45deg); 272 | -moz-transform: rotate(45deg); 273 | -o-transform: rotate(45deg); 274 | transform: rotate(45deg); 275 | position: absolute; 276 | width: 12px; } 277 | 278 | .height-container { 279 | display: none; 280 | left: -25px; 281 | padding: 0 25px; 282 | position: relative; 283 | width: 100%; 284 | overflow: hidden; } 285 | .height-container .section { 286 | background: #f9f9f9; 287 | border-bottom: 1px solid #e2e2e2; 288 | left: -25px; 289 | position: relative; 290 | width: 100%; 291 | padding-top: 10px; 292 | padding-bottom: 5px; } 293 | 294 | .aside, .language { 295 | padding: 6px 12px; 296 | margin: 12px 0; 297 | border-left: 5px solid #dddddd; 298 | overflow-y: hidden; } 299 | .aside .aside-title, .language .aside-title { 300 | font-size: 9px; 301 | letter-spacing: 2px; 302 | text-transform: uppercase; 303 | padding-bottom: 0; 304 | margin: 0; 305 | color: #aaa; 306 | -webkit-user-select: none; } 307 | .aside p:last-child, .language p:last-child { 308 | margin-bottom: 0; } 309 | 310 | .language { 311 | border-left: 5px solid #cde9f4; } 312 | .language .aside-title { 313 | color: #4b8afb; } 314 | 315 | .aside-warning, .aside-deprecated, .aside-unavailable { 316 | border-left: 5px solid #ff6666; } 317 | .aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title { 318 | color: #ff0000; } 319 | 320 | .graybox { 321 | border-collapse: collapse; 322 | width: 100%; } 323 | .graybox p { 324 | margin: 0; 325 | word-break: break-word; 326 | min-width: 50px; } 327 | .graybox td { 328 | border: 1px solid #e2e2e2; 329 | padding: 5px 25px 5px 10px; 330 | vertical-align: middle; } 331 | .graybox tr td:first-of-type { 332 | text-align: right; 333 | padding: 7px; 334 | vertical-align: top; 335 | word-break: normal; 336 | width: 40px; } 337 | 338 | .slightly-smaller { 339 | font-size: 0.9em; } 340 | 341 | #footer { 342 | position: relative; 343 | top: 10px; 344 | bottom: 0px; 345 | margin-left: 25px; } 346 | #footer p { 347 | margin: 0; 348 | color: #aaa; 349 | font-size: 0.8em; } 350 | 351 | html.dash header, html.dash #breadcrumbs, html.dash .sidebar { 352 | display: none; } 353 | 354 | html.dash .main-content { 355 | width: 980px; 356 | margin-left: 0; 357 | border: none; 358 | width: 100%; 359 | top: 0; 360 | padding-bottom: 0; } 361 | 362 | html.dash .height-container { 363 | display: block; } 364 | 365 | html.dash .item .token { 366 | margin-left: 0; } 367 | 368 | html.dash .content-wrapper { 369 | width: auto; } 370 | 371 | html.dash #footer { 372 | position: static; } 373 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIdentifier 6 | com.jazzy.apimanager 7 | CFBundleName 8 | APIManager 9 | DocSetPlatformFamily 10 | apimanager 11 | isDashDocset 12 | 13 | dashIndexFilePath 14 | index.html 15 | isJavaScriptEnabled 16 | 17 | DashDocSetFamily 18 | dashtoc 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/Classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Classes Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

APIManager 0.4.0 Docs (100% documented)

18 |

View on GitHub

19 |
20 |
21 |
22 | 27 |
28 |
29 | 97 |
98 |
99 |
100 |

Classes

101 |

The following classes are available globally.

102 | 103 |
104 |
105 |
106 |
    107 |
  • 108 |
    109 | 110 | 111 | 112 | APIRequest 113 | 114 |
    115 |
    116 |
    117 |
    118 |
    119 |
    120 |

    Base class for creating an APIRequest.

    121 |
    122 |

    Note

    123 | APIRequests should be created through a class that conforms to 124 | APIService. 125 | 126 |
    127 | 128 | See more 129 |
    130 |
    131 |

    Declaration

    132 |
    133 |

    Swift

    134 |
    open class APIRequest<ReturnType> : Operation where ReturnType : APIReturnable
    135 | 136 |
    137 |
    138 |
    139 |
    140 |
  • 141 |
142 |
143 |
144 |
145 | 149 |
150 |
151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/Classes/APIRequest/APIRequestError.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | APIRequestError Enumeration Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

APIManager Docs (100% documented)

18 |
19 |
20 |
21 | 26 |
27 |
28 | 74 |
75 |
76 |
77 |

APIRequestError

78 |
79 |
80 |
public enum APIRequestError: Error
81 | 82 |
83 |
84 |

Enumeration of the Errors that can occur during an APIRequest.

85 | 86 |
87 |
88 |
89 |
    90 |
  • 91 |
    92 | 93 | 94 | 95 | invalidHTTPReponse 96 | 97 |
    98 |
    99 |
    100 |
    101 |
    102 |
    103 |

    occurs when an APIRequest gets a response with an invalid response code, additionally provides a decription of the error code

    104 | 105 |
    106 |
    107 |

    Declaration

    108 |
    109 |

    Swift

    110 |
    case invalidHTTPReponse(code: Int, description: String)
    111 | 112 |
    113 |
    114 |
    115 |
    116 |
  • 117 |
118 |
119 |
120 |
    121 |
  • 122 |
    123 | 124 | 125 | 126 | internalError 127 | 128 |
    129 |
    130 |
    131 |
    132 |
    133 |
    134 |

    occurs when an APIRequest encounters an inconsistancy it does not know how to handle, additionally provides a decription of the error

    135 | 136 |
    137 |
    138 |

    Declaration

    139 |
    140 |

    Swift

    141 |
    case internalError(description: String)
    142 | 143 |
    144 |
    145 |
    146 |
    147 |
  • 148 |
149 |
150 |
151 |
152 | 156 |
157 |
158 | 159 | 160 | 161 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/Classes/APIRequestCenter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | APIRequestCenter Class Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

19 | APIManager Docs 20 | (97% documented) 21 |

22 | 23 | 24 |
25 |
26 | 37 |
38 |
39 |
40 |
41 |
42 |

APIRequestCenter

43 |
44 |
45 |
public final class APIRequestCenter
46 | 47 |
48 |
49 |

Undocumented

50 | 51 |
52 |
53 |
54 |
    55 |
  • 56 |
    57 | 58 | 59 | 60 | queue 61 | 62 |
    63 |
    64 |
    65 |
    66 |
    67 |
    68 |

    Undocumented

    69 | 70 |
    71 |
    72 |

    Declaration

    73 |
    74 |

    Swift

    75 |
    public static let queue: OperationQueue
    76 | 77 |
    78 |
    79 |
    80 |
    81 |
  • 82 |
83 |
84 |
85 |
86 |
87 |
88 | 161 | 167 |
168 | 169 | 170 | 171 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/Extensions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Extensions Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

APIManager 0.4.0 Docs (100% documented)

18 |

View on GitHub

19 |
20 |
21 |
22 | 27 |
28 |
29 | 97 |
98 |
99 |
100 |

Extensions

101 |

The following extensions are available globally.

102 | 103 |
104 |
105 |
106 |
    107 |
  • 108 |
    109 | 110 | 111 | 112 | OperationQueue 113 | 114 |
    115 |
    116 |
    117 |
    118 |
    119 |
    120 | 121 | See more 122 |
    123 |
    124 |

    Declaration

    125 |
    126 |

    Swift

    127 |
    public extension OperationQueue
    128 | 129 |
    130 |
    131 |
    132 |
    133 |
  • 134 |
  • 135 |
    136 | 137 | 138 | 139 | Dictionary 140 | 141 |
    142 |
    143 |
    144 |
    145 |
    146 |
    147 | 148 | See more 149 |
    150 |
    151 |

    Declaration

    152 |
    153 |

    Swift

    154 |
    internal extension Dictionary
    155 | 156 |
    157 |
    158 |
    159 |
    160 |
  • 161 |
162 |
163 |
164 |
165 | 169 |
170 |
171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/Extensions/Dictionary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Dictionary Extension Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

APIManager 0.4.0 Docs (100% documented)

18 |

View on GitHub

19 |
20 |
21 |
22 | 27 |
28 |
29 | 97 |
98 |
99 |
100 |

Dictionary

101 |
102 |
103 |
internal extension Dictionary
104 | 105 |
106 |
107 | 108 |
109 |
110 |
111 |
    112 |
  • 113 |
    114 | 115 | 116 | 117 | init(_:) 118 | 119 |
    120 |
    121 |
    122 |
    123 |
    124 |
    125 |

    Initializes a dictionary by combining the contents of an arbitrary 126 | number of dictionaries. In the case of colliding keys, the last 127 | dictionary’s value will be used.

    128 | 129 |
    130 |
    131 |

    Declaration

    132 |
    133 |

    Swift

    134 |
    init(_ dictionarys: Dictionary?...)
    135 | 136 |
    137 |
    138 |
    139 |
    140 |
  • 141 |
142 |
143 |
144 |
145 | 149 |
150 |
151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/Extensions/OperationQueue.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OperationQueue Extension Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

APIManager 0.4.0 Docs (100% documented)

18 |

View on GitHub

19 |
20 |
21 |
22 | 27 |
28 |
29 | 97 |
98 |
99 |
100 |

OperationQueue

101 |
102 |
103 |
public extension OperationQueue
104 | 105 |
106 |
107 | 108 |
109 |
110 |
111 |
    112 |
  • 113 |
    114 | 115 | 116 | 117 | defaultAPIRequestQueue 118 | 119 |
    120 |
    121 |
    122 |
    123 |
    124 |
    125 |

    Default OperationQueue for running requests. Other queues can be used 126 | via APIRequest.launch(on:).

    127 | 128 |
    129 |
    130 |

    Declaration

    131 |
    132 |

    Swift

    133 |
    static let defaultAPIRequestQueue: OperationQueue
    134 | 135 |
    136 |
    137 |
    138 |
    139 |
  • 140 |
141 |
142 |
143 |
144 | 148 |
149 |
150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/Extensions/URL.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | URL Extension Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

APIManager Docs (98% documented)

18 |
19 |
20 |
21 | 26 |
27 |
28 | 93 |
94 |
95 |
96 |

URL

97 |
98 |
99 |
struct URL : ReferenceConvertible, Equatable
100 | 101 |
102 |
103 |

Extension of Foundation.URL.

104 | 105 |
106 |
107 |
108 |
    109 |
  • 110 |
    111 | 112 | 113 | 114 | init(base:paramaters:) 115 | 116 |
    117 |
    118 |
    119 |
    120 |
    121 |
    122 |

    Initializer for creating a URL with a base string and optional URLParameters.

    123 | 124 |
    125 |
    126 |

    Declaration

    127 |
    128 |

    Swift

    129 |
    init?(base: String, paramaters: HTTPParameters?)
    130 | 131 |
    132 |
    133 |
    134 |
    135 |
  • 136 |
137 |
138 |
139 |
140 | 144 |
145 |
146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/Extensions/URLRequest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | URLRequest Extension Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |

APIManager Docs (98% documented)

18 |
19 |
20 |
21 | 26 |
27 |
28 | 93 |
94 |
95 |
96 |

URLRequest

97 |

Extension of Foundation.URL.

98 | 99 |
100 |
101 |
102 |
    103 |
  • 104 |
    105 | 106 | 107 | 108 | init(url:method:body:headers:) 109 | 110 |
    111 |
    112 |
    113 |
    114 |
    115 |
    116 |

    Initializer for creating a URLRequest with an HTTPMethod, HTTPBody, and HTTPHeaders.

    117 | 118 |
    119 |
    120 |

    Declaration

    121 |
    122 |

    Swift

    123 |
    init(url: URL, method: HTTPMethod, body: HTTPBody?, headers: HTTPHeaders?)
    124 | 125 |
    126 |
    127 |
    128 |
    129 |
  • 130 |
131 |
132 |
133 |
134 | 138 |
139 |
140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/Structs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Structures Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

19 | APIManager Docs 20 | (91% documented) 21 |

22 | 23 | 24 |
25 |
26 | 37 |
38 |
39 |
40 |
41 |
42 |

Structures

43 |

The following structures are available globally.

44 | 45 |
46 |
47 |
48 |
    49 |
  • 50 |
    51 | 52 | 53 | 54 | APIRequestCenter 55 | 56 |
    57 |
    58 |
    59 |
    60 |
    61 |
    62 |

    Undocumented

    63 | 64 | See more 65 |
    66 |
    67 |

    Declaration

    68 |
    69 |

    Swift

    70 |
    public struct APIRequestCenter
    71 | 72 |
    73 |
    74 |
    75 |
    76 |
  • 77 |
78 |
79 |
80 |
81 |
82 |
83 | 161 | 167 |
168 | 169 | 170 | 171 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/Structs/APIRequestCenter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | APIRequestCenter Structure Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

19 | APIManager Docs 20 | (91% documented) 21 |

22 | 23 | 24 |
25 |
26 | 37 |
38 |
39 |
40 |
41 |
42 |

APIRequestCenter

43 |
44 |
45 |
public struct APIRequestCenter
46 | 47 |
48 |
49 |

Undocumented

50 | 51 |
52 |
53 |
54 |
    55 |
  • 56 |
    57 | 58 | 59 | 60 | queue 61 | 62 |
    63 |
    64 |
    65 |
    66 |
    67 |
    68 |

    Undocumented

    69 | 70 |
    71 |
    72 |

    Declaration

    73 |
    74 |

    Swift

    75 |
    public static let queue: OperationQueue
    76 | 77 |
    78 |
    79 |
    80 |
    81 |
  • 82 |
83 |
84 |
85 |
86 |
87 |
88 | 166 | 172 |
173 | 174 | 175 | 176 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | documentation 17 | 18 | 19 | documentation 20 | 21 | 22 | 100% 23 | 24 | 25 | 100% 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/css/highlight.css: -------------------------------------------------------------------------------- 1 | /* Credit to https://gist.github.com/wataru420/2048287 */ 2 | .highlight { 3 | /* Comment */ 4 | /* Error */ 5 | /* Keyword */ 6 | /* Operator */ 7 | /* Comment.Multiline */ 8 | /* Comment.Preproc */ 9 | /* Comment.Single */ 10 | /* Comment.Special */ 11 | /* Generic.Deleted */ 12 | /* Generic.Deleted.Specific */ 13 | /* Generic.Emph */ 14 | /* Generic.Error */ 15 | /* Generic.Heading */ 16 | /* Generic.Inserted */ 17 | /* Generic.Inserted.Specific */ 18 | /* Generic.Output */ 19 | /* Generic.Prompt */ 20 | /* Generic.Strong */ 21 | /* Generic.Subheading */ 22 | /* Generic.Traceback */ 23 | /* Keyword.Constant */ 24 | /* Keyword.Declaration */ 25 | /* Keyword.Pseudo */ 26 | /* Keyword.Reserved */ 27 | /* Keyword.Type */ 28 | /* Literal.Number */ 29 | /* Literal.String */ 30 | /* Name.Attribute */ 31 | /* Name.Builtin */ 32 | /* Name.Class */ 33 | /* Name.Constant */ 34 | /* Name.Entity */ 35 | /* Name.Exception */ 36 | /* Name.Function */ 37 | /* Name.Namespace */ 38 | /* Name.Tag */ 39 | /* Name.Variable */ 40 | /* Operator.Word */ 41 | /* Text.Whitespace */ 42 | /* Literal.Number.Float */ 43 | /* Literal.Number.Hex */ 44 | /* Literal.Number.Integer */ 45 | /* Literal.Number.Oct */ 46 | /* Literal.String.Backtick */ 47 | /* Literal.String.Char */ 48 | /* Literal.String.Doc */ 49 | /* Literal.String.Double */ 50 | /* Literal.String.Escape */ 51 | /* Literal.String.Heredoc */ 52 | /* Literal.String.Interpol */ 53 | /* Literal.String.Other */ 54 | /* Literal.String.Regex */ 55 | /* Literal.String.Single */ 56 | /* Literal.String.Symbol */ 57 | /* Name.Builtin.Pseudo */ 58 | /* Name.Variable.Class */ 59 | /* Name.Variable.Global */ 60 | /* Name.Variable.Instance */ 61 | /* Literal.Number.Integer.Long */ } 62 | .highlight .c { 63 | color: #999988; 64 | font-style: italic; } 65 | .highlight .err { 66 | color: #a61717; 67 | background-color: #e3d2d2; } 68 | .highlight .k { 69 | color: #000000; 70 | font-weight: bold; } 71 | .highlight .o { 72 | color: #000000; 73 | font-weight: bold; } 74 | .highlight .cm { 75 | color: #999988; 76 | font-style: italic; } 77 | .highlight .cp { 78 | color: #999999; 79 | font-weight: bold; } 80 | .highlight .c1 { 81 | color: #999988; 82 | font-style: italic; } 83 | .highlight .cs { 84 | color: #999999; 85 | font-weight: bold; 86 | font-style: italic; } 87 | .highlight .gd { 88 | color: #000000; 89 | background-color: #ffdddd; } 90 | .highlight .gd .x { 91 | color: #000000; 92 | background-color: #ffaaaa; } 93 | .highlight .ge { 94 | color: #000000; 95 | font-style: italic; } 96 | .highlight .gr { 97 | color: #aa0000; } 98 | .highlight .gh { 99 | color: #999999; } 100 | .highlight .gi { 101 | color: #000000; 102 | background-color: #ddffdd; } 103 | .highlight .gi .x { 104 | color: #000000; 105 | background-color: #aaffaa; } 106 | .highlight .go { 107 | color: #888888; } 108 | .highlight .gp { 109 | color: #555555; } 110 | .highlight .gs { 111 | font-weight: bold; } 112 | .highlight .gu { 113 | color: #aaaaaa; } 114 | .highlight .gt { 115 | color: #aa0000; } 116 | .highlight .kc { 117 | color: #000000; 118 | font-weight: bold; } 119 | .highlight .kd { 120 | color: #000000; 121 | font-weight: bold; } 122 | .highlight .kp { 123 | color: #000000; 124 | font-weight: bold; } 125 | .highlight .kr { 126 | color: #000000; 127 | font-weight: bold; } 128 | .highlight .kt { 129 | color: #445588; } 130 | .highlight .m { 131 | color: #009999; } 132 | .highlight .s { 133 | color: #d14; } 134 | .highlight .na { 135 | color: #008080; } 136 | .highlight .nb { 137 | color: #0086B3; } 138 | .highlight .nc { 139 | color: #445588; 140 | font-weight: bold; } 141 | .highlight .no { 142 | color: #008080; } 143 | .highlight .ni { 144 | color: #800080; } 145 | .highlight .ne { 146 | color: #990000; 147 | font-weight: bold; } 148 | .highlight .nf { 149 | color: #990000; } 150 | .highlight .nn { 151 | color: #555555; } 152 | .highlight .nt { 153 | color: #000080; } 154 | .highlight .nv { 155 | color: #008080; } 156 | .highlight .ow { 157 | color: #000000; 158 | font-weight: bold; } 159 | .highlight .w { 160 | color: #bbbbbb; } 161 | .highlight .mf { 162 | color: #009999; } 163 | .highlight .mh { 164 | color: #009999; } 165 | .highlight .mi { 166 | color: #009999; } 167 | .highlight .mo { 168 | color: #009999; } 169 | .highlight .sb { 170 | color: #d14; } 171 | .highlight .sc { 172 | color: #d14; } 173 | .highlight .sd { 174 | color: #d14; } 175 | .highlight .s2 { 176 | color: #d14; } 177 | .highlight .se { 178 | color: #d14; } 179 | .highlight .sh { 180 | color: #d14; } 181 | .highlight .si { 182 | color: #d14; } 183 | .highlight .sx { 184 | color: #d14; } 185 | .highlight .sr { 186 | color: #009926; } 187 | .highlight .s1 { 188 | color: #d14; } 189 | .highlight .ss { 190 | color: #990073; } 191 | .highlight .bp { 192 | color: #999999; } 193 | .highlight .vc { 194 | color: #008080; } 195 | .highlight .vg { 196 | color: #008080; } 197 | .highlight .vi { 198 | color: #008080; } 199 | .highlight .il { 200 | color: #009999; } 201 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/css/jazzy.css: -------------------------------------------------------------------------------- 1 | html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { 2 | background: transparent; 3 | border: 0; 4 | margin: 0; 5 | outline: 0; 6 | padding: 0; 7 | vertical-align: baseline; } 8 | 9 | body { 10 | background-color: #f2f2f2; 11 | font-family: Helvetica, freesans, Arial, sans-serif; 12 | font-size: 14px; 13 | -webkit-font-smoothing: subpixel-antialiased; 14 | word-wrap: break-word; } 15 | 16 | h1, h2, h3 { 17 | margin-top: 0.8em; 18 | margin-bottom: 0.3em; 19 | font-weight: 100; 20 | color: black; } 21 | 22 | h1 { 23 | font-size: 2.5em; } 24 | 25 | h2 { 26 | font-size: 2em; 27 | border-bottom: 1px solid #e2e2e2; } 28 | 29 | h4 { 30 | font-size: 13px; 31 | line-height: 1.5; 32 | margin-top: 21px; } 33 | 34 | h5 { 35 | font-size: 1.1em; } 36 | 37 | h6 { 38 | font-size: 1.1em; 39 | color: #777; } 40 | 41 | .section-name { 42 | color: gray; 43 | display: block; 44 | font-family: Helvetica; 45 | font-size: 22px; 46 | font-weight: 100; 47 | margin-bottom: 15px; } 48 | 49 | pre, code { 50 | font: 0.95em Menlo, monospace; 51 | color: #777; 52 | word-wrap: normal; } 53 | 54 | p code, li code { 55 | background-color: #eee; 56 | padding: 2px 4px; 57 | border-radius: 4px; } 58 | 59 | a { 60 | color: #0088cc; 61 | text-decoration: none; } 62 | 63 | ul { 64 | padding-left: 15px; } 65 | 66 | li { 67 | line-height: 1.8em; } 68 | 69 | img { 70 | max-width: 100%; } 71 | 72 | blockquote { 73 | margin-left: 0; 74 | padding: 0 10px; 75 | border-left: 4px solid #ccc; } 76 | 77 | .content-wrapper { 78 | margin: 0 auto; 79 | width: 980px; } 80 | 81 | header { 82 | font-size: 0.85em; 83 | line-height: 26px; 84 | background-color: #414141; 85 | position: fixed; 86 | width: 100%; 87 | z-index: 2; } 88 | header img { 89 | padding-right: 6px; 90 | vertical-align: -4px; 91 | height: 16px; } 92 | header a { 93 | color: #fff; } 94 | header p { 95 | float: left; 96 | color: #999; } 97 | header .header-right { 98 | float: right; 99 | margin-left: 16px; } 100 | 101 | #breadcrumbs { 102 | background-color: #f2f2f2; 103 | height: 27px; 104 | padding-top: 17px; 105 | position: fixed; 106 | width: 100%; 107 | z-index: 2; 108 | margin-top: 26px; } 109 | #breadcrumbs #carat { 110 | height: 10px; 111 | margin: 0 5px; } 112 | 113 | .sidebar { 114 | background-color: #f9f9f9; 115 | border: 1px solid #e2e2e2; 116 | overflow-y: auto; 117 | overflow-x: hidden; 118 | position: fixed; 119 | top: 70px; 120 | bottom: 0; 121 | width: 230px; 122 | word-wrap: normal; } 123 | 124 | .nav-groups { 125 | list-style-type: none; 126 | background: #fff; 127 | padding-left: 0; } 128 | 129 | .nav-group-name { 130 | border-bottom: 1px solid #e2e2e2; 131 | font-size: 1.1em; 132 | font-weight: 100; 133 | padding: 15px 0 15px 20px; } 134 | .nav-group-name > a { 135 | color: #333; } 136 | 137 | .nav-group-tasks { 138 | margin-top: 5px; } 139 | 140 | .nav-group-task { 141 | font-size: 0.9em; 142 | list-style-type: none; 143 | white-space: nowrap; } 144 | .nav-group-task a { 145 | color: #888; } 146 | 147 | .main-content { 148 | background-color: #fff; 149 | border: 1px solid #e2e2e2; 150 | margin-left: 246px; 151 | position: absolute; 152 | overflow: hidden; 153 | padding-bottom: 20px; 154 | top: 70px; 155 | width: 734px; } 156 | .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { 157 | margin-bottom: 1em; } 158 | .main-content p { 159 | line-height: 1.8em; } 160 | .main-content section .section:first-child { 161 | margin-top: 0; 162 | padding-top: 0; } 163 | .main-content section .task-group-section .task-group:first-of-type { 164 | padding-top: 10px; } 165 | .main-content section .task-group-section .task-group:first-of-type .section-name { 166 | padding-top: 15px; } 167 | .main-content section .heading:before { 168 | content: ""; 169 | display: block; 170 | padding-top: 70px; 171 | margin: -70px 0 0; } 172 | .main-content .section-name p { 173 | margin-bottom: inherit; 174 | line-height: inherit; } 175 | .main-content .section-name code { 176 | background-color: inherit; 177 | padding: inherit; 178 | color: inherit; } 179 | 180 | .section { 181 | padding: 0 25px; } 182 | 183 | .highlight { 184 | background-color: #eee; 185 | padding: 10px 12px; 186 | border: 1px solid #e2e2e2; 187 | border-radius: 4px; 188 | overflow-x: auto; } 189 | 190 | .declaration .highlight { 191 | overflow-x: initial; 192 | padding: 0 40px 40px 0; 193 | margin-bottom: -25px; 194 | background-color: transparent; 195 | border: none; } 196 | 197 | .section-name { 198 | margin: 0; 199 | margin-left: 18px; } 200 | 201 | .task-group-section { 202 | padding-left: 6px; 203 | border-top: 1px solid #e2e2e2; } 204 | 205 | .task-group { 206 | padding-top: 0px; } 207 | 208 | .task-name-container a[name]:before { 209 | content: ""; 210 | display: block; 211 | padding-top: 70px; 212 | margin: -70px 0 0; } 213 | 214 | .section-name-container { 215 | position: relative; 216 | display: inline-block; } 217 | .section-name-container .section-name-link { 218 | position: absolute; 219 | top: 0; 220 | left: 0; 221 | bottom: 0; 222 | right: 0; 223 | margin-bottom: 0; } 224 | .section-name-container .section-name { 225 | position: relative; 226 | pointer-events: none; 227 | z-index: 1; } 228 | .section-name-container .section-name a { 229 | pointer-events: auto; } 230 | 231 | .item { 232 | padding-top: 8px; 233 | width: 100%; 234 | list-style-type: none; } 235 | .item a[name]:before { 236 | content: ""; 237 | display: block; 238 | padding-top: 70px; 239 | margin: -70px 0 0; } 240 | .item code { 241 | background-color: transparent; 242 | padding: 0; } 243 | .item .token, .item .direct-link { 244 | padding-left: 3px; 245 | margin-left: 15px; 246 | font-size: 11.9px; 247 | transition: all 300ms; } 248 | .item .token-open { 249 | margin-left: 0px; } 250 | .item .discouraged { 251 | text-decoration: line-through; } 252 | .item .declaration-note { 253 | font-size: .85em; 254 | color: gray; 255 | font-style: italic; } 256 | 257 | .pointer-container { 258 | border-bottom: 1px solid #e2e2e2; 259 | left: -23px; 260 | padding-bottom: 13px; 261 | position: relative; 262 | width: 110%; } 263 | 264 | .pointer { 265 | background: #f9f9f9; 266 | border-left: 1px solid #e2e2e2; 267 | border-top: 1px solid #e2e2e2; 268 | height: 12px; 269 | left: 21px; 270 | top: -7px; 271 | -webkit-transform: rotate(45deg); 272 | -moz-transform: rotate(45deg); 273 | -o-transform: rotate(45deg); 274 | transform: rotate(45deg); 275 | position: absolute; 276 | width: 12px; } 277 | 278 | .height-container { 279 | display: none; 280 | left: -25px; 281 | padding: 0 25px; 282 | position: relative; 283 | width: 100%; 284 | overflow: hidden; } 285 | .height-container .section { 286 | background: #f9f9f9; 287 | border-bottom: 1px solid #e2e2e2; 288 | left: -25px; 289 | position: relative; 290 | width: 100%; 291 | padding-top: 10px; 292 | padding-bottom: 5px; } 293 | 294 | .aside, .language { 295 | padding: 6px 12px; 296 | margin: 12px 0; 297 | border-left: 5px solid #dddddd; 298 | overflow-y: hidden; } 299 | .aside .aside-title, .language .aside-title { 300 | font-size: 9px; 301 | letter-spacing: 2px; 302 | text-transform: uppercase; 303 | padding-bottom: 0; 304 | margin: 0; 305 | color: #aaa; 306 | -webkit-user-select: none; } 307 | .aside p:last-child, .language p:last-child { 308 | margin-bottom: 0; } 309 | 310 | .language { 311 | border-left: 5px solid #cde9f4; } 312 | .language .aside-title { 313 | color: #4b8afb; } 314 | 315 | .aside-warning, .aside-deprecated, .aside-unavailable { 316 | border-left: 5px solid #ff6666; } 317 | .aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title { 318 | color: #ff0000; } 319 | 320 | .graybox { 321 | border-collapse: collapse; 322 | width: 100%; } 323 | .graybox p { 324 | margin: 0; 325 | word-break: break-word; 326 | min-width: 50px; } 327 | .graybox td { 328 | border: 1px solid #e2e2e2; 329 | padding: 5px 25px 5px 10px; 330 | vertical-align: middle; } 331 | .graybox tr td:first-of-type { 332 | text-align: right; 333 | padding: 7px; 334 | vertical-align: top; 335 | word-break: normal; 336 | width: 40px; } 337 | 338 | .slightly-smaller { 339 | font-size: 0.9em; } 340 | 341 | #footer { 342 | position: relative; 343 | top: 10px; 344 | bottom: 0px; 345 | margin-left: 25px; } 346 | #footer p { 347 | margin: 0; 348 | color: #aaa; 349 | font-size: 0.8em; } 350 | 351 | html.dash header, html.dash #breadcrumbs, html.dash .sidebar { 352 | display: none; } 353 | 354 | html.dash .main-content { 355 | width: 980px; 356 | margin-left: 0; 357 | border: none; 358 | width: 100%; 359 | top: 0; 360 | padding-bottom: 0; } 361 | 362 | html.dash .height-container { 363 | display: block; } 364 | 365 | html.dash .item .token { 366 | margin-left: 0; } 367 | 368 | html.dash .content-wrapper { 369 | width: auto; } 370 | 371 | html.dash #footer { 372 | position: static; } 373 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/img/carat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rauhul/api-manager/c8b6b426a4172cf1cd4568601cf36b6437d65ae8/docs/docsets/APIManager.docset/Contents/Resources/Documents/img/carat.png -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/img/dash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rauhul/api-manager/c8b6b426a4172cf1cd4568601cf36b6437d65ae8/docs/docsets/APIManager.docset/Contents/Resources/Documents/img/dash.png -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/img/gh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rauhul/api-manager/c8b6b426a4172cf1cd4568601cf36b6437d65ae8/docs/docsets/APIManager.docset/Contents/Resources/Documents/img/gh.png -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/img/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rauhul/api-manager/c8b6b426a4172cf1cd4568601cf36b6437d65ae8/docs/docsets/APIManager.docset/Contents/Resources/Documents/img/spinner.gif -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/js/jazzy.js: -------------------------------------------------------------------------------- 1 | window.jazzy = {'docset': false} 2 | if (typeof window.dash != 'undefined') { 3 | document.documentElement.className += ' dash' 4 | window.jazzy.docset = true 5 | } 6 | if (navigator.userAgent.match(/xcode/i)) { 7 | document.documentElement.className += ' xcode' 8 | window.jazzy.docset = true 9 | } 10 | 11 | function toggleItem($link, $content) { 12 | var animationDuration = 300; 13 | $link.toggleClass('token-open'); 14 | $content.slideToggle(animationDuration); 15 | } 16 | 17 | function itemLinkToContent($link) { 18 | return $link.parent().parent().next(); 19 | } 20 | 21 | // On doc load + hash-change, open any targetted item 22 | function openCurrentItemIfClosed() { 23 | if (window.jazzy.docset) { 24 | return; 25 | } 26 | var $link = $(`.token[href="${location.hash}"]`); 27 | $content = itemLinkToContent($link); 28 | if ($content.is(':hidden')) { 29 | toggleItem($link, $content); 30 | } 31 | } 32 | 33 | $(openCurrentItemIfClosed); 34 | $(window).on('hashchange', openCurrentItemIfClosed); 35 | 36 | // On item link ('token') click, toggle its discussion 37 | $('.token').on('click', function(event) { 38 | if (window.jazzy.docset) { 39 | return; 40 | } 41 | var $link = $(this); 42 | toggleItem($link, itemLinkToContent($link)); 43 | 44 | // Keeps the document from jumping to the hash. 45 | var href = $link.attr('href'); 46 | if (history.pushState) { 47 | history.pushState({}, '', href); 48 | } else { 49 | location.hash = href; 50 | } 51 | event.preventDefault(); 52 | }); 53 | 54 | // Clicks on links to the current, closed, item need to open the item 55 | $("a:not('.token')").on('click', function() { 56 | if (location == this.href) { 57 | openCurrentItemIfClosed(); 58 | } 59 | }); 60 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/js/jazzy.search.js: -------------------------------------------------------------------------------- 1 | $(function(){ 2 | var searchIndex = lunr(function() { 3 | this.ref('url'); 4 | this.field('name'); 5 | }); 6 | 7 | var $typeahead = $('[data-typeahead]'); 8 | var $form = $typeahead.parents('form'); 9 | var searchURL = $form.attr('action'); 10 | 11 | function displayTemplate(result) { 12 | return result.name; 13 | } 14 | 15 | function suggestionTemplate(result) { 16 | var t = '
'; 17 | t += '' + result.name + ''; 18 | if (result.parent_name) { 19 | t += '' + result.parent_name + ''; 20 | } 21 | t += '
'; 22 | return t; 23 | } 24 | 25 | $typeahead.one('focus', function() { 26 | $form.addClass('loading'); 27 | 28 | $.getJSON(searchURL).then(function(searchData) { 29 | $.each(searchData, function (url, doc) { 30 | searchIndex.add({url: url, name: doc.name}); 31 | }); 32 | 33 | $typeahead.typeahead( 34 | { 35 | highlight: true, 36 | minLength: 3 37 | }, 38 | { 39 | limit: 10, 40 | display: displayTemplate, 41 | templates: { suggestion: suggestionTemplate }, 42 | source: function(query, sync) { 43 | var results = searchIndex.search(query).map(function(result) { 44 | var doc = searchData[result.ref]; 45 | doc.url = result.ref; 46 | return doc; 47 | }); 48 | sync(results); 49 | } 50 | } 51 | ); 52 | $form.removeClass('loading'); 53 | $typeahead.trigger('focus'); 54 | }); 55 | }); 56 | 57 | var baseURL = searchURL.slice(0, -"search.json".length); 58 | 59 | $typeahead.on('typeahead:select', function(e, result) { 60 | window.location = baseURL + result.url; 61 | }); 62 | }); 63 | -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/Documents/undocumented.json: -------------------------------------------------------------------------------- 1 | { 2 | "warnings": [ 3 | 4 | ], 5 | "source_directory": "/Users/rauhul/Developer/api-manager" 6 | } -------------------------------------------------------------------------------- /docs/docsets/APIManager.docset/Contents/Resources/docSet.dsidx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rauhul/api-manager/c8b6b426a4172cf1cd4568601cf36b6437d65ae8/docs/docsets/APIManager.docset/Contents/Resources/docSet.dsidx -------------------------------------------------------------------------------- /docs/docsets/APIManager.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rauhul/api-manager/c8b6b426a4172cf1cd4568601cf36b6437d65ae8/docs/docsets/APIManager.tgz -------------------------------------------------------------------------------- /docs/img/carat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rauhul/api-manager/c8b6b426a4172cf1cd4568601cf36b6437d65ae8/docs/img/carat.png -------------------------------------------------------------------------------- /docs/img/dash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rauhul/api-manager/c8b6b426a4172cf1cd4568601cf36b6437d65ae8/docs/img/dash.png -------------------------------------------------------------------------------- /docs/img/gh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rauhul/api-manager/c8b6b426a4172cf1cd4568601cf36b6437d65ae8/docs/img/gh.png -------------------------------------------------------------------------------- /docs/img/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rauhul/api-manager/c8b6b426a4172cf1cd4568601cf36b6437d65ae8/docs/img/spinner.gif -------------------------------------------------------------------------------- /docs/js/jazzy.js: -------------------------------------------------------------------------------- 1 | window.jazzy = {'docset': false} 2 | if (typeof window.dash != 'undefined') { 3 | document.documentElement.className += ' dash' 4 | window.jazzy.docset = true 5 | } 6 | if (navigator.userAgent.match(/xcode/i)) { 7 | document.documentElement.className += ' xcode' 8 | window.jazzy.docset = true 9 | } 10 | 11 | function toggleItem($link, $content) { 12 | var animationDuration = 300; 13 | $link.toggleClass('token-open'); 14 | $content.slideToggle(animationDuration); 15 | } 16 | 17 | function itemLinkToContent($link) { 18 | return $link.parent().parent().next(); 19 | } 20 | 21 | // On doc load + hash-change, open any targetted item 22 | function openCurrentItemIfClosed() { 23 | if (window.jazzy.docset) { 24 | return; 25 | } 26 | var $link = $(`.token[href="${location.hash}"]`); 27 | $content = itemLinkToContent($link); 28 | if ($content.is(':hidden')) { 29 | toggleItem($link, $content); 30 | } 31 | } 32 | 33 | $(openCurrentItemIfClosed); 34 | $(window).on('hashchange', openCurrentItemIfClosed); 35 | 36 | // On item link ('token') click, toggle its discussion 37 | $('.token').on('click', function(event) { 38 | if (window.jazzy.docset) { 39 | return; 40 | } 41 | var $link = $(this); 42 | toggleItem($link, itemLinkToContent($link)); 43 | 44 | // Keeps the document from jumping to the hash. 45 | var href = $link.attr('href'); 46 | if (history.pushState) { 47 | history.pushState({}, '', href); 48 | } else { 49 | location.hash = href; 50 | } 51 | event.preventDefault(); 52 | }); 53 | 54 | // Clicks on links to the current, closed, item need to open the item 55 | $("a:not('.token')").on('click', function() { 56 | if (location == this.href) { 57 | openCurrentItemIfClosed(); 58 | } 59 | }); 60 | -------------------------------------------------------------------------------- /docs/js/jazzy.search.js: -------------------------------------------------------------------------------- 1 | $(function(){ 2 | var searchIndex = lunr(function() { 3 | this.ref('url'); 4 | this.field('name'); 5 | }); 6 | 7 | var $typeahead = $('[data-typeahead]'); 8 | var $form = $typeahead.parents('form'); 9 | var searchURL = $form.attr('action'); 10 | 11 | function displayTemplate(result) { 12 | return result.name; 13 | } 14 | 15 | function suggestionTemplate(result) { 16 | var t = '
'; 17 | t += '' + result.name + ''; 18 | if (result.parent_name) { 19 | t += '' + result.parent_name + ''; 20 | } 21 | t += '
'; 22 | return t; 23 | } 24 | 25 | $typeahead.one('focus', function() { 26 | $form.addClass('loading'); 27 | 28 | $.getJSON(searchURL).then(function(searchData) { 29 | $.each(searchData, function (url, doc) { 30 | searchIndex.add({url: url, name: doc.name}); 31 | }); 32 | 33 | $typeahead.typeahead( 34 | { 35 | highlight: true, 36 | minLength: 3 37 | }, 38 | { 39 | limit: 10, 40 | display: displayTemplate, 41 | templates: { suggestion: suggestionTemplate }, 42 | source: function(query, sync) { 43 | var results = searchIndex.search(query).map(function(result) { 44 | var doc = searchData[result.ref]; 45 | doc.url = result.ref; 46 | return doc; 47 | }); 48 | sync(results); 49 | } 50 | } 51 | ); 52 | $form.removeClass('loading'); 53 | $typeahead.trigger('focus'); 54 | }); 55 | }); 56 | 57 | var baseURL = searchURL.slice(0, -"search.json".length); 58 | 59 | $typeahead.on('typeahead:select', function(e, result) { 60 | window.location = baseURL + result.url; 61 | }); 62 | }); 63 | -------------------------------------------------------------------------------- /docs/undocumented.json: -------------------------------------------------------------------------------- 1 | { 2 | "warnings": [ 3 | 4 | ], 5 | "source_directory": "/Users/rauhul/Developer/api-manager" 6 | } --------------------------------------------------------------------------------