Skip to main content
Version: 5.11.8

GetPostList(PostType.Rank)

public BackendReturnObject GetPostList(PostType.Rank);
public BackendReturnObject GetPostList(PostType.Rank, 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.
  • Every mail has an expiration date according to its type, after which the mail gets deleted from the list.
  • The user who loaded the mail is marked as 'Unclaimed' on the Mail Management page of the console. When claimed, the date is overwritten.
  • Items that are attached to ranking mail are automatically removed after the user claims them.
  • The mail expires seven days after it is sent.

Ranking mail title

  • For more information on rules to create ranking mail titles, please refer to the documentation on checking ranking rewards.

Guild ranking mail rewards

  • If a user leaves a guild without checking the guild ranking rewards mail, they cannot receive the guild ranking rewards from the guild they left and cannot check the mail even after rejoining. Users can receive guild ranking rewards mail by calling GetPostList() only if they are a member of the guild.(not the case for users who join after the reward handout)

Example

Synchronous

BackendReturnObject bro = Backend.UPost.GetPostList(PostType.Rank, 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.Rank, 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.Rank, 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

Ranking Mail

Ranking mail always has only one item. It is, however, inside an array type, similar to that of admin mail.

{
"postList": [
{
"rankType": "user", // Ranking type("guild" or "user")
"content":"Max score rank(1–1)", // Content of ranking reward
"expirationDate": "2021-12-26T19:03:52.243Z", // Expiration date
"reservationDate": "2021-12-19T19:03:52.243Z", // Mail registration date
"nickname": "User2", // Receiving user
"inDate": "2021-12-19T19:03:52.243Z", // Mail's inDate
"title":"Max score rank(1–1)", // Title of the ranking rewards mail
"sentDate": "2021-12-19T19:03:52.243Z", // Sent date
"items": [
{
"item": {
"itemID": "i104",
"itemName": "Item4",
},
"itemCount": 999999,
"chartName": "Ranking rewards chart"
}
]
},
{
"rankType": "guild",
"content": "All Random All Mid ranking(21–40)",
"expirationDate": "2021-12-26T19:03:44.163Z",
"reservationDate": "2021-12-19T19:03:44.163Z",
"nickname": "User2",
"inDate": "2021-12-19T19:03:44.163Z",
"title": "All Random All Mid ranking(21–40)",
"sentDate": "2021-12-19T19:03:44.163Z",
"items": [
{
"item": {
"itemID": "i102",
"itemName": "Item2",
"hpPower": "10",
"aabab": "2"
},
"itemCount": 1,
"chartName": "Ranking rewards chart2"
}
]
}
]
}

Sample code

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

public class UPostChartItem {
public string chartFileName;
public string itemID;
public string itemName;
public string hpPower;
public int itemCount;
public override string ToString() {
return
"item : \n" +
$"| chartFileName : {chartFileName}\n" +
$"| itemID : {itemID}\n" +
$"| itemName : {itemName}\n" +
$"| itemCount : {itemCount}\n" +
$"| hpPower : {hpPower}\n";
}
}
public class UPostItem {
public PostType postType;
public string title;
public string content;
public DateTime expirationDate;
public DateTime reservationDate;
public DateTime sentDate;
public string nickname;
public string inDate;
public string author; // Exists only in admin mail
public string rankType; // Exists only in ranking mail
public List<UPostChartItem> items = new List<UPostChartItem>();
public override string ToString() {
string totalString =
$"title : {title}\n" +
$"inDate : {inDate}\n";
if(postType == PostType.Admin || postType == PostType.Rank) {
totalString +=
$"content : {content}\n" +
$"expirationDate : {expirationDate}\n" +
$"reservationDate : {reservationDate}\n" +
$"sentDate : {sentDate}\n" +
$"nickname : {nickname}\n";
if(postType == PostType.Admin) {
totalString += $"author : {author}\n";
}
if(postType == PostType.Rank) {
totalString += $"rankType : {rankType}\n";
}
}
string itemList = string.Empty;
for(int i = 0; i < items.Count; i++) {
itemList += items[i].ToString();
itemList += "\n";
}
totalString += itemList;
return totalString;
}
}
public void GetPostListTest() {
int limit = 100;
PostType postType = PostType.Rank;
BackendReturnObject bro = Backend.UPost.GetPostList(postType, limit);
if(!bro.IsSuccess()) {
Debug.LogError(bro.ToString());
return;
}
LitJson.JsonData postListJson = bro.GetReturnValuetoJSON()["postList"];

List<UPostItem> postItemList = new List<UPostItem>();

for(int i = 0; i < postListJson.Count; i++) {

UPostItem postItem = new UPostItem();

postItem.inDate = postListJson[i]["inDate"].ToString();
postItem.title = postListJson[i]["title"].ToString();
postItem.postType = postType;

if(postType == PostType.Admin || postType == PostType.Rank) {
postItem.content = postListJson[i]["content"].ToString();
postItem.expirationDate = DateTime.Parse(postListJson[i]["expirationDate"].ToString());
postItem.reservationDate = DateTime.Parse(postListJson[i]["reservationDate"].ToString());
postItem.nickname = postListJson[i]["nickname"]?.ToString();
postItem.sentDate = DateTime.Parse(postListJson[i]["sentDate"].ToString());

if(postListJson[i].ContainsKey("author")) {
postItem.author = postListJson[i]["author"].ToString();
}
if(postListJson[i].ContainsKey("rankType")) {
postItem.author = postListJson[i]["rankType"].ToString();
}
}
if(postListJson[i]["items"].Count > 0) {

for(int itemNum = 0; itemNum < postListJson[i]["items"].Count; itemNum++) {

UPostChartItem item = new UPostChartItem();
item.itemCount = int.Parse(postListJson[i]["items"][itemNum]["itemCount"].ToString());
item.chartFileName = postListJson[i]["items"][itemNum]["item"]["chartFileName"].ToString();
item.itemID = postListJson[i]["items"][itemNum]["item"]["itemID"].ToString();
item.itemName = postListJson[i]["items"][itemNum]["item"]["itemName"].ToString();
item.hpPower = postListJson[i]["items"][itemNum]["item"]["hpPower"].ToString();

postItem.items.Add(item);
}
}

postItemList.Add(postItem);
Debug.Log(postItem.ToString());
}
}