Skip to main content
Version: 5.11.6

GetUserInfo

public BackendReturnObject GetUserInfo();

Description

The user's metadata stored in the server is retrieved.

User's metadata

  • Nickname
  • User inDate
  • gamer_id(the user's unique value used in the console)
  • Login type(custom, federation)
  • Federation account ID(Google/Apple/Facebook federation ID)
  • Email to find custom account ID/PW
  • Country code

Example

Synchronous

BackendReturnObject bro = Backend.BMember.GetUserInfo();
string nickname = bro.GetReturnValuetoJSON()["row"]["nickname"].ToString();

Asynchronous

Backend.BMember.GetUserInfo((callback) =>
{
string nickname = callback.GetReturnValuetoJSON()["row"]["nickname"].ToString();
});

SendQueue

SendQueue.Enqueue(Backend.BMember.GetUserInfo, (callback) =>
{
string nickname = callback.GetReturnValuetToJSON()["row"]["nickname"].ToString();
});

Return cases

Success cases

When loaded successfully
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

GetReturnValuetoJSON

In the case of success, the information of the logged-in user is displayed.

{
"row": {
"gamerId":"123456a0-7890-11ab-22cd-33f4567fa89" // User's gamer_id
"countryCode": "KR", // null when country code is not set
"nickname": "Test User 1", // null when nickname is not set
"inDate": "2020-06-23T05:54:29.743Z", // User inDate
"emailForFindPassword": "backend@afidev.com", // Email used to find custom account ID, PW; null when it is not registered.
"subscriptionType": "customSignUp", // custom/federation type
"federationId": null // Google, Apple, Facebook federation ID'; null for custom account
}
}

Sample code

public class UserInfo
{
public string gamerId;
public string countryCode;
public string nickname;
public string inDate;
public string emailForFindPassword;
public string subscriptionType;
public string federationId;

public override string ToString()
{
return $"gamerId: {gamerId}\n" +
$"countryCode: {countryCode}\n" +
$"nickname: {nickname}\n" +
$"inDate: {inDate}\n" +
$"emailForFindPassword: {emailForFindPassword}\n" +
$"subscriptionType: {subscriptionType}\n" +
$"federationId: {federationId}\n";
}
}
public void GetUserInfoTest()
{
var bro = Backend.BMember.GetUserInfo();

if(!bro.IsSuccess())
{
Debug.LogError("An error occurred : " + bro.ToString());
return;
}

LitJson.JsonData userInfoJson = bro.GetReturnValuetoJSON()["row"];

UserInfo userInfo = new UserInfo();

userInfo.gamerId = userInfoJson["gamerId"].ToString();
userInfo.countryCode = userInfoJson["countryCode"].ToString();
userInfo.nickname = userInfoJson["nickname"].ToString();
userInfo.inDate = userInfoJson["inDate"].ToString();
userInfo.emailForFindPassword = userInfoJson["emailForFindPassword"]?.ToString();
userInfo.subscriptionType = userInfoJson["subscriptionType"].ToString();
userInfo.federationId = userInfoJson["federationId"]?.ToString();

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