OAuth2AuthRequest
open class OAuth2AuthRequest
Class representing an OAuth2 authorization request that can be used to create NSURLRequest instances.
-
The url of the receiver. Queries may by added by parameters specified on
params
.Declaration
Swift
open let url: URL
-
The HTTP method.
Declaration
Swift
open let method: OAuth2HTTPMethod
-
The content type that will be specified. Defaults to
wwwForm
.Declaration
Swift
open var contentType = OAuth2HTTPContentType.wwwForm
-
Custom headers can be set here, they will take precedence over any built-in headers.
Declaration
Swift
open private(set) var headers: [String: String]?
-
Query parameters to use with the request.
Declaration
Swift
open var params = OAuth2RequestParams()
-
Designated initializer. Neither URL nor method can later be changed.
Declaration
Swift
public init(url: URL, method: OAuth2HTTPMethod = .POST)
-
Set the given custom header.
Declaration
Swift
public func set(header: String, to value: String)
Parameters
header
The header’s name
value
The value to use
-
Unset the given header so that the default can be applied again.
Declaration
Swift
public func unset(header: String)
Parameters
header
The header’s name
-
Add the given parameter to the receiver’s parameter list, overwriting existing parameters. This method can take nil for convenience.
Declaration
Swift
open func add(params inParams: OAuth2StringDict?)
Parameters
params
The parameters to add to the receiver
-
Creates an NSURL from the receiver’s components; calls
asURLComponents()
, so its caveats apply.Declaration
Swift
open func asURL() throws -> URL
Return Value
An NSURL representing the receiver
-
Creates a mutable URL request from the receiver, taking into account settings from the provided OAuth2 instance.
Declaration
Swift
open func asURLRequest(for oauth2: OAuth2Base) throws -> URLRequest
Parameters
oauth2
The OAuth2 instance from which to take client and auth settings
Return Value
A mutable NSURLRequest