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” | ✓ | ~ 538214400 | 交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分) | |
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” | ✓ | ~ 538214400 | 交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分) | |
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 | ✓ | ~ 10 | 底 | ||
adds | List<double> | ✓ | 1 ~ 10000 items | 加算する対数のリスト | ||
subs | List<double> | ~ 10000 items | 減算する対数のリスト |
LogRate
対数を使用した入手量補正
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
base | double | ✓ | ~ 10 | 底 | ||
logs | List<double> | ✓ | 1 ~ 10000 items | 対数のリスト |
AcquireAction
入手アクション
ConsumeAction
消費アクション
VerifyAction
検証アクション
Config
コンフィグ設定
トランザクションの変数に適用する設定値
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
key | string | ✓ | ~ 64文字 | 名前 | ||
value | string | ~ 51200文字 | 値 |
VerifyActionResult
検証アクションの実行結果
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
action | enum { } | ✓ | ~ 128文字 | 検証アクションで実行するアクションの種類 | ||
verifyRequest | string | ✓ | ~ 1048576文字 | リクエストのJSON | ||
statusCode | int | ~ 999 | ステータスコード | |||
verifyResult | string | ~ 1048576文字 | 結果内容 |
action に指定する列挙型の定義
定義 | 説明 |
---|
ConsumeActionResult
消費アクションの実行結果
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
action | enum { } | ✓ | ~ 128文字 | 消費アクションで実行するアクションの種類 | ||
consumeRequest | string | ✓ | ~ 1048576文字 | リクエストのJSON | ||
statusCode | int | ~ 999 | ステータスコード | |||
consumeResult | string | ~ 1048576文字 | 結果内容 |
action に指定する列挙型の定義
定義 | 説明 |
---|
AcquireActionResult
入手アクションの実行結果
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
action | enum { } | ✓ | ~ 128文字 | 入手アクションで実行するアクションの種類 | ||
acquireRequest | string | ✓ | ~ 1048576文字 | リクエストのJSON | ||
statusCode | int | ~ 999 | ステータスコード | |||
acquireResult | string | ~ 1048576文字 | 結果内容 |
action に指定する列挙型の定義
定義 | 説明 |
---|
TransactionResult
トランザクション実行結果
サーバーサイドでのトランザクションの自動実行機能を利用して実行されたトランザクションの実行結果
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
transactionId | string | ✓ | 36 ~ 36文字 | トランザクションID | ||
verifyResults | List<VerifyActionResult> | ~ 10 items | 検証アクションの実行結果リスト | |||
consumeResults | List<ConsumeActionResult> | ~ 10 items | 消費アクションの実行結果リスト | |||
acquireResults | List<AcquireActionResult> | ~ 100 items | 入手アクションの実行結果リスト |
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 | 発行したトランザクションをサーバーサイドで自動的に実行するか | ||
enableAtomicCommit | bool | {enableAutoRun} == true | ✓ | false | トランザクションの実行をアトミックにコミットするか | |
transactionUseDistributor | bool | {enableAtomicCommit} == true | ✓ | false | トランザクションを非同期処理で実行する | |
acquireActionUseJobQueue | bool | {enableAtomicCommit} == true | ✓ | false | 入手アクションを実行する際に GS2-JobQueue を使用するか | |
distributorNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024文字 | トランザクションの実行に使用する GS2-Distributor ネームスペース | |
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” | ✓ | ~ 538214400 | 交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分) | |
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” | ✓ | ~ 538214400 | 交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分) | |
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-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
}
},
})
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;
deleteRateModelMaster
交換レートマスターを削除
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.DeleteRateModelMaster(
&exchange.DeleteRateModelMasterRequest {
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\DeleteRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteRateModelMaster(
(new DeleteRateModelMasterRequest())
->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.DeleteRateModelMasterRequest;
import io.gs2.exchange.result.DeleteRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DeleteRateModelMasterResult result = client.deleteRateModelMaster(
new DeleteRateModelMasterRequest()
.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.DeleteRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.DeleteRateModelMasterResult;
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.DeleteRateModelMasterResult> asyncResult = null;
yield return client.DeleteRateModelMaster(
new Gs2.Gs2Exchange.Request.DeleteRateModelMasterRequest()
.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.deleteRateModelMaster(
new Gs2Exchange.DeleteRateModelMasterRequest()
.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.delete_rate_model_master(
exchange.DeleteRateModelMasterRequest()
.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.delete_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.delete_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;
describeIncrementalRateModels
コスト上昇型交換レートモデルの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
items | List<IncrementalRateModel> | コスト上昇型交換レートモデルのリスト |
実装例
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.DescribeIncrementalRateModels(
&exchange.DescribeIncrementalRateModelsRequest {
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\DescribeIncrementalRateModelsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeIncrementalRateModels(
(new DescribeIncrementalRateModelsRequest())
->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.DescribeIncrementalRateModelsRequest;
import io.gs2.exchange.result.DescribeIncrementalRateModelsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DescribeIncrementalRateModelsResult result = client.describeIncrementalRateModels(
new DescribeIncrementalRateModelsRequest()
.withNamespaceName("namespace1")
);
List<IncrementalRateModel> 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.DescribeIncrementalRateModelsRequest;
using Gs2.Gs2Exchange.Result.DescribeIncrementalRateModelsResult;
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.DescribeIncrementalRateModelsResult> asyncResult = null;
yield return client.DescribeIncrementalRateModels(
new Gs2.Gs2Exchange.Request.DescribeIncrementalRateModelsRequest()
.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.describeIncrementalRateModels(
new Gs2Exchange.DescribeIncrementalRateModelsRequest()
.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_incremental_rate_models(
exchange.DescribeIncrementalRateModelsRequest()
.with_namespace_name(self.hash1)
)
items = result.items
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.describe_incremental_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_incremental_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;
getIncrementalRateModel
コスト上昇型交換レートモデルを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
rateName | string | ✓ | ~ 128文字 | コスト上昇型交換レートの名前 |
Result
型 | 説明 | |
---|---|---|
item | IncrementalRateModel | コスト上昇型交換レートモデル |
実装例
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.GetIncrementalRateModel(
&exchange.GetIncrementalRateModelRequest {
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\GetIncrementalRateModelRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getIncrementalRateModel(
(new GetIncrementalRateModelRequest())
->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.GetIncrementalRateModelRequest;
import io.gs2.exchange.result.GetIncrementalRateModelResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetIncrementalRateModelResult result = client.getIncrementalRateModel(
new GetIncrementalRateModelRequest()
.withNamespaceName("namespace1")
.withRateName("character-level")
);
IncrementalRateModel 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.GetIncrementalRateModelRequest;
using Gs2.Gs2Exchange.Result.GetIncrementalRateModelResult;
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.GetIncrementalRateModelResult> asyncResult = null;
yield return client.GetIncrementalRateModel(
new Gs2.Gs2Exchange.Request.GetIncrementalRateModelRequest()
.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.getIncrementalRateModel(
new Gs2Exchange.GetIncrementalRateModelRequest()
.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_incremental_rate_model(
exchange.GetIncrementalRateModelRequest()
.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_incremental_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_incremental_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;
describeIncrementalRateModelMasters
コスト上昇型交換レートマスターの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | List<IncrementalRateModelMaster> | コスト上昇型交換レートマスターのリスト |
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.DescribeIncrementalRateModelMasters(
&exchange.DescribeIncrementalRateModelMastersRequest {
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\DescribeIncrementalRateModelMastersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeIncrementalRateModelMasters(
(new DescribeIncrementalRateModelMastersRequest())
->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.DescribeIncrementalRateModelMastersRequest;
import io.gs2.exchange.result.DescribeIncrementalRateModelMastersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DescribeIncrementalRateModelMastersResult result = client.describeIncrementalRateModelMasters(
new DescribeIncrementalRateModelMastersRequest()
.withNamespaceName("namespace1")
.withPageToken(null)
.withLimit(null)
);
List<IncrementalRateModelMaster> 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.DescribeIncrementalRateModelMastersRequest;
using Gs2.Gs2Exchange.Result.DescribeIncrementalRateModelMastersResult;
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.DescribeIncrementalRateModelMastersResult> asyncResult = null;
yield return client.DescribeIncrementalRateModelMasters(
new Gs2.Gs2Exchange.Request.DescribeIncrementalRateModelMastersRequest()
.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.describeIncrementalRateModelMasters(
new Gs2Exchange.DescribeIncrementalRateModelMastersRequest()
.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_incremental_rate_model_masters(
exchange.DescribeIncrementalRateModelMastersRequest()
.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_incremental_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_incremental_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;
createIncrementalRateModelMaster
コスト上昇型交換レートマスターを新規作成
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
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 | 入手アクションリスト |
calculateType に指定する列挙型の定義
定義 | 説明 |
---|---|
linear | ベース値 + (係数 * 交換回数) |
power | 係数 * (交換回数 + 1) ^ 2 |
gs2_script | GS2-Script による任意のロジック |
Result
型 | 説明 | |
---|---|---|
item | IncrementalRateModelMaster | 作成したコスト上昇型交換レートマスター |
実装例
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.CreateIncrementalRateModelMaster(
&exchange.CreateIncrementalRateModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
Name: pointy.String("rate-0001"),
Description: nil,
Metadata: pointy.String("N2R"),
ConsumeAction: &exchange.ConsumeAction{
Action: pointy.String("Gs2Inventory:ConsumeItemSetByUserId"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"),
},
CalculateType: pointy.String("linear"),
BaseValue: pointy.Int64(100),
CoefficientValue: pointy.Int64(150),
CalculateScriptId: nil,
ExchangeCountId: pointy.String("grn:gs2:limit-0001"),
MaximumExchangeCount: 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}"),
},
},
}
)
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\CreateIncrementalRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createIncrementalRateModelMaster(
(new CreateIncrementalRateModelMasterRequest())
->withNamespaceName(self::namespace1)
->withName("rate-0001")
->withDescription(null)
->withMetadata("N2R")
->withConsumeAction((new \Gs2\Exchange\Model\ConsumeAction())
->withAction("Gs2Inventory:ConsumeItemSetByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"))
->withCalculateType("linear")
->withBaseValue(100)
->withCoefficientValue(150)
->withCalculateScriptId(null)
->withExchangeCountId("grn:gs2:limit-0001")
->withMaximumExchangeCount(null)
->withAcquireActions([
(new \Gs2\Exchange\Model\AcquireAction())
->withAction("Gs2Inventory:AcquireItemSetByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
])
);
$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.CreateIncrementalRateModelMasterRequest;
import io.gs2.exchange.result.CreateIncrementalRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CreateIncrementalRateModelMasterResult result = client.createIncrementalRateModelMaster(
new CreateIncrementalRateModelMasterRequest()
.withNamespaceName("namespace1")
.withName("rate-0001")
.withDescription(null)
.withMetadata("N2R")
.withConsumeAction(new io.gs2.exchange.model.ConsumeAction()
.withAction("Gs2Inventory:ConsumeItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"))
.withCalculateType("linear")
.withBaseValue(100L)
.withCoefficientValue(150L)
.withCalculateScriptId(null)
.withExchangeCountId("grn:gs2:limit-0001")
.withMaximumExchangeCount(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}")
))
);
IncrementalRateModelMaster 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.CreateIncrementalRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.CreateIncrementalRateModelMasterResult;
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.CreateIncrementalRateModelMasterResult> asyncResult = null;
yield return client.CreateIncrementalRateModelMaster(
new Gs2.Gs2Exchange.Request.CreateIncrementalRateModelMasterRequest()
.WithNamespaceName("namespace1")
.WithName("rate-0001")
.WithDescription(null)
.WithMetadata("N2R")
.WithConsumeAction(new Gs2.Core.Model.ConsumeAction()
.WithAction("Gs2Inventory:ConsumeItemSetByUserId")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"))
.WithCalculateType("linear")
.WithBaseValue(100L)
.WithCoefficientValue(150L)
.WithCalculateScriptId(null)
.WithExchangeCountId("grn:gs2:limit-0001")
.WithMaximumExchangeCount(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}"),
}),
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.createIncrementalRateModelMaster(
new Gs2Exchange.CreateIncrementalRateModelMasterRequest()
.withNamespaceName("namespace1")
.withName("rate-0001")
.withDescription(null)
.withMetadata("N2R")
.withConsumeAction(new Gs2Exchange.model.ConsumeAction()
.withAction("Gs2Inventory:ConsumeItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"))
.withCalculateType("linear")
.withBaseValue(100)
.withCoefficientValue(150)
.withCalculateScriptId(null)
.withExchangeCountId("grn:gs2:limit-0001")
.withMaximumExchangeCount(null)
.withAcquireActions([
new Gs2Exchange.model.AcquireAction()
.withAction("Gs2Inventory:AcquireItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
])
);
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_incremental_rate_model_master(
exchange.CreateIncrementalRateModelMasterRequest()
.with_namespace_name(self.hash1)
.with_name('rate-0001')
.with_description(None)
.with_metadata('N2R')
.with_consume_action(
exchange.ConsumeAction()
.with_action('Gs2Inventory:ConsumeItemSetByUserId')
.with_request('{"namespaceName": "namespace-0001", "inventoryName": "item", "itemName": "item-0001", "userId": "#{userId}", "consumeCount": 10}'))
.with_calculate_type('linear')
.with_base_value(100)
.with_coefficient_value(150)
.with_calculate_script_id(None)
.with_exchange_count_id('grn:gs2:limit-0001')
.with_maximum_exchange_count(None)
.with_acquire_actions([
exchange.AcquireAction()
.with_action('Gs2Inventory:AcquireItemSetByUserId')
.with_request('{"namespaceName": "namespace-0001", "inventoryName": "item", "itemName": "item-0002", "userId": "#{userId}", "acquireCount": 1}'),
])
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.create_incremental_rate_model_master({
namespaceName="namespace1",
name="rate-0001",
description=nil,
metadata="N2R",
consumeAction={
action="Gs2Inventory:ConsumeItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}",
},
calculateType="linear",
baseValue=100,
coefficientValue=150,
calculateScriptId=nil,
exchangeCountId="grn:gs2:limit-0001",
maximumExchangeCount=nil,
acquireActions={
{
action="Gs2Inventory:AcquireItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}",
}
},
})
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_incremental_rate_model_master_async({
namespaceName="namespace1",
name="rate-0001",
description=nil,
metadata="N2R",
consumeAction={
action="Gs2Inventory:ConsumeItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}",
},
calculateType="linear",
baseValue=100,
coefficientValue=150,
calculateScriptId=nil,
exchangeCountId="grn:gs2:limit-0001",
maximumExchangeCount=nil,
acquireActions={
{
action="Gs2Inventory:AcquireItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}",
}
},
})
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;
getIncrementalRateModelMaster
コスト上昇型交換レートマスターを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
rateName | string | ✓ | ~ 128文字 | 交換レート名 |
Result
型 | 説明 | |
---|---|---|
item | IncrementalRateModelMaster | コスト上昇型交換レートマスター |
実装例
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.GetIncrementalRateModelMaster(
&exchange.GetIncrementalRateModelMasterRequest {
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\GetIncrementalRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getIncrementalRateModelMaster(
(new GetIncrementalRateModelMasterRequest())
->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.GetIncrementalRateModelMasterRequest;
import io.gs2.exchange.result.GetIncrementalRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetIncrementalRateModelMasterResult result = client.getIncrementalRateModelMaster(
new GetIncrementalRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
);
IncrementalRateModelMaster 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.GetIncrementalRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.GetIncrementalRateModelMasterResult;
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.GetIncrementalRateModelMasterResult> asyncResult = null;
yield return client.GetIncrementalRateModelMaster(
new Gs2.Gs2Exchange.Request.GetIncrementalRateModelMasterRequest()
.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.getIncrementalRateModelMaster(
new Gs2Exchange.GetIncrementalRateModelMasterRequest()
.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_incremental_rate_model_master(
exchange.GetIncrementalRateModelMasterRequest()
.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_incremental_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_incremental_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;
updateIncrementalRateModelMaster
コスト上昇型交換レートマスターを更新
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
rateName | 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 | 入手アクションリスト |
calculateType に指定する列挙型の定義
定義 | 説明 |
---|---|
linear | ベース値 + (係数 * 交換回数) |
power | 係数 * (交換回数 + 1) ^ 2 |
gs2_script | GS2-Script による任意のロジック |
Result
型 | 説明 | |
---|---|---|
item | IncrementalRateModelMaster | 更新したコスト上昇型交換レートマスター |
実装例
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.UpdateIncrementalRateModelMaster(
&exchange.UpdateIncrementalRateModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
Description: pointy.String("description1"),
Metadata: pointy.String("RATE_0001"),
ConsumeAction: &exchange.ConsumeAction{
Action: pointy.String("Gs2Money:WithdrawByUserId"),
Request: pointy.String("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
},
CalculateType: pointy.String("gs2_script"),
BaseValue: pointy.Int64(100),
CoefficientValue: pointy.Int64(150),
CalculateScriptId: pointy.String("grn:gs2:script-0001"),
ExchangeCountId: pointy.String("grn:gs2:limit-0001"),
MaximumExchangeCount: nil,
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}"),
},
},
}
)
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\UpdateIncrementalRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateIncrementalRateModelMaster(
(new UpdateIncrementalRateModelMasterRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-0001")
->withDescription("description1")
->withMetadata("RATE_0001")
->withConsumeAction((new \Gs2\Exchange\Model\ConsumeAction())
->withAction("Gs2Money:WithdrawByUserId")
->withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"))
->withCalculateType("gs2_script")
->withBaseValue(100)
->withCoefficientValue(150)
->withCalculateScriptId("grn:gs2:script-0001")
->withExchangeCountId("grn:gs2:limit-0001")
->withMaximumExchangeCount(null)
->withAcquireActions([
(new \Gs2\Exchange\Model\AcquireAction())
->withAction("Gs2Stamina:RecoverStaminaByUserId")
->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.UpdateIncrementalRateModelMasterRequest;
import io.gs2.exchange.result.UpdateIncrementalRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
UpdateIncrementalRateModelMasterResult result = client.updateIncrementalRateModelMaster(
new UpdateIncrementalRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withDescription("description1")
.withMetadata("RATE_0001")
.withConsumeAction(new io.gs2.exchange.model.ConsumeAction()
.withAction("Gs2Money:WithdrawByUserId")
.withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"))
.withCalculateType("gs2_script")
.withBaseValue(100L)
.withCoefficientValue(150L)
.withCalculateScriptId("grn:gs2:script-0001")
.withExchangeCountId("grn:gs2:limit-0001")
.withMaximumExchangeCount(null)
.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}")
))
);
IncrementalRateModelMaster 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.UpdateIncrementalRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.UpdateIncrementalRateModelMasterResult;
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.UpdateIncrementalRateModelMasterResult> asyncResult = null;
yield return client.UpdateIncrementalRateModelMaster(
new Gs2.Gs2Exchange.Request.UpdateIncrementalRateModelMasterRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-0001")
.WithDescription("description1")
.WithMetadata("RATE_0001")
.WithConsumeAction(new Gs2.Core.Model.ConsumeAction()
.WithAction("Gs2Money:WithdrawByUserId")
.WithRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"))
.WithCalculateType("gs2_script")
.WithBaseValue(100L)
.WithCoefficientValue(150L)
.WithCalculateScriptId("grn:gs2:script-0001")
.WithExchangeCountId("grn:gs2:limit-0001")
.WithMaximumExchangeCount(null)
.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}"),
}),
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.updateIncrementalRateModelMaster(
new Gs2Exchange.UpdateIncrementalRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withDescription("description1")
.withMetadata("RATE_0001")
.withConsumeAction(new Gs2Exchange.model.ConsumeAction()
.withAction("Gs2Money:WithdrawByUserId")
.withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"))
.withCalculateType("gs2_script")
.withBaseValue(100)
.withCoefficientValue(150)
.withCalculateScriptId("grn:gs2:script-0001")
.withExchangeCountId("grn:gs2:limit-0001")
.withMaximumExchangeCount(null)
.withAcquireActions([
new Gs2Exchange.model.AcquireAction()
.withAction("Gs2Stamina:RecoverStaminaByUserId")
.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_incremental_rate_model_master(
exchange.UpdateIncrementalRateModelMasterRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
.with_description('description1')
.with_metadata('RATE_0001')
.with_consume_action(
exchange.ConsumeAction()
.with_action('Gs2Money:WithdrawByUserId')
.with_request('{"moneyName": "money-0001", "userId": "user-0001", "slot": 0, "count": 200, "paidOnly": false}'))
.with_calculate_type('gs2_script')
.with_base_value(100)
.with_coefficient_value(150)
.with_calculate_script_id('grn:gs2:script-0001')
.with_exchange_count_id('grn:gs2:limit-0001')
.with_maximum_exchange_count(None)
.with_acquire_actions([
exchange.AcquireAction()
.with_action('Gs2Stamina:RecoverStaminaByUserId')
.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_incremental_rate_model_master({
namespaceName="namespace1",
rateName="rate-0001",
description="description1",
metadata="RATE_0001",
consumeAction={
action="Gs2Money:WithdrawByUserId",
request="{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
},
calculateType="gs2_script",
baseValue=100,
coefficientValue=150,
calculateScriptId="grn:gs2:script-0001",
exchangeCountId="grn:gs2:limit-0001",
maximumExchangeCount=nil,
acquireActions={
{
action="Gs2Stamina:RecoverStaminaByUserId",
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_incremental_rate_model_master_async({
namespaceName="namespace1",
rateName="rate-0001",
description="description1",
metadata="RATE_0001",
consumeAction={
action="Gs2Money:WithdrawByUserId",
request="{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
},
calculateType="gs2_script",
baseValue=100,
coefficientValue=150,
calculateScriptId="grn:gs2:script-0001",
exchangeCountId="grn:gs2:limit-0001",
maximumExchangeCount=nil,
acquireActions={
{
action="Gs2Stamina:RecoverStaminaByUserId",
request="{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
}
},
})
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;
deleteIncrementalRateModelMaster
コスト上昇型交換レートマスターを削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
rateName | string | ✓ | ~ 128文字 | 交換レート名 |
Result
型 | 説明 | |
---|---|---|
item | IncrementalRateModelMaster | 削除したコスト上昇型交換レートマスター |
実装例
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.DeleteIncrementalRateModelMaster(
&exchange.DeleteIncrementalRateModelMasterRequest {
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\DeleteIncrementalRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteIncrementalRateModelMaster(
(new DeleteIncrementalRateModelMasterRequest())
->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.DeleteIncrementalRateModelMasterRequest;
import io.gs2.exchange.result.DeleteIncrementalRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DeleteIncrementalRateModelMasterResult result = client.deleteIncrementalRateModelMaster(
new DeleteIncrementalRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
);
IncrementalRateModelMaster 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.DeleteIncrementalRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.DeleteIncrementalRateModelMasterResult;
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.DeleteIncrementalRateModelMasterResult> asyncResult = null;
yield return client.DeleteIncrementalRateModelMaster(
new Gs2.Gs2Exchange.Request.DeleteIncrementalRateModelMasterRequest()
.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.deleteIncrementalRateModelMaster(
new Gs2Exchange.DeleteIncrementalRateModelMasterRequest()
.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.delete_incremental_rate_model_master(
exchange.DeleteIncrementalRateModelMasterRequest()
.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.delete_incremental_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.delete_incremental_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;
exchange
交換を実行
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
rateName | string | ✓ | ~ 128文字 | 交換レートの名前 | ||
accessToken | string | ✓ | ~ 128文字 | ユーザーID | ||
count | int | ✓ | 1 ~ 1073741821 | 交換するロット数 | ||
config | List<Config> | [] | ~ 32 items | トランザクションの変数に適用する設定値 |
Result
型 | 説明 | |
---|---|---|
item | RateModel | 交換レートモデル |
transactionId | string | 発行されたトランザクションID |
stampSheet | string | 交換処理の実行に使用するスタンプシート |
stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN |
autoRunStampSheet | bool? | トランザクションの自動実行が有効か |
atomicCommit | bool? | トランザクションをアトミックにコミットするか |
transaction | string | 発行されたトランザクション |
transactionResult | TransactionResult | トランザクション実行結果 |
実装例
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.Exchange(
&exchange.ExchangeRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
AccessToken: pointy.String("accessToken-0001"),
Count: pointy.Int32(1),
Config: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
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\ExchangeRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->exchange(
(new ExchangeRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-0001")
->withAccessToken(self::$accessToken0001)
->withCount(1)
->withConfig(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.ExchangeRequest;
import io.gs2.exchange.result.ExchangeResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
ExchangeResult result = client.exchange(
new ExchangeRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withAccessToken("accessToken-0001")
.withCount(1)
.withConfig(null)
);
RateModel item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} 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.ExchangeRequest;
using Gs2.Gs2Exchange.Result.ExchangeResult;
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.ExchangeResult> asyncResult = null;
yield return client.Exchange(
new Gs2.Gs2Exchange.Request.ExchangeRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-0001")
.WithAccessToken("accessToken-0001")
.WithCount(1)
.WithConfig(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
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.exchange(
new Gs2Exchange.ExchangeRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withAccessToken("accessToken-0001")
.withCount(1)
.withConfig(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} 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.exchange(
exchange.ExchangeRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
.with_access_token(self.access_token_0001)
.with_count(1)
.with_config(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.exchange({
namespaceName="namespace1",
rateName="rate-0001",
accessToken="accessToken-0001",
count=1,
config=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.exchange_async({
namespaceName="namespace1",
rateName="rate-0001",
accessToken="accessToken-0001",
count=1,
config=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
exchangeByUserId
ユーザIDを指定して交換を実行
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
rateName | string | ✓ | ~ 128文字 | 交換レートの名前 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
count | int | ✓ | 1 ~ 1073741821 | 交換するロット数 | ||
config | List<Config> | [] | ~ 32 items | トランザクションの変数に適用する設定値 | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | RateModel | 交換レートモデル |
transactionId | string | 発行されたトランザクションID |
stampSheet | string | 交換処理の実行に使用するスタンプシート |
stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN |
autoRunStampSheet | bool? | トランザクションの自動実行が有効か |
atomicCommit | bool? | トランザクションをアトミックにコミットするか |
transaction | string | 発行されたトランザクション |
transactionResult | TransactionResult | トランザクション実行結果 |
実装例
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.ExchangeByUserId(
&exchange.ExchangeByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
UserId: pointy.String("user-0001"),
Count: pointy.Int32(1),
Config: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
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\ExchangeByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->exchangeByUserId(
(new ExchangeByUserIdRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-0001")
->withUserId("user-0001")
->withCount(1)
->withConfig(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.ExchangeByUserIdRequest;
import io.gs2.exchange.result.ExchangeByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
ExchangeByUserIdResult result = client.exchangeByUserId(
new ExchangeByUserIdRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withUserId("user-0001")
.withCount(1)
.withConfig(null)
.withTimeOffsetToken(null)
);
RateModel item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} 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.ExchangeByUserIdRequest;
using Gs2.Gs2Exchange.Result.ExchangeByUserIdResult;
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.ExchangeByUserIdResult> asyncResult = null;
yield return client.ExchangeByUserId(
new Gs2.Gs2Exchange.Request.ExchangeByUserIdRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-0001")
.WithUserId("user-0001")
.WithCount(1)
.WithConfig(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
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.exchangeByUserId(
new Gs2Exchange.ExchangeByUserIdRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withUserId("user-0001")
.withCount(1)
.withConfig(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} 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.exchange_by_user_id(
exchange.ExchangeByUserIdRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
.with_user_id('user-0001')
.with_count(1)
.with_config(None)
.with_time_offset_token(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.exchange_by_user_id({
namespaceName="namespace1",
rateName="rate-0001",
userId="user-0001",
count=1,
config=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.exchange_by_user_id_async({
namespaceName="namespace1",
rateName="rate-0001",
userId="user-0001",
count=1,
config=nil,
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
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
exchangeByStampSheet
入手アクションとして交換を実行
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
stampSheet | string | ✓ | ~ 5242880文字 | トランザクション | ||
keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN |
Result
型 | 説明 | |
---|---|---|
item | RateModel | 交換レートモデル |
transactionId | string | 発行されたトランザクションID |
stampSheet | string | 交換処理の実行に使用するスタンプシート |
stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN |
autoRunStampSheet | bool? | トランザクションの自動実行が有効か |
atomicCommit | bool? | トランザクションをアトミックにコミットするか |
transaction | string | 発行されたトランザクション |
transactionResult | TransactionResult | トランザクション実行結果 |
実装例
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.ExchangeByStampSheet(
&exchange.ExchangeByStampSheetRequest {
StampSheet: pointy.String("stampSheet"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
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\ExchangeByStampSheetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->exchangeByStampSheet(
(new ExchangeByStampSheetRequest())
->withStampSheet(self::stampSheet)
->withKeyId(self::key-0001)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.ExchangeByStampSheetRequest;
import io.gs2.exchange.result.ExchangeByStampSheetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
ExchangeByStampSheetResult result = client.exchangeByStampSheet(
new ExchangeByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
RateModel item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} 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.ExchangeByStampSheetRequest;
using Gs2.Gs2Exchange.Result.ExchangeByStampSheetResult;
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.ExchangeByStampSheetResult> asyncResult = null;
yield return client.ExchangeByStampSheet(
new Gs2.Gs2Exchange.Request.ExchangeByStampSheetRequest()
.WithStampSheet("stampSheet")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
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.exchangeByStampSheet(
new Gs2Exchange.ExchangeByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} 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.exchange_by_stamp_sheet(
exchange.ExchangeByStampSheetRequest()
.with_stamp_sheet(self.stamp_sheet)
.with_key_id(self.key1.key_id)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.exchange_by_stamp_sheet({
stampSheet="stampSheet",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.exchange_by_stamp_sheet_async({
stampSheet="stampSheet",
keyId="key-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;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
incrementalExchange
コスト上昇型交換を実行
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
rateName | string | ✓ | ~ 128文字 | コスト上昇型交換レートの名前 | ||
accessToken | string | ✓ | ~ 128文字 | ユーザーID | ||
count | int | ✓ | 1 ~ 1073741821 | 交換するロット数 | ||
config | List<Config> | [] | ~ 32 items | トランザクションの変数に適用する設定値 |
Result
型 | 説明 | |
---|---|---|
item | IncrementalRateModel | コスト上昇型交換レートモデル |
transactionId | string | 発行されたトランザクションID |
stampSheet | string | 交換処理の実行に使用するスタンプシート |
stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN |
autoRunStampSheet | bool? | トランザクションの自動実行が有効か |
atomicCommit | bool? | トランザクションをアトミックにコミットするか |
transaction | string | 発行されたトランザクション |
transactionResult | TransactionResult | トランザクション実行結果 |
実装例
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.IncrementalExchange(
&exchange.IncrementalExchangeRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
AccessToken: pointy.String("accessToken-0001"),
Count: pointy.Int32(1),
Config: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
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\IncrementalExchangeRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->incrementalExchange(
(new IncrementalExchangeRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-0001")
->withAccessToken(self::$accessToken0001)
->withCount(1)
->withConfig(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.IncrementalExchangeRequest;
import io.gs2.exchange.result.IncrementalExchangeResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
IncrementalExchangeResult result = client.incrementalExchange(
new IncrementalExchangeRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withAccessToken("accessToken-0001")
.withCount(1)
.withConfig(null)
);
IncrementalRateModel item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} 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.IncrementalExchangeRequest;
using Gs2.Gs2Exchange.Result.IncrementalExchangeResult;
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.IncrementalExchangeResult> asyncResult = null;
yield return client.IncrementalExchange(
new Gs2.Gs2Exchange.Request.IncrementalExchangeRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-0001")
.WithAccessToken("accessToken-0001")
.WithCount(1)
.WithConfig(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
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.incrementalExchange(
new Gs2Exchange.IncrementalExchangeRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withAccessToken("accessToken-0001")
.withCount(1)
.withConfig(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} 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.incremental_exchange(
exchange.IncrementalExchangeRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
.with_access_token(self.access_token_0001)
.with_count(1)
.with_config(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.incremental_exchange({
namespaceName="namespace1",
rateName="rate-0001",
accessToken="accessToken-0001",
count=1,
config=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.incremental_exchange_async({
namespaceName="namespace1",
rateName="rate-0001",
accessToken="accessToken-0001",
count=1,
config=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
incrementalExchangeByUserId
ユーザIDを指定してコスト上昇型交換を実行
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
rateName | string | ✓ | ~ 128文字 | コスト上昇型交換レートの名前 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
count | int | ✓ | 1 ~ 1073741821 | 交換するロット数 | ||
config | List<Config> | [] | ~ 32 items | トランザクションの変数に適用する設定値 | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | IncrementalRateModel | コスト上昇型交換レートモデル |
transactionId | string | 発行されたトランザクションID |
stampSheet | string | 交換処理の実行に使用するスタンプシート |
stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN |
autoRunStampSheet | bool? | トランザクションの自動実行が有効か |
atomicCommit | bool? | トランザクションをアトミックにコミットするか |
transaction | string | 発行されたトランザクション |
transactionResult | TransactionResult | トランザクション実行結果 |
実装例
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.IncrementalExchangeByUserId(
&exchange.IncrementalExchangeByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
UserId: pointy.String("user-0001"),
Count: pointy.Int32(1),
Config: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
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\IncrementalExchangeByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->incrementalExchangeByUserId(
(new IncrementalExchangeByUserIdRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-0001")
->withUserId("user-0001")
->withCount(1)
->withConfig(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.IncrementalExchangeByUserIdRequest;
import io.gs2.exchange.result.IncrementalExchangeByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
IncrementalExchangeByUserIdResult result = client.incrementalExchangeByUserId(
new IncrementalExchangeByUserIdRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withUserId("user-0001")
.withCount(1)
.withConfig(null)
.withTimeOffsetToken(null)
);
IncrementalRateModel item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} 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.IncrementalExchangeByUserIdRequest;
using Gs2.Gs2Exchange.Result.IncrementalExchangeByUserIdResult;
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.IncrementalExchangeByUserIdResult> asyncResult = null;
yield return client.IncrementalExchangeByUserId(
new Gs2.Gs2Exchange.Request.IncrementalExchangeByUserIdRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-0001")
.WithUserId("user-0001")
.WithCount(1)
.WithConfig(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
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.incrementalExchangeByUserId(
new Gs2Exchange.IncrementalExchangeByUserIdRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withUserId("user-0001")
.withCount(1)
.withConfig(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} 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.incremental_exchange_by_user_id(
exchange.IncrementalExchangeByUserIdRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
.with_user_id('user-0001')
.with_count(1)
.with_config(None)
.with_time_offset_token(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.incremental_exchange_by_user_id({
namespaceName="namespace1",
rateName="rate-0001",
userId="user-0001",
count=1,
config=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.incremental_exchange_by_user_id_async({
namespaceName="namespace1",
rateName="rate-0001",
userId="user-0001",
count=1,
config=nil,
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
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
incrementalExchangeByStampSheet
入手アクションとしてコスト上昇型交換を実行
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
stampSheet | string | ✓ | ~ 5242880文字 | トランザクション | ||
keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN |
Result
型 | 説明 | |
---|---|---|
item | IncrementalRateModel | コスト上昇型交換レートモデル |
transactionId | string | 発行されたトランザクションID |
stampSheet | string | 交換処理の実行に使用するスタンプシート |
stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN |
autoRunStampSheet | bool? | トランザクションの自動実行が有効か |
atomicCommit | bool? | トランザクションをアトミックにコミットするか |
transaction | string | 発行されたトランザクション |
transactionResult | TransactionResult | トランザクション実行結果 |
実装例
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.IncrementalExchangeByStampSheet(
&exchange.IncrementalExchangeByStampSheetRequest {
StampSheet: pointy.String("stampSheet"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
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\IncrementalExchangeByStampSheetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->incrementalExchangeByStampSheet(
(new IncrementalExchangeByStampSheetRequest())
->withStampSheet(self::stampSheet)
->withKeyId(self::key-0001)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.IncrementalExchangeByStampSheetRequest;
import io.gs2.exchange.result.IncrementalExchangeByStampSheetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
IncrementalExchangeByStampSheetResult result = client.incrementalExchangeByStampSheet(
new IncrementalExchangeByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
IncrementalRateModel item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} 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.IncrementalExchangeByStampSheetRequest;
using Gs2.Gs2Exchange.Result.IncrementalExchangeByStampSheetResult;
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.IncrementalExchangeByStampSheetResult> asyncResult = null;
yield return client.IncrementalExchangeByStampSheet(
new Gs2.Gs2Exchange.Request.IncrementalExchangeByStampSheetRequest()
.WithStampSheet("stampSheet")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
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.incrementalExchangeByStampSheet(
new Gs2Exchange.IncrementalExchangeByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} 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.incremental_exchange_by_stamp_sheet(
exchange.IncrementalExchangeByStampSheetRequest()
.with_stamp_sheet(self.stamp_sheet)
.with_key_id(self.key1.key_id)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.incremental_exchange_by_stamp_sheet({
stampSheet="stampSheet",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.incremental_exchange_by_stamp_sheet_async({
stampSheet="stampSheet",
keyId="key-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;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
exportMaster
現在有効な交換レート設定のマスターデータをエクスポート
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
item | CurrentRateMaster | 現在有効な交換レート設定 |
実装例
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.ExportMaster(
&exchange.ExportMasterRequest {
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\ExportMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->exportMaster(
(new ExportMasterRequest())
->withNamespaceName(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.ExportMasterRequest;
import io.gs2.exchange.result.ExportMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
ExportMasterResult result = client.exportMaster(
new ExportMasterRequest()
.withNamespaceName("namespace1")
);
CurrentRateMaster 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.ExportMasterRequest;
using Gs2.Gs2Exchange.Result.ExportMasterResult;
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.ExportMasterResult> asyncResult = null;
yield return client.ExportMaster(
new Gs2.Gs2Exchange.Request.ExportMasterRequest()
.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.exportMaster(
new Gs2Exchange.ExportMasterRequest()
.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.export_master(
exchange.ExportMasterRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.export_master({
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.export_master_async({
namespaceName="namespace1",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getCurrentRateMaster
現在有効な交換レート設定を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
item | CurrentRateMaster | 現在有効な交換レート設定 |
実装例
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.GetCurrentRateMaster(
&exchange.GetCurrentRateMasterRequest {
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\GetCurrentRateMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getCurrentRateMaster(
(new GetCurrentRateMasterRequest())
->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.GetCurrentRateMasterRequest;
import io.gs2.exchange.result.GetCurrentRateMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetCurrentRateMasterResult result = client.getCurrentRateMaster(
new GetCurrentRateMasterRequest()
.withNamespaceName("namespace1")
);
CurrentRateMaster 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.GetCurrentRateMasterRequest;
using Gs2.Gs2Exchange.Result.GetCurrentRateMasterResult;
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.GetCurrentRateMasterResult> asyncResult = null;
yield return client.GetCurrentRateMaster(
new Gs2.Gs2Exchange.Request.GetCurrentRateMasterRequest()
.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.getCurrentRateMaster(
new Gs2Exchange.GetCurrentRateMasterRequest()
.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_current_rate_master(
exchange.GetCurrentRateMasterRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_current_rate_master({
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_current_rate_master_async({
namespaceName="namespace1",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateCurrentRateMaster
現在有効な交換レート設定を更新
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
settings | string | ✓ | ~ 5242880文字 | マスターデータ |
Result
型 | 説明 | |
---|---|---|
item | CurrentRateMaster | 更新した現在有効な交換レート設定 |
実装例
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.UpdateCurrentRateMaster(
&exchange.UpdateCurrentRateMasterRequest {
NamespaceName: pointy.String("namespace1"),
Settings: pointy.String("{\n \"version\": \"2019-08-19\",\n \"rateModels\": [\n {\n \"name\": \"material_n_to_r\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 10}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 1}\"\n }\n ]\n },\n {\n \"name\": \"material_r_to_n\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 1}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 10}\"\n }\n ]\n }\n ]\n}"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\UpdateCurrentRateMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateCurrentRateMaster(
(new UpdateCurrentRateMasterRequest())
->withNamespaceName(self::namespace1)
->withSettings("{\n \"version\": \"2019-08-19\",\n \"rateModels\": [\n {\n \"name\": \"material_n_to_r\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 10}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 1}\"\n }\n ]\n },\n {\n \"name\": \"material_r_to_n\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 1}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 10}\"\n }\n ]\n }\n ]\n}")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.UpdateCurrentRateMasterRequest;
import io.gs2.exchange.result.UpdateCurrentRateMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
UpdateCurrentRateMasterResult result = client.updateCurrentRateMaster(
new UpdateCurrentRateMasterRequest()
.withNamespaceName("namespace1")
.withSettings("{\n \"version\": \"2019-08-19\",\n \"rateModels\": [\n {\n \"name\": \"material_n_to_r\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 10}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 1}\"\n }\n ]\n },\n {\n \"name\": \"material_r_to_n\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 1}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 10}\"\n }\n ]\n }\n ]\n}")
);
CurrentRateMaster 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.UpdateCurrentRateMasterRequest;
using Gs2.Gs2Exchange.Result.UpdateCurrentRateMasterResult;
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.UpdateCurrentRateMasterResult> asyncResult = null;
yield return client.UpdateCurrentRateMaster(
new Gs2.Gs2Exchange.Request.UpdateCurrentRateMasterRequest()
.WithNamespaceName("namespace1")
.WithSettings("{\n \"version\": \"2019-08-19\",\n \"rateModels\": [\n {\n \"name\": \"material_n_to_r\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 10}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 1}\"\n }\n ]\n },\n {\n \"name\": \"material_r_to_n\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 1}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 10}\"\n }\n ]\n }\n ]\n}"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.updateCurrentRateMaster(
new Gs2Exchange.UpdateCurrentRateMasterRequest()
.withNamespaceName("namespace1")
.withSettings("{\n \"version\": \"2019-08-19\",\n \"rateModels\": [\n {\n \"name\": \"material_n_to_r\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 10}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 1}\"\n }\n ]\n },\n {\n \"name\": \"material_r_to_n\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 1}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 10}\"\n }\n ]\n }\n ]\n}")
);
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_current_rate_master(
exchange.UpdateCurrentRateMasterRequest()
.with_namespace_name(self.hash1)
.with_settings('{\n "version": "2019-08-19",\n "rateModels": [\n {\n "name": "material_n_to_r",\n "metadata": "N2R",\n "timingType": "await",\n "enableSkip": false,\n "lockTime": 50,\n "consumeActions": [\n {\n "action": "Gs2Inventory:ConsumeItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0001\\", \\"userId\\": \\"#{userId}\\", \\"consumeCount\\": 10}"\n }\n ],\n "acquireActions": [\n {\n "action": "Gs2Inventory:AcquireItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0002\\", \\"userId\\": \\"#{userId}\\", \\"acquireCount\\": 1}"\n }\n ]\n },\n {\n "name": "material_r_to_n",\n "metadata": "N2R",\n "timingType": "await",\n "enableSkip": false,\n "lockTime": 50,\n "consumeActions": [\n {\n "action": "Gs2Inventory:ConsumeItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0002\\", \\"userId\\": \\"#{userId}\\", \\"consumeCount\\": 1}"\n }\n ],\n "acquireActions": [\n {\n "action": "Gs2Inventory:AcquireItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0001\\", \\"userId\\": \\"#{userId}\\", \\"acquireCount\\": 10}"\n }\n ]\n }\n ]\n}')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.update_current_rate_master({
namespaceName="namespace1",
settings="{\n "version": "2019-08-19",\n "rateModels": [\n {\n "name": "material_n_to_r",\n "metadata": "N2R",\n "timingType": "await",\n "enableSkip": false,\n "lockTime": 50,\n "consumeActions": [\n {\n "action": "Gs2Inventory:ConsumeItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0001\\", \\"userId\\": \\"#{userId}\\", \\"consumeCount\\": 10}"\n }\n ],\n "acquireActions": [\n {\n "action": "Gs2Inventory:AcquireItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0002\\", \\"userId\\": \\"#{userId}\\", \\"acquireCount\\": 1}"\n }\n ]\n },\n {\n "name": "material_r_to_n",\n "metadata": "N2R",\n "timingType": "await",\n "enableSkip": false,\n "lockTime": 50,\n "consumeActions": [\n {\n "action": "Gs2Inventory:ConsumeItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0002\\", \\"userId\\": \\"#{userId}\\", \\"consumeCount\\": 1}"\n }\n ],\n "acquireActions": [\n {\n "action": "Gs2Inventory:AcquireItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0001\\", \\"userId\\": \\"#{userId}\\", \\"acquireCount\\": 10}"\n }\n ]\n }\n ]\n}",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.update_current_rate_master_async({
namespaceName="namespace1",
settings="{\n "version": "2019-08-19",\n "rateModels": [\n {\n "name": "material_n_to_r",\n "metadata": "N2R",\n "timingType": "await",\n "enableSkip": false,\n "lockTime": 50,\n "consumeActions": [\n {\n "action": "Gs2Inventory:ConsumeItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0001\\", \\"userId\\": \\"#{userId}\\", \\"consumeCount\\": 10}"\n }\n ],\n "acquireActions": [\n {\n "action": "Gs2Inventory:AcquireItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0002\\", \\"userId\\": \\"#{userId}\\", \\"acquireCount\\": 1}"\n }\n ]\n },\n {\n "name": "material_r_to_n",\n "metadata": "N2R",\n "timingType": "await",\n "enableSkip": false,\n "lockTime": 50,\n "consumeActions": [\n {\n "action": "Gs2Inventory:ConsumeItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0002\\", \\"userId\\": \\"#{userId}\\", \\"consumeCount\\": 1}"\n }\n ],\n "acquireActions": [\n {\n "action": "Gs2Inventory:AcquireItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0001\\", \\"userId\\": \\"#{userId}\\", \\"acquireCount\\": 10}"\n }\n ]\n }\n ]\n}",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateCurrentRateMasterFromGitHub
現在有効な交換レート設定を更新
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
checkoutSetting | GitHubCheckoutSetting | ✓ | GitHubからマスターデータをチェックアウトしてくる設定 |
Result
型 | 説明 | |
---|---|---|
item | CurrentRateMaster | 更新した現在有効な交換レート設定 |
実装例
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.UpdateCurrentRateMasterFromGitHub(
&exchange.UpdateCurrentRateMasterFromGitHubRequest {
NamespaceName: pointy.String("namespace1"),
CheckoutSetting: &exchange.GitHubCheckoutSetting{
ApiKeyId: pointy.String("$gitHubApiKey1.apiKeyId"),
RepositoryName: pointy.String("gs2io/master-data"),
SourcePath: pointy.String("path/to/file.json"),
ReferenceType: pointy.String("branch"),
BranchName: pointy.String("develop"),
},
}
)
if err != nil {
panic("error occurred")
}
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\UpdateCurrentRateMasterFromGitHubRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateCurrentRateMasterFromGitHub(
(new UpdateCurrentRateMasterFromGitHubRequest())
->withNamespaceName(self::namespace1)
->withCheckoutSetting((new GitHubCheckoutSetting())
->withApiKeyId(self::$gitHubApiKey1.apiKeyId)
->withRepositoryName("gs2io/master-data")
->withSourcePath("path/to/file.json")
->withReferenceType("branch")
->withBranchName("develop")
)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.UpdateCurrentRateMasterFromGitHubRequest;
import io.gs2.exchange.result.UpdateCurrentRateMasterFromGitHubResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
UpdateCurrentRateMasterFromGitHubResult result = client.updateCurrentRateMasterFromGitHub(
new UpdateCurrentRateMasterFromGitHubRequest()
.withNamespaceName("namespace1")
.withCheckoutSetting(new GitHubCheckoutSetting()
.withApiKeyId("$gitHubApiKey1.apiKeyId")
.withRepositoryName("gs2io/master-data")
.withSourcePath("path/to/file.json")
.withReferenceType("branch")
.withBranchName("develop")
)
);
CurrentRateMaster 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.UpdateCurrentRateMasterFromGitHubRequest;
using Gs2.Gs2Exchange.Result.UpdateCurrentRateMasterFromGitHubResult;
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.UpdateCurrentRateMasterFromGitHubResult> asyncResult = null;
yield return client.UpdateCurrentRateMasterFromGitHub(
new Gs2.Gs2Exchange.Request.UpdateCurrentRateMasterFromGitHubRequest()
.WithNamespaceName("namespace1")
.WithCheckoutSetting(new Gs2.Gs2Exchange.Model.GitHubCheckoutSetting()
.WithApiKeyId("$gitHubApiKey1.apiKeyId")
.WithRepositoryName("gs2io/master-data")
.WithSourcePath("path/to/file.json")
.WithReferenceType("branch")
.WithBranchName("develop")
),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var 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.updateCurrentRateMasterFromGitHub(
new Gs2Exchange.UpdateCurrentRateMasterFromGitHubRequest()
.withNamespaceName("namespace1")
.withCheckoutSetting(new Gs2Exchange.model.GitHubCheckoutSetting()
.withApiKeyId("$gitHubApiKey1.apiKeyId")
.withRepositoryName("gs2io/master-data")
.withSourcePath("path/to/file.json")
.withReferenceType("branch")
.withBranchName("develop")
)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import 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_current_rate_master_from_git_hub(
exchange.UpdateCurrentRateMasterFromGitHubRequest()
.with_namespace_name(self.hash1)
.with_checkout_setting(exchange.GitHubCheckoutSetting()
.with_api_key_id(self.git_hub_api_key1.api_key_id)
.with_repository_name('gs2io/master-data')
.with_source_path('path/to/file.json')
.with_reference_type('branch')
.with_branch_name('develop')
)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.update_current_rate_master_from_git_hub({
namespaceName="namespace1",
checkoutSetting={
api_key_id="$gitHubApiKey1.apiKeyId",
repository_name="gs2io/master-data",
source_path="path/to/file.json",
reference_type="branch",
branch_name="develop",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.update_current_rate_master_from_git_hub_async({
namespaceName="namespace1",
checkoutSetting={
api_key_id="$gitHubApiKey1.apiKeyId",
repository_name="gs2io/master-data",
source_path="path/to/file.json",
reference_type="branch",
branch_name="develop",
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
createAwaitByUserId
ユーザーIDを指定して交換待機を作成
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
rateName | string | ✓ | ~ 128文字 | 交換レートの名前 | ||
count | int | ✓ | 1 | 1 ~ 10000 | 交換数 | |
config | List<Config> | [] | ~ 32 items | 報酬取得時に適用する設定値のデフォルト値 | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | Await | 交換待機 |
実装例
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.CreateAwaitByUserId(
&exchange.CreateAwaitByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
RateName: pointy.String("material_n_to_r"),
Count: nil,
Config: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CreateAwaitByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createAwaitByUserId(
(new CreateAwaitByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withRateName("material_n_to_r")
->withCount(null)
->withConfig(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CreateAwaitByUserIdRequest;
import io.gs2.exchange.result.CreateAwaitByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CreateAwaitByUserIdResult result = client.createAwaitByUserId(
new CreateAwaitByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withRateName("material_n_to_r")
.withCount(null)
.withConfig(null)
.withTimeOffsetToken(null)
);
Await 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.CreateAwaitByUserIdRequest;
using Gs2.Gs2Exchange.Result.CreateAwaitByUserIdResult;
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.CreateAwaitByUserIdResult> asyncResult = null;
yield return client.CreateAwaitByUserId(
new Gs2.Gs2Exchange.Request.CreateAwaitByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithRateName("material_n_to_r")
.WithCount(null)
.WithConfig(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.createAwaitByUserId(
new Gs2Exchange.CreateAwaitByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withRateName("material_n_to_r")
.withCount(null)
.withConfig(null)
.withTimeOffsetToken(null)
);
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_await_by_user_id(
exchange.CreateAwaitByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_rate_name('material_n_to_r')
.with_count(None)
.with_config(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.create_await_by_user_id({
namespaceName="namespace1",
userId="user-0001",
rateName="material_n_to_r",
count=nil,
config=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.create_await_by_user_id_async({
namespaceName="namespace1",
userId="user-0001",
rateName="material_n_to_r",
count=nil,
config=nil,
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
item = result.item;
describeAwaits
交換待機の一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | ユーザーID | ||
rateName | string | ~ 128文字 | 交換レートの名前 | |||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | List<Await> | 交換待機のリスト |
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.DescribeAwaits(
&exchange.DescribeAwaitsRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("accessToken-0001"),
RateName: pointy.String("material_n_to_r"),
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\DescribeAwaitsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeAwaits(
(new DescribeAwaitsRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withRateName("material_n_to_r")
->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.DescribeAwaitsRequest;
import io.gs2.exchange.result.DescribeAwaitsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DescribeAwaitsResult result = client.describeAwaits(
new DescribeAwaitsRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withRateName("material_n_to_r")
.withPageToken(null)
.withLimit(null)
);
List<Await> 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.DescribeAwaitsRequest;
using Gs2.Gs2Exchange.Result.DescribeAwaitsResult;
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.DescribeAwaitsResult> asyncResult = null;
yield return client.DescribeAwaits(
new Gs2.Gs2Exchange.Request.DescribeAwaitsRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("accessToken-0001")
.WithRateName("material_n_to_r")
.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.describeAwaits(
new Gs2Exchange.DescribeAwaitsRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withRateName("material_n_to_r")
.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_awaits(
exchange.DescribeAwaitsRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_rate_name('material_n_to_r')
.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_awaits({
namespaceName="namespace1",
accessToken="accessToken-0001",
rateName="material_n_to_r",
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_awaits_async({
namespaceName="namespace1",
accessToken="accessToken-0001",
rateName="material_n_to_r",
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;
describeAwaitsByUserId
ユーザーIDを指定して交換待機の一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
rateName | string | ~ 128文字 | 交換レートの名前 | |||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 | |
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
items | List<Await> | 交換待機のリスト |
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.DescribeAwaitsByUserId(
&exchange.DescribeAwaitsByUserIdRequest {
NamespaceName: pointy.String("namespace2"),
UserId: pointy.String("user-0001"),
RateName: pointy.String("material_n_to_r"),
PageToken: nil,
Limit: nil,
TimeOffsetToken: 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\DescribeAwaitsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeAwaitsByUserId(
(new DescribeAwaitsByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withRateName("material_n_to_r")
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(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.DescribeAwaitsByUserIdRequest;
import io.gs2.exchange.result.DescribeAwaitsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DescribeAwaitsByUserIdResult result = client.describeAwaitsByUserId(
new DescribeAwaitsByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withRateName("material_n_to_r")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<Await> 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.DescribeAwaitsByUserIdRequest;
using Gs2.Gs2Exchange.Result.DescribeAwaitsByUserIdResult;
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.DescribeAwaitsByUserIdResult> asyncResult = null;
yield return client.DescribeAwaitsByUserId(
new Gs2.Gs2Exchange.Request.DescribeAwaitsByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithRateName("material_n_to_r")
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(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.describeAwaitsByUserId(
new Gs2Exchange.DescribeAwaitsByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withRateName("material_n_to_r")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(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_awaits_by_user_id(
exchange.DescribeAwaitsByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
.with_rate_name('material_n_to_r')
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(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_awaits_by_user_id({
namespaceName="namespace2",
userId="user-0001",
rateName="material_n_to_r",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('exchange')
api_result_handler = client.describe_awaits_by_user_id_async({
namespaceName="namespace2",
userId="user-0001",
rateName="material_n_to_r",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
getAwait
交換待機を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | ユーザーID | ||
awaitName | string | ✓ | UUID | ~ 36文字 | 交換待機の名前 |
Result
型 | 説明 | |
---|---|---|
item | Await | 交換待機 |
実装例
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.GetAwait(
&exchange.GetAwaitRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("accessToken-0001"),
AwaitName: pointy.String("await-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\GetAwaitRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getAwait(
(new GetAwaitRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withAwaitName(self::await-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.GetAwaitRequest;
import io.gs2.exchange.result.GetAwaitResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetAwaitResult result = client.getAwait(
new GetAwaitRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withAwaitName("await-0001")
);
Await 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.GetAwaitRequest;
using Gs2.Gs2Exchange.Result.GetAwaitResult;
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.GetAwaitResult> asyncResult = null;
yield return client.GetAwait(
new Gs2.Gs2Exchange.Request.GetAwaitRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("accessToken-0001")
.WithAwaitName("await-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.getAwait(
new Gs2Exchange.GetAwaitRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withAwaitName("await-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_await(
exchange.GetAwaitRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_await_name(self.await1.name)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_await({
namespaceName="namespace1",
accessToken="accessToken-0001",
awaitName="await-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_await_async({
namespaceName="namespace1",
accessToken="accessToken-0001",
awaitName="await-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;
getAwaitByUserId
ユーザーIDを指定して交換待機を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
awaitName | string | ✓ | UUID | ~ 36文字 | 交換待機の名前 | |
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | Await | 交換待機 |
実装例
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.GetAwaitByUserId(
&exchange.GetAwaitByUserIdRequest {
NamespaceName: pointy.String("namespace2"),
UserId: pointy.String("user-0001"),
AwaitName: pointy.String("await-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\GetAwaitByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getAwaitByUserId(
(new GetAwaitByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withAwaitName("await-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.GetAwaitByUserIdRequest;
import io.gs2.exchange.result.GetAwaitByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetAwaitByUserIdResult result = client.getAwaitByUserId(
new GetAwaitByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withTimeOffsetToken(null)
);
Await 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.GetAwaitByUserIdRequest;
using Gs2.Gs2Exchange.Result.GetAwaitByUserIdResult;
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.GetAwaitByUserIdResult> asyncResult = null;
yield return client.GetAwaitByUserId(
new Gs2.Gs2Exchange.Request.GetAwaitByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithAwaitName("await-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.getAwaitByUserId(
new Gs2Exchange.GetAwaitByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withTimeOffsetToken(null)
);
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_await_by_user_id(
exchange.GetAwaitByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
.with_await_name('await-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_await_by_user_id({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.get_await_by_user_id_async({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-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
item = result.item;
acquire
交換待機の報酬を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | ユーザーID | ||
awaitName | string | ✓ | UUID | ~ 36文字 | 交換待機の名前 | |
config | List<Config> | [] | ~ 32 items | トランザクションの変数に適用する設定値 |
Result
型 | 説明 | |
---|---|---|
item | Await | 交換待機 |
transactionId | string | 発行されたトランザクションID |
stampSheet | string | 報酬取得処理の実行に使用するスタンプシート |
stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN |
autoRunStampSheet | bool? | トランザクションの自動実行が有効か |
atomicCommit | bool? | トランザクションをアトミックにコミットするか |
transaction | string | 発行されたトランザクション |
transactionResult | TransactionResult | トランザクション実行結果 |
実装例
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.Acquire(
&exchange.AcquireRequest {
NamespaceName: pointy.String("namespace2"),
AccessToken: pointy.String("accessToken-0001"),
AwaitName: pointy.String("await-0001"),
Config: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
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\AcquireRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->acquire(
(new AcquireRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->withAwaitName("await-0001")
->withConfig(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.AcquireRequest;
import io.gs2.exchange.result.AcquireResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
AcquireResult result = client.acquire(
new AcquireRequest()
.withNamespaceName("namespace2")
.withAccessToken("accessToken-0001")
.withAwaitName("await-0001")
.withConfig(null)
);
Await item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} 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.AcquireRequest;
using Gs2.Gs2Exchange.Result.AcquireResult;
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.AcquireResult> asyncResult = null;
yield return client.Acquire(
new Gs2.Gs2Exchange.Request.AcquireRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("accessToken-0001")
.WithAwaitName("await-0001")
.WithConfig(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
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.acquire(
new Gs2Exchange.AcquireRequest()
.withNamespaceName("namespace2")
.withAccessToken("accessToken-0001")
.withAwaitName("await-0001")
.withConfig(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} 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.acquire(
exchange.AcquireRequest()
.with_namespace_name(self.hash2)
.with_access_token(self.access_token_0001)
.with_await_name('await-0001')
.with_config(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.acquire({
namespaceName="namespace2",
accessToken="accessToken-0001",
awaitName="await-0001",
config=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.acquire_async({
namespaceName="namespace2",
accessToken="accessToken-0001",
awaitName="await-0001",
config=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
acquireByUserId
交換待機の報酬を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
awaitName | string | ✓ | UUID | ~ 36文字 | 交換待機の名前 | |
config | List<Config> | [] | ~ 32 items | トランザクションの変数に適用する設定値 | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | Await | 交換待機 |
transactionId | string | 発行されたトランザクションID |
stampSheet | string | 報酬取得処理の実行に使用するスタンプシート |
stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN |
autoRunStampSheet | bool? | トランザクションの自動実行が有効か |
atomicCommit | bool? | トランザクションをアトミックにコミットするか |
transaction | string | 発行されたトランザクション |
transactionResult | TransactionResult | トランザクション実行結果 |
実装例
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.AcquireByUserId(
&exchange.AcquireByUserIdRequest {
NamespaceName: pointy.String("namespace2"),
UserId: pointy.String("user-0001"),
AwaitName: pointy.String("await-0001"),
Config: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
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\AcquireByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->acquireByUserId(
(new AcquireByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withAwaitName("await-0001")
->withConfig(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.AcquireByUserIdRequest;
import io.gs2.exchange.result.AcquireByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
AcquireByUserIdResult result = client.acquireByUserId(
new AcquireByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withConfig(null)
.withTimeOffsetToken(null)
);
Await item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} 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.AcquireByUserIdRequest;
using Gs2.Gs2Exchange.Result.AcquireByUserIdResult;
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.AcquireByUserIdResult> asyncResult = null;
yield return client.AcquireByUserId(
new Gs2.Gs2Exchange.Request.AcquireByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithAwaitName("await-0001")
.WithConfig(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
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.acquireByUserId(
new Gs2Exchange.AcquireByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withConfig(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} 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.acquire_by_user_id(
exchange.AcquireByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
.with_await_name('await-0001')
.with_config(None)
.with_time_offset_token(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.acquire_by_user_id({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
config=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.acquire_by_user_id_async({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
config=nil,
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
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
acquireForceByUserId
交換待機の報酬を、待機時間の判定を行わず強制取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
awaitName | string | ✓ | UUID | ~ 36文字 | 交換待機の名前 | |
config | List<Config> | [] | ~ 32 items | トランザクションの変数に適用する設定値 | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | Await | 交換待機 |
transactionId | string | 発行されたトランザクションID |
stampSheet | string | 報酬取得処理の実行に使用するスタンプシート |
stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN |
autoRunStampSheet | bool? | トランザクションの自動実行が有効か |
atomicCommit | bool? | トランザクションをアトミックにコミットするか |
transaction | string | 発行されたトランザクション |
transactionResult | TransactionResult | トランザクション実行結果 |
実装例
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.AcquireForceByUserId(
&exchange.AcquireForceByUserIdRequest {
NamespaceName: pointy.String("namespace2"),
UserId: pointy.String("user-0001"),
AwaitName: pointy.String("await-0001"),
Config: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
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\AcquireForceByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->acquireForceByUserId(
(new AcquireForceByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withAwaitName("await-0001")
->withConfig(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.AcquireForceByUserIdRequest;
import io.gs2.exchange.result.AcquireForceByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
AcquireForceByUserIdResult result = client.acquireForceByUserId(
new AcquireForceByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withConfig(null)
.withTimeOffsetToken(null)
);
Await item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} 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.AcquireForceByUserIdRequest;
using Gs2.Gs2Exchange.Result.AcquireForceByUserIdResult;
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.AcquireForceByUserIdResult> asyncResult = null;
yield return client.AcquireForceByUserId(
new Gs2.Gs2Exchange.Request.AcquireForceByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithAwaitName("await-0001")
.WithConfig(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
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.acquireForceByUserId(
new Gs2Exchange.AcquireForceByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withConfig(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} 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.acquire_force_by_user_id(
exchange.AcquireForceByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
.with_await_name('await-0001')
.with_config(None)
.with_time_offset_token(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.acquire_force_by_user_id({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
config=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.acquire_force_by_user_id_async({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
config=nil,
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
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
skipByUserId
ユーザーIDを指定して交換待機をスキップ
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
awaitName | string | ✓ | UUID | ~ 36文字 | 交換待機の名前 | |
skipType | enum { “complete”, “minutes”, “totalRate”, “remainRate” } | ✓ | “complete” | ~ 128文字 | スキップ方法 | |
minutes | int | {skipType} == “minutes” | ~ 2147483646 | スキップする分数 | ||
rate | float | {skipType} == “totalRate” or {skipType} == “remainRate” | ~ 1 | スキップする割合 | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
skipType に指定する列挙型の定義
定義 | 説明 |
---|---|
complete | 完全にスキップ |
minutes | 時間を指定してスキップ(分) |
totalRate | 全体の待機時間の割合を指定してスキップ |
remainRate | 残りの待機時間の割合を指定してスキップ |
Result
型 | 説明 | |
---|---|---|
item | Await | 交換待機 |
実装例
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.SkipByUserId(
&exchange.SkipByUserIdRequest {
NamespaceName: pointy.String("namespace2"),
UserId: pointy.String("user-0001"),
AwaitName: pointy.String("await-0001"),
SkipType: nil,
Minutes: nil,
Rate: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\SkipByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->skipByUserId(
(new SkipByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withAwaitName("await-0001")
->withSkipType(null)
->withMinutes(null)
->withRate(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.SkipByUserIdRequest;
import io.gs2.exchange.result.SkipByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
SkipByUserIdResult result = client.skipByUserId(
new SkipByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withSkipType(null)
.withMinutes(null)
.withRate(null)
.withTimeOffsetToken(null)
);
Await 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.SkipByUserIdRequest;
using Gs2.Gs2Exchange.Result.SkipByUserIdResult;
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.SkipByUserIdResult> asyncResult = null;
yield return client.SkipByUserId(
new Gs2.Gs2Exchange.Request.SkipByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithAwaitName("await-0001")
.WithSkipType(null)
.WithMinutes(null)
.WithRate(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.skipByUserId(
new Gs2Exchange.SkipByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withSkipType(null)
.withMinutes(null)
.withRate(null)
.withTimeOffsetToken(null)
);
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.skip_by_user_id(
exchange.SkipByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
.with_await_name('await-0001')
.with_skip_type(None)
.with_minutes(None)
.with_rate(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.skip_by_user_id({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
skipType=nil,
minutes=nil,
rate=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.skip_by_user_id_async({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
skipType=nil,
minutes=nil,
rate=nil,
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
item = result.item;
deleteAwait
交換待機を削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | ユーザーID | ||
awaitName | string | ✓ | UUID | ~ 36文字 | 交換待機の名前 |
Result
型 | 説明 | |
---|---|---|
item | Await | 交換待機 |
実装例
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.DeleteAwait(
&exchange.DeleteAwaitRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("accessToken-0001"),
AwaitName: pointy.String("await-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\DeleteAwaitRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteAwait(
(new DeleteAwaitRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withAwaitName(self::await-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.DeleteAwaitRequest;
import io.gs2.exchange.result.DeleteAwaitResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DeleteAwaitResult result = client.deleteAwait(
new DeleteAwaitRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withAwaitName("await-0001")
);
Await 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.DeleteAwaitRequest;
using Gs2.Gs2Exchange.Result.DeleteAwaitResult;
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.DeleteAwaitResult> asyncResult = null;
yield return client.DeleteAwait(
new Gs2.Gs2Exchange.Request.DeleteAwaitRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("accessToken-0001")
.WithAwaitName("await-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.deleteAwait(
new Gs2Exchange.DeleteAwaitRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withAwaitName("await-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.delete_await(
exchange.DeleteAwaitRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_await_name(self.await1.name)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.delete_await({
namespaceName="namespace1",
accessToken="accessToken-0001",
awaitName="await-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.delete_await_async({
namespaceName="namespace1",
accessToken="accessToken-0001",
awaitName="await-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;
deleteAwaitByUserId
交換待機を削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
awaitName | string | ✓ | UUID | ~ 36文字 | 交換待機の名前 | |
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | Await | 交換待機 |
実装例
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.DeleteAwaitByUserId(
&exchange.DeleteAwaitByUserIdRequest {
NamespaceName: pointy.String("namespace2"),
UserId: pointy.String("user-0001"),
AwaitName: pointy.String("await-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DeleteAwaitByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteAwaitByUserId(
(new DeleteAwaitByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withAwaitName("await-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DeleteAwaitByUserIdRequest;
import io.gs2.exchange.result.DeleteAwaitByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DeleteAwaitByUserIdResult result = client.deleteAwaitByUserId(
new DeleteAwaitByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withTimeOffsetToken(null)
);
Await 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.DeleteAwaitByUserIdRequest;
using Gs2.Gs2Exchange.Result.DeleteAwaitByUserIdResult;
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.DeleteAwaitByUserIdResult> asyncResult = null;
yield return client.DeleteAwaitByUserId(
new Gs2.Gs2Exchange.Request.DeleteAwaitByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithAwaitName("await-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.deleteAwaitByUserId(
new Gs2Exchange.DeleteAwaitByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withTimeOffsetToken(null)
);
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_await_by_user_id(
exchange.DeleteAwaitByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
.with_await_name('await-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.delete_await_by_user_id({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.delete_await_by_user_id_async({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-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
item = result.item;
createAwaitByStampSheet
入手アクションとして交換待機の作成を実行
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
stampSheet | string | ✓ | ~ 5242880文字 | トランザクション | ||
keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN |
Result
型 | 説明 | |
---|---|---|
item | Await | 交換待機 |
実装例
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.CreateAwaitByStampSheet(
&exchange.CreateAwaitByStampSheetRequest {
StampSheet: pointy.String("stampSheet"),
KeyId: pointy.String("key-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\CreateAwaitByStampSheetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createAwaitByStampSheet(
(new CreateAwaitByStampSheetRequest())
->withStampSheet(self::stampSheet)
->withKeyId(self::key-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.CreateAwaitByStampSheetRequest;
import io.gs2.exchange.result.CreateAwaitByStampSheetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CreateAwaitByStampSheetResult result = client.createAwaitByStampSheet(
new CreateAwaitByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
Await 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.CreateAwaitByStampSheetRequest;
using Gs2.Gs2Exchange.Result.CreateAwaitByStampSheetResult;
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.CreateAwaitByStampSheetResult> asyncResult = null;
yield return client.CreateAwaitByStampSheet(
new Gs2.Gs2Exchange.Request.CreateAwaitByStampSheetRequest()
.WithStampSheet("stampSheet")
.WithKeyId("key-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.createAwaitByStampSheet(
new Gs2Exchange.CreateAwaitByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-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.create_await_by_stamp_sheet(
exchange.CreateAwaitByStampSheetRequest()
.with_stamp_sheet(self.stamp_sheet)
.with_key_id(self.key1.key_id)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.create_await_by_stamp_sheet({
stampSheet="stampSheet",
keyId="key-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.create_await_by_stamp_sheet_async({
stampSheet="stampSheet",
keyId="key-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;
acquireForceByStampSheet
入手アクションとして交換待機の報酬を、待機時間の判定を行わず強制取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
stampSheet | string | ✓ | ~ 5242880文字 | トランザクション | ||
keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN |
Result
型 | 説明 | |
---|---|---|
item | Await | 交換待機 |
transactionId | string | 発行されたトランザクションID |
stampSheet | string | 報酬取得処理の実行に使用するスタンプシート |
stampSheetEncryptionKeyId | string | スタンプシートの署名計算に使用した暗号鍵GRN |
autoRunStampSheet | bool? | トランザクションの自動実行が有効か |
atomicCommit | bool? | トランザクションをアトミックにコミットするか |
transaction | string | 発行されたトランザクション |
transactionResult | TransactionResult | トランザクション実行結果 |
実装例
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.AcquireForceByStampSheet(
&exchange.AcquireForceByStampSheetRequest {
StampSheet: pointy.String("stampSheet"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
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\AcquireForceByStampSheetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->acquireForceByStampSheet(
(new AcquireForceByStampSheetRequest())
->withStampSheet(self::stampSheet)
->withKeyId(self::key-0001)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.AcquireForceByStampSheetRequest;
import io.gs2.exchange.result.AcquireForceByStampSheetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
AcquireForceByStampSheetResult result = client.acquireForceByStampSheet(
new AcquireForceByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
Await item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} 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.AcquireForceByStampSheetRequest;
using Gs2.Gs2Exchange.Result.AcquireForceByStampSheetResult;
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.AcquireForceByStampSheetResult> asyncResult = null;
yield return client.AcquireForceByStampSheet(
new Gs2.Gs2Exchange.Request.AcquireForceByStampSheetRequest()
.WithStampSheet("stampSheet")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
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.acquireForceByStampSheet(
new Gs2Exchange.AcquireForceByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} 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.acquire_force_by_stamp_sheet(
exchange.AcquireForceByStampSheetRequest()
.with_stamp_sheet(self.stamp_sheet)
.with_key_id(self.key1.key_id)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.acquire_force_by_stamp_sheet({
stampSheet="stampSheet",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.acquire_force_by_stamp_sheet_async({
stampSheet="stampSheet",
keyId="key-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;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
skipByStampSheet
入手アクションとして交換待機のスキップを実行
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
stampSheet | string | ✓ | ~ 5242880文字 | トランザクション | ||
keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN |
Result
型 | 説明 | |
---|---|---|
item | Await | 交換待機 |
実装例
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.SkipByStampSheet(
&exchange.SkipByStampSheetRequest {
StampSheet: pointy.String("stampSheet"),
KeyId: pointy.String("key-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\SkipByStampSheetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->skipByStampSheet(
(new SkipByStampSheetRequest())
->withStampSheet(self::stampSheet)
->withKeyId(self::key-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.SkipByStampSheetRequest;
import io.gs2.exchange.result.SkipByStampSheetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
SkipByStampSheetResult result = client.skipByStampSheet(
new SkipByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
Await 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.SkipByStampSheetRequest;
using Gs2.Gs2Exchange.Result.SkipByStampSheetResult;
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.SkipByStampSheetResult> asyncResult = null;
yield return client.SkipByStampSheet(
new Gs2.Gs2Exchange.Request.SkipByStampSheetRequest()
.WithStampSheet("stampSheet")
.WithKeyId("key-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.skipByStampSheet(
new Gs2Exchange.SkipByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-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.skip_by_stamp_sheet(
exchange.SkipByStampSheetRequest()
.with_stamp_sheet(self.stamp_sheet)
.with_key_id(self.key1.key_id)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.skip_by_stamp_sheet({
stampSheet="stampSheet",
keyId="key-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.skip_by_stamp_sheet_async({
stampSheet="stampSheet",
keyId="key-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;
deleteAwaitByStampTask
スタンプタスクで 交換待機 を削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
stampTask | string | ✓ | ~ 5242880文字 | 消費アクション | ||
keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN |
Result
型 | 説明 | |
---|---|---|
item | Await | 交換待機 |
newContextStack | 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.DeleteAwaitByStampTask(
&exchange.DeleteAwaitByStampTaskRequest {
StampTask: pointy.String("stampTask"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
newContextStack := result.NewContextStack
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\DeleteAwaitByStampTaskRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteAwaitByStampTask(
(new DeleteAwaitByStampTaskRequest())
->withStampTask(self::stampTask)
->withKeyId(self::key-0001)
);
$item = $result->getItem();
$newContextStack = $result->getNewContextStack();
} 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.DeleteAwaitByStampTaskRequest;
import io.gs2.exchange.result.DeleteAwaitByStampTaskResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DeleteAwaitByStampTaskResult result = client.deleteAwaitByStampTask(
new DeleteAwaitByStampTaskRequest()
.withStampTask("stampTask")
.withKeyId("key-0001")
);
Await item = result.getItem();
String newContextStack = result.getNewContextStack();
} 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.DeleteAwaitByStampTaskRequest;
using Gs2.Gs2Exchange.Result.DeleteAwaitByStampTaskResult;
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.DeleteAwaitByStampTaskResult> asyncResult = null;
yield return client.DeleteAwaitByStampTask(
new Gs2.Gs2Exchange.Request.DeleteAwaitByStampTaskRequest()
.WithStampTask("stampTask")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var newContextStack = result.NewContextStack;
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.deleteAwaitByStampTask(
new Gs2Exchange.DeleteAwaitByStampTaskRequest()
.withStampTask("stampTask")
.withKeyId("key-0001")
);
const item = result.getItem();
const newContextStack = result.getNewContextStack();
} 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_await_by_stamp_task(
exchange.DeleteAwaitByStampTaskRequest()
.with_stamp_task(self.stamp_task)
.with_key_id(self.key1.key_id)
)
item = result.item
new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.delete_await_by_stamp_task({
stampTask="stampTask",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
newContextStack = result.newContextStack;
client = gs2('exchange')
api_result_handler = client.delete_await_by_stamp_task_async({
stampTask="stampTask",
keyId="key-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;
newContextStack = result.newContextStack;