GS2-News SDK API Reference

Specification of models and API references for GS2-News SDK for various programming languages

Models

Namespace

Namespace

A Namespace allows multiple independent instances of the same service within a single project by separating data spaces and usage contexts. Each GS2 service is managed on a per-namespace basis. Even when using the same service, if the namespace differs, the data is treated as a completely independent data space.

Therefore, you must create a namespace before you can start using each service.

Details
Type Condition Required Default Value Limits Description
namespaceId string
*
~ 1024 chars Namespace GRN
* Set automatically by the server
name string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
description string ~ 1024 chars Description
version string ~ 1024 chars Version
The current version identifier of the deployed news content.
Updated automatically when new article data is uploaded or synchronized from a GitHub repository.
This value is confidential and not exposed to clients.
logSetting LogSetting Log Output Setting
Configuration for outputting API request/response logs to GS2-Log.
When configured, news operations (article retrieval, content generation, cookie issuance, etc.) are logged for monitoring and analysis.
createdAt long
*
Current time Creation Timestamp
Unix time, milliseconds
* Set automatically by the server
updatedAt long
*
Current time Last Updated Timestamp
Unix time, milliseconds
* Set automatically by the server
revision long 0 0 ~ 9223372036854775805 Revision

LogSetting

Log Output Setting

Log Output Setting defines how log data is exported. This type holds the GS2-Log namespace identifier (Namespace ID), which is used to export log data. Specify the GS2-Log namespace where log data is collected and stored in the GRN format for the Log Namespace ID (loggingNamespaceId). Configuring this setting ensures that log data for API requests and responses occurring within the specified namespace is output to the target GS2-Log namespace. GS2-Log provides real-time logs that can be used for system monitoring, analysis, debugging, and other operational purposes.

Details
Type Condition Required Default Value Limits Description
loggingNamespaceId string
~ 1024 chars GS2-Log namespace GRN to output logs
Must be specified in GRN format starting with “grn:gs2:”.

GitHubCheckoutSetting

Setting for checking out master data from GitHub

Details
Type Condition Required Default Value Limits Description
apiKeyId string
~ 1024 chars GitHub API Key GRN
repositoryName string
~ 1024 chars Repository Name
sourcePath string
~ 1024 chars Master data (JSON) file path
referenceType string (enum)
enum {
  “commit_hash”,
  “branch”,
  “tag”
}
Source of code
DefinitionDescription
“commit_hash”Commit hash
“branch”Branch
“tag”Tag
commitHash string {referenceType} == “commit_hash”
✓*
~ 1024 chars Commit hash
* Required if referenceType is “commit_hash”
branchName string {referenceType} == “branch”
✓*
~ 1024 chars Branch Name
* Required if referenceType is “branch”
tagName string {referenceType} == “tag”
✓*
~ 1024 chars Tag Name
* Required if referenceType is “tag”

Progress

Progress

Tracks the progress of generating static HTML content from uploaded Hugo site data. When article data is uploaded or synchronized from GitHub, content is generated for different user segments (patterns). This entity monitors how many patterns have been generated versus the total expected, and collects Output log entries during the process.

Details
Type Condition Required Default Value Limits Description
progressId string
*
~ 1024 chars Content generation progress GRN
* Set automatically by the server
uploadToken string
~ 1024 chars Upload Token
A token identifying the specific upload session that triggered this content generation.
Used to correlate the progress tracking with the original upload request.
generated int
0 ~ 1000 Generated Count
The number of content patterns that have been successfully generated so far.
This value increments as each pattern is processed. When it equals patternCount, generation is complete. Maximum 1000.
patternCount int
0 ~ 1000 Pattern Count
The total number of content patterns (templates) that need to be generated for this upload.
Represents the full scope of the generation task. Progress is measured as generated / patternCount. Maximum 1000.
createdAt long
*
Current time Creation Timestamp
Unix time, milliseconds
* Set automatically by the server
updatedAt long
*
Current time Last Updated Timestamp
Unix time, milliseconds
* Set automatically by the server
revision long 0 0 ~ 9223372036854775805 Revision

Output

Output

A log entry produced during the content generation process. Each Output records a message about the progress or result of generating static HTML from Hugo site data. Outputs are associated with a Progress entity.

Details
Type Condition Required Default Value Limits Description
outputId string
*
~ 1024 chars Output of content generation progress GRN
* Set automatically by the server
name string
UUID ~ 36 chars Output Name
Maintains a unique name for each output.
The name is automatically generated in UUID (Universally Unique Identifier) format and used to identify each output.
text string
~ 1048576 chars Text
The log message text produced during content generation.
May contain status messages, error details, or other information about the generation process. Maximum 1MB.
createdAt long
*
Current time Creation Timestamp
Unix time, milliseconds
* Set automatically by the server
revision long 0 0 ~ 9223372036854775805 Revision

News

News Article

Represents a single news article generated from Hugo site data. Each article belongs to a section and content path, and has a title, timestamp, and front matter metadata. Articles can optionally be linked to a GS2-Schedule event to control their display period. The front matter contains additional metadata in JSON format, including an optional weight field for controlling display order.

Details
Type Condition Required Default Value Limits Description
section string
~ 1024 chars Section Name
The section (category) to which this article belongs, corresponding to the Hugo content directory structure.
Used to organize articles into logical groups for display.
content string
~ 1024 chars Content
The content path identifier for this article within its section.
Together with the section, uniquely identifies the article’s location in the Hugo content structure.
title string
~ 1024 chars Article Headline
The title of the news article, typically defined in the Hugo front matter.
Displayed as the headline when listing articles for the player.
scheduleEventId string ~ 1024 chars GS2-Schedule Event GRN
timestamp long
Timestamp
Unix time, milliseconds
frontMatter string
~ 1024 chars Front Matter
Metadata associated with the article in JSON format, originally defined in the Hugo markdown front matter.
May contain arbitrary fields such as weight (for controlling display order), tags, categories, and other custom properties.

SetCookieRequestEntry

Set Cookie Request Entry

Represents a cookie key-value pair that must be set in the browser/WebView to access the news article web content. The client must set these cookies before loading the article URLs to ensure authorized access to the content.

Details
Type Condition Required Default Value Limits Description
key string
~ 128 chars Cookie Key
The name of the cookie that must be set for authenticated access to the news content.
Maximum 128 characters.
value string
~ 1024 chars Cookie Value
The value of the cookie that must be set for authenticated access to the news content.
Maximum 1024 characters.

View

View

Represents the difference between the current and previous versions of the news content for a specific user. Contains two lists: contents to be added or updated, and contents to be removed. This delta-based approach enables efficient incremental updates on the client side, avoiding the need to re-download all content on every update.

Details
Type Condition Required Default Value Limits Description
contents List<Content> 0 ~ 1000 items Contents to Add/Update
The list of content entries that should be added or updated in the client’s local cache.
These represent new or modified articles since the last version the user retrieved. Maximum 1000 entries.
removeContents List<Content> 0 ~ 1000 items Contents to Remove
The list of content entries that should be removed from the client’s local cache.
These represent articles that have been deleted or are no longer visible since the last version. Maximum 1000 entries.

Content

Content

Represents a content entry used in View definitions to specify which articles to include or exclude. Each Content is identified by a section and content path, and carries front matter metadata in JSON format. The front matter carries metadata in JSON format.

Details
Type Condition Required Default Value Limits Description
section string
~ 1024 chars Section
The section (category) path for this content entry, corresponding to the Hugo content directory structure.
content string
~ 1024 chars Content Path
The content path identifier within the section, used to uniquely identify this content entry.
Uniqueness within a View is enforced by this field.
frontMatter string
~ 1048576 chars Front Matter
Metadata associated with this content entry in JSON format.
Contains article properties such as title, date, weight, tags, and other Hugo front matter fields.
Can store up to 1MB of metadata.

Methods

describeNamespaces

Get a list of namespaces

Details

Request

Type Condition Required Default Value Limits Description
namePrefix string ~ 64 chars Filter by Namespace name prefix
pageToken string ~ 1024 chars Token specifying the position from which to start acquiring data
limit int 30 1 ~ 1000 Number of data items to retrieve

Result

Type Description
items List<Namespace> List of Namespaces
nextPageToken string Page token to retrieve the rest of the listing

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.DescribeNamespaces(
    &news.DescribeNamespacesRequest {
        NamePrefix: nil,
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\DescribeNamespacesRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->describeNamespaces(
        (new DescribeNamespacesRequest())
            ->withNamePrefix(null)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.DescribeNamespacesRequest;
import io.gs2.news.result.DescribeNamespacesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    DescribeNamespacesResult result = client.describeNamespaces(
        new DescribeNamespacesRequest()
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<Namespace> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
    new Gs2.Gs2News.Request.DescribeNamespacesRequest()
        .WithNamePrefix(null)
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.describeNamespaces(
        new Gs2News.DescribeNamespacesRequest()
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.describe_namespaces(
        news.DescribeNamespacesRequest()
            .with_name_prefix(None)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.describe_namespaces({
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('news')

api_result_handler = client.describe_namespaces_async({
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

createNamespace

Create a new Namespace

You must specify detailed information including the name, description, and various settings of the namespace.

Details

Request

Type Condition Required Default Value Limits Description
name string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
description string ~ 1024 chars Description
logSetting LogSetting Log Output Setting
Configuration for outputting API request/response logs to GS2-Log.
When configured, news operations (article retrieval, content generation, cookie issuance, etc.) are logged for monitoring and analysis.

Result

Type Description
item Namespace Namespace created

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &news.CreateNamespaceRequest {
        Name: pointy.String("namespace-0001"),
        Description: nil,
        LogSetting: &news.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\CreateNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName("namespace-0001")
            ->withDescription(null)
            ->withLogSetting((new \Gs2\News\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.CreateNamespaceRequest;
import io.gs2.news.result.CreateNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    CreateNamespaceResult result = client.createNamespace(
        new CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withLogSetting(new io.gs2.news.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
    new Gs2.Gs2News.Request.CreateNamespaceRequest()
        .WithName("namespace-0001")
        .WithDescription(null)
        .WithLogSetting(new Gs2.Gs2News.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.createNamespace(
        new Gs2News.CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withLogSetting(new Gs2News.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.create_namespace(
        news.CreateNamespaceRequest()
            .with_name('namespace-0001')
            .with_description(None)
            .with_log_setting(
                news.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.create_namespace({
    name="namespace-0001",
    description=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
    },
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('news')

api_result_handler = client.create_namespace_async({
    name="namespace-0001",
    description=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
    },
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

getNamespaceStatus

Get Namespace status

Get the current status of the specified namespace. This includes whether the Namespace is active, pending, or in some other state.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).

Result

Type Description
status string

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.GetNamespaceStatus(
    &news.GetNamespaceStatusRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
status := result.Status
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\GetNamespaceStatusRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->getNamespaceStatus(
        (new GetNamespaceStatusRequest())
            ->withNamespaceName("namespace-0001")
    );
    $status = $result->getStatus();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.GetNamespaceStatusRequest;
import io.gs2.news.result.GetNamespaceStatusResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    GetNamespaceStatusResult result = client.getNamespaceStatus(
        new GetNamespaceStatusRequest()
            .withNamespaceName("namespace-0001")
    );
    String status = result.getStatus();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
    new Gs2.Gs2News.Request.GetNamespaceStatusRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.getNamespaceStatus(
        new Gs2News.GetNamespaceStatusRequest()
            .withNamespaceName("namespace-0001")
    );
    const status = result.getStatus();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.get_namespace_status(
        news.GetNamespaceStatusRequest()
            .with_namespace_name('namespace-0001')
    )
    status = result.status
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.get_namespace_status({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
status = result.status;
client = gs2('news')

api_result_handler = client.get_namespace_status_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
status = result.status;

getNamespace

Get a Namespace

Get detailed information about the specified namespace. This includes the name, description, and other settings of the namespace.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).

Result

Type Description
item Namespace Namespace

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.GetNamespace(
    &news.GetNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\GetNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->getNamespace(
        (new GetNamespaceRequest())
            ->withNamespaceName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.GetNamespaceRequest;
import io.gs2.news.result.GetNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    GetNamespaceResult result = client.getNamespace(
        new GetNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
    new Gs2.Gs2News.Request.GetNamespaceRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.getNamespace(
        new Gs2News.GetNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.get_namespace(
        news.GetNamespaceRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.get_namespace({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('news')

api_result_handler = client.get_namespace_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

updateNamespace

Update Namespace

Update the settings of the specified Namespace. You can change the description and other settings of the Namespace.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
description string ~ 1024 chars Description
logSetting LogSetting Log Output Setting
Configuration for outputting API request/response logs to GS2-Log.
When configured, news operations (article retrieval, content generation, cookie issuance, etc.) are logged for monitoring and analysis.

Result

Type Description
item Namespace Namespace updated

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &news.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Description: pointy.String("description1"),
        LogSetting: &news.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\UpdateNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->updateNamespace(
        (new UpdateNamespaceRequest())
            ->withNamespaceName("namespace-0001")
            ->withDescription("description1")
            ->withLogSetting((new \Gs2\News\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.UpdateNamespaceRequest;
import io.gs2.news.result.UpdateNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withLogSetting(new io.gs2.news.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
    new Gs2.Gs2News.Request.UpdateNamespaceRequest()
        .WithNamespaceName("namespace-0001")
        .WithDescription("description1")
        .WithLogSetting(new Gs2.Gs2News.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.updateNamespace(
        new Gs2News.UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withLogSetting(new Gs2News.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.update_namespace(
        news.UpdateNamespaceRequest()
            .with_namespace_name('namespace-0001')
            .with_description('description1')
            .with_log_setting(
                news.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.update_namespace({
    namespaceName="namespace-0001",
    description="description1",
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
    },
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('news')

api_result_handler = client.update_namespace_async({
    namespaceName="namespace-0001",
    description="description1",
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
    },
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

deleteNamespace

Delete Namespace

Delete the specified Namespace. This operation is irreversible and all data associated with the deleted Namespace will be lost.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).

Result

Type Description
item Namespace The deleted Namespace

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.DeleteNamespace(
    &news.DeleteNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\DeleteNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->deleteNamespace(
        (new DeleteNamespaceRequest())
            ->withNamespaceName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.DeleteNamespaceRequest;
import io.gs2.news.result.DeleteNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    DeleteNamespaceResult result = client.deleteNamespace(
        new DeleteNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
    new Gs2.Gs2News.Request.DeleteNamespaceRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.deleteNamespace(
        new Gs2News.DeleteNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.delete_namespace(
        news.DeleteNamespaceRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.delete_namespace({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('news')

api_result_handler = client.delete_namespace_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

getServiceVersion

Get the microservice version

Details

Request

Request parameters: None

Result

Type Description
item string Version

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.GetServiceVersion(
    &news.GetServiceVersionRequest {
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\GetServiceVersionRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->getServiceVersion(
        (new GetServiceVersionRequest())
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.GetServiceVersionRequest;
import io.gs2.news.result.GetServiceVersionResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    GetServiceVersionResult result = client.getServiceVersion(
        new GetServiceVersionRequest()
    );
    String item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
    new Gs2.Gs2News.Request.GetServiceVersionRequest(),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.getServiceVersion(
        new Gs2News.GetServiceVersionRequest()
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.get_service_version(
        news.GetServiceVersionRequest()
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.get_service_version({
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('news')

api_result_handler = client.get_service_version_async({
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

describeProgresses

Get a list of content generation progress

Retrieves a paginated list of content generation progress records for the namespace. Each record represents the status of a site generation task.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
pageToken string ~ 1024 chars Token specifying the position from which to start acquiring data
limit int 30 1 ~ 1000 Number of data items to retrieve

Result

Type Description
items List<Progress> List of Content generation progress
nextPageToken string Page token to retrieve the rest of the listing

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.DescribeProgresses(
    &news.DescribeProgressesRequest {
        NamespaceName: pointy.String("namespace-0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\DescribeProgressesRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->describeProgresses(
        (new DescribeProgressesRequest())
            ->withNamespaceName("namespace-0001")
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.DescribeProgressesRequest;
import io.gs2.news.result.DescribeProgressesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    DescribeProgressesResult result = client.describeProgresses(
        new DescribeProgressesRequest()
            .withNamespaceName("namespace-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Progress> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.DescribeProgressesResult> asyncResult = null;
yield return client.DescribeProgresses(
    new Gs2.Gs2News.Request.DescribeProgressesRequest()
        .WithNamespaceName("namespace-0001")
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.describeProgresses(
        new Gs2News.DescribeProgressesRequest()
            .withNamespaceName("namespace-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.describe_progresses(
        news.DescribeProgressesRequest()
            .with_namespace_name('namespace-0001')
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.describe_progresses({
    namespaceName="namespace-0001",
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('news')

api_result_handler = client.describe_progresses_async({
    namespaceName="namespace-0001",
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

getProgress

Get content generation progress

Retrieves the content generation progress for the specified upload token. Shows the current status and details of the site generation task.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
uploadToken string
~ 1024 chars Upload Token
A token identifying the specific upload session that triggered this content generation.
Used to correlate the progress tracking with the original upload request.

Result

Type Description
item Progress Progress

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.GetProgress(
    &news.GetProgressRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UploadToken: pointy.String("upload-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\GetProgressRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->getProgress(
        (new GetProgressRequest())
            ->withNamespaceName("namespace-0001")
            ->withUploadToken("upload-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.GetProgressRequest;
import io.gs2.news.result.GetProgressResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    GetProgressResult result = client.getProgress(
        new GetProgressRequest()
            .withNamespaceName("namespace-0001")
            .withUploadToken("upload-0001")
    );
    Progress item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.GetProgressResult> asyncResult = null;
yield return client.GetProgress(
    new Gs2.Gs2News.Request.GetProgressRequest()
        .WithNamespaceName("namespace-0001")
        .WithUploadToken("upload-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.getProgress(
        new Gs2News.GetProgressRequest()
            .withNamespaceName("namespace-0001")
            .withUploadToken("upload-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.get_progress(
        news.GetProgressRequest()
            .with_namespace_name('namespace-0001')
            .with_upload_token('upload-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.get_progress({
    namespaceName="namespace-0001",
    uploadToken="upload-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('news')

api_result_handler = client.get_progress_async({
    namespaceName="namespace-0001",
    uploadToken="upload-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

describeOutputs

Get a list of output of content generation progress

Retrieves a paginated list of output logs from the content generation process for the specified upload token.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
uploadToken string
~ 1024 chars Upload Token
A token identifying the specific upload session that triggered this content generation.
Used to correlate the progress tracking with the original upload request.
pageToken string ~ 1024 chars Token specifying the position from which to start acquiring data
limit int 30 1 ~ 1000 Number of data items to retrieve

Result

Type Description
items List<Output> List of Output of content generation progress
nextPageToken string Page token to retrieve the rest of the listing

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.DescribeOutputs(
    &news.DescribeOutputsRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UploadToken: pointy.String("upload-0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\DescribeOutputsRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->describeOutputs(
        (new DescribeOutputsRequest())
            ->withNamespaceName("namespace-0001")
            ->withUploadToken("upload-0001")
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.DescribeOutputsRequest;
import io.gs2.news.result.DescribeOutputsResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    DescribeOutputsResult result = client.describeOutputs(
        new DescribeOutputsRequest()
            .withNamespaceName("namespace-0001")
            .withUploadToken("upload-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Output> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.DescribeOutputsResult> asyncResult = null;
yield return client.DescribeOutputs(
    new Gs2.Gs2News.Request.DescribeOutputsRequest()
        .WithNamespaceName("namespace-0001")
        .WithUploadToken("upload-0001")
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.describeOutputs(
        new Gs2News.DescribeOutputsRequest()
            .withNamespaceName("namespace-0001")
            .withUploadToken("upload-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.describe_outputs(
        news.DescribeOutputsRequest()
            .with_namespace_name('namespace-0001')
            .with_upload_token('upload-0001')
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.describe_outputs({
    namespaceName="namespace-0001",
    uploadToken="upload-0001",
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('news')

api_result_handler = client.describe_outputs_async({
    namespaceName="namespace-0001",
    uploadToken="upload-0001",
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

getOutput

Get output of content generation progress

Retrieves a specific output log entry from the content generation process by specifying the upload token and output name.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
uploadToken string
~ 1024 chars Upload Token
A token identifying the specific upload session that triggered this content generation.
Used to correlate the progress tracking with the original upload request.
outputName string
UUID ~ 36 chars Output Name
Maintains a unique name for each output.
The name is automatically generated in UUID (Universally Unique Identifier) format and used to identify each output.

Result

Type Description
item Output Output

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.GetOutput(
    &news.GetOutputRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UploadToken: pointy.String("upload-0001"),
        OutputName: pointy.String("output-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\GetOutputRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->getOutput(
        (new GetOutputRequest())
            ->withNamespaceName("namespace-0001")
            ->withUploadToken("upload-0001")
            ->withOutputName("output-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.GetOutputRequest;
import io.gs2.news.result.GetOutputResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    GetOutputResult result = client.getOutput(
        new GetOutputRequest()
            .withNamespaceName("namespace-0001")
            .withUploadToken("upload-0001")
            .withOutputName("output-0001")
    );
    Output item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.GetOutputResult> asyncResult = null;
yield return client.GetOutput(
    new Gs2.Gs2News.Request.GetOutputRequest()
        .WithNamespaceName("namespace-0001")
        .WithUploadToken("upload-0001")
        .WithOutputName("output-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.getOutput(
        new Gs2News.GetOutputRequest()
            .withNamespaceName("namespace-0001")
            .withUploadToken("upload-0001")
            .withOutputName("output-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.get_output(
        news.GetOutputRequest()
            .with_namespace_name('namespace-0001')
            .with_upload_token('upload-0001')
            .with_output_name('output-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.get_output({
    namespaceName="namespace-0001",
    uploadToken="upload-0001",
    outputName="output-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('news')

api_result_handler = client.get_output_async({
    namespaceName="namespace-0001",
    uploadToken="upload-0001",
    outputName="output-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

describeNews

Get a list of News Articles

Retrieves the list of news articles for the requesting user. Returns articles along with content hash and template hash for cache validation.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
accessToken string
~ 128 chars Access token

Result

Type Description
items List<News> List of News Articles
contentHash string Hash value of News Article data
templateHash string Hash value of template data

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.DescribeNews(
    &news.DescribeNewsRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
contentHash := result.ContentHash
templateHash := result.TemplateHash
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\DescribeNewsRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->describeNews(
        (new DescribeNewsRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
    );
    $items = $result->getItems();
    $contentHash = $result->getContentHash();
    $templateHash = $result->getTemplateHash();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.DescribeNewsRequest;
import io.gs2.news.result.DescribeNewsResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    DescribeNewsResult result = client.describeNews(
        new DescribeNewsRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
    );
    List<News> items = result.getItems();
    String contentHash = result.getContentHash();
    String templateHash = result.getTemplateHash();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.DescribeNewsResult> asyncResult = null;
yield return client.DescribeNews(
    new Gs2.Gs2News.Request.DescribeNewsRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var contentHash = result.ContentHash;
var templateHash = result.TemplateHash;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.describeNews(
        new Gs2News.DescribeNewsRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
    );
    const items = result.getItems();
    const contentHash = result.getContentHash();
    const templateHash = result.getTemplateHash();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.describe_news(
        news.DescribeNewsRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
    )
    items = result.items
    content_hash = result.content_hash
    template_hash = result.template_hash
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.describe_news({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
contentHash = result.contentHash;
templateHash = result.templateHash;
client = gs2('news')

api_result_handler = client.describe_news_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
contentHash = result.contentHash;
templateHash = result.templateHash;

describeNewsByUserId

Get a list of News Articles by specifying a user ID

Retrieves the list of news articles for the specified user. Returns articles along with content hash and template hash for cache validation.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userId string
~ 128 chars User ID
timeOffsetToken string ~ 1024 chars Time offset token

Result

Type Description
items List<News> List of News Articles
contentHash string Hash value of News Article data
templateHash string Hash value of template data

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.DescribeNewsByUserId(
    &news.DescribeNewsByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
contentHash := result.ContentHash
templateHash := result.TemplateHash
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\DescribeNewsByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->describeNewsByUserId(
        (new DescribeNewsByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $contentHash = $result->getContentHash();
    $templateHash = $result->getTemplateHash();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.DescribeNewsByUserIdRequest;
import io.gs2.news.result.DescribeNewsByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    DescribeNewsByUserIdResult result = client.describeNewsByUserId(
        new DescribeNewsByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    List<News> items = result.getItems();
    String contentHash = result.getContentHash();
    String templateHash = result.getTemplateHash();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.DescribeNewsByUserIdResult> asyncResult = null;
yield return client.DescribeNewsByUserId(
    new Gs2.Gs2News.Request.DescribeNewsByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var contentHash = result.ContentHash;
var templateHash = result.TemplateHash;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.describeNewsByUserId(
        new Gs2News.DescribeNewsByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const contentHash = result.getContentHash();
    const templateHash = result.getTemplateHash();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.describe_news_by_user_id(
        news.DescribeNewsByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_time_offset_token(None)
    )
    items = result.items
    content_hash = result.content_hash
    template_hash = result.template_hash
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.describe_news_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
contentHash = result.contentHash;
templateHash = result.templateHash;
client = gs2('news')

api_result_handler = client.describe_news_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
contentHash = result.contentHash;
templateHash = result.templateHash;

wantGrant

Get the information needed to access the News Article

Retrieves the cookies and URLs needed to access news web content for the requesting user. Returns cookies for browser-based access, a browser URL, and a ZIP URL for downloading content without cookies.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
accessToken string
~ 128 chars Access token

Result

Type Description
items List<SetCookieRequestEntry> 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 the announcement contents in ZIP format (Cookie setting is not required for access)

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.WantGrant(
    &news.WantGrantRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
browserUrl := result.BrowserUrl
zipUrl := result.ZipUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\WantGrantRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->wantGrant(
        (new WantGrantRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
    );
    $items = $result->getItems();
    $browserUrl = $result->getBrowserUrl();
    $zipUrl = $result->getZipUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.WantGrantRequest;
import io.gs2.news.result.WantGrantResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    WantGrantResult result = client.wantGrant(
        new WantGrantRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
    );
    List<SetCookieRequestEntry> items = result.getItems();
    String browserUrl = result.getBrowserUrl();
    String zipUrl = result.getZipUrl();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.WantGrantResult> asyncResult = null;
yield return client.WantGrant(
    new Gs2.Gs2News.Request.WantGrantRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var browserUrl = result.BrowserUrl;
var zipUrl = result.ZipUrl;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.wantGrant(
        new Gs2News.WantGrantRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
    );
    const items = result.getItems();
    const browserUrl = result.getBrowserUrl();
    const zipUrl = result.getZipUrl();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.want_grant(
        news.WantGrantRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
    )
    items = result.items
    browser_url = result.browser_url
    zip_url = result.zip_url
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.want_grant({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
browserUrl = result.browserUrl;
zipUrl = result.zipUrl;
client = gs2('news')

api_result_handler = client.want_grant_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
browserUrl = result.browserUrl;
zipUrl = result.zipUrl;

wantGrantByUserId

Get the information necessary to access a News Article by specifying a user ID

Retrieves the cookies and URLs needed to access news web content for the specified user. Returns cookies for browser-based access, a browser URL, and a ZIP URL for downloading content without cookies.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userId string
~ 128 chars User ID
timeOffsetToken string ~ 1024 chars Time offset token

Result

Type Description
items List<SetCookieRequestEntry> 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 the announcement contents in ZIP format (Cookie setting is not required for access)

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.WantGrantByUserId(
    &news.WantGrantByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
browserUrl := result.BrowserUrl
zipUrl := result.ZipUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\WantGrantByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->wantGrantByUserId(
        (new WantGrantByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $browserUrl = $result->getBrowserUrl();
    $zipUrl = $result->getZipUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.WantGrantByUserIdRequest;
import io.gs2.news.result.WantGrantByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    WantGrantByUserIdResult result = client.wantGrantByUserId(
        new WantGrantByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    List<SetCookieRequestEntry> items = result.getItems();
    String browserUrl = result.getBrowserUrl();
    String zipUrl = result.getZipUrl();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.WantGrantByUserIdResult> asyncResult = null;
yield return client.WantGrantByUserId(
    new Gs2.Gs2News.Request.WantGrantByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var browserUrl = result.BrowserUrl;
var zipUrl = result.ZipUrl;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.wantGrantByUserId(
        new Gs2News.WantGrantByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const browserUrl = result.getBrowserUrl();
    const zipUrl = result.getZipUrl();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.want_grant_by_user_id(
        news.WantGrantByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_time_offset_token(None)
    )
    items = result.items
    browser_url = result.browser_url
    zip_url = result.zip_url
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.want_grant_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
browserUrl = result.browserUrl;
zipUrl = result.zipUrl;
client = gs2('news')

api_result_handler = client.want_grant_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
browserUrl = result.browserUrl;
zipUrl = result.zipUrl;

prepareUpdateCurrentNewsMaster

Prepare updates to Currently Active Notice

Upload a zip file with compressed site data to the URL included in the response, and After the upload is complete, updateCurrentNewsMaster is called to reflect the results.

When uploading a zip file, Content-Type must be application/zip.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).

Result

Type Description
uploadToken string Token used to reflect results after upload
templateUploadUrl string URL used to execute the template upload process

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.PrepareUpdateCurrentNewsMaster(
    &news.PrepareUpdateCurrentNewsMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
uploadToken := result.UploadToken
templateUploadUrl := result.TemplateUploadUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\PrepareUpdateCurrentNewsMasterRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->prepareUpdateCurrentNewsMaster(
        (new PrepareUpdateCurrentNewsMasterRequest())
            ->withNamespaceName("namespace-0001")
    );
    $uploadToken = $result->getUploadToken();
    $templateUploadUrl = $result->getTemplateUploadUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.PrepareUpdateCurrentNewsMasterRequest;
import io.gs2.news.result.PrepareUpdateCurrentNewsMasterResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    PrepareUpdateCurrentNewsMasterResult result = client.prepareUpdateCurrentNewsMaster(
        new PrepareUpdateCurrentNewsMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    String uploadToken = result.getUploadToken();
    String templateUploadUrl = result.getTemplateUploadUrl();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.PrepareUpdateCurrentNewsMasterResult> asyncResult = null;
yield return client.PrepareUpdateCurrentNewsMaster(
    new Gs2.Gs2News.Request.PrepareUpdateCurrentNewsMasterRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var templateUploadUrl = result.TemplateUploadUrl;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.prepareUpdateCurrentNewsMaster(
        new Gs2News.PrepareUpdateCurrentNewsMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    const uploadToken = result.getUploadToken();
    const templateUploadUrl = result.getTemplateUploadUrl();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.prepare_update_current_news_master(
        news.PrepareUpdateCurrentNewsMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    upload_token = result.upload_token
    template_upload_url = result.template_upload_url
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.prepare_update_current_news_master({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
uploadToken = result.uploadToken;
templateUploadUrl = result.templateUploadUrl;
client = gs2('news')

api_result_handler = client.prepare_update_current_news_master_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
uploadToken = result.uploadToken;
templateUploadUrl = result.templateUploadUrl;

updateCurrentNewsMaster

Update currently available notices

Applies the uploaded site data to generate the news content.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
uploadToken string
~ 1024 chars Token received in preparation for upload

Result

Type Description

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentNewsMaster(
    &news.UpdateCurrentNewsMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UploadToken: pointy.String("token"),
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\UpdateCurrentNewsMasterRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->updateCurrentNewsMaster(
        (new UpdateCurrentNewsMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withUploadToken("token")
    );
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.UpdateCurrentNewsMasterRequest;
import io.gs2.news.result.UpdateCurrentNewsMasterResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    UpdateCurrentNewsMasterResult result = client.updateCurrentNewsMaster(
        new UpdateCurrentNewsMasterRequest()
            .withNamespaceName("namespace-0001")
            .withUploadToken("token")
    );
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.UpdateCurrentNewsMasterResult> asyncResult = null;
yield return client.UpdateCurrentNewsMaster(
    new Gs2.Gs2News.Request.UpdateCurrentNewsMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithUploadToken("token"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.updateCurrentNewsMaster(
        new Gs2News.UpdateCurrentNewsMasterRequest()
            .withNamespaceName("namespace-0001")
            .withUploadToken("token")
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.update_current_news_master(
        news.UpdateCurrentNewsMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_upload_token('token')
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.update_current_news_master({
    namespaceName="namespace-0001",
    uploadToken="token",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
client = gs2('news')

api_result_handler = client.update_current_news_master_async({
    namespaceName="namespace-0001",
    uploadToken="token",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result

prepareUpdateCurrentNewsMasterFromGitHub

Update currently available notices from GitHub

Prepares a news content update by checking out site data from a GitHub repository.

Details

Request

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
checkoutSetting GitHubCheckoutSetting
Setting for checking out master data from GitHub

Result

Type Description
uploadToken string Token used to reflect results after upload

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/news"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := news.Gs2NewsRestClient{
    Session: &session,
}
result, err := client.PrepareUpdateCurrentNewsMasterFromGitHub(
    &news.PrepareUpdateCurrentNewsMasterFromGitHubRequest {
        NamespaceName: pointy.String("namespace-0001"),
        CheckoutSetting: &news.GitHubCheckoutSetting{
            ApiKeyId: pointy.String("apiKeyId-0001"),
            RepositoryName: pointy.String("gs2io/master-data"),
            SourcePath: pointy.String("path/to/file.json"),
            ReferenceType: pointy.String("branch"),
            BranchName: pointy.String("develop"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
uploadToken := result.UploadToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\News\Gs2NewsRestClient;
use Gs2\News\Request\PrepareUpdateCurrentNewsMasterFromGitHubRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2NewsRestClient(
    $session
);

try {
    $result = $client->prepareUpdateCurrentNewsMasterFromGitHub(
        (new PrepareUpdateCurrentNewsMasterFromGitHubRequest())
            ->withNamespaceName("namespace-0001")
            ->withCheckoutSetting((new GitHubCheckoutSetting())
                ->withApiKeyId("apiKeyId-0001")
                ->withRepositoryName("gs2io/master-data")
                ->withSourcePath("path/to/file.json")
                ->withReferenceType("branch")
                ->withBranchName("develop")
            )
    );
    $uploadToken = $result->getUploadToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.news.rest.Gs2NewsRestClient;
import io.gs2.news.request.PrepareUpdateCurrentNewsMasterFromGitHubRequest;
import io.gs2.news.result.PrepareUpdateCurrentNewsMasterFromGitHubResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2NewsRestClient client = new Gs2NewsRestClient(session);

try {
    PrepareUpdateCurrentNewsMasterFromGitHubResult result = client.prepareUpdateCurrentNewsMasterFromGitHub(
        new PrepareUpdateCurrentNewsMasterFromGitHubRequest()
            .withNamespaceName("namespace-0001")
            .withCheckoutSetting(new GitHubCheckoutSetting()
                .withApiKeyId("apiKeyId-0001")
                .withRepositoryName("gs2io/master-data")
                .withSourcePath("path/to/file.json")
                .withReferenceType("branch")
                .withBranchName("develop")
            )
    );
    String uploadToken = result.getUploadToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2NewsRestClient(session);

AsyncResult<Gs2.Gs2News.Result.PrepareUpdateCurrentNewsMasterFromGitHubResult> asyncResult = null;
yield return client.PrepareUpdateCurrentNewsMasterFromGitHub(
    new Gs2.Gs2News.Request.PrepareUpdateCurrentNewsMasterFromGitHubRequest()
        .WithNamespaceName("namespace-0001")
        .WithCheckoutSetting(new Gs2.Gs2News.Model.GitHubCheckoutSetting()
            .WithApiKeyId("apiKeyId-0001")
            .WithRepositoryName("gs2io/master-data")
            .WithSourcePath("path/to/file.json")
            .WithReferenceType("branch")
            .WithBranchName("develop")
        ),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
import Gs2Core from '@/gs2/core';
import * as Gs2News from '@/gs2/news';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2News.Gs2NewsRestClient(session);

try {
    const result = await client.prepareUpdateCurrentNewsMasterFromGitHub(
        new Gs2News.PrepareUpdateCurrentNewsMasterFromGitHubRequest()
            .withNamespaceName("namespace-0001")
            .withCheckoutSetting(new Gs2News.model.GitHubCheckoutSetting()
                .withApiKeyId("apiKeyId-0001")
                .withRepositoryName("gs2io/master-data")
                .withSourcePath("path/to/file.json")
                .withReferenceType("branch")
                .withBranchName("develop")
            )
    );
    const uploadToken = result.getUploadToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import news

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = news.Gs2NewsRestClient(session)

try:
    result = client.prepare_update_current_news_master_from_git_hub(
        news.PrepareUpdateCurrentNewsMasterFromGitHubRequest()
            .with_namespace_name('namespace-0001')
            .with_checkout_setting(news.GitHubCheckoutSetting()
                .with_api_key_id('apiKeyId-0001')
                .with_repository_name('gs2io/master-data')
                .with_source_path('path/to/file.json')
                .with_reference_type('branch')
                .with_branch_name('develop')
            )
    )
    upload_token = result.upload_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('news')

api_result = client.prepare_update_current_news_master_from_git_hub({
    namespaceName="namespace-0001",
    checkoutSetting={
        api_key_id="apiKeyId-0001",
        repository_name="gs2io/master-data",
        source_path="path/to/file.json",
        reference_type="branch",
        branch_name="develop",
    },
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
uploadToken = result.uploadToken;
client = gs2('news')

api_result_handler = client.prepare_update_current_news_master_from_git_hub_async({
    namespaceName="namespace-0001",
    checkoutSetting={
        api_key_id="apiKeyId-0001",
        repository_name="gs2io/master-data",
        source_path="path/to/file.json",
        reference_type="branch",
        branch_name="develop",
    },
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
uploadToken = result.uploadToken;