GS2-Exchange SDK API リファレンス
モデル
Namespace
ネームスペース
ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。
GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceId | string | ✓ | ~ 1024文字 | ネームスペースGRN | ||
name | string | ✓ | ~ 128文字 | ネームスペース名 | ||
description | string | ~ 1024文字 | 説明文 | |||
enableDirectExchange | bool | ✓ | true | 直接交換APIの呼び出しを許可する。許可しない場合はスタンプシート経由でしか交換できない | ||
enableAwaitExchange | bool | ✓ | false | 交換結果の受け取りに待ち時間の発生する交換機能を利用するか | ||
transactionSetting | TransactionSetting | ✓ | トランザクション設定 | |||
exchangeScript | ScriptSetting | 交換を実行しようとした時に実行するスクリプト | ||||
incrementalExchangeScript | ScriptSetting | レート上昇型交換を実行しようとした時に実行するスクリプト | ||||
logSetting | LogSetting | ログの出力設定 | ||||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
RateModel
交換レートモデル
交換レートはリソースとリソースを交換する際に使用するレートを定義するエンティティです。
直ちに交換できるレートだけでなく、現実時間で一定時間経過したのちに交換できるレートを設定できます。
現実時間での時間経過が必要な交換レートには、更に即時交換を実行するために必要なリソースを定義することが可能です。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
rateModelId | string | ✓ | ~ 1024文字 | 交換レートモデルGRN | ||
name | string | ✓ | ~ 128文字 | 交換レートの名前 | ||
metadata | string | ~ 2048文字 | メタデータ | |||
verifyActions | List<VerifyAction> | [] | ~ 10 items | 検証アクションリスト | ||
consumeActions | List<ConsumeAction> | [] | ~ 10 items | 消費アクションリスト | ||
timingType | enum { “immediate”, “await” } | ✓ | “immediate” | ~ 128文字 | 交換の種類 | |
lockTime | int | {timingType} == “await” | ✓ | ~ 525600 | 交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分) | |
acquireActions | List<AcquireAction> | [] | ~ 100 items | 入手アクションリスト |
timingType に指定する列挙型の定義
定義 | 説明 |
---|---|
immediate | 即時 |
await | 現実時間の経過待ち |
RateModelMaster
交換レートモデルマスター
交換レートはリソースとリソースを交換する際に使用するレートを定義するエンティティです。
直ちに交換できるレートだけでなく、現実時間で一定時間経過したのちに交換できるレートを設定できます。
現実時間での時間経過が必要な交換レートには、更に即時交換を実行するために必要なリソースを定義することが可能です。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
rateModelId | string | ✓ | ~ 1024文字 | 交換レートマスターGRN | ||
name | string | ✓ | ~ 128文字 | 交換レート名 | ||
description | string | ~ 1024文字 | 説明文 | |||
metadata | string | ~ 2048文字 | メタデータ | |||
verifyActions | List<VerifyAction> | [] | ~ 10 items | 検証アクションリスト | ||
consumeActions | List<ConsumeAction> | [] | ~ 10 items | 消費アクションリスト | ||
timingType | enum { “immediate”, “await” } | ✓ | “immediate” | ~ 128文字 | 交換の種類 | |
lockTime | int | {timingType} == “await” | ✓ | ~ 525600 | 交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分) | |
acquireActions | List<AcquireAction> | [] | ~ 100 items | 入手アクションリスト | ||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
timingType に指定する列挙型の定義
定義 | 説明 |
---|---|
immediate | 即時 |
await | 現実時間の経過待ち |
IncrementalRateModel
コスト上昇型交換レートモデル
通常の交換レートは常に一定のレートでの交換を提供します。
上昇型交換レートでは、交換回数に応じてコストが上昇していくレートを定義することができます。
例えば、1回目の交換では 1:1 で交換できるが、2回目の交換では 2:1 で交換できる、といったレートを定義することができます。
このようなレートを定義することで、プレイヤーがゲームを進めることで得られるリソースの価値を上げることができます。
交換回数は現実時間の経過でリセットすることができます。
この機能を利用することで、毎日あるいは毎週交換に必要なコストをリセットすることができます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
incrementalRateModelId | string | ✓ | ~ 1024文字 | コスト上昇型交換レートモデルGRN | ||
name | string | ✓ | ~ 128文字 | コスト上昇型交換レートの名前 | ||
metadata | string | ~ 2048文字 | メタデータ | |||
consumeAction | ConsumeAction | ✓ | 消費アクション(数量/値は上書きされるため設定不要です) | |||
calculateType | enum { “linear”, “power”, “gs2_script” } | ✓ | ~ 128文字 | コスト上昇量の計算方式 | ||
baseValue | long | {calculateType} == “linear” | ✓ | ~ 9223372036854775805 | ベース値 | |
coefficientValue | long | {calculateType} in [“linear”, “power”] | ✓ | ~ 9223372036854775805 | 係数 | |
calculateScriptId | string | {calculateType} == “gs2_script” | ✓ | ~ 1024文字 | コスト計算スクリプトのGRN | |
exchangeCountId | string | ✓ | ~ 1024文字 | 交換実行回数を管理する GS2-Limit の回数制限モデルGRN | ||
maximumExchangeCount | int | ✓ | 2147483646 | ~ 2147483646 | 交換回数の上限 | |
acquireActions | List<AcquireAction> | [] | ~ 100 items | 入手アクションリスト |
calculateType に指定する列挙型の定義
定義 | 説明 |
---|---|
linear | ベース値 + (係数 * 交換回数) |
power | 係数 * (交換回数 + 1) ^ 2 |
gs2_script | GS2-Script による任意のロジック |
IncrementalRateModelMaster
コスト上昇型交換レートモデルマスター
通常の交換レートは常に一定のレートでの交換を提供します。
上昇型交換レートでは、交換回数に応じてコストが上昇していくレートを定義することができます。
例えば、1回目の交換では 1:1 で交換できるが、2回目の交換では 2:1 で交換できる、といったレートを定義することができます。
このようなレートを定義することで、プレイヤーがゲームを進めることで得られるリソースの価値を上げることができます。
交換回数は現実時間の経過でリセットすることができます。
この機能を利用することで、毎日あるいは毎週交換に必要なコストをリセットすることができます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
incrementalRateModelId | string | ✓ | ~ 1024文字 | 交換レートマスターGRN | ||
name | string | ✓ | ~ 128文字 | 交換レート名 | ||
description | string | ~ 1024文字 | 説明文 | |||
metadata | string | ~ 2048文字 | メタデータ | |||
consumeAction | ConsumeAction | ✓ | 消費アクション(数量/値は上書きされるため設定不要です) | |||
calculateType | enum { “linear”, “power”, “gs2_script” } | ✓ | ~ 128文字 | コスト上昇量の計算方式 | ||
baseValue | long | {calculateType} == “linear” | ✓ | ~ 9223372036854775805 | ベース値 | |
coefficientValue | long | {calculateType} in [“linear”, “power”] | ✓ | ~ 9223372036854775805 | 係数 | |
calculateScriptId | string | {calculateType} == “gs2_script” | ✓ | ~ 1024文字 | コスト計算スクリプトのGRN | |
exchangeCountId | string | ✓ | ~ 1024文字 | 交換実行回数を管理する GS2-Limit の回数制限モデルGRN | ||
maximumExchangeCount | int | ✓ | 2147483646 | ~ 2147483646 | 交換回数の上限 | |
acquireActions | List<AcquireAction> | [] | ~ 100 items | 入手アクションリスト | ||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
calculateType に指定する列挙型の定義
定義 | 説明 |
---|---|
linear | ベース値 + (係数 * 交換回数) |
power | 係数 * (交換回数 + 1) ^ 2 |
gs2_script | GS2-Script による任意のロジック |
CurrentRateMaster
現在有効なマスターデータ
GS2ではマスターデータの管理にJSON形式のファイルを使用します。
ファイルをアップロードすることで、実際にサーバーに設定を反映することができます。
JSONファイルを作成する方法として、マネージメントコンソール上でのマスターデータエディタを提供していますが
よりゲームの運営に相応しいツールを作成し、適切なフォーマットのJSONファイルを書き出すことでもサービスを利用可能です。
Note
JSONファイルの形式については GS2-Exchange マスターデータリファレンス をご参照ください。型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceId | string | ✓ | ~ 1024文字 | 現在有効な交換レート設定GRN | ||
settings | string | ✓ | ~ 5242880文字 | マスターデータ |
Await
交換待機
交換待機は、現実時間での時間経過が交換条件となる交換処理の実行状態を表すエンティティです。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
awaitId | string | ✓ | ~ 1024文字 | 交換待機GRN | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
rateName | string | ✓ | ~ 128文字 | 交換レートの名前 | ||
name | string | ✓ | UUID | ~ 36文字 | 交換待機の名前 | |
count | int | ✓ | 1 | 1 ~ 10000 | 交換数 | |
skipSeconds | int | ✓ | 0 | ~ 2147483646 | スキップ秒数 | |
config | List<Config> | [] | ~ 32 items | 報酬取得時に適用する設定値のデフォルト値 | ||
acquirableAt | long | 報酬を受け取れるようになる時間 (UNIX時間 単位:ミリ秒) | ||||
exchangedAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
LogCost
対数を使用したコスト計算結果
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
base | double | ✓ | 2 ~ 10 | 底 | ||
adds | List<double> | ✓ | 1 ~ 100 items | 加算する対数のリスト | ||
subs | List<double> | ~ 100 items | 減算する対数のリスト |
AcquireAction
入手アクション
ConsumeAction
消費アクション
VerifyAction
検証アクション
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 | タグ |
ScriptSetting
スクリプト設定
GS2 ではマイクロサービスのイベントに関連づけて、カスタムスクリプトを実行することができます。
このモデルは、スクリプトの実行をトリガーするための設定を保持します。
スクリプトの実行方式は大きく2種類あり、それは「同期実行」と「非同期実行」です。
同期実行は、スクリプトの実行が完了するまで処理がブロックされます。
かわりに、スクリプトの実行結果を使ってAPIの実行を止めたり、APIの結果を改ざんすることができます。
一方、非同期実行は、スクリプトの実行が完了するまで処理がブロックされません。
かわりに、スクリプトの実行結果を使ってAPIの実行を止めたり、APIの結果を改ざんすることはできません。
しかし、非同期実行は、スクリプトの実行が完了するまで処理がブロックされないため、APIの応答に影響を与えないため、原則非同期実行を使用することをおすすめします。
非同期実行には実行方式が2種類あり、GS2-Script と Amazon EventBridge があります。
Amazon EventBridge を使用することで、Lua 以外の言語で処理を記述することができます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
triggerScriptId | string | ~ 1024文字 | スクリプトGRN | |||
doneTriggerTargetType | enum { “none”, “gs2_script”, “aws” } | ✓ | “none” | ~ 128文字 | 完了通知の通知先 | |
doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024文字 | スクリプトGRN | ||
doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024文字 | ネームスペースGRN |
doneTriggerTargetType に指定する列挙型の定義
定義 | 説明 |
---|---|
none | なし |
gs2_script | GS2-Script |
aws | Amazon EventBridge |
LogSetting
ログの書き出し設定
ログデータの書き出し設定を管理します。この型は、ログデータを書き出すために使用されるログ名前空間の識別子(Namespace ID)を保持します。
ログ名前空間IDは、ログデータを集約し、保存する対象の GS2-Log の名前空間を指定します。
この設定を通じて、この名前空間以下のAPIリクエスト・レスポンスログデータが対象の GS2-Log へ出力されるようになります。
GS2-Log にはリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
loggingNamespaceId | string | ✓ | ~ 1024文字 | ネームスペースGRN |
TransactionSetting
トランザクション設定
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
enableAutoRun | bool | ✓ | false | 発行したトランザクションをサーバーサイドで自動的に実行するか | ||
distributorNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024文字 | トランザクションの実行に使用する GS2-Distributor ネームスペース | |
keyId | string | ✓ | “grn:gs2:{region}:{ownerId}:key:default:key:default” | ~ 1024文字 | トランザクションの署名に使用する GS2-Key の暗号鍵 | |
queueNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024文字 | トランザクションの実行に使用する GS2-JobQueue のネームスペース |
メソッド
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/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&exchange.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\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DescribeNamespacesRequest;
import io.gs2.exchange.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(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.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DescribeNamespacesRequest;
using Gs2.Gs2Exchange.Result.DescribeNamespacesResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Exchange.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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2Exchange.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 exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.describe_namespaces(
exchange.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('exchange')
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('exchange')
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文字 | 説明文 | |||
enableAwaitExchange | bool | ✓ | false | 交換結果の受け取りに待ち時間の発生する交換機能を利用するか | ||
enableDirectExchange | bool | ✓ | true | 直接交換APIの呼び出しを許可する。許可しない場合はスタンプシート経由でしか交換できない | ||
transactionSetting | TransactionSetting | ✓ | トランザクション設定 | |||
exchangeScript | ScriptSetting | 交換を実行しようとした時に実行するスクリプト | ||||
incrementalExchangeScript | ScriptSetting | レート上昇型交換を実行しようとした時に実行するスクリプト | ||||
logSetting | LogSetting | ログの出力設定 | ||||
queueNamespaceId | string | ~ 1024文字 | トランザクションの実行に使用する GS2-JobQueue のネームスペース | |||
keyId | string | ~ 1024文字 | スタンプシートの発行に使用する GS2-Key のネームスペース |
Result
型 | 説明 | |
---|---|---|
item | Namespace | 作成したネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&exchange.CreateNamespaceRequest {
Name: pointy.String("namespace1"),
Description: nil,
EnableAwaitExchange: nil,
EnableDirectExchange: nil,
TransactionSetting: &exchange.TransactionSetting{
EnableAutoRun: pointy.Bool(false),
QueueNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"),
KeyId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001"),
},
ExchangeScript: nil,
IncrementalExchangeScript: nil,
LogSetting: &exchange.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CreateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createNamespace(
(new CreateNamespaceRequest())
->withName(self::namespace1)
->withDescription(null)
->withEnableAwaitExchange(null)
->withEnableDirectExchange(null)
->withTransactionSetting((new \Gs2\Exchange\Model\TransactionSetting())
->withEnableAutoRun(False)
->withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
->withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:\namespace1:key:key-0001"))
->withExchangeScript(null)
->withIncrementalExchangeScript(null)
->withLogSetting((new \Gs2\Exchange\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CreateNamespaceRequest;
import io.gs2.exchange.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withEnableAwaitExchange(null)
.withEnableDirectExchange(null)
.withTransactionSetting(new io.gs2.exchange.model.TransactionSetting()
.withEnableAutoRun(false)
.withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
.withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001"))
.withExchangeScript(null)
.withIncrementalExchangeScript(null)
.withLogSetting(new io.gs2.exchange.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CreateNamespaceRequest;
using Gs2.Gs2Exchange.Result.CreateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Exchange.Request.CreateNamespaceRequest()
.WithName("namespace1")
.WithDescription(null)
.WithEnableAwaitExchange(null)
.WithEnableDirectExchange(null)
.WithTransactionSetting(new Gs2.Gs2Exchange.Model.TransactionSetting()
.WithEnableAutoRun(false)
.WithQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
.WithKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001"))
.WithExchangeScript(null)
.WithIncrementalExchangeScript(null)
.WithLogSetting(new Gs2.Gs2Exchange.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.createNamespace(
new Gs2Exchange.CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withEnableAwaitExchange(null)
.withEnableDirectExchange(null)
.withTransactionSetting(new Gs2Exchange.model.TransactionSetting()
.withEnableAutoRun(false)
.withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
.withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001"))
.withExchangeScript(null)
.withIncrementalExchangeScript(null)
.withLogSetting(new Gs2Exchange.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.create_namespace(
exchange.CreateNamespaceRequest()
.with_name(self.hash1)
.with_description(None)
.with_enable_await_exchange(None)
.with_enable_direct_exchange(None)
.with_transaction_setting(
exchange.TransactionSetting()
.with_enable_auto_run(False)
.with_queue_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001')
.with_key_id('grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001'))
.with_exchange_script(None)
.with_incremental_exchange_script(None)
.with_log_setting(
exchange.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.create_namespace({
name="namespace1",
description=nil,
enableAwaitExchange=nil,
enableDirectExchange=nil,
transactionSetting={
enableAutoRun=false,
queueNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001",
keyId="grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001",
},
exchangeScript=nil,
incrementalExchangeScript=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.create_namespace_async({
name="namespace1",
description=nil,
enableAwaitExchange=nil,
enableDirectExchange=nil,
transactionSetting={
enableAutoRun=false,
queueNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001",
keyId="grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001",
},
exchangeScript=nil,
incrementalExchangeScript=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getNamespaceStatus
ネームスペースの状態を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
status | string |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&exchange.GetNamespaceStatusRequest {
NamespaceName: pointy.String("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
status := result.Status
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\GetNamespaceStatusRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getNamespaceStatus(
(new GetNamespaceStatusRequest())
->withNamespaceName(self::namespace1)
);
$status = $result->getStatus();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.GetNamespaceStatusRequest;
import io.gs2.exchange.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetNamespaceStatusResult result = client.getNamespaceStatus(
new GetNamespaceStatusRequest()
.withNamespaceName("namespace1")
);
String status = result.getStatus();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Exchange.Result.GetNamespaceStatusResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Exchange.Request.GetNamespaceStatusRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2Exchange.GetNamespaceStatusRequest()
.withNamespaceName("namespace1")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.get_namespace_status(
exchange.GetNamespaceStatusRequest()
.with_namespace_name(self.hash1)
)
status = result.status
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_namespace_status({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
status = result.status;
client = gs2('exchange')
api_result_handler = client.get_namespace_status_async({
namespaceName="namespace1",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
status = result.status;
getNamespace
ネームスペースを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
item | Namespace | ネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&exchange.GetNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\GetNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getNamespace(
(new GetNamespaceRequest())
->withNamespaceName(self::namespace1)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.GetNamespaceRequest;
import io.gs2.exchange.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetNamespaceResult result = client.getNamespace(
new GetNamespaceRequest()
.withNamespaceName("namespace1")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.GetNamespaceRequest;
using Gs2.Gs2Exchange.Result.GetNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Exchange.Request.GetNamespaceRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.getNamespace(
new Gs2Exchange.GetNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.get_namespace(
exchange.GetNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_namespace({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.get_namespace_async({
namespaceName="namespace1",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateNamespace
ネームスペースを更新
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
description | string | ~ 1024文字 | 説明文 | |||
enableAwaitExchange | bool | ✓ | false | 交換結果の受け取りに待ち時間の発生する交換機能を利用するか | ||
enableDirectExchange | bool | ✓ | true | 直接交換APIの呼び出しを許可する。許可しない場合はスタンプシート経由でしか交換できない | ||
transactionSetting | TransactionSetting | ✓ | トランザクション設定 | |||
exchangeScript | ScriptSetting | 交換を実行しようとした時に実行するスクリプト | ||||
incrementalExchangeScript | ScriptSetting | レート上昇型交換を実行しようとした時に実行するスクリプト | ||||
logSetting | LogSetting | ログの出力設定 | ||||
queueNamespaceId | string | ~ 1024文字 | トランザクションの実行に使用する GS2-JobQueue のネームスペース | |||
keyId | string | ~ 1024文字 | スタンプシートの発行に使用する GS2-Key のネームスペース |
Result
型 | 説明 | |
---|---|---|
item | Namespace | 更新したネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&exchange.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
Description: pointy.String("description1"),
EnableAwaitExchange: pointy.Bool(true),
EnableDirectExchange: nil,
TransactionSetting: &exchange.TransactionSetting{
EnableAutoRun: pointy.Bool(false),
QueueNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002"),
KeyId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002"),
},
ExchangeScript: nil,
IncrementalExchangeScript: nil,
LogSetting: &exchange.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\UpdateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateNamespace(
(new UpdateNamespaceRequest())
->withNamespaceName(self::namespace1)
->withDescription("description1")
->withEnableAwaitExchange(True)
->withEnableDirectExchange(null)
->withTransactionSetting((new \Gs2\Exchange\Model\TransactionSetting())
->withEnableAutoRun(False)
->withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
->withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:\namespace1:key:key-0002"))
->withExchangeScript(null)
->withIncrementalExchangeScript(null)
->withLogSetting((new \Gs2\Exchange\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.UpdateNamespaceRequest;
import io.gs2.exchange.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withEnableAwaitExchange(true)
.withEnableDirectExchange(null)
.withTransactionSetting(new io.gs2.exchange.model.TransactionSetting()
.withEnableAutoRun(false)
.withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
.withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002"))
.withExchangeScript(null)
.withIncrementalExchangeScript(null)
.withLogSetting(new io.gs2.exchange.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.UpdateNamespaceRequest;
using Gs2.Gs2Exchange.Result.UpdateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Exchange.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace1")
.WithDescription("description1")
.WithEnableAwaitExchange(true)
.WithEnableDirectExchange(null)
.WithTransactionSetting(new Gs2.Gs2Exchange.Model.TransactionSetting()
.WithEnableAutoRun(false)
.WithQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
.WithKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002"))
.WithExchangeScript(null)
.WithIncrementalExchangeScript(null)
.WithLogSetting(new Gs2.Gs2Exchange.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2Exchange.UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withEnableAwaitExchange(true)
.withEnableDirectExchange(null)
.withTransactionSetting(new Gs2Exchange.model.TransactionSetting()
.withEnableAutoRun(false)
.withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
.withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002"))
.withExchangeScript(null)
.withIncrementalExchangeScript(null)
.withLogSetting(new Gs2Exchange.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.update_namespace(
exchange.UpdateNamespaceRequest()
.with_namespace_name(self.hash1)
.with_description('description1')
.with_enable_await_exchange(True)
.with_enable_direct_exchange(None)
.with_transaction_setting(
exchange.TransactionSetting()
.with_enable_auto_run(False)
.with_queue_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002')
.with_key_id('grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002'))
.with_exchange_script(None)
.with_incremental_exchange_script(None)
.with_log_setting(
exchange.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.update_namespace({
namespaceName="namespace1",
description="description1",
enableAwaitExchange=true,
enableDirectExchange=nil,
transactionSetting={
enableAutoRun=false,
queueNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002",
keyId="grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002",
},
exchangeScript=nil,
incrementalExchangeScript=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.update_namespace_async({
namespaceName="namespace1",
description="description1",
enableAwaitExchange=true,
enableDirectExchange=nil,
transactionSetting={
enableAutoRun=false,
queueNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002",
keyId="grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002",
},
exchangeScript=nil,
incrementalExchangeScript=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
deleteNamespace
ネームスペースを削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
item | Namespace | 削除したネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&exchange.DeleteNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DeleteNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteNamespace(
(new DeleteNamespaceRequest())
->withNamespaceName(self::namespace1)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DeleteNamespaceRequest;
import io.gs2.exchange.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DeleteNamespaceResult result = client.deleteNamespace(
new DeleteNamespaceRequest()
.withNamespaceName("namespace1")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DeleteNamespaceRequest;
using Gs2.Gs2Exchange.Result.DeleteNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Exchange.Request.DeleteNamespaceRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2Exchange.DeleteNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.delete_namespace(
exchange.DeleteNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.delete_namespace({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.delete_namespace_async({
namespaceName="namespace1",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
dumpUserDataByUserId
指定したユーザーIDに紐づくデータのダンプを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 |
---|
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DumpUserDataByUserId(
&exchange.DumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->dumpUserDataByUserId(
(new DumpUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DumpUserDataByUserIdRequest;
import io.gs2.exchange.result.DumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DumpUserDataByUserIdResult result = client.dumpUserDataByUserId(
new DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} 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.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DumpUserDataByUserIdRequest;
using Gs2.Gs2Exchange.Result.DumpUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
new Gs2.Gs2Exchange.Request.DumpUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.dumpUserDataByUserId(
new Gs2Exchange.DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.dump_user_data_by_user_id(
exchange.DumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.dump_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
client = gs2('exchange')
api_result_handler = client.dump_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
checkDumpUserDataByUserId
指定したユーザーIDに紐づくデータのダンプが完了しているか確認
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
url | string | 出力データのURL |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
&exchange.CheckDumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.Url
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CheckDumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->checkDumpUserDataByUserId(
(new CheckDumpUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$url = $result->getUrl();
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.exchange.result.CheckDumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CheckDumpUserDataByUserIdResult result = client.checkDumpUserDataByUserId(
new CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
String url = result.getUrl();
} 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.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CheckDumpUserDataByUserIdRequest;
using Gs2.Gs2Exchange.Result.CheckDumpUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
new Gs2.Gs2Exchange.Request.CheckDumpUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.checkDumpUserDataByUserId(
new Gs2Exchange.CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.check_dump_user_data_by_user_id(
exchange.CheckDumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.check_dump_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
client = gs2('exchange')
api_result_handler = client.check_dump_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
cleanUserDataByUserId
指定したユーザーIDに紐づくデータのダンプを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 |
---|
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CleanUserDataByUserId(
&exchange.CleanUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->cleanUserDataByUserId(
(new CleanUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CleanUserDataByUserIdRequest;
import io.gs2.exchange.result.CleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CleanUserDataByUserIdResult result = client.cleanUserDataByUserId(
new CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} 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.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CleanUserDataByUserIdRequest;
using Gs2.Gs2Exchange.Result.CleanUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
new Gs2.Gs2Exchange.Request.CleanUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.cleanUserDataByUserId(
new Gs2Exchange.CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.clean_user_data_by_user_id(
exchange.CleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.clean_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
client = gs2('exchange')
api_result_handler = client.clean_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
checkCleanUserDataByUserId
指定したユーザーIDに紐づくデータのダンプが完了しているか確認
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 |
---|
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
&exchange.CheckCleanUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CheckCleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->checkCleanUserDataByUserId(
(new CheckCleanUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.exchange.result.CheckCleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CheckCleanUserDataByUserIdResult result = client.checkCleanUserDataByUserId(
new CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} 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.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CheckCleanUserDataByUserIdRequest;
using Gs2.Gs2Exchange.Result.CheckCleanUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
new Gs2.Gs2Exchange.Request.CheckCleanUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.checkCleanUserDataByUserId(
new Gs2Exchange.CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.check_clean_user_data_by_user_id(
exchange.CheckCleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.check_clean_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
client = gs2('exchange')
api_result_handler = client.check_clean_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
prepareImportUserDataByUserId
指定したユーザーIDに紐づくデータのインポートを開始
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
uploadToken | string | アップロード後に結果を反映する際に使用するトークン |
uploadUrl | string | ユーザーデータアップロード処理の実行に使用するURL |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
&exchange.PrepareImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\PrepareImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->prepareImportUserDataByUserId(
(new PrepareImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$uploadToken = $result->getUploadToken();
$uploadUrl = $result->getUploadUrl();
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.exchange.result.PrepareImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
PrepareImportUserDataByUserIdResult result = client.prepareImportUserDataByUserId(
new PrepareImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
String uploadToken = result.getUploadToken();
String uploadUrl = result.getUploadUrl();
} 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.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.PrepareImportUserDataByUserIdRequest;
using Gs2.Gs2Exchange.Result.PrepareImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
new Gs2.Gs2Exchange.Request.PrepareImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.prepareImportUserDataByUserId(
new Gs2Exchange.PrepareImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const uploadToken = result.getUploadToken();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.prepare_import_user_data_by_user_id(
exchange.PrepareImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
upload_token = result.upload_token
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.prepare_import_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;
client = gs2('exchange')
api_result_handler = client.prepare_import_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;
importUserDataByUserId
指定したユーザーIDに紐づくデータのインポートを開始
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
uploadToken | string | ✓ | ~ 1024文字 | アップロード準備で受け取ったトークン | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 |
---|
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.ImportUserDataByUserId(
&exchange.ImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\ImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->importUserDataByUserId(
(new ImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withUploadToken("upload-0001")
->withTimeOffsetToken(null)
);
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.ImportUserDataByUserIdRequest;
import io.gs2.exchange.result.ImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
ImportUserDataByUserIdResult result = client.importUserDataByUserId(
new ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} 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.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.ImportUserDataByUserIdRequest;
using Gs2.Gs2Exchange.Result.ImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
new Gs2.Gs2Exchange.Request.ImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithUploadToken("upload-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.importUserDataByUserId(
new Gs2Exchange.ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.import_user_data_by_user_id(
exchange.ImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_upload_token('upload-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.import_user_data_by_user_id({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
client = gs2('exchange')
api_result_handler = client.import_user_data_by_user_id_async({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
checkImportUserDataByUserId
指定したユーザーIDに紐づくデータのインポートが完了しているか確認
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
uploadToken | string | ✓ | ~ 1024文字 | アップロード準備で受け取ったトークン | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
url | string | 出力ログのURL |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
&exchange.CheckImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.Url
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CheckImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->checkImportUserDataByUserId(
(new CheckImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withUploadToken("upload-0001")
->withTimeOffsetToken(null)
);
$url = $result->getUrl();
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CheckImportUserDataByUserIdRequest;
import io.gs2.exchange.result.CheckImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CheckImportUserDataByUserIdResult result = client.checkImportUserDataByUserId(
new CheckImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
String url = result.getUrl();
} 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.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CheckImportUserDataByUserIdRequest;
using Gs2.Gs2Exchange.Result.CheckImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
new Gs2.Gs2Exchange.Request.CheckImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithUploadToken("upload-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.checkImportUserDataByUserId(
new Gs2Exchange.CheckImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.check_import_user_data_by_user_id(
exchange.CheckImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_upload_token('upload-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.check_import_user_data_by_user_id({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
client = gs2('exchange')
api_result_handler = client.check_import_user_data_by_user_id_async({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
describeRateModels
交換レートモデルの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
items | List<RateModel> | 交換レートモデルのリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DescribeRateModels(
&exchange.DescribeRateModelsRequest {
NamespaceName: pointy.String("namespace1"),
}
)
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\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DescribeRateModelsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeRateModels(
(new DescribeRateModelsRequest())
->withNamespaceName(self::namespace1)
);
$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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DescribeRateModelsRequest;
import io.gs2.exchange.result.DescribeRateModelsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DescribeRateModelsResult result = client.describeRateModels(
new DescribeRateModelsRequest()
.withNamespaceName("namespace1")
);
List<RateModel> 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.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DescribeRateModelsRequest;
using Gs2.Gs2Exchange.Result.DescribeRateModelsResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DescribeRateModelsResult> asyncResult = null;
yield return client.DescribeRateModels(
new Gs2.Gs2Exchange.Request.DescribeRateModelsRequest()
.WithNamespaceName("namespace1"),
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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.describeRateModels(
new Gs2Exchange.DescribeRateModelsRequest()
.withNamespaceName("namespace1")
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.describe_rate_models(
exchange.DescribeRateModelsRequest()
.with_namespace_name(self.hash1)
)
items = result.items
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.describe_rate_models({
namespaceName="namespace1",
})
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('exchange')
api_result_handler = client.describe_rate_models_async({
namespaceName="namespace1",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
getRateModel
交換レートモデルを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
rateName | string | ✓ | ~ 128文字 | 交換レートの名前 |
Result
型 | 説明 | |
---|---|---|
item | RateModel | 交換レートモデル |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.GetRateModel(
&exchange.GetRateModelRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("character-level"),
}
)
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\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\GetRateModelRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getRateModel(
(new GetRateModelRequest())
->withNamespaceName(self::namespace1)
->withRateName("character-level")
);
$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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.GetRateModelRequest;
import io.gs2.exchange.result.GetRateModelResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetRateModelResult result = client.getRateModel(
new GetRateModelRequest()
.withNamespaceName("namespace1")
.withRateName("character-level")
);
RateModel 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.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.GetRateModelRequest;
using Gs2.Gs2Exchange.Result.GetRateModelResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.GetRateModelResult> asyncResult = null;
yield return client.GetRateModel(
new Gs2.Gs2Exchange.Request.GetRateModelRequest()
.WithNamespaceName("namespace1")
.WithRateName("character-level"),
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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.getRateModel(
new Gs2Exchange.GetRateModelRequest()
.withNamespaceName("namespace1")
.withRateName("character-level")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.get_rate_model(
exchange.GetRateModelRequest()
.with_namespace_name(self.hash1)
.with_rate_name('character-level')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_rate_model({
namespaceName="namespace1",
rateName="character-level",
})
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('exchange')
api_result_handler = client.get_rate_model_async({
namespaceName="namespace1",
rateName="character-level",
})
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;
describeRateModelMasters
交換レートマスターの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | List<RateModelMaster> | 交換レートマスターのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DescribeRateModelMasters(
&exchange.DescribeRateModelMastersRequest {
NamespaceName: pointy.String("namespace1"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DescribeRateModelMastersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeRateModelMasters(
(new DescribeRateModelMastersRequest())
->withNamespaceName(self::namespace1)
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DescribeRateModelMastersRequest;
import io.gs2.exchange.result.DescribeRateModelMastersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DescribeRateModelMastersResult result = client.describeRateModelMasters(
new DescribeRateModelMastersRequest()
.withNamespaceName("namespace1")
.withPageToken(null)
.withLimit(null)
);
List<RateModelMaster> 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.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DescribeRateModelMastersRequest;
using Gs2.Gs2Exchange.Result.DescribeRateModelMastersResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DescribeRateModelMastersResult> asyncResult = null;
yield return client.DescribeRateModelMasters(
new Gs2.Gs2Exchange.Request.DescribeRateModelMastersRequest()
.WithNamespaceName("namespace1")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.describeRateModelMasters(
new Gs2Exchange.DescribeRateModelMastersRequest()
.withNamespaceName("namespace1")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.describe_rate_model_masters(
exchange.DescribeRateModelMastersRequest()
.with_namespace_name(self.hash1)
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.describe_rate_model_masters({
namespaceName="namespace1",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('exchange')
api_result_handler = client.describe_rate_model_masters_async({
namespaceName="namespace1",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
createRateModelMaster
交換レートマスターを新規作成
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
name | string | ✓ | ~ 128文字 | 交換レート名 | ||
description | string | ~ 1024文字 | 説明文 | |||
metadata | string | ~ 2048文字 | メタデータ | |||
timingType | enum { “immediate”, “await” } | ✓ | “immediate” | ~ 128文字 | 交換の種類 | |
lockTime | int | {timingType} == “await” | ✓ | ~ 525600 | 交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分) | |
acquireActions | List<AcquireAction> | [] | ~ 100 items | 入手アクションリスト | ||
verifyActions | List<VerifyAction> | [] | ~ 10 items | 検証アクションリスト | ||
consumeActions | List<ConsumeAction> | [] | ~ 10 items | 消費アクションリスト |
timingType に指定する列挙型の定義
定義 | 説明 |
---|---|
immediate | 即時 |
await | 現実時間の経過待ち |
Result
型 | 説明 | |
---|---|---|
item | RateModelMaster | 作成した交換レートマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CreateRateModelMaster(
&exchange.CreateRateModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
Name: pointy.String("rate-0001"),
Description: nil,
Metadata: pointy.String("N2R"),
TimingType: nil,
LockTime: nil,
AcquireActions: []exchange.AcquireAction{
exchange.AcquireAction{
Action: pointy.String("Gs2Inventory:AcquireItemSetByUserId"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
},
},
VerifyActions: nil,
ConsumeActions: []exchange.ConsumeAction{
exchange.ConsumeAction{
Action: pointy.String("Gs2Inventory:ConsumeItemSetByUserId"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"),
},
},
}
)
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\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CreateRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createRateModelMaster(
(new CreateRateModelMasterRequest())
->withNamespaceName(self::namespace1)
->withName("rate-0001")
->withDescription(null)
->withMetadata("N2R")
->withTimingType(null)
->withLockTime(null)
->withAcquireActions([
(new \Gs2\Exchange\Model\AcquireAction())
->withAction("Gs2Inventory:AcquireItemSetByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
])
->withVerifyActions(null)
->withConsumeActions([
(new \Gs2\Exchange\Model\ConsumeAction())
->withAction("Gs2Inventory:ConsumeItemSetByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"),
])
);
$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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CreateRateModelMasterRequest;
import io.gs2.exchange.result.CreateRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CreateRateModelMasterResult result = client.createRateModelMaster(
new CreateRateModelMasterRequest()
.withNamespaceName("namespace1")
.withName("rate-0001")
.withDescription(null)
.withMetadata("N2R")
.withTimingType(null)
.withLockTime(null)
.withAcquireActions(Arrays.asList(
new io.gs2.exchange.model.AcquireAction()
.withAction("Gs2Inventory:AcquireItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}")
))
.withVerifyActions(null)
.withConsumeActions(Arrays.asList(
new io.gs2.exchange.model.ConsumeAction()
.withAction("Gs2Inventory:ConsumeItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}")
))
);
RateModelMaster 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.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CreateRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.CreateRateModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CreateRateModelMasterResult> asyncResult = null;
yield return client.CreateRateModelMaster(
new Gs2.Gs2Exchange.Request.CreateRateModelMasterRequest()
.WithNamespaceName("namespace1")
.WithName("rate-0001")
.WithDescription(null)
.WithMetadata("N2R")
.WithTimingType(null)
.WithLockTime(null)
.WithAcquireActions(new Gs2.Core.Model.AcquireAction[] {
new Gs2.Core.Model.AcquireAction()
.WithAction("Gs2Inventory:AcquireItemSetByUserId")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
})
.WithVerifyActions(null)
.WithConsumeActions(new Gs2.Core.Model.ConsumeAction[] {
new Gs2.Core.Model.ConsumeAction()
.WithAction("Gs2Inventory:ConsumeItemSetByUserId")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"),
}),
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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.createRateModelMaster(
new Gs2Exchange.CreateRateModelMasterRequest()
.withNamespaceName("namespace1")
.withName("rate-0001")
.withDescription(null)
.withMetadata("N2R")
.withTimingType(null)
.withLockTime(null)
.withAcquireActions([
new Gs2Exchange.model.AcquireAction()
.withAction("Gs2Inventory:AcquireItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
])
.withVerifyActions(null)
.withConsumeActions([
new Gs2Exchange.model.ConsumeAction()
.withAction("Gs2Inventory:ConsumeItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"),
])
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.create_rate_model_master(
exchange.CreateRateModelMasterRequest()
.with_namespace_name(self.hash1)
.with_name('rate-0001')
.with_description(None)
.with_metadata('N2R')
.with_timing_type(None)
.with_lock_time(None)
.with_acquire_actions([
exchange.AcquireAction()
.with_action('Gs2Inventory:AcquireItemSetByUserId')
.with_request('{"namespaceName": "namespace-0001", "inventoryName": "item", "itemName": "item-0002", "userId": "#{userId}", "acquireCount": 1}'),
])
.with_verify_actions(None)
.with_consume_actions([
exchange.ConsumeAction()
.with_action('Gs2Inventory:ConsumeItemSetByUserId')
.with_request('{"namespaceName": "namespace-0001", "inventoryName": "item", "itemName": "item-0001", "userId": "#{userId}", "consumeCount": 10}'),
])
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.create_rate_model_master({
namespaceName="namespace1",
name="rate-0001",
description=nil,
metadata="N2R",
timingType=nil,
lockTime=nil,
acquireActions={
{
action="Gs2Inventory:AcquireItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}",
}
},
verifyActions=nil,
consumeActions={
{
action="Gs2Inventory:ConsumeItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}",
}
},
})
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('exchange')
api_result_handler = client.create_rate_model_master_async({
namespaceName="namespace1",
name="rate-0001",
description=nil,
metadata="N2R",
timingType=nil,
lockTime=nil,
acquireActions={
{
action="Gs2Inventory:AcquireItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}",
}
},
verifyActions=nil,
consumeActions={
{
action="Gs2Inventory:ConsumeItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}",
}
},
})
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;
getRateModelMaster
交換レートマスターを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
rateName | string | ✓ | ~ 128文字 | 交換レート名 |
Result
型 | 説明 | |
---|---|---|
item | RateModelMaster | 交換レートマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.GetRateModelMaster(
&exchange.GetRateModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-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\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\GetRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getRateModelMaster(
(new GetRateModelMasterRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.GetRateModelMasterRequest;
import io.gs2.exchange.result.GetRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetRateModelMasterResult result = client.getRateModelMaster(
new GetRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
);
RateModelMaster 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.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.GetRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.GetRateModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.GetRateModelMasterResult> asyncResult = null;
yield return client.GetRateModelMaster(
new Gs2.Gs2Exchange.Request.GetRateModelMasterRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.getRateModelMaster(
new Gs2Exchange.GetRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.get_rate_model_master(
exchange.GetRateModelMasterRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_rate_model_master({
namespaceName="namespace1",
rateName="rate-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('exchange')
api_result_handler = client.get_rate_model_master_async({
namespaceName="namespace1",
rateName="rate-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;
updateRateModelMaster
交換レートマスターを更新
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
rateName | string | ✓ | ~ 128文字 | 交換レート名 | ||
description | string | ~ 1024文字 | 説明文 | |||
metadata | string | ~ 2048文字 | メタデータ | |||
timingType | enum { “immediate”, “await” } | ✓ | “immediate” | ~ 128文字 | 交換の種類 | |
lockTime | int | {timingType} == “await” | ✓ | ~ 525600 | 交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分) | |
acquireActions | List<AcquireAction> | [] | ~ 100 items | 入手アクションリスト | ||
verifyActions | List<VerifyAction> | [] | ~ 10 items | 検証アクションリスト | ||
consumeActions | List<ConsumeAction> | [] | ~ 10 items | 消費アクションリスト |
timingType に指定する列挙型の定義
定義 | 説明 |
---|---|
immediate | 即時 |
await | 現実時間の経過待ち |
Result
型 | 説明 | |
---|---|---|
item | RateModelMaster | 更新した交換レートマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.UpdateRateModelMaster(
&exchange.UpdateRateModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
Description: pointy.String("description1"),
Metadata: pointy.String("RATE_0001"),
TimingType: pointy.String("await"),
LockTime: pointy.Int32(180),
AcquireActions: []exchange.AcquireAction{
exchange.AcquireAction{
Action: pointy.String("Gs2Stamina:RecoverStaminaByUserId"),
Request: pointy.String("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
},
},
VerifyActions: nil,
ConsumeActions: []exchange.ConsumeAction{
exchange.ConsumeAction{
Action: pointy.String("Gs2Money:WithdrawByUserId"),
Request: pointy.String("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
},
},
}
)
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\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\UpdateRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateRateModelMaster(
(new UpdateRateModelMasterRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-0001")
->withDescription("description1")
->withMetadata("RATE_0001")
->withTimingType("await")
->withLockTime(180)
->withAcquireActions([
(new \Gs2\Exchange\Model\AcquireAction())
->withAction("Gs2Stamina:RecoverStaminaByUserId")
->withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
])
->withVerifyActions(null)
->withConsumeActions([
(new \Gs2\Exchange\Model\ConsumeAction())
->withAction("Gs2Money:WithdrawByUserId")
->withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
])
);
$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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.UpdateRateModelMasterRequest;
import io.gs2.exchange.result.UpdateRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
UpdateRateModelMasterResult result = client.updateRateModelMaster(
new UpdateRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withDescription("description1")
.withMetadata("RATE_0001")
.withTimingType("await")
.withLockTime(180)
.withAcquireActions(Arrays.asList(
new io.gs2.exchange.model.AcquireAction()
.withAction("Gs2Stamina:RecoverStaminaByUserId")
.withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}")
))
.withVerifyActions(null)
.withConsumeActions(Arrays.asList(
new io.gs2.exchange.model.ConsumeAction()
.withAction("Gs2Money:WithdrawByUserId")
.withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}")
))
);
RateModelMaster 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.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.UpdateRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.UpdateRateModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.UpdateRateModelMasterResult> asyncResult = null;
yield return client.UpdateRateModelMaster(
new Gs2.Gs2Exchange.Request.UpdateRateModelMasterRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-0001")
.WithDescription("description1")
.WithMetadata("RATE_0001")
.WithTimingType("await")
.WithLockTime(180)
.WithAcquireActions(new Gs2.Core.Model.AcquireAction[] {
new Gs2.Core.Model.AcquireAction()
.WithAction("Gs2Stamina:RecoverStaminaByUserId")
.WithRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
})
.WithVerifyActions(null)
.WithConsumeActions(new Gs2.Core.Model.ConsumeAction[] {
new Gs2.Core.Model.ConsumeAction()
.WithAction("Gs2Money:WithdrawByUserId")
.WithRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
}),
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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.updateRateModelMaster(
new Gs2Exchange.UpdateRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withDescription("description1")
.withMetadata("RATE_0001")
.withTimingType("await")
.withLockTime(180)
.withAcquireActions([
new Gs2Exchange.model.AcquireAction()
.withAction("Gs2Stamina:RecoverStaminaByUserId")
.withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
])
.withVerifyActions(null)
.withConsumeActions([
new Gs2Exchange.model.ConsumeAction()
.withAction("Gs2Money:WithdrawByUserId")
.withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
])
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.update_rate_model_master(
exchange.UpdateRateModelMasterRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
.with_description('description1')
.with_metadata('RATE_0001')
.with_timing_type('await')
.with_lock_time(180)
.with_acquire_actions([
exchange.AcquireAction()
.with_action('Gs2Stamina:RecoverStaminaByUserId')
.with_request('{"moneyName": "money-0001", "userId": "user-0001", "slot": 0, "count": 200, "paidOnly": false}'),
])
.with_verify_actions(None)
.with_consume_actions([
exchange.ConsumeAction()
.with_action('Gs2Money:WithdrawByUserId')
.with_request('{"moneyName": "money-0001", "userId": "user-0001", "slot": 0, "count": 200, "paidOnly": false}'),
])
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.update_rate_model_master({
namespaceName="namespace1",
rateName="rate-0001",
description="description1",
metadata="RATE_0001",
timingType="await",
lockTime=180,
acquireActions={
{
action="Gs2Stamina:RecoverStaminaByUserId",
request="{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
}
},
verifyActions=nil,
consumeActions={
{
action="Gs2Money:WithdrawByUserId",
request="{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
}
},
})
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('exchange')
api_result_handler = client.update_rate_model_master_async({
namespaceName="namespace1",
rateName="rate-0001",
description="description1",
metadata="RATE_0001",
timingType="await",
lockTime=180,
acquireActions={
{
action="Gs2Stamina:RecoverStaminaByUserId",
request="{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
}
},
verifyActions=nil,
consumeActions={
{
action="Gs2Money:WithdrawByUserId",
request="{\"moneyName\": \"money-