API Reference of GS2-Schedule SDK for Game Engine
Model
EzTrigger
Trigger
A trigger is an entity that defines the starting point for the beginning of an event when realizing different event durations for different game players.
| Type | Require | Default | Limitation | Description |
---|
triggerId | string | ✓ | | ~ 1024 chars | Trigger Name |
name | string | ✓ | | ~ 128 chars | Trigger Name |
createdAt | long | ✓ | | | Datetime of creation |
expiresAt | long | | | | Trigger Expiration Date |
EzEvent
Event
Two types of event durations exist: absolute and relative.
Absolute periods are fixed periods, such as January 1, 2021 00:00(UTC) to January 7, 2021 23:59(UTC).
A relative period is an event period that varies from one game player to another, such as 24 hours from the time the trigger is pulled.
The event can be set to repeat itself as well as the duration of the event.
An event period can be set up so that only Monday from 10:00 to 11:00 is included in the event period.
| Type | Require | Default | Limitation | Description |
---|
name | string | ✓ | | ~ 128 chars | Event Type Name |
metadata | string | | | ~ 2048 chars | metadata |
scheduleType | enum [‘absolute’, ‘relative’] | ✓ | | ~ 128 chars | Type of Event Period |
repeatType | enum [‘always’, ‘daily’, ‘weekly’, ‘monthly’] | {scheduleType} == “absolute” | “always” | ~ 128 chars | Type of repetition |
absoluteBegin | long | {scheduleType} == “absolute” | | | Event start date and time |
absoluteEnd | long | {scheduleType} == “absolute” | | | Event end date and time |
repeatBeginDayOfMonth | int | {repeatType} == “monthly” | | 1 ~ 31 | Event repeat start date (If the value exceeds the days of the month, it is treated as the last day.) |
repeatEndDayOfMonth | int | {repeatType} == “monthly” | | 1 ~ 31 | Event repeat end date (If the value exceeds the days of the month, it is treated as the last day.) |
repeatBeginDayOfWeek | enum [‘sunday’, ‘monday’, ’tuesday’, ‘wednesday’, ’thursday’, ‘friday’, ‘saturday’] | {repeatType} == “weekly” | | ~ 128 chars | Repeat start day of event |
repeatEndDayOfWeek | enum [‘sunday’, ‘monday’, ’tuesday’, ‘wednesday’, ’thursday’, ‘friday’, ‘saturday’] | {repeatType} == “weekly” | | ~ 128 chars | Repeat event end day of the week |
repeatBeginHour | int | {repeatType} in [“daily”, “weekly”, “monthly”] | | ~ 23 | Repeat event start time |
repeatEndHour | int | {repeatType} in [“daily”, “weekly”, “monthly”] | | ~ 23 | Repeat event end time |
relativeTriggerName | string | {scheduleType} == “relative” | | ~ 128 chars | Trigger the start of the event |
relativeDuration | int | {scheduleType} == “relative” | | ~ 2147483646 | Event duration(seconds) |
Methods
getTrigger
Get the trigger being pulled
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
triggerName | string | ✓ | | ~ 128 chars | Trigger Name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
Result
Implementation Example
var domain = gs2.Schedule.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Trigger(
triggerName: "trigger1"
);
var item = await domain.ModelAsync();
var domain = gs2.Schedule.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Trigger(
triggerName: "trigger1"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Schedule->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Trigger(
"trigger1" // triggerName
);
const auto item = Domain.Model();
listTriggers
Get list of triggers being pulled
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
Result
| Type | Description |
---|
items | List<EzTrigger> | List of Triggers |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Schedule.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.TriggersAsync(
).ToListAsync();
var domain = gs2.Schedule.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Triggers(
);
List<EzTrigger> items = new List<EzTrigger>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->Schedule->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->Triggers(
);
for (auto Item : *It)
{
}
getEvent
Retrieve ongoing events
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
eventName | string | ✓ | | ~ 128 chars | Event Type Name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
Result
| Type | Description |
---|
item | EzEvent | Event |
repeatCount | int | Number of times to repeat |
Implementation Example
var domain = gs2.Schedule.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Event(
eventName: "event-0001"
);
var item = await domain.ModelAsync();
var domain = gs2.Schedule.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Event(
eventName: "event-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Schedule->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Event(
"event-0001" // eventName
);
const auto item = Domain.Model();
listEvents
Get list of events currently being held
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
Result
Implementation Example
var domain = gs2.Schedule.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.EventsAsync(
).ToListAsync();
var domain = gs2.Schedule.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Events(
);
List<EzEvent> items = new List<EzEvent>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->Schedule->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->Events(
);
for (auto Item : *It)
{
}