Skip to main content
Version: 5.11.4

GetUserInfoByNickName

public BackendReturnObject GetUserInfoByNickName(string nickName);

Parameter

ValueTypeDescription
nickNamestringNickname of the user whose information is to be looked up

Description

Retrieves the user information of the user with the corresponding nickname.
The following information can be looked up:

  • User's nickname
  • User's gamerIndate
  • Last accessed time
  • Name of the guild the user belongs to

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();
}
});

Return cases

Success cases

When a user with the corresponding nickname exists
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

When a user with the corresponding nickname does not exist
statusCode : 404
errorCode : NotFoundException

GetReturnValuetoJSON

{
"row":
{
"nickname": "ImATestUser", // User's nickname
"inDate":"2021-00-00T00:00:00.000Z", // User inDate
"lastLogin":"2021-06-23T02:08:56.235Z", // Last time of login
"guildName":"testGuild" // Name of the user's guild(null if non-existent)
}
}

Sample code

 public class SearchUserItem
{
public string nickname;
public string inDate;
public string lastLogin;
public string guildName;

public override string ToString()
{
return $"nickname : {nickname}\ninDate : {inDate}\nlastLogin : {lastLogin}\nguildName : {guildName}\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();
if(json["row"]["guildName"] != null)
{
userInfo.guildName = json["row"]["guildName"].ToString();
}

Debug.Log(userInfo.ToString());
}