GetUserInfoByNickNameV2
public BackendReturnObject GetUserInfoByNickNameV2(string nickName);
Parameters
Value | Type | Description |
---|---|---|
nickName | string | Nickname of the user whose information is to be looked up |
Description
Retrieves the user information of the user with the corresponding nickname.\ V2 adds country code and group name to the return value of the existing API.
User's metadata
- User's nickname
- User's gamerIndate
- Last accessed time
- Name of the guild the user belongs to
- Country code
- Group name
Example
Synchronous
var bro = Backend.Social.GetUserInfoByNickName("nickName");
//example
string gamerIndate = bro.GetReturnValuetoJSON()["row"]["inDate"].ToString();
if(bro.GetReturnValuetoJSON()["row"]["guildName"] != null) // null is returned when no guild name is registered
{
string guildName = bro.GetReturnValuetoJSON()["row"]["guildName"].ToString();
}
Asynchronous
Backend.Social.GetUserInfoByNickName("ImATestUser", (callback) =>
{
// Post-process
//example
string gamerIndate = callback.GetReturnValuetoJSON()["row"]["inDate"].ToString();
if(callback.GetReturnValuetoJSON()["row"]["guildName"] != null) // null is returned when no guild name is registered
{
string guildName = callback.GetReturnValuetoJSON()["row"]["guildName"].ToString();
}
});
SendQueue
SendQueue.Enqueue(Backend.Social.GetUserInfoByNickName, "ImATestUser", (callback) =>
{
// Post-process
//example
string gamerIndate = callback.GetReturnValuetoJSON()["row"]["inDate"].ToString();
if(callback.GetReturnValuetoJSON()["row"]["guildName"] != null) // null is returned when no guild name is registered
{
string guildName = callback.GetReturnValuetoJSON()["row"]["guildName"].ToString();
}
});
ReturnCase
Success cases
When a user with the corresponding nickname exists\ statusCode : 200\ message : Success\ returnValue : refer to GetReturnValuetoJSON
When a user with the corresponding nickname does not exist\ statusCode : 404\ errorCode : NotFoundException\ message : gamer does not exist.
GetReturnValuetoJSON
{
"row":
{
"nickname":"ImATestUser", // User's nickname
"inDate":"2021-00-00T00:00:00.000Z", // User's inDate
"lastLogin":"2021-06-23T02:08:56.235Z", // User's last login time
"guildName":"testGuild" // User's guid name (null if not present)
"countryCode": "KR", // null if the country code is not set
"propertyGroup": "USA" // null if there is no group,
}
}
Sample Code
public class SearchUserItem
{
public string nickname;
public string inDate;
public string lastLogin;
public string guildName;
public string countryCode;
public string propertyGroup;
public override string ToString()
{
return $"nickname: {nickname}\n" +
$"inDate: {inDate}\n" +
$"lastLogin: {lastLogin}\n" +
$"guildName: {guildName}\n" +
$"countryCode: {countryCode}\n" +
$"propertyGroup: {propertyGroup}\n";
}
};
public void GetUserInfoByNickNameTest()
{
string userNickname = "Nickname";
var bro = Backend.Social.GetUserInfoByNickName(userNickname);
if(!bro.IsSuccess())
return;
LitJson.JsonData json = bro.GetReturnValuetoJSON();
SearchUserItem userInfo = new SearchUserItem();
userInfo.nickname = json["row"]["nickname"].ToString();
userInfo.inDate = json["row"]["inDate"].ToString();
userInfo.lastLogin = json["row"]["lastLogin"].ToString();
userInfo.guildName = json["row"]["guildName"]?.ToString();
userInfo.countryCode = json["row"]["countryCode"]?.ToString();
userInfo.propertyGroup = json["row"]["propertyGroup"]?.ToString();
Debug.Log(userInfo.ToString());
}