NoticeOne
public BackendReturnObject NoticeOne(string inDate);
Parameter
Value | Type |
---|---|
inDate | string |
Description
The information of a specific announcement registered in BACKND Console is returned.
inDate value is required to bring a specific announcement from the list.
Example
Loading announcement inDate(synchronous)
BackendReturnObject bro = Backend.Notice.NoticeList(10);
//The data of the first announcement in the announcements list
string inDate = bro.FlattenRows()[0]["inDate"].ToString();
Synchronous
BackendReturnObject bro = Backend.Notice.NoticeOne(inDate);
string content = bro.GetFlattenJSON()["row"]["content"].ToString();
Asynchronous
Backend.Notice.NoticeOne(inDate, callback => {
string content = bro.GetFlattenJSON()["row"]["content"].ToString();
});
SendQueue
SendQueue.Enqueue(Backend.Notice.NoticeOne, inDate, callback => {
string content = bro.GetFlattenJSON()["row"]["content"].ToString();
});
Return cases
Success cases
When loaded successfully
statusCode : 200
returnValue : refer to GetReturnValuetoJSON
Error cases
When the corresponding announcement does not exist
statusCode : 404
errorCode : NotFoundException
returnValue: notice not found, notice cannot be found
GetReturnValuetoJSON
In the case of success, the information about the registered announcements is displayed.{
row:
{
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" }
}
}
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 NoticeOneTest()
{
List<Notice> noticeList = new List<Notice>();
List<string> noticeIndateList = new List<string>();
BackendReturnObject bro = Backend.Notice.NoticeList(10);
if(bro.IsSuccess())
{
LitJson.JsonData noticeListJson = bro.FlattenRows();
for(int i = 0; i < noticeListJson.Count; i++)
{
noticeIndateList.Add(noticeListJson[i]["inDate"].ToString());
}
for(int i = 0; i < noticeIndateList.Count; i++)
{
BackendReturnObject bro2 = Backend.Notice.NoticeOne(noticeIndateList[i]);
LitJson.JsonData jsonData = bro2.GetFlattenJSON()["row"];
if(bro2.IsSuccess())
{
Notice notice = new Notice();
notice.title = jsonData["title"].ToString();
notice.contents = jsonData["content"].ToString();
notice.postingDate = DateTime.Parse(jsonData["postingDate"].ToString());
notice.inDate = jsonData["inDate"].ToString();
notice.uuid = jsonData["uuid"].ToString();
notice.isPublic = jsonData["isPublic"].ToString() == "y" ? true : false;
notice.author = jsonData["author"].ToString();
if(jsonData.ContainsKey("imageKey"))
{
notice.imageKey = "http://upload-console.thebackend.io" + jsonData["imageKey"].ToString();
}
if(jsonData.ContainsKey("linkUrl"))
{
notice.linkUrl = jsonData["linkUrl"].ToString();
}
if(jsonData.ContainsKey("linkButtonName"))
{
notice.linkButtonName = jsonData["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 > Among Key, search for 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.