BackendReturnObject(Return Value)
BackendReturnObject is a class that stores the value passed due to communication.
All functions requested to the server using BACKND SDK are returned as a BackendReturnObject class format.
Value | Type | Description |
---|---|---|
statusCode | string | Status code passed from the server |
errorCode | string | Code that signals error information |
message | string | Details of success/failure passed from the server |
returnValue | string | Data delivered in JSON format by the server when the request succeeds |
BackendReturnObject contains the response to the request in returnValue. This is in JSON format.
The JSON library uses LitJson, and you can check the api here.
Example
BackendReturnObject bro= Backend.BMember.AuthorizeFederation("AccessToken", FederationType.Google);
if(bro.IsSuccess() == false) {
// 서버에 에러가 리턴되었다면
Debug.Log(bro.ToString()); // 에러 정보 확인
return;
}
// Convert the server's response to a JSON object
var json = bro.GetFlattenJson();
List of BackendReturnObject methods
Method | Return Type | Description |
---|---|---|
Clear() | void | Resets information |
GetStatusCode() | string | Gets statusCode value |
GetErrorCode() | string | Gets errorCode value |
GetMessage() | string | Gets message value |
HasReturnValue() | bool | Checks if returnValue exists |
GetReturnValue() | string | Gets returnValue value |
GetReturnValuetoJSON() | JsonData | Gets returnValue value by converting it to JsonData |
ToString() | string | If statusCode, errorCode, message, and returnValue are present, converts them to a string format |
HasRows() | bool | Checks if rows exist in returnValue |
Rows() | JsonData | Returns rows in returnValue by converting them to JsonData |
HasInDate() | bool | Checks if inDate exists in returnValue |
GetInDate() | string | Returns inDate in returnValue |
HasFirstKey() | bool | Check if firstKey exists in returnValue |
FirstKey() | JsonData | Returns firstKey in returnValue by converting it to JsonData |
FirstKeystring() | string | Returns firstKey in returnValue by converting it to a string |
JsonDataContaionsKey (JsonData data, string key) | bool | Returns the key after confirming it is present in the data |
IsSuccess() | bool | Confirms whether the request succeeded or failed (Successful: 2xx statusCode, Failed: 3xx or higher statusCode) |
IsServerError() | bool | Returns Return statusCode by determining whether it is a server error(5xx) |
LastEvaluatedKeyString() | string | Returns LastEvaluatedKey in returnValue by converting it to a string(used as notice/event offset) |
Flatten(JsonData jsonData) | JsonData | Returns data format in JsonData by unmarshalling it |
GetFlattenJSON() | JsonData | Returns data format that contains the return value of GetReturnValuetoJSON() by unmarshalling it |
FlattenRows() | JsonData | Returns data format that contains the return value of Rows() by unmarshalling it |