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 Authorization header 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

    prefix

    The prefix used in the authorization header.

    value

    The value of the authorization header.

    description

    A description of the authentication type.

  • Creates an Authentication instance representing an API key.

    Declaration

    Swift

    static func apiKey(_ key: String) -> Authentication

    Parameters

    key

    The SendGrid API key to use.

    Return Value

    An Authentication instance.

  • Creates an Authentication instance representing a username and password.

    Declaration

    Swift

    static func credential(username: String, password: String) throws -> Authentication

    Parameters

    username

    The SendGrid username key to use.

    password

    The SendGrid password key to use.

    Return Value

    An Authentication instance.