GS2-Distributor SDK API リファレンス
モデル
Namespace
ネームスペース
ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。
GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceId | string | ✓ | ~ 1024文字 | ネームスペースGRN | ||
name | string | ✓ | ~ 128文字 | ネームスペース名 | ||
description | string | ~ 1024文字 | 説明文 | |||
assumeUserId | string | ~ 1024文字 | ユーザGRN | |||
autoRunStampSheetNotification | NotificationSetting | ✓ | トランザクションの自動実行が完了したときのプッシュ通知(旧仕様) | |||
autoRunTransactionNotification | NotificationSetting | ✓ | トランザクションの自動実行が完了したときのプッシュ通知 | |||
logSetting | LogSetting | ログの出力設定 | ||||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
DistributorModelMaster
配信設定モデルマスター
配信設定とはエンティティの入手時に所持枠を超えて入手した時のポリシーを設定するエンティティです。
GS2-Distributor を通して入手処理を行うことで、あふれたリソースを GS2-Inbox のメッセージとして転送することができます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
distributorModelId | string | ✓ | ~ 1024文字 | 配信設定マスターGRN | ||
name | string | ✓ | ~ 128文字 | 配信設定名 | ||
description | string | ~ 1024文字 | 説明文 | |||
metadata | string | ~ 2048文字 | メタデータ | |||
inboxNamespaceId | string | ~ 1024文字 | あふれたリソースを転送する GS2-Inbox のネームスペースGRN | |||
whiteListTargetIds | List<string> | [] | ~ 100 items | ディストリビューターを通して処理出来る対象のリソースGRNのホワイトリスト | ||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
DistributorModel
配信設定モデル
配信設定とはエンティティの入手時に所持枠を超えて入手した時のポリシーを設定するエンティティです。
GS2-Distributor を通して入手処理を行うことで、あふれたリソースを GS2-Inbox のメッセージとして転送することができます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
distributorModelId | string | ✓ | ~ 1024文字 | 配信設定GRN | ||
name | string | ✓ | ~ 128文字 | 配信設定名 | ||
metadata | string | ~ 2048文字 | メタデータ | |||
inboxNamespaceId | string | ~ 1024文字 | あふれたリソースを転送する GS2-Inbox のネームスペースGRN | |||
whiteListTargetIds | List<string> | [] | ~ 1000 items | ディストリビューターを通して処理出来る対象のリソースGRNのホワイトリスト |
CurrentDistributorMaster
現在有効なマスターデータ
GS2ではマスターデータの管理にJSON形式のファイルを使用します。
ファイルをアップロードすることで、実際にサーバーに設定を反映することができます。
JSONファイルを作成する方法として、マネージメントコンソール上でのマスターデータエディタを提供していますが
よりゲームの運営に相応しいツールを作成し、適切なフォーマットのJSONファイルを書き出すことでもサービスを利用可能です。
Note
JSONファイルの形式については GS2-Distributor マスターデータリファレンス をご参照ください。型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceId | string | ✓ | ~ 1024文字 | 現在有効な配信設定GRN | ||
settings | string | ✓ | ~ 5242880文字 | マスターデータ |
StampSheetResult
トランザクション実行結果
サーバーサイドでのトランザクションの自動実行機能を利用して実行されたトランザクションの実行結果
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
stampSheetResultId | string | ✓ | ~ 1024文字 | トランザクション実行結果GRN | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
transactionId | string | ✓ | 36 ~ 36文字 | トランザクションID | ||
verifyTaskRequests | List<VerifyAction> | ~ 100 items | 検証アクションのリクエスト内容 | |||
taskRequests | List<ConsumeAction> | ~ 100 items | 消費アクションのリクエスト内容 | |||
sheetRequest | AcquireAction | ✓ | 入手アクションのリクエスト内容 | |||
verifyTaskResultCodes | List<int> | [] | ~ 100 items | 検証アクションの実行ステータスコード | ||
verifyTaskResults | List<string> | [] | ~ 100 items | 検証アクションの実行結果 | ||
taskResultCodes | List<int> | [] | ~ 100 items | 消費アクションの実行ステータスコード | ||
taskResults | List<string> | [] | ~ 100 items | 消費アクションの実行結果 | ||
sheetResultCode | int | ~ 999 | 入手アクションの実行ステータスコード | |||
sheetResult | string | ~ 1048576文字 | 入手アクションの実行結果レスポンス内容 | |||
nextTransactionId | string | 36 ~ 36文字 | トランザクションの実行によって、新しく発行されたトランザクションのトランザクションID | |||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
BatchRequestPayload
API一括実行リクエスト
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
requestId | string | ✓ | ~ 128文字 | リクエストID | ||
service | enum { “account”, “adReward”, “auth”, “buff”, “chat”, “datastore”, “deploy”, “dictionary”, “distributor”, “enchant”, “enhance”, “exchange”, “experience”, “formation”, “friend”, “gateway”, “grade”, “guard”, “guild”, “identifier”, “idle”, “inbox”, “inventory”, “jobQueue”, “key”, “limit”, “lock”, “log”, “loginReward”, “lottery”, “matchmaking”, “megaField”, “mission”, “money”, “money2”, “news”, “quest”, “ranking”, “ranking2”, “realtime”, “schedule”, “script”, “seasonRating”, “serialKey”, “showcase”, “skillTree”, “stamina”, “stateMachine”, “version” } | ✓ | ~ 128文字 | マイクロサービス名 | ||
methodName | string | ✓ | ~ 128文字 | メソッド名 | ||
parameter | string | ✓ | ~ 10240文字 | メソッド名 |
service に指定する列挙型の定義
定義 | 説明 |
---|---|
account | GS2-Account |
adReward | GS2-AdReward |
auth | GS2-Auth |
buff | GS2-Buff |
chat | GS2-Chat |
datastore | GS2-Datastore |
deploy | GS2-Deploy |
dictionary | GS2-Dictionary |
distributor | GS2-Distributor |
enchant | GS2-Enchant |
enhance | GS2-Enhance |
exchange | GS2-Exchange |
experience | GS2-Experience |
formation | GS2-Formation |
friend | GS2-Friend |
gateway | GS2-Gateway |
grade | GS2-Grade |
guard | GS2-Guard |
guild | GS2-Guild |
identifier | GS2-Identifier |
idle | GS2-Idle |
inbox | GS2-Inbox |
inventory | GS2-Inventory |
jobQueue | GS2-JobQueue |
key | GS2-Key |
limit | GS2-Limit |
lock | GS2-Lock |
log | GS2-Log |
loginReward | GS2-LoginReward |
lottery | GS2-Lottery |
matchmaking | GS2-Matchmaking |
megaField | GS2-MegaField |
mission | GS2-Mission |
money | GS2-Money |
money2 | GS2-Money2 |
news | GS2-News |
quest | GS2-Quest |
ranking | GS2-Ranking |
ranking2 | GS2-Ranking2 |
realtime | GS2-Realtime |
schedule | GS2-Schedule |
script | GS2-Script |
seasonRating | GS2-SeasonRating |
serialKey | GS2-SerialKey |
showcase | GS2-Showcase |
skillTree | GS2-SkillTree |
stamina | GS2-Stamina |
stateMachine | GS2-StateMachine |
version | GS2-Version |
BatchResultPayload
API一括実行結果
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
requestId | string | ✓ | ~ 128文字 | リクエストID | ||
statusCode | int | ✓ | 100 ~ 1000 | ステータスコード | ||
resultPayload | string | ✓ | ~ 10240文字 | レスポンス |
AcquireAction
入手アクション
ConsumeAction
消費アクション
VerifyAction
検証アクション
TransactionResult
トランザクション実行結果
サーバーサイドでのトランザクションの自動実行機能を利用して実行されたトランザクションの実行結果
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
transactionResultId | string | ✓ | ~ 1024文字 | トランザクション実行結果GRN | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
transactionId | string | ✓ | 36 ~ 36文字 | トランザクションID | ||
verifyResults | List<VerifyActionResult> | ~ 100 items | 検証アクションの実行結果リスト | |||
consumeResults | List<ConsumeActionResult> | ~ 100 items | 消費アクションの実行結果リスト | |||
acquireResults | List<AcquireActionResult> | ~ 100 items | 入手アクションの実行結果リスト | |||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
AcquireActionResult
入手アクションの実行結果
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
action | enum { } | ✓ | ~ 128文字 | 入手アクションで実行するアクションの種類 | ||
acquireRequest | string | ✓ | ~ 1048576文字 | リクエストのJSON | ||
statusCode | int | ~ 999 | ステータスコード | |||
acquireResult | string | ~ 1048576文字 | 結果内容 |
action に指定する列挙型の定義
定義 | 説明 |
---|
ConsumeActionResult
消費アクションの実行結果
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
action | enum { } | ✓ | ~ 128文字 | 消費アクションで実行するアクションの種類 | ||
consumeRequest | string | ✓ | ~ 1048576文字 | リクエストのJSON | ||
statusCode | int | ~ 999 | ステータスコード | |||
consumeResult | string | ~ 1048576文字 | 結果内容 |
action に指定する列挙型の定義
定義 | 説明 |
---|
VerifyActionResult
検証アクションの実行結果
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
action | enum { } | ✓ | ~ 128文字 | 検証アクションで実行するアクションの種類 | ||
verifyRequest | string | ✓ | ~ 1048576文字 | リクエストのJSON | ||
statusCode | int | ~ 999 | ステータスコード | |||
verifyResult | string | ~ 1048576文字 | 結果内容 |
action に指定する列挙型の定義
定義 | 説明 |
---|
Config
コンフィグ設定
トランザクションの変数に適用する設定値
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
key | string | ✓ | ~ 64文字 | 名前 | ||
value | string | ~ 51200文字 | 値 |
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 | タグ |
DistributeResource
リソース配布
LogSetting
ログの書き出し設定
ログデータの書き出し設定を管理します。この型は、ログデータを書き出すために使用されるログ名前空間の識別子(Namespace ID)を保持します。
ログ名前空間IDは、ログデータを集約し、保存する対象の GS2-Log の名前空間を指定します。
この設定を通じて、この名前空間以下のAPIリクエスト・レスポンスログデータが対象の GS2-Log へ出力されるようになります。
GS2-Log にはリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
loggingNamespaceId | string | ✓ | ~ 1024文字 | ネームスペースGRN |
NotificationSetting
プッシュ通知に関する設定
GS2 のマイクロサービス内で何らかのイベントが発生した際に、プッシュ通知を送信するための設定です。
ここでいうプッシュ通知は GS2-Gateway の提供する WebSocket インターフェースを経由した処理であり、スマートフォンのプッシュ通知とは性質が異なります。
たとえば、マッチメイキングが完了した時やフレンドリクエストが届いた時など、ゲームクライアントの操作とは関係なく状態が変化した際に GS2-Gateway を経由してプッシュ通知をすることで、ゲームクライアントは状態の変化を検知することができます。
GS2-Gateway のプッシュ通知は通知先のデバイスがオフラインだった時に追加の処理としてモバイルプッシュ通知を送信できます。
モバイルプッシュ通知をうまく利用すれば、マッチメイキング中にゲームを終了しても、モバイルプッシュ通知を使用してプレイヤーに通知し、ゲームに戻ってくるフローを実現できる可能性があります。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
gatewayNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:gateway:default” | ~ 1024文字 | プッシュ通知に使用する GS2-Gateway のネームスペース | |
enableTransferMobileNotification | bool? | false | モバイルプッシュ通知へ転送するか | |||
sound | string | {enableTransferMobileNotification} == true | ~ 1024文字 | モバイルプッシュ通知で使用するサウンドファイル名 |
メソッド
describeNamespaces
ネームスペースの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | List<Namespace> | ネームスペースのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&distributor.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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DescribeNamespacesRequest;
import io.gs2.distributor.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.DescribeNamespacesRequest;
using Gs2.Gs2Distributor.Result.DescribeNamespacesResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Distributor.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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2Distributor.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 distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.describe_namespaces(
distributor.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('distributor')
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('distributor')
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文字 | 説明文 | |||
assumeUserId | string | ~ 1024文字 | ユーザGRN | |||
autoRunStampSheetNotification | NotificationSetting | ✓ | トランザクションの自動実行が完了したときのプッシュ通知(旧仕様) | |||
autoRunTransactionNotification | NotificationSetting | ✓ | トランザクションの自動実行が完了したときのプッシュ通知 | |||
logSetting | LogSetting | ログの出力設定 |
Result
型 | 説明 | |
---|---|---|
item | Namespace | 作成したネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&distributor.CreateNamespaceRequest {
Name: pointy.String("namespace-0001"),
Description: nil,
AssumeUserId: pointy.String("grn:gs2::YourOwnerId:identifier:user:user-0001"),
AutoRunStampSheetNotification: nil,
AutoRunTransactionNotification: nil,
LogSetting: &distributor.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\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("namespace-0001")
->withDescription(null)
->withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
->withAutoRunStampSheetNotification(null)
->withAutoRunTransactionNotification(null)
->withLogSetting((new \Gs2\Distributor\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.CreateNamespaceRequest;
import io.gs2.distributor.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace-0001")
.withDescription(null)
.withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
.withAutoRunStampSheetNotification(null)
.withAutoRunTransactionNotification(null)
.withLogSetting(new io.gs2.distributor.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.CreateNamespaceRequest;
using Gs2.Gs2Distributor.Result.CreateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Distributor.Request.CreateNamespaceRequest()
.WithName("namespace-0001")
.WithDescription(null)
.WithAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
.WithAutoRunStampSheetNotification(null)
.WithAutoRunTransactionNotification(null)
.WithLogSetting(new Gs2.Gs2Distributor.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.createNamespace(
new Gs2Distributor.CreateNamespaceRequest()
.withName("namespace-0001")
.withDescription(null)
.withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
.withAutoRunStampSheetNotification(null)
.withAutoRunTransactionNotification(null)
.withLogSetting(new Gs2Distributor.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.create_namespace(
distributor.CreateNamespaceRequest()
.with_name('namespace-0001')
.with_description(None)
.with_assume_user_id('grn:gs2::YourOwnerId:identifier:user:user-0001')
.with_auto_run_stamp_sheet_notification(None)
.with_auto_run_transaction_notification(None)
.with_log_setting(
distributor.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.create_namespace({
name="namespace-0001",
description=nil,
assumeUserId="grn:gs2::YourOwnerId:identifier:user:user-0001",
autoRunStampSheetNotification=nil,
autoRunTransactionNotification=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('distributor')
api_result_handler = client.create_namespace_async({
name="namespace-0001",
description=nil,
assumeUserId="grn:gs2::YourOwnerId:identifier:user:user-0001",
autoRunStampSheetNotification=nil,
autoRunTransactionNotification=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getNamespaceStatus
ネームスペースの状態を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
status | string |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&distributor.GetNamespaceStatusRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
status := result.Status
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\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("namespace-0001")
);
$status = $result->getStatus();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetNamespaceStatusRequest;
import io.gs2.distributor.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetNamespaceStatusResult result = client.getNamespaceStatus(
new GetNamespaceStatusRequest()
.withNamespaceName("namespace-0001")
);
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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Distributor.Result.GetNamespaceStatusResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Distributor.Request.GetNamespaceStatusRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2Distributor.GetNamespaceStatusRequest()
.withNamespaceName("namespace-0001")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_namespace_status(
distributor.GetNamespaceStatusRequest()
.with_namespace_name('namespace-0001')
)
status = result.status
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.get_namespace_status({
namespaceName="namespace-0001",
})
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('distributor')
api_result_handler = client.get_namespace_status_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
status = result.status;
getNamespace
ネームスペースを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
item | Namespace | ネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&distributor.GetNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\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("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetNamespaceRequest;
import io.gs2.distributor.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetNamespaceResult result = client.getNamespace(
new GetNamespaceRequest()
.withNamespaceName("namespace-0001")
);
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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.GetNamespaceRequest;
using Gs2.Gs2Distributor.Result.GetNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Distributor.Request.GetNamespaceRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getNamespace(
new Gs2Distributor.GetNamespaceRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_namespace(
distributor.GetNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.get_namespace({
namespaceName="namespace-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('distributor')
api_result_handler = client.get_namespace_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateNamespace
ネームスペースを更新
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
description | string | ~ 1024文字 | 説明文 | |||
assumeUserId | string | ~ 1024文字 | ユーザGRN | |||
autoRunStampSheetNotification | NotificationSetting | ✓ | トランザクションの自動実行が完了したときのプッシュ通知(旧仕様) | |||
autoRunTransactionNotification | NotificationSetting | ✓ | トランザクションの自動実行が完了したときのプッシュ通知 | |||
logSetting | LogSetting | ログの出力設定 |
Result
型 | 説明 | |
---|---|---|
item | Namespace | 更新したネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&distributor.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
Description: pointy.String("description1"),
AssumeUserId: pointy.String("grn:gs2::YourOwnerId:identifier:user:user-0001"),
AutoRunStampSheetNotification: nil,
AutoRunTransactionNotification: nil,
LogSetting: nil,
}
)
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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\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("namespace-0001")
->withDescription("description1")
->withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
->withAutoRunStampSheetNotification(null)
->withAutoRunTransactionNotification(null)
->withLogSetting(null)
);
$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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.UpdateNamespaceRequest;
import io.gs2.distributor.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace-0001")
.withDescription("description1")
.withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
.withAutoRunStampSheetNotification(null)
.withAutoRunTransactionNotification(null)
.withLogSetting(null)
);
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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.UpdateNamespaceRequest;
using Gs2.Gs2Distributor.Result.UpdateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Distributor.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace-0001")
.WithDescription("description1")
.WithAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
.WithAutoRunStampSheetNotification(null)
.WithAutoRunTransactionNotification(null)
.WithLogSetting(null),
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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2Distributor.UpdateNamespaceRequest()
.withNamespaceName("namespace-0001")
.withDescription("description1")
.withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
.withAutoRunStampSheetNotification(null)
.withAutoRunTransactionNotification(null)
.withLogSetting(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.update_namespace(
distributor.UpdateNamespaceRequest()
.with_namespace_name('namespace-0001')
.with_description('description1')
.with_assume_user_id('grn:gs2::YourOwnerId:identifier:user:user-0001')
.with_auto_run_stamp_sheet_notification(None)
.with_auto_run_transaction_notification(None)
.with_log_setting(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.update_namespace({
namespaceName="namespace-0001",
description="description1",
assumeUserId="grn:gs2::YourOwnerId:identifier:user:user-0001",
autoRunStampSheetNotification=nil,
autoRunTransactionNotification=nil,
logSetting=nil,
})
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('distributor')
api_result_handler = client.update_namespace_async({
namespaceName="namespace-0001",
description="description1",
assumeUserId="grn:gs2::YourOwnerId:identifier:user:user-0001",
autoRunStampSheetNotification=nil,
autoRunTransactionNotification=nil,
logSetting=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
item = result.item;
deleteNamespace
ネームスペースを削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
item | Namespace | 削除したネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&distributor.DeleteNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\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("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DeleteNamespaceRequest;
import io.gs2.distributor.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
DeleteNamespaceResult result = client.deleteNamespace(
new DeleteNamespaceRequest()
.withNamespaceName("namespace-0001")
);
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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.DeleteNamespaceRequest;
using Gs2.Gs2Distributor.Result.DeleteNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Distributor.Request.DeleteNamespaceRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2Distributor.DeleteNamespaceRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.delete_namespace(
distributor.DeleteNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.delete_namespace({
namespaceName="namespace-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('distributor')
api_result_handler = client.delete_namespace_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
describeDistributorModelMasters
配信設定マスターの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | List<DistributorModelMaster> | 配信設定マスターのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.DescribeDistributorModelMasters(
&distributor.DescribeDistributorModelMastersRequest {
NamespaceName: pointy.String("namespace-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DescribeDistributorModelMastersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeDistributorModelMasters(
(new DescribeDistributorModelMastersRequest())
->withNamespaceName("namespace-0001")
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DescribeDistributorModelMastersRequest;
import io.gs2.distributor.result.DescribeDistributorModelMastersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
DescribeDistributorModelMastersResult result = client.describeDistributorModelMasters(
new DescribeDistributorModelMastersRequest()
.withNamespaceName("namespace-0001")
.withPageToken(null)
.withLimit(null)
);
List<DistributorModelMaster> 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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.DescribeDistributorModelMastersRequest;
using Gs2.Gs2Distributor.Result.DescribeDistributorModelMastersResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.DescribeDistributorModelMastersResult> asyncResult = null;
yield return client.DescribeDistributorModelMasters(
new Gs2.Gs2Distributor.Request.DescribeDistributorModelMastersRequest()
.WithNamespaceName("namespace-0001")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.describeDistributorModelMasters(
new Gs2Distributor.DescribeDistributorModelMastersRequest()
.withNamespaceName("namespace-0001")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.describe_distributor_model_masters(
distributor.DescribeDistributorModelMastersRequest()
.with_namespace_name('namespace-0001')
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.describe_distributor_model_masters({
namespaceName="namespace-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('distributor')
api_result_handler = client.describe_distributor_model_masters_async({
namespaceName="namespace-0001",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
createDistributorModelMaster
配信設定マスターを新規作成
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
name | string | ✓ | ~ 128文字 | 配信設定名 | ||
description | string | ~ 1024文字 | 説明文 | |||
metadata | string | ~ 2048文字 | メタデータ | |||
inboxNamespaceId | string | ~ 1024文字 | あふれたリソースを転送する GS2-Inbox のネームスペースGRN | |||
whiteListTargetIds | List<string> | [] | ~ 100 items | ディストリビューターを通して処理出来る対象のリソースGRNのホワイトリスト |
Result
型 | 説明 | |
---|---|---|
item | DistributorModelMaster | 作成した配信設定マスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.CreateDistributorModelMaster(
&distributor.CreateDistributorModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
Name: pointy.String("distributor-model-0001"),
Description: nil,
Metadata: nil,
InboxNamespaceId: nil,
WhiteListTargetIds: nil,
}
)
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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\CreateDistributorModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createDistributorModelMaster(
(new CreateDistributorModelMasterRequest())
->withNamespaceName("namespace-0001")
->withName("distributor-model-0001")
->withDescription(null)
->withMetadata(null)
->withInboxNamespaceId(null)
->withWhiteListTargetIds(null)
);
$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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.CreateDistributorModelMasterRequest;
import io.gs2.distributor.result.CreateDistributorModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
CreateDistributorModelMasterResult result = client.createDistributorModelMaster(
new CreateDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withName("distributor-model-0001")
.withDescription(null)
.withMetadata(null)
.withInboxNamespaceId(null)
.withWhiteListTargetIds(null)
);
DistributorModelMaster 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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.CreateDistributorModelMasterRequest;
using Gs2.Gs2Distributor.Result.CreateDistributorModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.CreateDistributorModelMasterResult> asyncResult = null;
yield return client.CreateDistributorModelMaster(
new Gs2.Gs2Distributor.Request.CreateDistributorModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithName("distributor-model-0001")
.WithDescription(null)
.WithMetadata(null)
.WithInboxNamespaceId(null)
.WithWhiteListTargetIds(null),
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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.createDistributorModelMaster(
new Gs2Distributor.CreateDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withName("distributor-model-0001")
.withDescription(null)
.withMetadata(null)
.withInboxNamespaceId(null)
.withWhiteListTargetIds(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.create_distributor_model_master(
distributor.CreateDistributorModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_name('distributor-model-0001')
.with_description(None)
.with_metadata(None)
.with_inbox_namespace_id(None)
.with_white_list_target_ids(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.create_distributor_model_master({
namespaceName="namespace-0001",
name="distributor-model-0001",
description=nil,
metadata=nil,
inboxNamespaceId=nil,
whiteListTargetIds=nil,
})
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('distributor')
api_result_handler = client.create_distributor_model_master_async({
namespaceName="namespace-0001",
name="distributor-model-0001",
description=nil,
metadata=nil,
inboxNamespaceId=nil,
whiteListTargetIds=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
item = result.item;
getDistributorModelMaster
配信設定マスターを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
distributorName | string | ✓ | ~ 128文字 | 配信設定名 |
Result
型 | 説明 | |
---|---|---|
item | DistributorModelMaster | 配信設定マスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetDistributorModelMaster(
&distributor.GetDistributorModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
DistributorName: pointy.String("distributor-model-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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetDistributorModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getDistributorModelMaster(
(new GetDistributorModelMasterRequest())
->withNamespaceName("namespace-0001")
->withDistributorName("distributor-model-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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetDistributorModelMasterRequest;
import io.gs2.distributor.result.GetDistributorModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetDistributorModelMasterResult result = client.getDistributorModelMaster(
new GetDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
);
DistributorModelMaster 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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.GetDistributorModelMasterRequest;
using Gs2.Gs2Distributor.Result.GetDistributorModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetDistributorModelMasterResult> asyncResult = null;
yield return client.GetDistributorModelMaster(
new Gs2.Gs2Distributor.Request.GetDistributorModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithDistributorName("distributor-model-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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getDistributorModelMaster(
new Gs2Distributor.GetDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_distributor_model_master(
distributor.GetDistributorModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_distributor_name('distributor-model-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.get_distributor_model_master({
namespaceName="namespace-0001",
distributorName="distributor-model-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('distributor')
api_result_handler = client.get_distributor_model_master_async({
namespaceName="namespace-0001",
distributorName="distributor-model-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;
updateDistributorModelMaster
配信設定マスターを更新
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
distributorName | string | ✓ | ~ 128文字 | 配信設定名 | ||
description | string | ~ 1024文字 | 説明文 | |||
metadata | string | ~ 2048文字 | メタデータ | |||
inboxNamespaceId | string | ~ 1024文字 | あふれたリソースを転送する GS2-Inbox のネームスペースGRN | |||
whiteListTargetIds | List<string> | [] | ~ 100 items | ディストリビューターを通して処理出来る対象のリソースGRNのホワイトリスト |
Result
型 | 説明 | |
---|---|---|
item | DistributorModelMaster | 更新した配信設定マスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.UpdateDistributorModelMaster(
&distributor.UpdateDistributorModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
DistributorName: pointy.String("distributor-model-0001"),
Description: pointy.String("description1"),
Metadata: pointy.String("{\"hoge\": \"fuga\"}"),
InboxNamespaceId: pointy.String("inbox-0001"),
WhiteListTargetIds: []*string{
pointy.String("grn:AAA"),
pointy.String("grn:BBB"),
},
}
)
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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\UpdateDistributorModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateDistributorModelMaster(
(new UpdateDistributorModelMasterRequest())
->withNamespaceName("namespace-0001")
->withDistributorName("distributor-model-0001")
->withDescription("description1")
->withMetadata("{\"hoge\": \"fuga\"}")
->withInboxNamespaceId("inbox-0001")
->withWhiteListTargetIds([
"grn:AAA",
"grn:BBB",
])
);
$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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.UpdateDistributorModelMasterRequest;
import io.gs2.distributor.result.UpdateDistributorModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
UpdateDistributorModelMasterResult result = client.updateDistributorModelMaster(
new UpdateDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
.withDescription("description1")
.withMetadata("{\"hoge\": \"fuga\"}")
.withInboxNamespaceId("inbox-0001")
.withWhiteListTargetIds(Arrays.asList(
"grn:AAA",
"grn:BBB"
))
);
DistributorModelMaster 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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.UpdateDistributorModelMasterRequest;
using Gs2.Gs2Distributor.Result.UpdateDistributorModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.UpdateDistributorModelMasterResult> asyncResult = null;
yield return client.UpdateDistributorModelMaster(
new Gs2.Gs2Distributor.Request.UpdateDistributorModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithDistributorName("distributor-model-0001")
.WithDescription("description1")
.WithMetadata("{\"hoge\": \"fuga\"}")
.WithInboxNamespaceId("inbox-0001")
.WithWhiteListTargetIds(new string[] {
"grn:AAA",
"grn:BBB",
}),
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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.updateDistributorModelMaster(
new Gs2Distributor.UpdateDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
.withDescription("description1")
.withMetadata("{\"hoge\": \"fuga\"}")
.withInboxNamespaceId("inbox-0001")
.withWhiteListTargetIds([
"grn:AAA",
"grn:BBB",
])
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.update_distributor_model_master(
distributor.UpdateDistributorModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_distributor_name('distributor-model-0001')
.with_description('description1')
.with_metadata('{"hoge": "fuga"}')
.with_inbox_namespace_id('inbox-0001')
.with_white_list_target_ids([
'grn:AAA',
'grn:BBB',
])
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.update_distributor_model_master({
namespaceName="namespace-0001",
distributorName="distributor-model-0001",
description="description1",
metadata="{\"hoge\": \"fuga\"}",
inboxNamespaceId="inbox-0001",
whiteListTargetIds={
"grn:AAA",
"grn:BBB"
},
})
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('distributor')
api_result_handler = client.update_distributor_model_master_async({
namespaceName="namespace-0001",
distributorName="distributor-model-0001",
description="description1",
metadata="{\"hoge\": \"fuga\"}",
inboxNamespaceId="inbox-0001",
whiteListTargetIds={
"grn:AAA",
"grn:BBB"
},
})
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;
deleteDistributorModelMaster
配信設定マスターを削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
distributorName | string | ✓ | ~ 128文字 | 配信設定名 |
Result
型 | 説明 | |
---|---|---|
item | DistributorModelMaster | 削除した配信設定マスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.DeleteDistributorModelMaster(
&distributor.DeleteDistributorModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
DistributorName: pointy.String("distributor-model-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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DeleteDistributorModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteDistributorModelMaster(
(new DeleteDistributorModelMasterRequest())
->withNamespaceName("namespace-0001")
->withDistributorName("distributor-model-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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DeleteDistributorModelMasterRequest;
import io.gs2.distributor.result.DeleteDistributorModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
DeleteDistributorModelMasterResult result = client.deleteDistributorModelMaster(
new DeleteDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
);
DistributorModelMaster 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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.DeleteDistributorModelMasterRequest;
using Gs2.Gs2Distributor.Result.DeleteDistributorModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.DeleteDistributorModelMasterResult> asyncResult = null;
yield return client.DeleteDistributorModelMaster(
new Gs2.Gs2Distributor.Request.DeleteDistributorModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithDistributorName("distributor-model-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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.deleteDistributorModelMaster(
new Gs2Distributor.DeleteDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.delete_distributor_model_master(
distributor.DeleteDistributorModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_distributor_name('distributor-model-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.delete_distributor_model_master({
namespaceName="namespace-0001",
distributorName="distributor-model-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('distributor')
api_result_handler = client.delete_distributor_model_master_async({
namespaceName="namespace-0001",
distributorName="distributor-model-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;
describeDistributorModels
配信設定の一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
items | List<DistributorModel> | 配信設定のリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.DescribeDistributorModels(
&distributor.DescribeDistributorModelsRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DescribeDistributorModelsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeDistributorModels(
(new DescribeDistributorModelsRequest())
->withNamespaceName("namespace-0001")
);
$items = $result->getItems();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DescribeDistributorModelsRequest;
import io.gs2.distributor.result.DescribeDistributorModelsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
DescribeDistributorModelsResult result = client.describeDistributorModels(
new DescribeDistributorModelsRequest()
.withNamespaceName("namespace-0001")
);
List<DistributorModel> items = result.getItems();
} 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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.DescribeDistributorModelsRequest;
using Gs2.Gs2Distributor.Result.DescribeDistributorModelsResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.DescribeDistributorModelsResult> asyncResult = null;
yield return client.DescribeDistributorModels(
new Gs2.Gs2Distributor.Request.DescribeDistributorModelsRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.describeDistributorModels(
new Gs2Distributor.DescribeDistributorModelsRequest()
.withNamespaceName("namespace-0001")
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.describe_distributor_models(
distributor.DescribeDistributorModelsRequest()
.with_namespace_name('namespace-0001')
)
items = result.items
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.describe_distributor_models({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
client = gs2('distributor')
api_result_handler = client.describe_distributor_models_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
getDistributorModel
配信設定を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
distributorName | string | ✓ | ~ 128文字 | 配信設定名 |
Result
型 | 説明 | |
---|---|---|
item | DistributorModel | 配信設定 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetDistributorModel(
&distributor.GetDistributorModelRequest {
NamespaceName: pointy.String("namespace-0001"),
DistributorName: pointy.String("distributor-model-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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetDistributorModelRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getDistributorModel(
(new GetDistributorModelRequest())
->withNamespaceName("namespace-0001")
->withDistributorName("distributor-model-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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetDistributorModelRequest;
import io.gs2.distributor.result.GetDistributorModelResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetDistributorModelResult result = client.getDistributorModel(
new GetDistributorModelRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
);
DistributorModel 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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.GetDistributorModelRequest;
using Gs2.Gs2Distributor.Result.GetDistributorModelResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetDistributorModelResult> asyncResult = null;
yield return client.GetDistributorModel(
new Gs2.Gs2Distributor.Request.GetDistributorModelRequest()
.WithNamespaceName("namespace-0001")
.WithDistributorName("distributor-model-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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getDistributorModel(
new Gs2Distributor.GetDistributorModelRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_distributor_model(
distributor.GetDistributorModelRequest()
.with_namespace_name('namespace-0001')
.with_distributor_name('distributor-model-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.get_distributor_model({
namespaceName="namespace-0001",
distributorName="distributor-model-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('distributor')
api_result_handler = client.get_distributor_model_async({
namespaceName="namespace-0001",
distributorName="distributor-model-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;
exportMaster
現在有効な配信設定のマスターデータをエクスポート
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
item | CurrentDistributorMaster | 現在有効な配信設定 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.ExportMaster(
&distributor.ExportMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\ExportMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->exportMaster(
(new ExportMasterRequest())
->withNamespaceName("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.ExportMasterRequest;
import io.gs2.distributor.result.ExportMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
ExportMasterResult result = client.exportMaster(
new ExportMasterRequest()
.withNamespaceName("namespace-0001")
);
CurrentDistributorMaster 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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.ExportMasterRequest;
using Gs2.Gs2Distributor.Result.ExportMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.ExportMasterResult> asyncResult = null;
yield return client.ExportMaster(
new Gs2.Gs2Distributor.Request.ExportMasterRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.exportMaster(
new Gs2Distributor.ExportMasterRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.export_master(
distributor.ExportMasterRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.export_master({
namespaceName="namespace-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('distributor')
api_result_handler = client.export_master_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getCurrentDistributorMaster
現在有効な配信設定を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
item | CurrentDistributorMaster | 現在有効な配信設定 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetCurrentDistributorMaster(
&distributor.GetCurrentDistributorMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetCurrentDistributorMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getCurrentDistributorMaster(
(new GetCurrentDistributorMasterRequest())
->withNamespaceName("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetCurrentDistributorMasterRequest;
import io.gs2.distributor.result.GetCurrentDistributorMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetCurrentDistributorMasterResult result = client.getCurrentDistributorMaster(
new GetCurrentDistributorMasterRequest()
.withNamespaceName("namespace-0001")
);
CurrentDistributorMaster 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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.GetCurrentDistributorMasterRequest;
using Gs2.Gs2Distributor.Result.GetCurrentDistributorMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetCurrentDistributorMasterResult> asyncResult = null;
yield return client.GetCurrentDistributorMaster(
new Gs2.Gs2Distributor.Request.GetCurrentDistributorMasterRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getCurrentDistributorMaster(
new Gs2Distributor.GetCurrentDistributorMasterRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_current_distributor_master(
distributor.GetCurrentDistributorMasterRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.get_current_distributor_master({
namespaceName="namespace-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('distributor')
api_result_handler = client.get_current_distributor_master_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateCurrentDistributorMaster
現在有効な配信設定を更新
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
settings | string | ✓ | ~ 5242880文字 | マスターデータ |
Result
型 | 説明 | |
---|---|---|
item | CurrentDistributorMaster | 更新した現在有効な配信設定 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.UpdateCurrentDistributorMaster(
&distributor.UpdateCurrentDistributorMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
Settings: pointy.String("{\n \"version\": \"2019-03-01\",\n \"distributorModels\": [\n {\n \"name\": \"basic\",\n \"metadata\": \"BASIC\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n },\n {\n \"name\": \"special\",\n \"metadata\": \"SPECIAL\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n \"whiteListTargetIds\": [\n \"test\"\n ]\n }\n ]\n}"),
}
)
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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\UpdateCurrentDistributorMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateCurrentDistributorMaster(
(new UpdateCurrentDistributorMasterRequest())
->withNamespaceName("namespace-0001")
->withSettings("{\n \"version\": \"2019-03-01\",\n \"distributorModels\": [\n {\n \"name\": \"basic\",\n \"metadata\": \"BASIC\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n },\n {\n \"name\": \"special\",\n \"metadata\": \"SPECIAL\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n \"whiteListTargetIds\": [\n \"test\"\n ]\n }\n ]\n}")
);
$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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.UpdateCurrentDistributorMasterRequest;
import io.gs2.distributor.result.UpdateCurrentDistributorMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
UpdateCurrentDistributorMasterResult result = client.updateCurrentDistributorMaster(
new UpdateCurrentDistributorMasterRequest()
.withNamespaceName("namespace-0001")
.withSettings("{\n \"version\": \"2019-03-01\",\n \"distributorModels\": [\n {\n \"name\": \"basic\",\n \"metadata\": \"BASIC\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n },\n {\n \"name\": \"special\",\n \"metadata\": \"SPECIAL\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n \"whiteListTargetIds\": [\n \"test\"\n ]\n }\n ]\n}")
);
CurrentDistributorMaster 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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.UpdateCurrentDistributorMasterRequest;
using Gs2.Gs2Distributor.Result.UpdateCurrentDistributorMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.UpdateCurrentDistributorMasterResult> asyncResult = null;
yield return client.UpdateCurrentDistributorMaster(
new Gs2.Gs2Distributor.Request.UpdateCurrentDistributorMasterRequest()
.WithNamespaceName("namespace-0001")
.WithSettings("{\n \"version\": \"2019-03-01\",\n \"distributorModels\": [\n {\n \"name\": \"basic\",\n \"metadata\": \"BASIC\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n },\n {\n \"name\": \"special\",\n \"metadata\": \"SPECIAL\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n \"whiteListTargetIds\": [\n \"test\"\n ]\n }\n ]\n}"),
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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.updateCurrentDistributorMaster(
new Gs2Distributor.UpdateCurrentDistributorMasterRequest()
.withNamespaceName("namespace-0001")
.withSettings("{\n \"version\": \"2019-03-01\",\n \"distributorModels\": [\n {\n \"name\": \"basic\",\n \"metadata\": \"BASIC\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n },\n {\n \"name\": \"special\",\n \"metadata\": \"SPECIAL\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n \"whiteListTargetIds\": [\n \"test\"\n ]\n }\n ]\n}")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.update_current_distributor_master(
distributor.UpdateCurrentDistributorMasterRequest()
.with_namespace_name('namespace-0001')
.with_settings('{\n "version": "2019-03-01",\n "distributorModels": [\n {\n "name": "basic",\n "metadata": "BASIC",\n "inboxNamespaceId": "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001"\n },\n {\n "name": "special",\n "metadata": "SPECIAL",\n "inboxNamespaceId": "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001",\n "whiteListTargetIds": [\n "test"\n ]\n }\n ]\n}')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.update_current_distributor_master({
namespaceName="namespace-0001",
settings="{\n "version": "2019-03-01",\n "distributorModels": [\n {\n "name": "basic",\n "metadata": "BASIC",\n "inboxNamespaceId": "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001"\n },\n {\n "name": "special",\n "metadata": "SPECIAL",\n "inboxNamespaceId": "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001",\n "whiteListTargetIds": [\n "test"\n ]\n }\n ]\n}",
})
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('distributor')
api_result_handler = client.update_current_distributor_master_async({
namespaceName="namespace-0001",
settings="{\n "version": "2019-03-01",\n "distributorModels": [\n {\n "name": "basic",\n "metadata": "BASIC",\n "inboxNamespaceId": "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001"\n },\n {\n "name": "special",\n "metadata": "SPECIAL",\n "inboxNamespaceId": "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001",\n "whiteListTargetIds": [\n "test"\n ]\n }\n ]\n}",
})
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;
updateCurrentDistributorMasterFromGitHub
現在有効な配信設定を更新
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
checkoutSetting | GitHubCheckoutSetting | ✓ | GitHubからマスターデータをチェックアウトしてくる設定 |
Result
型 | 説明 | |
---|---|---|
item | CurrentDistributorMaster | 更新した現在有効な配信設定 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.UpdateCurrentDistributorMasterFromGitHub(
&distributor.UpdateCurrentDistributorMasterFromGitHubRequest {
NamespaceName: pointy.String("namespace-0001"),
CheckoutSetting: &distributor.GitHubCheckoutSetting{
ApiKeyId: pointy.String("apiKeyId-0001"),
RepositoryName: pointy.String("gs2io/master-data"),
SourcePath: pointy.String("path/to/file.json"),
ReferenceType: pointy.String("branch"),
BranchName: pointy.String("develop"),
},
}
)
if err != nil {
panic("error occurred")
}
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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\UpdateCurrentDistributorMasterFromGitHubRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateCurrentDistributorMasterFromGitHub(
(new UpdateCurrentDistributorMasterFromGitHubRequest())
->withNamespaceName("namespace-0001")
->withCheckoutSetting((new GitHubCheckoutSetting())
->withApiKeyId("apiKeyId-0001")
->withRepositoryName("gs2io/master-data")
->withSourcePath("path/to/file.json")
->withReferenceType("branch")
->withBranchName("develop")
)
);
$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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.UpdateCurrentDistributorMasterFromGitHubRequest;
import io.gs2.distributor.result.UpdateCurrentDistributorMasterFromGitHubResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
UpdateCurrentDistributorMasterFromGitHubResult result = client.updateCurrentDistributorMasterFromGitHub(
new UpdateCurrentDistributorMasterFromGitHubRequest()
.withNamespaceName("namespace-0001")
.withCheckoutSetting(new GitHubCheckoutSetting()
.withApiKeyId("apiKeyId-0001")
.withRepositoryName("gs2io/master-data")
.withSourcePath("path/to/file.json")
.withReferenceType("branch")
.withBranchName("develop")
)
);
CurrentDistributorMaster 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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.UpdateCurrentDistributorMasterFromGitHubRequest;
using Gs2.Gs2Distributor.Result.UpdateCurrentDistributorMasterFromGitHubResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.UpdateCurrentDistributorMasterFromGitHubResult> asyncResult = null;
yield return client.UpdateCurrentDistributorMasterFromGitHub(
new Gs2.Gs2Distributor.Request.UpdateCurrentDistributorMasterFromGitHubRequest()
.WithNamespaceName("namespace-0001")
.WithCheckoutSetting(new Gs2.Gs2Distributor.Model.GitHubCheckoutSetting()
.WithApiKeyId("apiKeyId-0001")
.WithRepositoryName("gs2io/master-data")
.WithSourcePath("path/to/file.json")
.WithReferenceType("branch")
.WithBranchName("develop")
),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.updateCurrentDistributorMasterFromGitHub(
new Gs2Distributor.UpdateCurrentDistributorMasterFromGitHubRequest()
.withNamespaceName("namespace-0001")
.withCheckoutSetting(new Gs2Distributor.model.GitHubCheckoutSetting()
.withApiKeyId("apiKeyId-0001")
.withRepositoryName("gs2io/master-data")
.withSourcePath("path/to/file.json")
.withReferenceType("branch")
.withBranchName("develop")
)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.update_current_distributor_master_from_git_hub(
distributor.UpdateCurrentDistributorMasterFromGitHubRequest()
.with_namespace_name('namespace-0001')
.with_checkout_setting(distributor.GitHubCheckoutSetting()
.with_api_key_id('apiKeyId-0001')
.with_repository_name('gs2io/master-data')
.with_source_path('path/to/file.json')
.with_reference_type('branch')
.with_branch_name('develop')
)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.update_current_distributor_master_from_git_hub({
namespaceName="namespace-0001",
checkoutSetting={
api_key_id="apiKeyId-0001",
repository_name="gs2io/master-data",
source_path="path/to/file.json",
reference_type="branch",
branch_name="develop",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('distributor')
api_result_handler = client.update_current_distributor_master_from_git_hub_async({
namespaceName="namespace-0001",
checkoutSetting={
api_key_id="apiKeyId-0001",
repository_name="gs2io/master-data",
source_path="path/to/file.json",
reference_type="branch",
branch_name="develop",
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
distribute
所持品を配布する
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
distributorName | string | ✓ | ~ 128文字 | 配信設定名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
distributeResource | DistributeResource | ✓ | 加算するリソース | |||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
distributeResource | DistributeResource | 処理した DistributeResource |
inboxNamespaceId | string | 所持品がキャパシティをオーバーしたときに転送するプレゼントボックスのネームスペース のGRN |
result | string | レスポンス内容 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.Distribute(
&distributor.DistributeRequest {
NamespaceName: pointy.String("namespace-0001"),
DistributorName: pointy.String("distributor-0001"),
UserId: pointy.String("user-0001"),
DistributeResource: &distributor.DistributeResource{
Action: pointy.String("Gs2Money:DepositWallet"),
Request: pointy.String("{}"),
},
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
distributeResource := result.DistributeResource
inboxNamespaceId := result.InboxNamespaceId
result := result.Result
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DistributeRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->distribute(
(new DistributeRequest())
->withNamespaceName("namespace-0001")
->withDistributorName("distributor-0001")
->withUserId("user-0001")
->withDistributeResource((new DistributeResource())
->withAction("Gs2Money:DepositWallet")
->withRequest("{}")
)
->withTimeOffsetToken(null)
);
$distributeResource = $result->getDistributeResource();
$inboxNamespaceId = $result->getInboxNamespaceId();
$result = $result->getResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DistributeRequest;
import io.gs2.distributor.result.DistributeResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
DistributeResult result = client.distribute(
new DistributeRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-0001")
.withUserId("user-0001")
.withDistributeResource(new DistributeResource()
.withAction("Gs2Money:DepositWallet")
.withRequest("{}")
)
.withTimeOffsetToken(null)
);
DistributeResource distributeResource = result.getDistributeResource();
String inboxNamespaceId = result.getInboxNamespaceId();
String result = result.getResult();
} 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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.DistributeRequest;
using Gs2.Gs2Distributor.Result.DistributeResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.DistributeResult> asyncResult = null;
yield return client.Distribute(
new Gs2.Gs2Distributor.Request.DistributeRequest()
.WithNamespaceName("namespace-0001")
.WithDistributorName("distributor-0001")
.WithUserId("user-0001")
.WithDistributeResource(new Gs2.Gs2Distributor.Model.DistributeResource()
.WithAction("Gs2Money:DepositWallet")
.WithRequest("{}")
)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var distributeResource = result.DistributeResource;
var inboxNamespaceId = result.InboxNamespaceId;
var result = result.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.distribute(
new Gs2Distributor.DistributeRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-0001")
.withUserId("user-0001")
.withDistributeResource(new Gs2Distributor.model.DistributeResource()
.withAction("Gs2Money:DepositWallet")
.withRequest("{}")
)
.withTimeOffsetToken(null)
);
const distributeResource = result.getDistributeResource();
const inboxNamespaceId = result.getInboxNamespaceId();
const result = result.getResult();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.distribute(
distributor.DistributeRequest()
.with_namespace_name('namespace-0001')
.with_distributor_name('distributor-0001')
.with_user_id('user-0001')
.with_distribute_resource(distributor.DistributeResource()
.with_action('Gs2Money:DepositWallet')
.with_request('{}')
)
.with_time_offset_token(None)
)
distribute_resource = result.distribute_resource
inbox_namespace_id = result.inbox_namespace_id
result = result.result
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.distribute({
namespaceName="namespace-0001",
distributorName="distributor-0001",
userId="user-0001",
distributeResource={
action="Gs2Money:DepositWallet",
request="{}",
},
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
distributeResource = result.distributeResource;
inboxNamespaceId = result.inboxNamespaceId;
result = result.result;
client = gs2('distributor')
api_result_handler = client.distribute_async({
namespaceName="namespace-0001",
distributorName="distributor-0001",
userId="user-0001",
distributeResource={
action="Gs2Money:DepositWallet",
request="{}",
},
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
distributeResource = result.distributeResource;
inboxNamespaceId = result.inboxNamespaceId;
result = result.result;
distributeWithoutOverflowProcess
所持品を配布する(溢れた際の救済処置無し)
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
distributeResource | DistributeResource | ✓ | 加算するリソース | |||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
distributeResource | DistributeResource | 処理した DistributeResource |
result | string | レスポンス内容 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.DistributeWithoutOverflowProcess(
&distributor.DistributeWithoutOverflowProcessRequest {
UserId: pointy.String("user-0001"),
DistributeResource: &distributor.DistributeResource{
Action: pointy.String("Gs2Money:DepositWallet"),
Request: pointy.String("{}"),
},
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
distributeResource := result.DistributeResource
result := result.Result
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DistributeWithoutOverflowProcessRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->distributeWithoutOverflowProcess(
(new DistributeWithoutOverflowProcessRequest())
->withUserId("user-0001")
->withDistributeResource((new DistributeResource())
->withAction("Gs2Money:DepositWallet")
->withRequest("{}")
)
->withTimeOffsetToken(null)
);
$distributeResource = $result->getDistributeResource();
$result = $result->getResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DistributeWithoutOverflowProcessRequest;
import io.gs2.distributor.result.DistributeWithoutOverflowProcessResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
DistributeWithoutOverflowProcessResult result = client.distributeWithoutOverflowProcess(
new DistributeWithoutOverflowProcessRequest()
.withUserId("user-0001")
.withDistributeResource(new DistributeResource()
.withAction("Gs2Money:DepositWallet")
.withRequest("{}")
)
.withTimeOffsetToken(null)
);
DistributeResource distributeResource = result.getDistributeResource();
String result = result.getResult();
} 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.Gs2Distributor.Gs2DistributorRestClient;
using Gs2.Gs2Distributor.Request.DistributeWithoutOverflowProcessRequest;
using Gs2.Gs2Distributor.Result.DistributeWithoutOverflowProcessResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.DistributeWithoutOverflowProcessResult> asyncResult = null;
yield return client.DistributeWithoutOverflowProcess(
new Gs2.Gs2Distributor.Request.DistributeWithoutOverflowProcessRequest()
.WithUserId("user-0001")
.WithDistributeResource(new Gs2.Gs2Distributor.Model.DistributeResource()
.WithAction("Gs2Money:DepositWallet")
.WithRequest("{}")
)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var distributeResource = result.DistributeResource;
var result = result.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.distributeWithoutOverflowProcess(
new Gs2Distributor.DistributeWithoutOverflowProcessRequest()
.withUserId("user-0001")
.withDistributeResource(new Gs2Distributor.model.DistributeResource()
.withAction("Gs2Money:DepositWallet")
.withRequest("{}")
)
.withTimeOffsetToken(null)
);
const distributeResource = result.getDistributeResource();
const result = result.getResult();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.distribute_without_overflow_process(
distributor.DistributeWithoutOverflowProcessRequest()
.with_user_id('user-0001')
.with_distribute_resource(distributor.DistributeResource()
.with_action('Gs2Money:DepositWallet')
.with_request('{}')
)
.with_time_offset_token(None)
)
distribute_resource = result.distribute_resource
result = result.result
except core.Gs2Exception as e:
exit(1)
client = gs2('distributor')
api_result = client.distribute_without_overflow_process({
userId="user-0001",
distributeResource={
action="Gs2Money:DepositWallet",
request="{}",
},
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
distributeResource = result.distributeResource;
result = result.result;
client = gs2('distributor')
api_result_handler = client.distribute_without_overflow_process_async({
userId="user-0001",
distributeResource={
action="Gs2Money:DepositWallet",
request="{}",
},
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
distributeResource = result.distributeResource;
result = result.result;
runVerifyTask
トランザクションの検証アクションを実行する
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
verifyTask | string | ✓ | ~ 5242880文字 | 検証アクション | ||
keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN |
Result
型 | 説明 | |
---|---|---|
contextStack | string | タスクの実行結果を反映したコンテキストスタック |
statusCode | int | ステータスコード |
result | string | レスポンス内容 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.RunVerifyTask(
&distributor.RunVerifyTaskRequest {
NamespaceName: pointy.String("namespace-0001"),
VerifyTask: pointy.String("stampTask"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
contextStack := result.ContextStack
statusCode := result.StatusCode
result := result.Result
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunVerifyTaskRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->runVerifyTask(
(new RunVerifyTaskRequest())
->withNamespaceName("namespace-0001")
->withVerifyTask("stampTask")
->withKeyId("key-0001")
);
$contextStack = $result->getContextStack();
$statusCode = $result->getStatusCode();