Skip to main content
Version: SDK-5.11.4

ReceivePostItemAll

public BackendReturnObject ReceivePostItemAll(PostType postType);

caution

This method loads only mail registered in the mail list.
Before using the method, we recommend you update the list by loading the mail list with UPost.GetPostList in advance.

Parameter

ValueTypeDescription
postTypePostTypeType of mail to claim all

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

Claims all mail in the list of the given postType.

  • The data types "S", "L", and "M" in the return values of the previous mail function(Backend.Social.Post) was removed.
  • You may use the same logic for claiming admin, ranking, and coupon mail, as they all have the same return values when claimed.
  • An error occurs if there is no mail to claim.

Example

Synchronous

var  bro = Backend.UPost.ReceivePostItemAll(PostType.Admin);

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

Asynchronous

Backend.UPost.ReceivePostItemAll(PostType.Admin, callback => {
// For the logic to claim all mail, please refer to the 'Sample code.'
});

SendQueue

SendQueue.Enqueue(Backend.UPost.ReceivePostItemAll, PostType.Admin, 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
message : Success returnValue : refer to GetReturnValuetoJSON

Error cases

When there is no more mail to claim statusCode : 404
errorCode : NotFoundException
message : post not found, post cannot be found

GetReturnValuetoJSON

{
"postItems": [
[], // When there are no items attached
[
{
"item": { // When there is one item attached(Ranking mail only allows one item to be attached.)
"chartFileName": "chartExample.xlsx",
"itemID": "i101",
"itemName": "Item111",
"hpPower": "1",
"aabab": "1"
},
"itemCount": 1,
"chartName": "Chart"
}
],
[
{
"item": { // When there are multiple items attached
"chartFileName": "chartExample.xlsx",
"itemID": "i101",
"itemName": "Item111",
"hpPower": "1",
"aabab": "1"
},
"itemCount": 1,
"chartName": "Chart"
},
{
"item": {
"chartFileName": "itemTable.xlsx",
"itemID": "item-2392",
"itemName": "Longsword"
},
"itemCount": 1,
"chartName": "Item"
}
]
]
}

Sample code

public class ReceiveItem {
public string chartFileName;
public string itemID;
public string itemName;
public int hpPower;
public int itemCount;

public override string ToString() {
return $"chartFileName:{chartFileName}\n" +
$"itemID:{itemID}\n" +
$"itemName:{itemName}\n" +
$"hpPower:{hpPower}\n" +
$"itemCount:{itemCount}\n";
}
}
public void ReceivePostItemAllTest() {

BackendReturnObject bro = Backend.UPost.GetPostList(PostType.Admin, 100);

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

var receiveBro = Backend.UPost.ReceivePostItemAll(PostType.Admin);

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

foreach(LitJson.JsonData postItemJson in receiveBro.GetReturnValuetoJSON()["postItems"]) {

for(int j = 0; j < postItemJson.Count; j++) {
if(!postItemJson[j].ContainsKey("item")) {
continue;
}

ReceiveItem item = new ReceiveItem();
if(postItemJson[j]["item"].ContainsKey("itemName")) {
item.itemName = postItemJson[j]["item"]["itemName"].ToString();
}

// chartFileName does not exist for ranking rewards.
if(postItemJson[j]["item"].ContainsKey("chartFileName")) {
item.chartFileName = postItemJson[j]["item"]["chartFileName"].ToString();
}

if(postItemJson[j]["item"].ContainsKey("itemID")) {
item.itemID = postItemJson[j]["item"]["itemID"].ToString();
}

if(postItemJson[j]["item"].ContainsKey("hpPower")) {
item.hpPower = int.Parse(postItemJson[j]["item"]["hpPower"].ToString());
}

if(postItemJson[j].ContainsKey("itemCount")) {
item.itemCount = int.Parse(postItemJson[j]["itemCount"].ToString());
}

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