함수 호출
클라우드코드의 함수 등록이 완료 되었다면 클라이언트에서 해당 함수를 호출 할 수 있습니다.
소스 코드
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");
}
});
}
}
호출 상세 정보
파라미터 | 설명 | 타입 |
---|---|---|
TableCode | 테이블 코드 | string |
FunctionName | 클라우드코드에 작성한 함수명 | string |
FunctionArguments | 클라우드코드 함수에 전달하고자 하는 데이터 | Anonymous |
FunctionArguments 는 String 데이터만 전송 하실 수 있습니다.
통신 결과
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"Function": Object,
"Logs": Array,
"Result": Object,
"Error": Object,
"RunTimeMilliSeconds": Integer
}
통신 결과 상세 정보
데이터키 | 설명 | 타입 |
---|---|---|
Function | 클라우드코드 호출 함수 정보 | object |
Logs | 클라우드코드 디버그 정보 | array |
Result | 클라우드코드 호출 결과 | object |
Error | 클라우드코드 에러 정보 | object |
RunTimeMilliSeconds | 클라우드코드 호출 경과 시간 | integer |