Skip to main content
Version: 5.11.6

NoticeList

public BackendReturnObject NoticeList();
public BackendReturnObject NoticeList(int limit);
public BackendReturnObject NoticeList(int limit, string offset);

Parameters

valueTypedescriptiondefault
limitintNumber of announcements to load10
offsetstringStarting point of the announcement to be loaded
Can be obtained via BackendReturnObject.LastEvaluatedKeyString().
-

Description

This is a function for receiving the announcements registered in BACKND Console.

When the user has a country code, and an announcement of that country is registered in the console → The announcement's title and content for that country will be returned.
If the user's country code is not present, or if an announcement is not registered for the country in the console → Returns the default title and content.

To obtain registered images, add imageKey path that is returned to http://upload-console.thebackend.io.

If the announcement's publicity is set to private, it is excluded from the announcement list that is returned upon calling the method.
You cannot use isPublic's key value to display the announcement on the client.

Example

Synchronous

BackendReturnObject bro = Backend.Notice.NoticeList(2);

if(bro.IsSuccess()) {
string offset = bro.LastEvaluatedKeyString();
if(!string.IsNullOrEmpty(offset)) {
// 2. Loads 3 announcements after loading 2 announcements
Backend.Notice.NoticeList(3, offset);
}
}

Asynchronous

Backend.Notice.NoticeList(2,callback=> {
if(callback.IsSuccess()) {
string offset = callback.LastEvaluatedKeyString();
if(!string.IsNullOrEmpty(offset)) {
// 2. Loads 3 announcements after loading 2 announcements
Backend.Notice.NoticeList(3, offset, callback2 => {
// Code afterward
});
}
}
});

SendQueue

SendQueue.Enqueue(Backend.Notice.NoticeList, 2, callback => {
if(callback.IsSuccess()) {
string offset = callback.LastEvaluatedKeyString();
if(!string.IsNullOrEmpty(offset)) {
// 2. Loads 3 announcements after loading 2 announcements
SendQueue.Enqueue(Backend.Notice.NoticeList, 3, offset, callback2=> {
// Code afterward
});
}
}
});

Return cases

Success cases

When loaded successfully
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

When the number of announcements is 0
statusCode : 200

returnValue : { "rows":[] }

GetReturnValuetoJSON

In the case of success, the information about the registered announcements is displayed.
{
rows:
[
{
content: // Content of announcement
{ S: "The game will be updated on Jan. 31. 2019. Details of the update are as follows: " },
postingDate: // Announcement publication date
{ S : "2018-12-19T09:30:00.000Z" },
imageKey: // Attached image URL
{ S : "/upload/2147483648/notice/2018-12-27T02:55:36.845Z511886972.jpg" },
inDate: // Announcement indate
{ S : "2018-12-19T09:26:53.382Z" },
uuid: // Announcement uuid
{ S : "38b07660-0370-11e9-8d1d-7571a0570adf" },
linkUrl: // External link button URL
{ S : "http://thebackend.io" },
isPublic: // Public/private status
{ S : "y" },
linkButtonName: // The name of the external link
{ S : "buttonN" },
author: // Author
{ S : "jake" },
title: // Announcement title
{ S: "Game update announcement" }
},
{
content: [Object],
postingDate: [Object],
imageKey: [Object],
inDate: [Object],
uuid: [Object],
linkUrl: [Object],
isPublic: [Object],
linkButtonName: [Object],
author: [Object],
title: [Object]
}
],
// Returned when there is data after the loaded data
// Not returned if no data exists after the loaded data
LastEvaluatedKey:{
gamer_id: { S: "notice" },
inDate:{ S: "2019-08-19T06:45:07.816Z" },
partition:{ S: "notice" }
}
}

Sample code

public class Notice
{
public string title;
public string contents;
public DateTime postingDate;
public string imageKey;
public string inDate;
public string uuid;
public string linkUrl;
public bool isPublic;
public string linkButtonName;
public string author;

public override string ToString()
{
return $"title : {title}\n" +
$"contents : {contents}\n" +
$"postingDate : {postingDate}\n" +
$"imageKey : {imageKey}\n" +
$"inDate : {inDate}\n" +
$"uuid : {uuid}\n" +
$"linkUrl : {linkUrl}\n" +
$"isPublic : {isPublic}\n" +
$"linkButtonName : {linkButtonName}\n" +
$"author : {author}\n";
}
}
public void GetNoticeList()
{
List<Notice> noticeList = new List<Notice>();

BackendReturnObject bro = Backend.Notice.NoticeList(10);
if(bro.IsSuccess())
{
Debug.Log("Return value: " + bro);

LitJson.JsonData jsonList = bro.FlattenRows();
for(int i = 0; i < jsonList.Count; i++)
{
Notice notice = new Notice();

notice.title = jsonList[i]["title"].ToString();
notice.contents = jsonList[i]["content"].ToString();
notice.postingDate = DateTime.Parse(jsonList[i]["postingDate"].ToString());
notice.inDate = jsonList[i]["inDate"].ToString();
notice.uuid = jsonList[i]["uuid"].ToString();
notice.isPublic = jsonList[i]["isPublic"].ToString() == "y" ? true : false;
notice.author = jsonList[i]["author"].ToString();

if(jsonList[i].ContainsKey("imageKey"))
{
notice.imageKey = "http://upload-console.thebackend.io" + jsonList[i]["imageKey"].ToString();
}
if(jsonList[i].ContainsKey("linkUrl"))
{
notice.linkUrl = jsonList[i]["linkUrl"].ToString();
}
if(jsonList[i].ContainsKey("linkButtonName"))
{
notice.linkButtonName = jsonList[i]["linkButtonName"].ToString();
}

noticeList.Add(notice);
Debug.Log(notice.ToString());
}
}
}

How to look up an image attached to the announcement

If you added an image upon registering an announcement, you can check its address by using the imageKey value of GetReturnValuetoJSON() value.

To look up the image, add its image key to the image key returned to http://upload-console.thebackend.io and make a request to the address shown below.

http://upload-console.thebackend.io/upload/2147483648/event/2018-12-27T02:46:57.391Z312652213.jpg
Caution for iOS

iOS blocks http access as a default setting according to its security policy.
If you wish to load an image attached to an announcement/event from an iOS device, allow all http or add certain domains as exceptions as shown below.

Open Info.lplist after building a project > In 'Key,' find or create the value of App Transport Security Settings Key.

Case 1. When allowing all Http access:

Go to App Transport Security Settings and change Allow Arbitrary Loads to YES.

Case 2. When allowing access only from certain domains

  • Go to App Transport Security Settings and change Allow Arbitrary Loads to NO.
  • In the options of App Transport Security Settings, create Exception Domains and add upload-console.thebackend as its subcategory.