new Cloud()
Contains functions for calling and declaring cloud functions.
Some functions are only available from Cloud Code.
Methods
(static) getJobStatus(jobStatusId) → {Parse.Object}
Gets job status by Id
Parameters:
| Name | Type | Description |
|---|---|---|
jobStatusId |
string
|
The Id of Job Status. |
(static) getJobsData() → {Promise}
Gets data for the current set of cloud jobs.
Returns:
- Type:
-
Promise
A promise that will be resolved with the result of the function.
(static) run(name, data, options) → {Promise}
Makes a call to a cloud function.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string
|
The function name. |
data |
object
|
The parameters to send to the cloud function. |
options |
object
|
Valid options are:
|
Returns:
- Type:
-
Promise
A promise that will be resolved with the result of the function.
(static) startJob(name, data) → {Promise}
Starts a given cloud job, which will process asynchronously.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string
|
The function name. |
data |
object
|
The parameters to send to the cloud function. |
Returns:
- Type:
-
Promise
A promise that will be resolved with the jobStatusId of the job.
Type Definitions
ConnectTriggerRequest
Properties:
| Name | Type | Description |
|---|---|---|
installationId |
string
|
If set, the installationId triggering the request. |
useMasterKey |
boolean
|
If true, means the master key was used. |
user |
Parse.User
|
If set, the user that made the request. |
clients |
number
|
The number of clients connected. |
subscriptions |
number
|
The number of subscriptions connected. |
sessionToken |
string
|
If set, the session of the user that made the request. |
FileTriggerRequest
Properties:
| Name | Type | Description |
|---|---|---|
installationId |
string
|
If set, the installationId triggering the request. |
master |
boolean
|
If true, means the master key was used. |
user |
Parse.User
|
If set, the user that made the request. |
file |
Parse.File
|
The file triggering the hook. |
ip |
string
|
The IP address of the client making the request. |
headers |
object
|
The original HTTP headers for the request. |
triggerName |
string
|
The name of the trigger ( |
log |
object
|
The current logger inside Parse Server. |
FunctionRequest
Properties:
| Name | Type | Description |
|---|---|---|
installationId |
string
|
If set, the installationId triggering the request. |
master |
boolean
|
If true, means the master key was used. |
user |
Parse.User
|
If set, the user that made the request. |
params |
object
|
The params passed to the cloud function. |
HTTPOptions
Properties:
| Name | Type | Description |
|---|---|---|
body |
string
|
object
|
The body of the request. |
followRedirects |
boolean
|
Whether to follow redirects caused by HTTP 3xx responses. Defaults to false. |
headers |
object
|
The headers for the request. |
method |
string
|
The method of the request. GET, POST, PUT, DELETE, HEAD, and OPTIONS are supported. |
params |
string
|
object
|
The query portion of the url. |
url |
string
|
The url to send the request to. |
HTTPResponse
Properties:
| Name | Type | Description |
|---|---|---|
buffer |
Buffer
|
The raw byte representation of the response body. |
cookies |
object
|
The cookies sent by the server. |
data |
object
|
The parsed response body as a JavaScript object. |
headers |
object
|
The headers sent by the server. |
status |
number
|
The status code. |
text |
string
|
The raw text representation of the response body. |
JobRequest
Properties:
| Name | Type | Description |
|---|---|---|
params |
object
|
The params passed to the background job. |
message |
function
|
If message is called with a string argument, will update the current message to be stored in the job status. |
TriggerRequest
Properties:
| Name | Type | Description |
|---|---|---|
installationId |
string
|
If set, the installationId triggering the request. |
master |
boolean
|
If true, means the master key was used. |
user |
Parse.User
|
If set, the user that made the request. |
object |
Parse.Object
|
The object triggering the hook. |
ip |
string
|
The IP address of the client making the request. |
headers |
object
|
The original HTTP headers for the request. |
triggerName |
string
|
The name of the trigger ( |
log |
object
|
The current logger inside Parse Server. |
original |
Parse.Object
|
If set, the object, as currently stored. |