API Reference of GS2-News SDK for Game Engine

Model

EzNews

Notification Articles

TypeRequireDefaultLimitationDescription
sectionstring~ 1024 charsSection Name
contentstring~ 1024 charsContent Name
titlestring~ 1024 charsArticle Headline
scheduleEventIdstring~ 1024 charsGS2-Schedule Event GRN
timestamplongTimestamp
frontMatterstring~ 1024 charsFront Matter

EzSetCookieRequestEntry

Cookies that need to be set in order to access the announcement content

TypeRequireDefaultLimitationDescription
keystring~ 128 charsKey value for cookie settings required to view the article
valuestring~ 1024 charsCookie setting value required to view the article

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 the announcement contents in ZIP format (Cookie setting is not required for 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(
        GameSession
    )->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 (Future2->GetTask().IsError())
        {
            return Future2->GetTask().Error();
        }
        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(
        GameSession
    );
    const auto It = Domain->Newses(
    );
    TArray<Gs2::UE5::News::Model::FEzNewsPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }