HttpOperation

public protocol HttpOperation : Operation

An operation that requires sending HTTP requests to the backend.

You can provide HTTP request headers that can be sent in the HTTP request. This additional headers can be used for example to correlate the operation executed by the SDK with a more general operation. For instance if you want to correlate all the operations involving the enrollment of a user (which includes registration of an authenticator), you can use this feature.

  • The name of the HTTP header.

    Declaration

    Swift

    typealias HeaderName = String
  • The value of the HTTP header.

    Declaration

    Swift

    typealias HeaderValue = String
  • The list containing the name of the headers and the associated values.

    Declaration

    Swift

    typealias RequestHeaders = [String]
  • Specifies the additional request headers that must be included in the HTTP requests sent by the operation. The even indexes contain the name of the header and the odd indexes the value. The total size is guaranteed to be an even number.

    For example:

    client.operations.outOfBandOperation
        .requestHeaders(["mycustomheader", "value1", "mycustomheader", "value2"])
    

    Declaration

    Swift

    @discardableResult
    func requestHeaders(_ headers: RequestHeaders) -> Self

    Parameters

    headers

    a list containing the name of the headers and the associated values.

    Return Value

    the represented operation.

  • Specifies the additional request headers that must be included in the HTTP requests sent by the operation. The even indexes contain the name of the header and the odd indexes the value. The total size is guaranteed to be an even number.

    For example:

    client.operations.outOfBandOperation
        .requestHeaders("mycustomheader", "value1", "mycustomheader", "value2")
    

    Declaration

    Swift

    @discardableResult
    func requestHeaders(_ namesAndValues: String...) -> Self

    Parameters

    namesAndValues

    the names and values of the headers.

    Return Value

    the represented operation.

  • Specifies the additional request headers that must be included in the HTTP requests sent by the operation. The SDK will not do any processing of the provided values and will send the headers as provided. If you want to send multivalued headers in separate headers, use either requestHeaders(_:) or requestHeaders(_:).

    For example:

    client.operations.outOfBandOperation
        .requestHeaders(["mycustomheader": "value1", "mycustomheader": "value2"])
    

    Declaration

    Swift

    @discardableResult
    func requestHeaders(_ headers: [HeaderName : HeaderValue]) -> Self

    Parameters

    headers

    a dictionary containing the header values keyed by their header names.

    Return Value

    the represented operation.