Authentication
public struct Authentication : CustomStringConvertible
The Authentication struct is used to authenticate all the requests made by
Session.
-
The prefix used in the authorization header.
Declaration
Swift
public let prefix: String -
The value of the authorization header.
Declaration
Swift
public let value: String -
A description for the type of the authorization.
Declaration
Swift
public let description: String -
Returns that
Authorizationheader value for the authentication type. This can be used on any web API V3 call.Declaration
Swift
public var authorizationHeader: String { get }
-
Initializes the struct.
Declaration
Swift
public init(prefix: String, value: String, description: String)Parameters
prefixThe prefix used in the authorization header.
valueThe value of the authorization header.
descriptionA description of the authentication type.
-
Creates an
Authenticationinstance representing an API key.Declaration
Swift
static func apiKey(_ key: String) -> AuthenticationParameters
keyThe SendGrid API key to use.
Return Value
An
Authenticationinstance. -
Creates an
Authenticationinstance representing a username and password.Declaration
Swift
static func credential(username: String, password: String) throws -> AuthenticationParameters
usernameThe SendGrid username key to use.
passwordThe SendGrid password key to use.
Return Value
An
Authenticationinstance.
View on GitHub
Authentication Structure Reference