You are viewing documentation for a previous version of this software.

Switch to the latest stable version.

RequestChainNetworkTransport


EXTENSION

RequestChainNetworkTransport

Swift
1extension RequestChainNetworkTransport: UploadingNetworkTransport

Methods

constructUploadRequest(for:with:manualBoundary:)

Swift
1open func constructUploadRequest<Operation: GraphQLOperation>(
2  for operation: Operation,
3  with files: [GraphQLFile],
4  manualBoundary: String? = nil) -> HTTPRequest<Operation>

Constructs an uploading (ie, multipart) GraphQL request

Override this method if you need to use a custom subclass of HTTPRequest.

  • Parameters:

    • operation: The operation to create a request for

    • files: The files you wish to upload

    • manualBoundary: [optional] A manually set boundary for your upload request. Defaults to nil.

  • Returns: The created request.

Parameters

NameDescription
operationThe operation to create a request for
filesThe files you wish to upload
manualBoundary[optional] A manually set boundary for your upload request. Defaults to nil.

upload(operation:files:callbackQueue:completionHandler:)

Swift
1public func upload<Operation: GraphQLOperation>(
2  operation: Operation,
3  files: [GraphQLFile],
4  callbackQueue: DispatchQueue = .main,
5  completionHandler: @escaping (Result<GraphQLResult<Operation.Data>, Error>) -> Void) -> Cancellable

Parameters

NameDescription
operationThe operation to send
filesAn array of GraphQLFile objects to send.
callbackQueueThe queue to call back on with the results. Should default to .main.
completionHandlerThe completion handler to execute when the request completes or errors
Feedback

Edit on GitHub

Forums