GS2-News SDK API リファレンス モデル Namespace ネームスペース
ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。 GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
型 有効化条件 必須 デフォルト 値の制限 説明 namespaceId string ✓ ~ 1024文字 ネームスペースGRN name string ✓ ~ 128文字 ネームスペースの名前 description string ~ 1024文字 説明文 version string ~ 1024文字 バージョン logSetting LogSetting ログの出力設定 createdAt long ✓ 現在時刻 作成日時 (UNIX時間 単位:ミリ秒) updatedAt long ✓ 現在時刻 最終更新日時 (UNIX時間 単位:ミリ秒) revision long 0 ~ 9223372036854775805 リビジョン
Progress コンテンツ生成進捗
型 有効化条件 必須 デフォルト 値の制限 説明 progressId string ✓ ~ 1024文字 コンテンツ生成進捗GRN uploadToken string ✓ ~ 1024文字 アップロードトークン generated int ✓ ~ 1000 生成済みコンテンツ数 patternCount int ✓ ~ 1000 コンテンツ数 createdAt long ✓ 現在時刻 作成日時 (UNIX時間 単位:ミリ秒) updatedAt long ✓ 現在時刻 最終更新日時 (UNIX時間 単位:ミリ秒) revision long 0 ~ 9223372036854775805 リビジョン
Output コンテンツ生成進捗出力
型 有効化条件 必須 デフォルト 値の制限 説明 outputId string ✓ ~ 1024文字 コンテンツ生成進捗出力GRN name string ✓ UUID ~ 36文字 出力名 text string ✓ ~ 1048576文字 テキスト createdAt long ✓ 現在時刻 作成日時 (UNIX時間 単位:ミリ秒) revision long 0 ~ 9223372036854775805 リビジョン
View ビュー
Content コンテンツ
型 有効化条件 必須 デフォルト 値の制限 説明 section string ✓ ~ 1024文字 セクション content string ✓ ~ 1024文字 コンテンツ名 frontMatter string ✓ ~ 1048576文字 Front Matter
News お知らせ記事
型 有効化条件 必須 デフォルト 値の制限 説明 section string ✓ ~ 1024文字 セクション名 content string ✓ ~ 1024文字 コンテンツ名 title string ✓ ~ 1024文字 記事見出し scheduleEventId string ~ 1024文字 GS2-Schedule イベントGRN timestamp long ✓ タイムスタンプ (UNIX時間 単位:ミリ秒) frontMatter string ✓ ~ 1024文字 Front Matter
SetCookieRequestEntry お知らせコンテンツにアクセスするために設定の必要なクッキー
型 有効化条件 必須 デフォルト 値の制限 説明 key string ✓ ~ 128文字 記事の閲覧に必要な Cookie 設定 のキー値 value string ✓ ~ 1024文字 記事の閲覧に必要な Cookie 設定 の値
LogSetting ログの書き出し設定
ログデータの書き出し設定を管理します。この型は、ログデータを書き出すために使用されるログ名前空間の識別子(Namespace ID)を保持します。 ログ名前空間IDは、ログデータを集約し、保存する対象の GS2-Log の名前空間を指定します。 この設定を通じて、この名前空間以下のAPIリクエスト・レスポンスログデータが対象の GS2-Log へ出力されるようになります。 GS2-Log にはリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。
型 有効化条件 必須 デフォルト 値の制限 説明 loggingNamespaceId string ✓ ~ 1024文字 ネームスペースGRN
GitHubCheckoutSetting GitHubからマスターデータをチェックアウトする設定
型 有効化条件 必須 デフォルト 値の制限 説明 apiKeyId string ✓ ~ 1024文字 GitHub のAPIキーGRN repositoryName string ✓ ~ 1024文字 リポジトリ名 sourcePath string ✓ ~ 1024文字 ソースコードのファイルパス referenceType enum { “commit_hash”, “branch”, “tag” } ✓ ~ 128文字 コードの取得元 commitHash string {referenceType} == “commit_hash” ✓ ~ 1024文字 コミットハッシュ branchName string {referenceType} == “branch” ✓ ~ 1024文字 ブランチ名 tagName string {referenceType} == “tag” ✓ ~ 1024文字 タグ名
referenceType に指定する列挙型の定義 定義 説明 commit_hash コミットハッシュ branch ブランチ tag タグ
メソッド describeNamespaces ネームスペースの一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン limit int ✓ 30 1 ~ 1000 データの取得件数
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 {
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> describeNamespaces (
( new DescribeNamespacesRequest ())
-> 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 ()
. withPageToken ( null )
. withLimit ( null )
);
List < Namespace > items = result . getItems ();
String nextPageToken = result . getNextPageToken ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.DescribeNamespacesRequest ;
using Gs2.Gs2News.Result.DescribeNamespacesResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . DescribeNamespacesResult > asyncResult = null ;
yield return client . DescribeNamespaces (
new Gs2 . Gs2News . Request . DescribeNamespacesRequest ()
. 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 ()
. 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_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 ({
pageToken = nil ,
limit = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
client = gs2 ( 'news' )
api_result_handler = client.describe_namespaces_async ({
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 [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
createNamespace ネームスペースを新規作成
Request 型 有効化条件 必須 デフォルト 値の制限 説明 name string ✓ ~ 128文字 ネームスペースの名前 description string ~ 1024文字 説明文 logSetting LogSetting ログの出力設定
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
Description : nil ,
LogSetting : & news . LogSetting {
LoggingNamespaceId : pointy . String ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1" ),
},
}
)
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> createNamespace (
( new CreateNamespaceRequest ())
-> withName ( self :: namespace1 )
-> withDescription ( null )
-> withLogSetting (( new \Gs2\News\Model\LogSetting ())
-> withLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log: \n amespace1" ))
);
$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 ( "namespace1" )
. withDescription ( null )
. withLogSetting ( new io . gs2 . news . model . LogSetting ()
. withLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1" ))
);
Namespace item = result . getItem ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.CreateNamespaceRequest ;
using Gs2.Gs2News.Result.CreateNamespaceResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . CreateNamespaceResult > asyncResult = null ;
yield return client . CreateNamespace (
new Gs2 . Gs2News . Request . CreateNamespaceRequest ()
. WithName ( "namespace1" )
. WithDescription ( null )
. WithLogSetting ( new Gs2 . Gs2News . Model . LogSetting ()
. WithLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1" )),
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 ( "namespace1" )
. withDescription ( null )
. withLogSetting ( new Gs2News . model . LogSetting ()
. withLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1" ))
);
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 ( self . hash1 )
. with_description ( None )
. with_log_setting (
news . LogSetting ()
. with_logging_namespace_id ( 'grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1' ))
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'news' )
api_result = client.create_namespace ({
name = "namespace1" ,
description = nil ,
logSetting = {
loggingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1" ,
},
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'news' )
api_result_handler = client.create_namespace_async ({
name = "namespace1" ,
description = nil ,
logSetting = {
loggingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1" ,
},
})
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 [ 'message' ])
end
result = api_result.result
item = result.item ;
getNamespaceStatus ネームスペースの状態を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
}
)
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> getNamespaceStatus (
( new GetNamespaceStatusRequest ())
-> withNamespaceName ( self :: namespace1 )
);
$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 ( "namespace1" )
);
String status = result . getStatus ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.GetNamespaceStatusRequest ;
using Gs2.Gs2News.Result.GetNamespaceStatusResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . GetNamespaceStatusResult > asyncResult = null ;
yield return client . GetNamespaceStatus (
new Gs2 . Gs2News . Request . GetNamespaceStatusRequest ()
. WithNamespaceName ( "namespace1" ),
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 ( "namespace1" )
);
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 ( self . hash1 )
)
status = result . status
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'news' )
api_result = client.get_namespace_status ({
namespaceName = "namespace1" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
status = result.status ;
client = gs2 ( 'news' )
api_result_handler = client.get_namespace_status_async ({
namespaceName = "namespace1" ,
})
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 [ 'message' ])
end
result = api_result.result
status = result.status ;
getNamespace ネームスペースを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
}
)
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> getNamespace (
( new GetNamespaceRequest ())
-> withNamespaceName ( self :: namespace1 )
);
$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 ( "namespace1" )
);
Namespace item = result . getItem ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.GetNamespaceRequest ;
using Gs2.Gs2News.Result.GetNamespaceResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . GetNamespaceResult > asyncResult = null ;
yield return client . GetNamespace (
new Gs2 . Gs2News . Request . GetNamespaceRequest ()
. WithNamespaceName ( "namespace1" ),
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 ( "namespace1" )
);
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 ( self . hash1 )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'news' )
api_result = client.get_namespace ({
namespaceName = "namespace1" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'news' )
api_result_handler = client.get_namespace_async ({
namespaceName = "namespace1" ,
})
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 [ 'message' ])
end
result = api_result.result
item = result.item ;
updateNamespace ネームスペースを更新
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 description string ~ 1024文字 説明文 logSetting LogSetting ログの出力設定
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
Description : pointy . String ( "description1" ),
LogSetting : & news . LogSetting {
LoggingNamespaceId : pointy . String ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1" ),
},
}
)
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> updateNamespace (
( new UpdateNamespaceRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withDescription ( "description1" )
-> withLogSetting (( new \Gs2\News\Model\LogSetting ())
-> withLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log: \n amespace1" ))
);
$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 ( "namespace1" )
. withDescription ( "description1" )
. withLogSetting ( new io . gs2 . news . model . LogSetting ()
. withLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1" ))
);
Namespace item = result . getItem ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.UpdateNamespaceRequest ;
using Gs2.Gs2News.Result.UpdateNamespaceResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . UpdateNamespaceResult > asyncResult = null ;
yield return client . UpdateNamespace (
new Gs2 . Gs2News . Request . UpdateNamespaceRequest ()
. WithNamespaceName ( "namespace1" )
. WithDescription ( "description1" )
. WithLogSetting ( new Gs2 . Gs2News . Model . LogSetting ()
. WithLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1" )),
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 ( "namespace1" )
. withDescription ( "description1" )
. withLogSetting ( new Gs2News . model . LogSetting ()
. withLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1" ))
);
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 ( self . hash1 )
. with_description ( 'description1' )
. with_log_setting (
news . LogSetting ()
. with_logging_namespace_id ( 'grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1' ))
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'news' )
api_result = client.update_namespace ({
namespaceName = "namespace1" ,
description = "description1" ,
logSetting = {
loggingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1" ,
},
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'news' )
api_result_handler = client.update_namespace_async ({
namespaceName = "namespace1" ,
description = "description1" ,
logSetting = {
loggingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1" ,
},
})
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 [ 'message' ])
end
result = api_result.result
item = result.item ;
deleteNamespace ネームスペースを削除
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
}
)
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> deleteNamespace (
( new DeleteNamespaceRequest ())
-> withNamespaceName ( self :: namespace1 )
);
$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 ( "namespace1" )
);
Namespace item = result . getItem ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.DeleteNamespaceRequest ;
using Gs2.Gs2News.Result.DeleteNamespaceResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . DeleteNamespaceResult > asyncResult = null ;
yield return client . DeleteNamespace (
new Gs2 . Gs2News . Request . DeleteNamespaceRequest ()
. WithNamespaceName ( "namespace1" ),
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 ( "namespace1" )
);
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 ( self . hash1 )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'news' )
api_result = client.delete_namespace ({
namespaceName = "namespace1" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'news' )
api_result_handler = client.delete_namespace_async ({
namespaceName = "namespace1" ,
})
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 [ 'message' ])
end
result = api_result.result
item = result.item ;
describeProgresses コンテンツ生成進捗の一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン limit int ✓ 30 1 ~ 1000 データの取得件数
Result 型 説明 items List<Progress> コンテンツ生成進捗のリスト nextPageToken string リストの続きを取得するためのページトークン
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> describeProgresses (
( new DescribeProgressesRequest ())
-> withNamespaceName ( self :: namespace1 )
-> 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 ( "namespace1" )
. withPageToken ( null )
. withLimit ( null )
);
List < Progress > items = result . getItems ();
String nextPageToken = result . getNextPageToken ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.DescribeProgressesRequest ;
using Gs2.Gs2News.Result.DescribeProgressesResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . DescribeProgressesResult > asyncResult = null ;
yield return client . DescribeProgresses (
new Gs2 . Gs2News . Request . DescribeProgressesRequest ()
. WithNamespaceName ( "namespace1" )
. 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 ( "namespace1" )
. 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 ( self . hash1 )
. 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 = "namespace1" ,
pageToken = nil ,
limit = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
client = gs2 ( 'news' )
api_result_handler = client.describe_progresses_async ({
namespaceName = "namespace1" ,
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 [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
getProgress コンテンツ生成進捗を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 uploadToken string ✓ ~ 1024文字 アップロードトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> getProgress (
( new GetProgressRequest ())
-> withNamespaceName ( self :: namespace1 )
-> 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 ( "namespace1" )
. withUploadToken ( "upload-0001" )
);
Progress item = result . getItem ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.GetProgressRequest ;
using Gs2.Gs2News.Result.GetProgressResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . GetProgressResult > asyncResult = null ;
yield return client . GetProgress (
new Gs2 . Gs2News . Request . GetProgressRequest ()
. WithNamespaceName ( "namespace1" )
. 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 ( "namespace1" )
. 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 ( self . hash1 )
. with_upload_token ( 'upload-0001' )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'news' )
api_result = client.get_progress ({
namespaceName = "namespace1" ,
uploadToken = "upload-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'news' )
api_result_handler = client.get_progress_async ({
namespaceName = "namespace1" ,
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 [ 'message' ])
end
result = api_result.result
item = result.item ;
describeOutputs コンテンツ生成進捗出力の一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 uploadToken string ✓ ~ 1024文字 アップロードトークン pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン limit int ✓ 30 1 ~ 1000 データの取得件数
Result 型 説明 items List<Output> コンテンツ生成進捗出力のリスト nextPageToken string リストの続きを取得するためのページトークン
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> describeOutputs (
( new DescribeOutputsRequest ())
-> withNamespaceName ( self :: namespace1 )
-> 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 ( "namespace1" )
. 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.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.DescribeOutputsRequest ;
using Gs2.Gs2News.Result.DescribeOutputsResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . DescribeOutputsResult > asyncResult = null ;
yield return client . DescribeOutputs (
new Gs2 . Gs2News . Request . DescribeOutputsRequest ()
. WithNamespaceName ( "namespace1" )
. 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 ( "namespace1" )
. 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 ( self . hash1 )
. 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 = "namespace1" ,
uploadToken = "upload-0001" ,
pageToken = nil ,
limit = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
client = gs2 ( 'news' )
api_result_handler = client.describe_outputs_async ({
namespaceName = "namespace1" ,
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 [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
getOutput コンテンツ生成進捗出力を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 uploadToken string ✓ ~ 1024文字 アップロードトークン outputName string ✓ UUID ~ 36文字 出力名
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> getOutput (
( new GetOutputRequest ())
-> withNamespaceName ( self :: namespace1 )
-> 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 ( "namespace1" )
. withUploadToken ( "upload-0001" )
. withOutputName ( "output-0001" )
);
Output item = result . getItem ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.GetOutputRequest ;
using Gs2.Gs2News.Result.GetOutputResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . GetOutputResult > asyncResult = null ;
yield return client . GetOutput (
new Gs2 . Gs2News . Request . GetOutputRequest ()
. WithNamespaceName ( "namespace1" )
. 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 ( "namespace1" )
. 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 ( self . hash1 )
. 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 = "namespace1" ,
uploadToken = "upload-0001" ,
outputName = "output-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'news' )
api_result_handler = client.get_output_async ({
namespaceName = "namespace1" ,
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 [ 'message' ])
end
result = api_result.result
item = result.item ;
prepareUpdateCurrentNewsMaster 現在有効なお知らせを更新準備する
応答に含まれるURLにサイトデータを圧縮したzipファイルをアップロードし アップロード完了後に updateCurrentNewsMaster を呼び出して反映します。
zipファイルをアップロードする際には Content-Type に application/zip を指定する必要があります。
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前
Result 型 説明 uploadToken string アップロード後に結果を反映する際に使用するトークン templateUploadUrl string テンプレートアップロード処理の実行に使用するURL
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
}
)
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> prepareUpdateCurrentNewsMaster (
( new PrepareUpdateCurrentNewsMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
);
$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 ( "namespace1" )
);
String uploadToken = result . getUploadToken ();
String templateUploadUrl = result . getTemplateUploadUrl ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.PrepareUpdateCurrentNewsMasterRequest ;
using Gs2.Gs2News.Result.PrepareUpdateCurrentNewsMasterResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . PrepareUpdateCurrentNewsMasterResult > asyncResult = null ;
yield return client . PrepareUpdateCurrentNewsMaster (
new Gs2 . Gs2News . Request . PrepareUpdateCurrentNewsMasterRequest ()
. WithNamespaceName ( "namespace1" ),
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 ( "namespace1" )
);
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 ( self . hash1 )
)
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 = "namespace1" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
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 = "namespace1" ,
})
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 [ 'message' ])
end
result = api_result.result
uploadToken = result.uploadToken ;
templateUploadUrl = result.templateUploadUrl ;
updateCurrentNewsMaster 現在有効なお知らせを更新
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 uploadToken string ✓ ~ 1024文字 アップロード準備で受け取ったトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> updateCurrentNewsMaster (
( new UpdateCurrentNewsMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
-> 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 ( "namespace1" )
. withUploadToken ( "token" )
);
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.UpdateCurrentNewsMasterRequest ;
using Gs2.Gs2News.Result.UpdateCurrentNewsMasterResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . UpdateCurrentNewsMasterResult > asyncResult = null ;
yield return client . UpdateCurrentNewsMaster (
new Gs2 . Gs2News . Request . UpdateCurrentNewsMasterRequest ()
. WithNamespaceName ( "namespace1" )
. 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 ( "namespace1" )
. 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 ( self . hash1 )
. with_upload_token ( 'token' )
)
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'news' )
api_result = client.update_current_news_master ({
namespaceName = "namespace1" ,
uploadToken = "token" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
client = gs2 ( 'news' )
api_result_handler = client.update_current_news_master_async ({
namespaceName = "namespace1" ,
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 [ 'message' ])
end
result = api_result.result
prepareUpdateCurrentNewsMasterFromGitHub 現在有効なお知らせを更新
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 checkoutSetting GitHubCheckoutSetting ✓ GitHubからマスターデータをチェックアウトしてくる設定
Result 型 説明 uploadToken string アップロード後に結果を反映する際に使用するトークン
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
CheckoutSetting : & news . GitHubCheckoutSetting {
ApiKeyId : pointy . String ( "$gitHubApiKey1.apiKeyId" ),
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> prepareUpdateCurrentNewsMasterFromGitHub (
( new PrepareUpdateCurrentNewsMasterFromGitHubRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withCheckoutSetting (( new GitHubCheckoutSetting ())
-> withApiKeyId ( self :: $gitHubApiKey1 . apiKeyId )
-> 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 ( "namespace1" )
. withCheckoutSetting ( new GitHubCheckoutSetting ()
. withApiKeyId ( "$gitHubApiKey1.apiKeyId" )
. 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.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.PrepareUpdateCurrentNewsMasterFromGitHubRequest ;
using Gs2.Gs2News.Result.PrepareUpdateCurrentNewsMasterFromGitHubResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . PrepareUpdateCurrentNewsMasterFromGitHubResult > asyncResult = null ;
yield return client . PrepareUpdateCurrentNewsMasterFromGitHub (
new Gs2 . Gs2News . Request . PrepareUpdateCurrentNewsMasterFromGitHubRequest ()
. WithNamespaceName ( "namespace1" )
. WithCheckoutSetting ( new Gs2 . Gs2News . Model . GitHubCheckoutSetting ()
. WithApiKeyId ( "$gitHubApiKey1.apiKeyId" )
. 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 ( "namespace1" )
. withCheckoutSetting ( new Gs2News . model . GitHubCheckoutSetting ()
. withApiKeyId ( "$gitHubApiKey1.apiKeyId" )
. 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 ( self . hash1 )
. with_checkout_setting ( news . GitHubCheckoutSetting ()
. with_api_key_id ( self . git_hub_api_key1 . api_key_id )
. 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 = "namespace1" ,
checkoutSetting = {
api_key_id = "$gitHubApiKey1.apiKeyId" ,
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 [ 'message' ])
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 = "namespace1" ,
checkoutSetting = {
api_key_id = "$gitHubApiKey1.apiKeyId" ,
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 [ 'message' ])
end
result = api_result.result
uploadToken = result.uploadToken ;
describeNews お知らせ記事の一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 accessToken string ✓ ~ 128文字 ユーザーID
Result 型 説明 items List<News> お知らせ記事のリスト contentHash string お知らせ記事データのハッシュ値 templateHash string テンプレートデータのハッシュ値
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> describeNews (
( new DescribeNewsRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withAccessToken ( self :: $accessToken0001 )
);
$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 ( "namespace1" )
. 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.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.DescribeNewsRequest ;
using Gs2.Gs2News.Result.DescribeNewsResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . DescribeNewsResult > asyncResult = null ;
yield return client . DescribeNews (
new Gs2 . Gs2News . Request . DescribeNewsRequest ()
. WithNamespaceName ( "namespace1" )
. 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 ( "namespace1" )
. 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 ( self . hash1 )
. with_access_token ( self . access_token_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 = "namespace1" ,
accessToken = "accessToken-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
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 = "namespace1" ,
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 [ 'message' ])
end
result = api_result.result
items = result.items ;
contentHash = result.contentHash ;
templateHash = result.templateHash ;
describeNewsByUserId ユーザIDを指定してお知らせ記事の一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 型 説明 items List<News> お知らせ記事のリスト contentHash string お知らせ記事データのハッシュ値 templateHash string テンプレートデータのハッシュ値
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> describeNewsByUserId (
( new DescribeNewsByUserIdRequest ())
-> withNamespaceName ( self :: namespace1 )
-> 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 ( "namespace1" )
. 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.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.DescribeNewsByUserIdRequest ;
using Gs2.Gs2News.Result.DescribeNewsByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . DescribeNewsByUserIdResult > asyncResult = null ;
yield return client . DescribeNewsByUserId (
new Gs2 . Gs2News . Request . DescribeNewsByUserIdRequest ()
. WithNamespaceName ( "namespace1" )
. 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 ( "namespace1" )
. 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 ( self . hash1 )
. 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 = "namespace1" ,
userId = "user-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
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 = "namespace1" ,
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 [ 'message' ])
end
result = api_result.result
items = result.items ;
contentHash = result.contentHash ;
templateHash = result.templateHash ;
wantGrant お知らせ記事にアクセスするために必要な情報を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 accessToken string ✓ ~ 128文字 ユーザーID
Result 型 説明 items List<SetCookieRequestEntry> お知らせコンテンツにアクセスするために設定の必要なクッキーのリスト browserUrl string お知らせコンテンツにアクセスするためのURL zipUrl string ZIP形式のお知らせコンテンツにアクセスするためのURL (アクセスにCookieの設定は不要)
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> wantGrant (
( new WantGrantRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withAccessToken ( self :: $accessToken0001 )
);
$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 ( "namespace1" )
. 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.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.WantGrantRequest ;
using Gs2.Gs2News.Result.WantGrantResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . WantGrantResult > asyncResult = null ;
yield return client . WantGrant (
new Gs2 . Gs2News . Request . WantGrantRequest ()
. WithNamespaceName ( "namespace1" )
. 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 ( "namespace1" )
. 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 ( self . hash1 )
. with_access_token ( self . access_token_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 = "namespace1" ,
accessToken = "accessToken-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
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 = "namespace1" ,
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 [ 'message' ])
end
result = api_result.result
items = result.items ;
browserUrl = result.browserUrl ;
zipUrl = result.zipUrl ;
wantGrantByUserId ユーザーIDを指定してお知らせ記事にアクセスするために必要な情報を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 型 説明 items List<SetCookieRequestEntry> お知らせコンテンツにアクセスするために設定の必要なクッキーのリスト browserUrl string お知らせコンテンツにアクセスするためのURL zipUrl string ZIP形式のお知らせコンテンツにアクセスするためのURL (アクセスにCookieの設定は不要)
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "namespace1" ),
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 Gs2AccountRestClient (
$session
);
try {
$result = $client -> wantGrantByUserId (
( new WantGrantByUserIdRequest ())
-> withNamespaceName ( self :: namespace1 )
-> 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 ( "namespace1" )
. 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.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2News.Gs2NewsRestClient ;
using Gs2.Gs2News.Request.WantGrantByUserIdRequest ;
using Gs2.Gs2News.Result.WantGrantByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2NewsRestClient ( session );
AsyncResult < Gs2 . Gs2News . Result . WantGrantByUserIdResult > asyncResult = null ;
yield return client . WantGrantByUserId (
new Gs2 . Gs2News . Request . WantGrantByUserIdRequest ()
. WithNamespaceName ( "namespace1" )
. 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 ( "namespace1" )
. 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 ( self . hash1 )
. 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 = "namespace1" ,
userId = "user-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
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 = "namespace1" ,
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 [ 'message' ])
end
result = api_result.result
items = result.items ;
browserUrl = result.browserUrl ;
zipUrl = result.zipUrl ;