Skip to main content
Version: 5.11.6

GetPostList(PostType.User)

public BackendReturnObject GetPostList(PostType.User);
public BackendReturnObject GetPostList(PostType.User, int limit);

Parameters

ValueTypeDescription
postTypePostTypeType of mail to load
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.

PostType

ValueDescription
AdminAdmin mail sent from BACKND Console
RankRanking mail sent automatically after ranking settlement
CouponCoupon mail sent after using a coupon with the page created in Web Coupon Settings in BACKND Console
UserUser mail sent using each user's data

Description

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

The return value varies for each PostType, so please refer to GetReturnValuetoJSON() below.
Note that user mail has vastly different JSON type from admin or ranking mail.

  • The data types "S", "L", and "M" in the return values of the previous mail function(Backend.Social.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(Backend.UPost.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

BackendReturnObject bro = Backend.UPost.GetPostList(PostType.User, 10);
LitJson.JsonData json = bro.GetReturnValuetoJSON()["postList"];

for(int i = 0; i < json.Count; i++) {
Debug.Log("Title : " + json[i]["title"].ToString());
Debug.Log("inDate : " + json[i]["inDate"].ToString());
}

Asynchronous

Backend.UPost.GetPostList(PostType.User, 10, callback => {
LitJson.JsonData json = callback.GetReturnValuetoJSON()["postList"];

for(int i = 0; i < json.Count; i++) {
Debug.Log("Title : " + json[i]["title"].ToString());
Debug.Log("inDate : " + json[i]["inDate"].ToString());
}
});

SendQueue

SendQueue.Enqueue(Backend.UPost.GetPostList, PostType.User, 10, callback =>  {
LitJson.JsonData json = callback.GetReturnValuetoJSON()["postList"];

for(int i = 0; i < json.Count; i++) {
Debug.Log("Title : " + json[i]["title"].ToString());
Debug.Log("inDate : " + json[i]["inDate"].ToString());
}
});

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 = Backend.GameData.Insert(tableName, param).GetInDate();

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

Sample code

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

public void GetPostListTest() {
int limit = 100;
PostType postType = PostType.User;

BackendReturnObject bro = Backend.UPost.GetPostList(postType, limit);

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

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