# Cloud

## AV. Cloud

Source:
  - cloudfunction.js, line 13

Contains functions for calling and declaring

Some functions are only available from Cloud Code.

### Methods

#### (static) getServerDate() → {Promise.<Date>}

Source:
  - cloudfunction.js, line 57
Since:
  - 0.5.9

Make a call to request server date time.

##### Returns:

A promise that will be resolved with the result of the function.

Type
  Promise.<Date>

#### (static) requestSmsCode(data) → {Promise}

Source:
  - cloudfunction.js, line 72

Makes a call to request a sms code for operation verification.

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | Object | The mobile phone number string or a JSON object that contains mobilePhoneNumber,template,op,ttl,name etc.

##### Returns:

A promise that will be resolved with the result of the function.

Type
  Promise

#### (static) rpc(name, data, options) → {Promise}

Source:
  - cloudfunction.js, line 41

Makes a call to a cloud function, you can send {AV.Object} as param or a field of param; the response from server will also be parsed as an {AV.Object}, array of {AV.Object}, or object includes {AV.Object}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String | The function name.
`data` | Object | The parameters to send to the cloud function.
`options` | AuthOptions |

##### Returns:

A promise that will be resolved with the result of the function.

Type
  Promise

#### (static) run(name, data, options) → {Promise}

Source:
  - cloudfunction.js, line 24

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` | AuthOptions |

##### Returns:

A promise that will be resolved with the result of the function.

Type
  Promise

#### (static) useMasterKey()

Source:
  - init.js, line 68

Switches the LeanCloud SDK to using the Master key. The Master key grants priveleged access to the data in LeanCloud and can be used to bypass ACLs and other restrictions that are applied to the client SDKs.

Available in Cloud Code and Node.js only.

#### (static) verifySmsCode(code, phone) → {Promise}

Source:
  - cloudfunction.js, line 91

Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode

##### Parameters:

Name | Type | Description
--- | --- | ---
`code` | String | The sms code sent by AV.Cloud.requestSmsCode
`phone` | phone | The mobile phoner number(optional).

##### Returns:

A promise that will be resolved with the result of the function.

Type
  Promise