ABSDKHTTPNetworkTransport

public class ABSDKHTTPNetworkTransport : NetworkTransport

A network transport that uses HTTP POST requests to send GraphQL operations to a server, and that uses URLSession as the networking implementation.

  • Creates a network transport with the specified server URL and session configuration.

    Declaration

    Swift

    public init(url: URL, configuration: URLSessionConfiguration = URLSessionConfiguration.default, sendOperationIdentifiers: Bool = false,
                accessKey: String? = nil, accessSecret: String? = nil)

    Parameters

    url

    The URL of a GraphQL server to connect to.

    configuration

    A session configuration used to configure the session. Defaults to URLSessionConfiguration.default.

    sendOperationIdentifiers

    Whether to send operation identifiers rather than full operation text, for use with servers that support query persistence. Defaults to false.

  • Send a GraphQL operation to a server and return a response.

    Declaration

    Swift

    public func send<Operation>(operation: Operation, completionHandler: @escaping (_ response: GraphQLResponse<Operation>?, _ error: Error?) -> Void) -> Cancellable

    Parameters

    operation

    The operation to send.

    completionHandler

    A closure to call when a request completes.

    response

    The response received from the server, or nil if an error occurred.

    error

    An error that indicates why a request failed, or nil if the request was succesful.

    Return Value

    An object that can be used to cancel an in progress request.