GetAllGuildList
public BackndGuildListReturnObject GetAllGuildList();
public BackndGuildListReturnObject GetAllGuildList(int limit);
public BackndGuildListReturnObject GetAllGuildList(string firstKey);
public BackndGuildListReturnObject GetAllGuildList(int limit, string firstKey);
BackndGuildListReturnObject
GetReturnValueByGuildList
If an error occurred, null is returned.
BackndGuildListReturnObject bro = Backnd.Guild.GetAllGuildList();
foreach(BackndGuildItem item in bro.GetReturnValueByGuildList()) {
Debug.Log(item.ToString());
}
BackndGuildItem
public class BackndGuildItem
{
public int memberCount;
public Dictionary<string, string> viceMasterList = new Dictionary<string, string>();
public string masterNickname;
public string inDate;
public string guildName;
public int goodsCount;
public bool _immediateRegistration;
public string _countryCode;
public string masterInDate;
public Dictionary<string, string> customGuildInfo = new Dictionary<string, string>();
}
Parameters
Value | Type | Description | default |
---|---|---|---|
limit | int | (Optional) Number of guild lists to be loaded | 100 |
firstKey | string | (Optional) Starting point of guild list to be loaded(offset) | - |
Description
Looks up all guild lists.
The guild list is returned with the metadata of each guild.
Example
Synchronous
Backnd.Guild.GetAllGuildList();
Backnd.Guild.GetAllGuildList(5);
// When reading the first list, stores the firstkey value,
BackndGuildListReturnObject bro = Backnd.Guild.GetAllGuildList();
String firstKey = bro.FirstKeyString();
// and reads it again when moving to the next page by setting firstKey as an offset.
Backnd.Guild.GetAllGuildList(firstKey);
Backnd.Guild.GetAllGuildList(5, firstKey);
Asynchronous
Backnd.Guild.GetAllGuildList((callback) =>
{
// Post-process
});
Backnd.Guild.GetAllGuildList(5, (callback) =>
{
// Post-process
});
// Stores firstKey the same way as the synchronous method, and loads the next list
Backnd.Guild.GetAllGuildList(firstKey, (callback) =>
{
// Post-process
});
Backnd.Guild.GetAllGuildList(20, firstKey, (callback) =>
{
// Post-process
});
Return cases
Success cases
When the lookup is successful
statusCode : 200
returnValue : refer to GetReturnValuetoJSON
GetReturnValuetoJSON
{
rows:
[
// new guild(guilds made with versions v2 and v3)
{
// Number of guild members
memberCount:{ N: "5" },
// Vice guild master list
viceMasterList: {
L:[
{
M:
{
// Vice guild master indate
inDate: { S: "2019-02-25T06:29:28.849Z" },
// Vice guild master's nickname
nickname: { S: "id23" }
}
},
{
M:
{
inDate: { S: "2019-02-25T06:29:27.533Z" },
nickname: { S: "id22"}
}
}
]
},
// Guild master's nickname
masterNickname: { S: "id24" },
// Guild inDate
inDate: { S: "2019-04-12T07:38:16.522Z" },
// Guild name
guildName: { S: "mumin" },
// Amount of guild goods
goodsCount: { N: "2"},
// Guild metadata
buf: { N: "1" },
// Guild metadata
level: { S: "silver" },
// Quick join status(Only exists when set through EnableAutoApproveGuildJoinRequest)
_immediateRegistration: { BOOL: "true"},
// Country code(Only exists when country code is added)
_countryCode: {S: "KR"}
// Guild master inDate
masterInDate: { S: "2019-02-25T06:29:30.022Z" }
},
// old guild
{
// Guild name
guildName: { S: "guildName" },
// Total amount of guild goods 1(contribution + use)
totalGoods1Amount: { N: "0" },
// Total amount of guild goods 2(contribution + use)
totalGoods2Amount: { N: "0" },
// Total amount of guild goods 3(contribution + use)
totalGoods3Amount: { N: "0" },
// Number of guild members
memberCount: { N: "2" },
// Vice guild master list
viceMasterList: {
L:[
{
M:{
// Vice guild master indate
inDate: { S: "2018-07-31T01:19:49.193Z" },
// Vice guild master's nickname
nickname: { S: "customid1" }
}
}
]
},
// Guild metadata
buf: { N: "1" },
// Guild master's nickname
masterNickname: { S: "masterNickname" },
// Guild inDate
inDate: { S: "2018-07-13T07:04:39.650Z" },
// Guild metadata
level: { S: "gold" },
// Guild master inDate
masterInDate: { S: "2018-06-25T03:19:01.706Z" }
}
],
firstKey: { // Offset key for the list's paging process(not returned if the entire list is loaded)
inDate: { S: "2018-07-13T07:04:39.650Z" }
}
}
Sample code
public class GuildItem
{
public int memberCount;
public Dictionary<string, string> viceMasterList = new Dictionary<string, string>();
public string masterNickname;
public string inDate;
public string guildName;
public int goodsCount;
public bool _immediateRegistration;
public string _countryCode;
public string masterInDate;
public override string ToString()
{
string viceMasterString = string.Empty;
foreach(var li in viceMasterList)
{
viceMasterString += $"Vice guild master : {li.Value}({li.Key})\n";
}
return $"memberCount : {memberCount}\n" +
$"masterNickname : {masterNickname}\n" +
$"inDate : {inDate}\n" +
$"guildName : {guildName}\n" +
$"goodsCount : {goodsCount}\n" +
$"_immediateRegistration : {_immediateRegistration}\n" +
$"_countryCode : {_countryCode}\n" +
$"masterInDate : {masterInDate}\n" +
$"memberCount : {memberCount}\n" +
viceMasterString;
}
};
public void GetAllGuildList()
{
var bro = Backnd.Guild.GetAllGuildList();
if(!bro.IsSuccess())
return;
BACKND.LitJson.JsonData json = bro.FlattenRows();
List<GuildItem> guildList = new List<GuildItem>();
for(int i = 0; i < json.Count; i++)
{
GuildItem guildItem = new GuildItem();
guildItem.memberCount = int.Parse(json[i]["memberCount"].ToString());
guildItem.masterNickname = json[i]["masterNickname"].ToString();
guildItem.inDate = json[i]["inDate"].ToString();
guildItem.guildName = json[i]["guildName"].ToString();
guildItem.goodsCount = int.Parse(json[i]["goodsCount"].ToString());
if(json[i].ContainsKey("_immediateRegistration"))
{
guildItem._immediateRegistration = json[i]["_immediateRegistration"].ToString() == "true" ? true : false;
}
if(json[i].ContainsKey("_countryCode"))
{
guildItem._countryCode = json[i]["_countryCode"].ToString();
}
guildItem.masterInDate = json[i]["masterInDate"].ToString();
BACKND.LitJson.JsonData viceListJson = json[i]["viceMasterList"];
for(int j = 0; j < viceListJson.Count; j++)
{
guildItem.viceMasterList.Add(viceListJson[j]["inDate"].ToString(), viceListJson[j]["nickname"].ToString());
}
guildList.Add(guildItem);
Debug.Log(guildItem.ToString());
}
}