BoxClientProtocol
public protocol BoxClientProtocol : AnyObject
Defines methods for communication with Box APIs
-
Performs an HTTP GET method call on an API endpoint and returns a response.
Declaration
Swift
func get(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, completion: @escaping Callback<BoxResponse>)Parameters
urlThe URL of the API endpoint to call.
httpHeadersAdditional information to be passed in the HTTP headers of the request.
queryParametersAdditional parameters to be passed in the URL that is called.
completionReturns a BoxResponse object or an error if request fails
-
Performs an HTTP POST method call on an API endpoint and returns a response.
Declaration
Swift
func post(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, json: Any?, completion: @escaping Callback<BoxResponse>)Parameters
urlThe URL of the API endpoint to call.
httpHeadersAdditional information to be passed in the HTTP headers of the request.
queryParametersAdditional parameters to be passed in the URL that is called.
jsonThe JSON body of the request
completionReturns a BoxResponse object or an error if request fails
-
Performs an HTTP POST method call on an API endpoint and returns a response.
Declaration
Swift
func post(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, multipartBody: MultipartForm, progress: @escaping (Progress) -> Void, completion: @escaping Callback<BoxResponse>)Parameters
urlThe URL of the API endpoint to call.
httpHeadersAdditional information to be passed in the HTTP headers of the request.
queryParametersAdditional parameters to be passed in the URL that is called.
multipartBodyThe multipart form body of the request
progressClosure where upload progress will be reported
completionReturns a BoxResponse object or an error if request fails
-
Performs an HTTP PUT method call on an API endpoint and returns a response.
Declaration
Swift
func put(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, json: Any?, completion: @escaping Callback<BoxResponse>)Parameters
urlThe URL of the API endpoint to call.
httpHeadersAdditional information to be passed in the HTTP headers of the request.
queryParametersAdditional parameters to be passed in the URL that is called.
jsonThe JSON body of the request
completionReturns a BoxResponse object or an error if request fails
-
Performs an HTTP PUT method call on an API endpoint and returns a response.
Declaration
Swift
func put(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, multipartBody: MultipartForm, progress: @escaping (Progress) -> Void, completion: @escaping Callback<BoxResponse>)Parameters
urlThe URL of the API endpoint to call.
httpHeadersAdditional information to be passed in the HTTP headers of the request.
queryParametersAdditional parameters to be passed in the URL that is called.
multipartBodyThe multipart form body of the request
progressClosure where upload progress will be reported
completionReturns a BoxResponse object or an error if request fails
-
Performs an HTTP PUT method call on an API endpoint and returns a response - variant for chunked upload.
Declaration
Swift
func put(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, data: Data, progress: @escaping (Progress) -> Void, completion: @escaping Callback<BoxResponse>)Parameters
urlThe URL of the API endpoint to call.
httpHeadersAdditional information to be passed in the HTTP headers of the request.
queryParametersAdditional parameters to be passed in the URL that is called.
dataBinary body of the request
progressClosure where upload progress will be reported
completionReturns a BoxResponse object or an error if request fails
-
Performs an HTTP OPTIONS method call on an API endpoint and returns a response.
Declaration
Swift
func options(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, json: Any?, completion: @escaping Callback<BoxResponse>)Parameters
urlThe URL of the API endpoint to call.
httpHeadersAdditional information to be passed in the HTTP headers of the request.
queryParametersAdditional parameters to be passed in the URL that is called.
jsonThe JSON body of the request
completionReturns a BoxResponse object or an error if request fails
-
Performs an HTTP DELETE method call on an API endpoint and returns a response.
Declaration
Swift
func delete(url: URL, httpHeaders: BoxHTTPHeaders, queryParameters: QueryParameters, completion: @escaping Callback<BoxResponse>)Parameters
urlThe URL of the API endpoint to call.
httpHeadersAdditional information to be passed in the HTTP headers of the request.
queryParametersAdditional parameters to be passed in the URL that is called.
completionReturns a BoxResponse object or an error if request fails
BoxClientProtocol Protocol Reference