API Reference of GS2-News SDK for Game Engine

Model

EzNews

TypeRequireDefaultLimitationDescription
sectionstring~ 1024 charsSection Name
contentstring~ 1024 charsContent Name
titlestring~ 1024 charsArticle Headline
scheduleEventIdstring~ 1024 charsEvent GRN
timestamplongTimestamp
frontMatterstring~ 1024 charsFront Matter

EzSetCookieRequestEntry

TypeRequireDefaultLimitationDescription
keystring~ 128 charsKey value of the cookie you would like us to set to be able to view the article
valuestring~ 1024 chars記事を閲覧できるようにするために設定してほしい Cookie の値

Methods

getContentsUrl

Get list of cookies that need to be set to access the announcement article

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace Name
accessTokenstring~ 128 charsUser Id

Result

TypeDescription
itemsList<EzSetCookieRequestEntry>List of cookies that need to be set in order to access the content
browserUrlstringURL to access the content
zipUrlstringURL 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

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace Name
accessTokenstring~ 128 charsUser Id

Result

TypeDescription
itemsList<EzNews>List of Articles
contentHashstringHash value of article data
templateHashstringHash 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)
    {

    }