NMAHttpOperation

@objc
public protocol NMAHttpOperation : NMAOperation

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 NMAHeaderName = String
  • The value of the HTTP header.

    Declaration

    Swift

    typealias NMAHeaderValue = String
  • The list contains the header names and values.

    Declaration

    Swift

    typealias NMARequestHeaders = [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:

    id<NMAOutOfBandOperation> oobOperation = [[client operations] outOfBandOperation];
    [oobOperation requestHeaders:@[@"mycustomheader", @"value1", @"mycustomheader", @"value2"]];
    

    Declaration

    Swift

    @discardableResult
    func requestHeaders(_ headers: NMARequestHeaders) -> 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 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 requestHeaders(_:).

    For example:

    id<NMAOutOfBandOperation> oobOperation = [[client operations] outOfBandOperation];
    [oobOperation requestHeaders:@{
        @"mycustomheader1": @"value1",
        @"mycustomheader2": @"value2"
    }];
    

    Declaration

    Swift

    @discardableResult
    func requestHeaders(namesAndValues: [NMAHeaderName : NMAHeaderValue]) -> Self

    Parameters

    namesAndValues

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

    Return Value

    the represented operation.