API Reference of GS2-News SDK for Game Engine
Model
EzNews
| Type | Require | Default | Limitation | Description |
---|
section | string | ✓ | | ~ 1024 chars | Section Name |
content | string | ✓ | | ~ 1024 chars | Content Name |
title | string | ✓ | | ~ 1024 chars | Article Headline |
scheduleEventId | string | | | ~ 1024 chars | Event GRN |
timestamp | long | ✓ | | | Timestamp |
frontMatter | string | ✓ | | ~ 1024 chars | Front Matter |
EzSetCookieRequestEntry
| Type | Require | Default | Limitation | Description |
---|
key | string | ✓ | | ~ 128 chars | Key value of the cookie you would like us to set to be able to view the article |
value | string | ✓ | | ~ 1024 chars | 記事を閲覧できるようにするために設定してほしい Cookie の値 |
Methods
getContentsUrl
Get list of cookies that need to be set to access the announcement article
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace Name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
Result
| Type | Description |
---|
items | List<EzSetCookieRequestEntry> | List of cookies that need to be set in order to access the content |
browserUrl | string | URL to access the content |
zipUrl | string | URL to access content in ZIP format / no cookie setting required to access |
Implementation Example
var domain = gs2.News.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).News(
);
var result = await domain.GetContentsUrlAsync(
);
List<EzSetCookieRequestEntry> cookies = new List<EzSetCookieRequestEntry>();
var items = result.ToList();
foreach (var item in items)
{
var entry = await item.ModelAsync();
cookies.Add(entry);
}
var browserUrl = domain.BrowserUrl;
var zipUrl = domain.ZipUrl;
var domain = gs2.News.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).News(
);
var future = domain.GetContentsUrlFuture(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
List<EzSetCookieRequestEntry> cookies = new List<EzSetCookieRequestEntry>();
var result = future.Result;
var items = result.ToList();
foreach (var item in items)
{
var future2 = item.Model();
yield return future2;
var entry = future2.Result;
cookies.Add(entry);
}
var browserUrl = domain.BrowserUrl;
var zipUrl = domain.ZipUrl;
const auto Domain = Gs2->News->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->News(
);
const auto Future = Domain->GetContentsUrl(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
TArray<EzSetCookieRequestEntryPtr> Cookies;
const auto It = Future->GetTask().Result();
foreach (auto Item in It)
{
const auto Future2 = Item.Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
Cookies.Add(Future->GetTask().Result());
}
const auto BrowserUrl = Domain->BrowserUrl;
const auto ZipUrl = Domain->ZipUrl;
listNewses
Retrieve list of announcement articles
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace Name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
Result
| Type | Description |
---|
items | List<EzNews> | List of Articles |
contentHash | string | Hash value of article data |
templateHash | string | Hash value of template data |
Implementation Example
var domain = gs2.News.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.NewsesAsync(
).ToListAsync();
var domain = gs2.News.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Newses(
);
List<EzNews> items = new List<EzNews>();
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->News->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->Newses(
);
for (auto Item : *It)
{
}