OAuth2RequestParams

public struct OAuth2RequestParams

Struct to hold on to request parameters.

Provides utility functions so the parameters can be correctly encoded for use in URLs and request bodies.

  • The parameters to be used.

    Declaration

    Swift

    public private(set) var params: OAuth2StringDict? = nil
  • Designated initalizer.

    Declaration

    Swift

    public init()
  • Removes the given value from the receiver, if it is defined.

    Declaration

    Swift

    public mutating func removeValue(forKey key: String) -> String?

    Parameters

    forKey

    The key for the value to be removed

    Return Value

    The value that was removed, if any

  • The number of items in the receiver.

    Declaration

    Swift

    public var count: Int
  • Creates a form encoded query string, then encodes it using UTF-8 to NSData.

    Declaration

    Swift

    public func utf8EncodedData() throws -> Data?

    Return Value

    NSData representing the receiver form-encoded

  • Creates a parameter string in the form of key1=value1&key2=value2, using form URL encoding.

    Declaration

    Swift

    public func percentEncodedQueryString() -> String

    Return Value

    A form encoded string

  • Create a query string from a dictionary of string: string pairs.

    This method does form encode the value part. If you’re using NSURLComponents you want to assign the return value to percentEncodedQuery, NOT query as this would double-encode the value.

    Declaration

    Swift

    public static func formEncodedQueryStringFor(_ params: OAuth2StringDict) -> String

    Parameters

    params

    The parameters you want to have encoded

    Return Value

    An URL-ready query string