Skip to main content
Version: 5.11.8

EventOne

public BackendReturnObject EventOne(string inDate);

Parameter

ValueTypeDescription
inDatestringinDate of the event to be loaded
EventList's BRO Return Value > JsonArray >(JsonObject) inDate > value

Description

The information of a specific event from the list of events registered in BACKND Console is returned.

inDate value is required to retrieve a specific event from the list.

Example

Synchronous

BackendReturnObject bro = Backend.Event.EventList(2);

string inDate = bro.Rows()[0]["inDate"]["S"].ToString();

BackendReturnObject bro2 = Backend.Event.EventOne(inDate);

string Content = bro2.GetReturnValuetoJSON()["row"]["content"]["S"].ToString();

Asynchronous

Backend.Event.EventList(2, callback =>
{
string inDate = callback.Rows()[0]["inDate"]["S"].ToString();

Backend.Event.EventOne(inDate,callback2 =>
{
string Content = callback2.GetReturnValuetoJSON()["row"]["content"]["S"].ToString();
);
});

SendQueue

SendQueue.Enqueue(Backend.Event.EventList, 2, callback =>
{
string inDate = callback.Rows()[0]["inDate"]["S"].ToString();

SendQueue.Enqueue(Backend.Event.EventOne, inDate, callback2 =>
{
string Content = callback2.GetReturnValuetoJSON()["row"]["content"]["S"].ToString();
);
});

Return cases

Success cases

When loaded successfully
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

Error cases

When loading fails
statusCode : 404
errorCode : NotFoundException
returnValue: notice not found, notice cannot be found

GetReturnValuetoJSON

In the case of success, the information about the relevant event is displayed.

{   
row:
{
uuid: // Event uuid
{ S : "b33bc260-0981-11e9-bfd0-3bf848e9c52c" },
content: // Content of event
{ S: "Enter a coupon number to receive items!" },
contentImageKey: // Attached content image URL
{ S : "/upload/2147483648/event/2018-12-27T02:46:57.391Z312652213.jpg" },
popUpImageKey: // Attached pop-up image URL
{ S : "/upload/2147483648/event/2018-12-27T02:46:58.945Z936251230.jpg" },
postingDate: // Event publication date
{ S : "2018-12-27T02:00:00.000Z" },
endDate: // Event end date
{ S : "2018-12-28T03:00:00.000Z" },
inDate: // Event indate
{ S : "2018-12-27T02:47:07.399Z" },
startDate: // Event start date
{ S : "2018-12-27T03:00:00.000Z" },
linkUrl: // External link button URL
{ S : "http://thebackend.io" },
isPublic: // Public/private status(y: public)
{ S : "y" },
linkButtonName: // The name of the external link
{ S : "buttonX" },
author: // Author information(admin nickname)
{ S : "jake" },
title: // Event title
{ S: "An event to celebrate 100,000 downloads!" }
}
}

Sample code

public class EventItem
{
public string uuid;
public string content;
public string contentImageKey;
public string popUpImageKey;
public DateTime postingDate;
public DateTime startDate;
public DateTime endDate;
public string inDate;
public string linkUrl;
public string author;
public bool isPublic;
public string linkButtonName;
public string title;

public override string ToString()
{
return $"uuid : {uuid}\n" +
$"content : {content}\n" +
$"contentImageKey : {contentImageKey}\n" +
$"popUpImageKey : {popUpImageKey}\n" +
$"postingDate : {postingDate}\n" +
$"startDate : {startDate}\n" +
$"endDate : {endDate}\n" +
$"inDate : {inDate}\n" +
$"linkUrl : {linkUrl}\n" +
$"author : {author}\n" +
$"isPublic : {isPublic}\n" +
$"linkButtonName : {linkButtonName}\n" +
$"title : {title}\n";
}
}
public void EventOne()
{
List<EventItem> eventList = new List<EventItem>();
List<string> eventIndateList = new List<string>();

BackendReturnObject bro = Backend.Event.EventList(10);

if(!bro.IsSuccess())
return;

for(int i = 0; i < bro.FlattenRows().Count; i++)
{
eventIndateList.Add(bro.FlattenRows()[i]["inDate"].ToString());
}

for(int i = 0; i < eventIndateList.Count; i++)
{
var eventOne = Backend.Event.EventOne(eventIndateList[i]);

if(eventOne.IsSuccess())
{
var json = eventOne.GetFlattenJSON();

EventItem eventItem = new EventItem();

eventItem.title = json["row"]["title"].ToString();
eventItem.content = json["row"]["content"].ToString();
eventItem.postingDate = DateTime.Parse(json["row"]["postingDate"].ToString());
eventItem.startDate = DateTime.Parse(json["row"]["startDate"].ToString());
eventItem.endDate = DateTime.Parse(json["row"]["endDate"].ToString());
eventItem.inDate = json["row"]["inDate"].ToString();
eventItem.uuid = json["row"]["uuid"].ToString();
eventItem.isPublic = json["row"]["isPublic"].ToString() == "y" ? true : false;
eventItem.author = json["row"]["author"].ToString();

if(json["row"].ContainsKey("contentImageKey"))
{
eventItem.contentImageKey = "http://upload-console.thebackend.io" + json["row"]["contentImageKey"].ToString();
}
if(json["row"].ContainsKey("popUpImageKey"))
{
eventItem.popUpImageKey= "http://upload-console.thebackend.io" + json["row"]["popUpImageKey"].ToString();
}
if(json["row"].ContainsKey("linkUrl"))
{
eventItem.linkUrl = json["row"]["linkUrl"].ToString();
}
if(json["row"].ContainsKey("linkButtonName"))
{
eventItem.linkButtonName = json["row"]["linkButtonName"].ToString();
}

eventList.Add(eventItem);
Debug.Log(eventItem.ToString());
}
else
{
Debug.Log($"The event cannot be loaded the event : {eventIndateList[i].ToString()}");
}
}
}

How to look up an image attached to the event

If you registered a content image and pop-up image when registering the event, you can check the address where the images are stored using the contentImageKey and popUpImageKey values, respectively, in the above 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.