Skip to main content
Version: 6.0.0

GetPlayerMailList

public BackndPlayerMailReturnObject GetPlayerMailList();
public BackndPlayerMailReturnObject GetPlayerMailList(int limit);

BackndPlayerMailReturnObject

GetReturnValueByPlayerMailItemList

If an error occurred, null is returned.

BackndPlayerMailReturnObject bro = Backnd.PlayerMail.GetPlayerMailList(10);

foreach(BackndMailItem item in bro.GetReturnValueByPlayerMailItemList()) {
Debug.Log(item.ToString());
}

BackndPlayerMailItem

public class BackndPlayerMailItem
{
public string content = string.Empty;
public string expirationDate = string.Empty;
public string receiverInDate = string.Empty;
public string columnOfItemLocation = string.Empty;
public string tableOfItemLocation = string.Empty;
public string receiverNickname = string.Empty;
public string receivedDate = string.Empty;
public string sender = string.Empty;
public string inDate = string.Empty;
public string senderNickname = string.Empty;
public string senderInDate = string.Empty;
public string sentDate = string.Empty;
public string title = string.Empty;
public string item = string.Empty;
}

Parameters

ValueTypeDescription
limitintNumber of mail to load. Choose between 10 and 100. The limit is set to 10 by default.

'limit' evaluates to 10 if you specify a smaller number.

Description

Loads the mail list of the given type(MailType).

The return value varies for each MailType, so please refer to GetReturnValuetoJSON() below.

Note that user mail has vastly different JSON type from admin or ranking PlayerMail.

  • The data types "S", "L", and "M" in the return values of the previous mail function(Backnd.Player.Post) was removed.
  • Items that are attached to user mail are not removed after the user claims them but cannot be claimed again.
  • To delete user mail, you have to call the user mail deletion method(Backnd.PlayerMail.DeleteUserPost).
  • Existence of receivedDate key indicates that the mail has been received.
  • User mail expires after 15 days, and expired mail is not returned to the sender.

Example

Synchronous

BackndPlayerMailReturnObject bro = Backnd.PlayerMail.GetPlayerMailList(10);

foreach(BackndMailItem item in bro.GetReturnValueByPlayerMailItemList()) {
Debug.Log(item.title);
}

Asynchronous

Backnd.PlayerMail.GetPlayerMailList(10, callback => {
foreach(BackndMailItem item in callback.GetReturnValueByPlayerMailItemList()) {
Debug.Log(item.sendDate);
}
});

Return cases

Success cases

When mail is loaded successfully
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

When there is no mail to load
statusCode : 200

returnValue : { "postList" : []}

GetReturnValuetoJSON

User mail

{
"postList": [
{
"content": "Mail content", // Content
"expirationDate": "2022-01-04T10:58:34.360Z", // Expiration date
"receiverInDate": "2021-11-09T02:16:35.406Z", // Mail registration date(sent date)
"item": { // Information on the sent item
"key1": "item1",
"key2": "item2",
"key3": "item3"
},
"itemLocation": { // Table entry information of the item
"column": "dic", // Column
"table": "tableName" // Table
},
"receiverNickname": "User2", // Recipient's nickname
"receivedDate":"2021-12-28T00:23:35.484Z" // Received date(exists only if the user has received the mail)
"sender": "0fdd6e40-4103-11ec-b4f7-4b3fc8e50bcf", // Sender's uuid
"inDate": "2021-12-20T10:58:34.360Z", // Mail's inDate
"senderNickname": "User3", // Sender's nickname
"senderInDate": "2021-11-09T02:16:34.852Z", // Sender's inDate
"sentDate": "2021-12-20T10:58:34.360Z", // Sent date
"title": "Mail title" // Title of the mail
},
{
"content": "Mail content",
"expirationDate": "2022-01-04T10:58:33.918Z",
"receiverInDate": "2021-11-09T02:16:35.406Z",
"item": {
"key1": "Item1",
"key2": "Item2",
"key3": "Item3"
},
"itemLocation": {
"column": "dic",
"table": "tableName"
},
"receiverNickname": "User2",
"sender": "0fdd6e40-4103-11ec-b4f7-4b3fc8e50bcf",
"inDate": "2021-12-20T10:58:33.918Z",
"senderNickname": "User1",
"senderInDate": "2020-01-09T02:12:34.822Z",
"sentDate": "2021-12-20T10:58:33.918Z",
"title": "Mail title"
}
]
}

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

PostItem postItem = new PostItem
{
Title = "Mail title",
Content = "Mail content",
TableName = tableName,
RowInDate = rowIndate,
Column = columnName
};
Backnd.PlayerMail.SendUserPost(playerInDate, postItem);

Sample code

This example works for admin, ranking, and coupon PlayerMail.

public void GetPlayerMailListTest() {
int limit = 100;
MailType mailType = MailType.User;

BackndReturnObject bro = Backnd.PlayerMail.GetPlayerMailList(limit);

if(!bro.IsSuccess()) {
Debug.LogError(bro.ToString());
return;
}

foreach(BACKND.LitJson.JsonData postJson in bro.GetReturnValuetoJSON()["postList"]) {

StringBuilder stringBuilder = new StringBuilder();

stringBuilder.AppendLine("title : " + postJson["title"].ToString());
stringBuilder.AppendLine("inDate : " + postJson["inDate"].ToString());

stringBuilder.AppendLine("sentDate : " + postJson["sentDate"].ToString());
stringBuilder.AppendLine("expirationDate : " + postJson["expirationDate"].ToString());
stringBuilder.AppendLine("receiverInDate : " + postJson["receiverInDate"].ToString());
stringBuilder.AppendLine("sender : " + postJson["sender"].ToString());
stringBuilder.AppendLine("senderInDate : " + postJson["senderInDate"].ToString());

if(postJson.ContainsKey("receiverNickname")) {
stringBuilder.AppendLine("receiverNickname : " + postJson["receiverNickname"].ToString());
}

if(postJson.ContainsKey("senderNickname")) {
stringBuilder.AppendLine("senderNickname : " + postJson["senderNickname"].ToString());
}

if(postJson.ContainsKey("receivedDate")) {
stringBuilder.AppendLine("receivedDate : " + postJson["receivedDate"].ToString());
}

stringBuilder.AppendLine("item table : " + postJson["itemLocation"]["table"].ToString());
stringBuilder.AppendLine("item column : " + postJson["itemLocation"]["column"].ToString());

stringBuilder.AppendLine("item : ");
foreach(string postItemKey in postJson["item"].Keys) {
stringBuilder.AppendLine($"| {postItemKey } : {postJson["item"][postItemKey].ToString()}");
}

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