GetRandomDataTableList
public BackendReturnObject GetRandomDataTableList();
Description
Calls all random lookup history generated in BACKND Console.
The list contains the following information:
- Name of the random lookup
- uuid
- Classification(user/guild)
Example
Synchronous
Backend.RandomInfo.GetRandomDataTableList();
Asynchronous
Backend.RandomInfo.GetRandomDataTableList(callback=>
{
// Post-process
});
SendQueue
SendQueue.Enqueue(Backend.RandomInfo.GetRandomDataTableList, callback =>
{
// Post-process
});
Return cases
Success cases
When the lookup is successful
statusCode : 200
returnValue : refer to GetReturnValuetoJSON
When the random lookup result is 0
statusCode : 200
returnValue : {"rows":[]}
GetReturnValuetoJSON
{
"rows": [
{
"randomType": "user",
"uuid": "6f438bd0-01a6-11ed-bdc8-a700365a13a1",
"title": "Random lookup for PVP"
},
{
"randomType": "user",
"uuid": "94b07a80-00f3-11ed-ade3-6d5252f35aa5",
"title": "Random lookup for friend recommendation"
},
{
"randomType": "guild",
"uuid": "96ab48f0-fce9-11ec-a8e9-3fc17cd7d4bd",
"title": "Random lookup for guild recommendation"
}
]
}
Sample code
public class RandomInfoTable {
public string title; // Random lookup title
public string uuid; // Random lookup uuid
public RandomType randomtype; //Random lookup type
public override string ToString() {
return $"title: {title}\n" +
$"uuid: {uuid}\n" +
$"randomtype: {randomtype}";
}
}
public void GetRandomDataTableList() {
var bro = Backend.RandomInfo.GetRandomDataTableList();
if(bro.IsSuccess()) {
LitJson.JsonData json = bro.Rows();
List<RandomInfoTable> list = new List<RandomInfoTable>();
for(int i = 0; i < json.Count; i++) {
RandomInfoTable table = new RandomInfoTable();
table.title = json[i]["title"].ToString();
table.uuid = json[i]["uuid"].ToString();
if(json[i]["randomType"].ToString() == "user") {
table.randomtype = RandomType.User;
}
else {
table.randomtype = RandomType.Guild;
}
list.Add(table);
}
foreach(var table in list) {
Debug.Log(list.ToString());
}
}
}