Function Call
Once the cloud code function registration is complete, you can call the function from the client.
Source Code
using PlayNANOO;
using PlayNANOO.CloudCode;
using PlayNANOO.SimpleJSON;
public class PlayNANOOExample : MonoBehaviour
{
Plugin plugin;
void Awake()
{
plugin = Plugin.GetInstance();
var parameters = new CloudCodeExecution()
{
TableCode = "CLOUDCODE_TALBLE_CODE",
FunctionName = "CLOUDCODE_FUNCTION_NAME",
FunctionArguments = new {
inputValue1 = "inputValue1",
inputValue2 = "inputValue2",
}
};
plugin.CloudCode.Run(parameters, (state, message, rawData, dictionary) =>
{
if (state.Equals(Configure.PN_API_STATE_SUCCESS))
{
PlayNANOO.SimpleJSON.JSONNode node = PlayNANOO.SimpleJSON.JSONNode.Parse(dictionary["Result"].ToString());
Debug.Log(node["Function"]["Name"].Value);
Debug.Log(node["Function"]["Version"].Value);
}
else
{
Debug.Log("Fail");
}
});
}
}
Call Details
| Parameter | Description | Type |
|---|---|---|
| TableCode | Table code | string |
| FunctionName | Function name written in cloud code | string |
| FunctionArguments | Data to pass to the cloud code function | Anonymous |
FunctionArguments can only send String data.
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"Function": Object,
"Logs": Array,
"Result": Object,
"Error": Object,
"RunTimeMilliSeconds": Integer
}
Response Details
| Data Key | Description | Type |
|---|---|---|
| Function | Cloud code called function information | object |
| Logs | Cloud code debug information | array |
| Result | Cloud code call result | object |
| Error | Cloud code error information | object |
| RunTimeMilliSeconds | Cloud code call elapsed time | integer |