public protocol NetworkTransport: class
A network transport is responsible for sending GraphQL operations to a server.
var clientName: String
The name of the client to send as a header value.
var clientVersion: String
The version of the client to send as a header value.
func send<Operation: GraphQLOperation>(operation: Operation, completionHandler: @escaping (_ result: Result<GraphQLResponse<Operation.Data>, Error>) -> Void) -> Cancellable
Send a GraphQL operation to a server and return a response.
Note if you're implementing this yourself rather than using one of the batteries-included versions of
NetworkTransport(which handle this for you): The
clientVersionshould be sent with any URL request which needs headers so your client can be identified by tools meant to see what client is using which request. The
addApolloClientHeadersmethod is provided below to do this for you if you're using Apollo Graph Manager.
- operation: The operation to send.
- completionHandler: A closure to call when a request completes. On
successwill contain the response received from the server. On
failurewill contain the error which occurred.
- Returns: An object that can be used to cancel an in progress request.
|operation||The operation to send.|
|completionHandler||A closure to call when a request completes. On |