StitchServiceClient
public protocol StitchServiceClient
StitchServiceClient acts as a general purpose client for working with services that are not defined or well defined
by this SDK. It has methods similar to the callFunction method on StitchAppClient.
-
Calls the MongoDB Stitch function with the provided name and arguments.
Declaration
Swift
func callFunction(withName name: String, withArgs args: [BSONValue], _ completionHandler: @escaping (StitchResult<Void>) -> Void)Parameters
withNameThe name of the Stitch function to be called.
withArgsThe
BSONArrayof arguments to be provided to the function.completionHandlerThe completion handler to call when the function call is complete. This handler is executed on a non-main global
DispatchQueue. -
Calls the MongoDB Stitch function with the provided name and arguments. Also accepts a timeout. Use this for function that may run longer than the client-wide default timeout (15 seconds by default).
Declaration
Swift
func callFunction(withName name: String, withArgs args: [BSONValue], withRequestTimeout requestTimeout: TimeInterval, _ completionHandler: @escaping (StitchResult<Void>) -> Void)Parameters
withNameThe name of the Stitch function to be called.
withArgsThe
BSONArrayof arguments to be provided to the function.withRequestTimeoutThe number of seconds the client should wait for a response from the server before failing with an error.
completionHandlerThe completion handler to call when the function call is complete. This handler is executed on a non-main global
DispatchQueue. -
Calls the function for this service with the provided name and arguments.
Declaration
Swift
func callFunction<T: Decodable>(withName name: String, withArgs args: [BSONValue], _ completionHandler: @escaping (StitchResult<T>) -> Void)Parameters
withNameThe name of the function to be called.
withArgsThe
BSONArrayof arguments to be provided to the function.completionHandlerThe completion handler to call when the function call is complete. This handler is executed on a non-main global
DispatchQueue.resultThe result of the function call as
T, ornilif the function call failed.errorAn error object that indicates why the function call failed, or
nilif the function call was successful. -
Calls the function for this service with the provided name and arguments, as well as with a specified timeout. Use this for functions that may run longer than the client-wide default timeout (15 seconds by default).
Declaration
Swift
func callFunction<T: Decodable>(withName name: String, withArgs args: [BSONValue], withRequestTimeout requestTimeout: TimeInterval, _ completionHandler: @escaping (StitchResult<T>) -> Void)Parameters
withNameThe name of the function to be called.
withArgsThe
BSONArrayof arguments to be provided to the function.withRequestTimeoutThe number of seconds the client should wait for a response from the server before failing with an error.
completionHandlerThe completion handler to call when the function call is complete. This handler is executed on a non-main global
DispatchQueue.resultThe result of the function call as
T, ornilif the function call failed.errorAn error object that indicates why the function call failed, or
nilif the function call was successful.
StitchServiceClient Protocol Reference