ParseCloud
public protocol ParseCloud : ParseType, CustomDebugStringConvertible, Decodable
Objects that conform to the ParseCloud
protocol are able to call Parse Cloud Functions and Jobs.
An object should be instantiated for each function and job type. When conforming to
ParseCloud
, any properties added will be passed as parameters to your Cloud Function or Job.
-
The name of the function or job.
Declaration
Swift
var functionJobName: String { get set }
-
runFunctionPublisher(options:
Extension method) Calls a Cloud Code function asynchronously and returns a result of it’s execution. Publishes when complete.
Declaration
Swift
func runFunctionPublisher(options: API.Options = []) -> Future<AnyCodable, ParseError>
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
A publisher that eventually produces a single value and then finishes or fails.
-
startJobPublisher(options:
Extension method) Starts a Cloud Code job asynchronously and returns a result with the jobStatusId of the job. Publishes when complete.
Declaration
Swift
func startJobPublisher(options: API.Options = []) -> Future<AnyCodable, ParseError>
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
A publisher that eventually produces a single value and then finishes or fails.
-
runFunction(options:
Extension method) Calls a Cloud Code function synchronously and returns a result of it’s execution.
Throws
An error of typeParseError
.Declaration
Swift
public func runFunction(options: API.Options = []) throws -> AnyCodable
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
Return Value
Returns a JSON response of
AnyCodable
type. -
runFunction(options:
Extension methodcallbackQueue: completion: ) Calls a Cloud Code function asynchronously and returns a result of it’s execution.
Declaration
Swift
public func runFunction(options: API.Options = [], callbackQueue: DispatchQueue = .main, completion: @escaping (Result<AnyCodable, ParseError>) -> Void)
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
callbackQueue
The queue to return to after completion. Default value of .main.
completion
A block that will be called when logging out, completes or fails. It should have the following argument signature:
(Result<AnyCodable, ParseError>)
.
-
startJob(options:
Extension method) Starts a Cloud Code job synchronously and returns a result with the jobStatusId of the job. - parameter options: A set of header options sent to the server. Defaults to an empty set. - returns: Returns a JSON response of
AnyCodable
type.Declaration
Swift
public func startJob(options: API.Options = []) throws -> AnyCodable
-
startJob(options:
Extension methodcallbackQueue: completion: ) Starts a Cloud Code job asynchronously and returns a result with the jobStatusId of the job.
Declaration
Swift
public func startJob(options: API.Options = [], callbackQueue: DispatchQueue = .main, completion: @escaping (Result<AnyCodable, ParseError>) -> Void)
Parameters
options
A set of header options sent to the server. Defaults to an empty set.
callbackQueue
The queue to return to after completion. Default value of .main.
completion
A block that will be called when logging out, completes or fails. It should have the following argument signature:
(Result<AnyCodable, ParseError>)
.
-
debugDescription
Extension methodDeclaration
Swift
public var debugDescription: String { get }