Skip to main content
Version: 6.0.0

ReadAllPlayerMail

public BackndReturnObject ReadAllPlayerMail();

Parameter

ValueTypeDescription
mailTypeMailTypeType of mail to claim all

Description

Claims all pieces of mail that have been looked up until now.

  • The data types "S", "L", and "M" in the return values of the previous mail function(Backnd.Player.Post) was removed.
  • An error occurs if there is no mail to claim.

Example

Synchronous

var  bro = Backnd.PlayerMail.ReadAllPlayerMail();

// For the logic to claim all mail, please refer to the 'Sample code.'

Asynchronous

Backnd.PlayerMail.ReadAllPlayerMail(callback => {
// For the logic to claim all mail, please refer to the 'Sample code.'
});

Return cases

Success cases

When the lookup is successful
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

Error cases

When there is no more mail to claim statusCode : 404
errorCode : NotFoundException

GetReturnValuetoJSON

User mail

{
"postItems": [
{
"key1": "Item1",
"key2": "Item2",
"key3": "Item3"
},
{
"key1": "Item4",
"key2": "Item5",
"key3": "Item6"
},
{
"key1": "Item7",
"key2": "Item8",
"key3": "Item9"
}
]
}

Inserted data

Param param = new Param();
Dictionary<string, string> dic = new Dictionary<string, string>();

dic.Add("key1", "Item1");
dic.Add("key2", "Item2");
dic.Add("key3", "Item3");

param.Add(columnName, dic);

string rowIndate = Backnd.PlayerTable.Insert(tableName, param).GetInDate();

string Title = "Mail title";
string Content = "Mail content";
string TableName = tableName;
string RowInDate = rowIndate;
string Column = columnName;


Backnd.PlayerMail.SendMail(playerInDate, Title, Content, TableName, RowInDate, Column);

Sample code

public void ReadAllPlayerMailTest() {

BackndReturnObject bro = Backnd.PlayerMail.GetPlayerMailList(MailType.Coupon, 100);

if(bro.IsSuccess() == false) {
Debug.Log("An error occurred while loading the PlayerMail.");
return;
}

var receiveBro = Backnd.PlayerMail.ReadAllPlayerMail(MailType.Coupon);

if(receiveBro.IsSuccess() == false) {
Debug.LogError("An error occurred while claiming all PlayerMail. : " + receiveBro);
return;
}

System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();

foreach(BACKND.LitJson.JsonData postItemJson in receiveBro.GetReturnValuetoJSON()["postItems"]) {
foreach(string postItemKey in postItemJson.Keys) {
stringBuilder.AppendLine($"{postItemKey} : {postItemJson[postItemKey].ToString()}");
}
stringBuilder.AppendLine();
}

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