DataRequest

class DataRequest : Request
  • Wraps Alamofire.Response from Alamofire.response(queue:) as CancellablePromise<(Foundation.URLRequest, Foundation.HTTPURLResponse, Foundation.Data)>

    Declaration

    Swift

    public func responseCC(_: PMKNamespacer, queue: DispatchQueue? = nil) -> CancellablePromise<(URLRequest, HTTPURLResponse, Data)>
  • Wraps Alamofire.DataResponse from Alamofire.responseData(queue:) as CancellablePromise<(Foundation.Data, PromiseKit.PMKAlamofireDataResponse)>

    Declaration

    Swift

    public func responseDataCC(queue: DispatchQueue? = nil) -> CancellablePromise<(data: Data, response: PMKAlamofireDataResponse)>
  • Wraps the response from Alamofire.responseString(queue:) as CancellablePromise<(String, PromiseKit.PMKAlamofireDataResponse)>. Uses the default encoding to decode the string data.

    Declaration

    Swift

    public func responseStringCC(queue: DispatchQueue? = nil) -> CancellablePromise<(string: String, response: PMKAlamofireDataResponse)>
  • Wraps the response from Alamofire.responseJSON(queue:options:) as CancellablePromise<(Any, PromiseKit.PMKAlamofireDataResponse)>. By default, the JSON decoder allows fragments, therefore ‘Any’ can be any standard JSON type (NSArray, NSDictionary, NSString, NSNumber, or NSNull). If the received JSON is not a fragment then ‘Any’ will be either an NSArray or NSDictionary.

    Declaration

    Swift

    public func responseJSONCC(queue: DispatchQueue? = nil, options: JSONSerialization.ReadingOptions = .allowFragments) -> CancellablePromise<(json: Any, response: PMKAlamofireDataResponse)>
  • Wraps the response from Alamofire.responsePropertyList(queue:options:) as CancellablePromise<(Any, PromiseKit.PMKAlamofireDataResponse)>. Uses Foundation.PropertyListSerialization to deserialize the property list. ‘Any’ is an NSArray or NSDictionary containing only the types NSData, NSString, NSArray, NSDictionary, NSDate, and NSNumber.

    Declaration

    Swift

    public func responsePropertyListCC(queue: DispatchQueue? = nil, options: PropertyListSerialization.ReadOptions = PropertyListSerialization.ReadOptions()) -> CancellablePromise<(plist: Any, response: PMKAlamofireDataResponse)>
  • Wraps the response from Alamofire.responseDecodable(queue:) as CancellablePromise. The Decodable is used to decode the incoming JSON data.

    Declaration

    Swift

    public func responseDecodableCC<T: Decodable>(queue: DispatchQueue? = nil, decoder: JSONDecoder = JSONDecoder()) -> CancellablePromise<T>
  • Wraps the response from Alamofire.responseDecodable() as CancellablePromise<(Decodable)>. The Decodable is used to decode the incoming JSON data.

    Declaration

    Swift

    public func responseDecodableCC<T: Decodable>(_ type: T.Type, queue: DispatchQueue? = nil, decoder: JSONDecoder = JSONDecoder()) -> CancellablePromise<T>