GS2-Exchange SDK API リファレンス

モデル

Namespace

ネームスペース

ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。
GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。

そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。

有効化条件必須デフォルト値の制限説明
namespaceIdstring~ 1024文字ネームスペースGRN
namestring~ 128文字ネームスペース名
descriptionstring~ 1024文字説明文
enableDirectExchangebooltrue直接交換APIの呼び出しを許可する。許可しない場合はスタンプシート経由でしか交換できない
enableAwaitExchangeboolfalse交換結果の受け取りに待ち時間の発生する交換機能を利用するか
transactionSettingTransactionSettingトランザクション設定
exchangeScriptScriptSetting交換を実行しようとした時に実行するスクリプト
incrementalExchangeScriptScriptSettingレート上昇型交換を実行しようとした時に実行するスクリプト
logSettingLogSettingログの出力設定
createdAtlong現在時刻作成日時 (UNIX時間 単位:ミリ秒)
updatedAtlong現在時刻最終更新日時 (UNIX時間 単位:ミリ秒)
revisionlong0~ 9223372036854775805リビジョン

RateModel

交換レートモデル

交換レートはリソースとリソースを交換する際に使用するレートを定義するエンティティです。

直ちに交換できるレートだけでなく、現実時間で一定時間経過したのちに交換できるレートを設定できます。
現実時間での時間経過が必要な交換レートには、更に即時交換を実行するために必要なリソースを定義することが可能です。

有効化条件必須デフォルト値の制限説明
rateModelIdstring~ 1024文字交換レートモデルGRN
namestring~ 128文字交換レートの名前
metadatastring~ 2048文字メタデータ
verifyActionsList<VerifyAction>[]~ 10 items検証アクションリスト
consumeActionsList<ConsumeAction>[]~ 10 items消費アクションリスト
timingTypeenum {
    “immediate”,
    “await”
}
“immediate”~ 128文字交換の種類
lockTimeint{timingType} == “await”~ 538214400交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分)
acquireActionsList<AcquireAction>[]~ 100 items入手アクションリスト

timingType に指定する列挙型の定義

定義説明
immediate即時
await現実時間の経過待ち

RateModelMaster

交換レートモデルマスター

交換レートはリソースとリソースを交換する際に使用するレートを定義するエンティティです。

直ちに交換できるレートだけでなく、現実時間で一定時間経過したのちに交換できるレートを設定できます。
現実時間での時間経過が必要な交換レートには、更に即時交換を実行するために必要なリソースを定義することが可能です。

有効化条件必須デフォルト値の制限説明
rateModelIdstring~ 1024文字交換レートマスターGRN
namestring~ 128文字交換レート名
descriptionstring~ 1024文字説明文
metadatastring~ 2048文字メタデータ
verifyActionsList<VerifyAction>[]~ 10 items検証アクションリスト
consumeActionsList<ConsumeAction>[]~ 10 items消費アクションリスト
timingTypeenum {
    “immediate”,
    “await”
}
“immediate”~ 128文字交換の種類
lockTimeint{timingType} == “await”~ 538214400交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分)
acquireActionsList<AcquireAction>[]~ 100 items入手アクションリスト
createdAtlong現在時刻作成日時 (UNIX時間 単位:ミリ秒)
updatedAtlong現在時刻最終更新日時 (UNIX時間 単位:ミリ秒)
revisionlong0~ 9223372036854775805リビジョン

timingType に指定する列挙型の定義

定義説明
immediate即時
await現実時間の経過待ち

IncrementalRateModel

コスト上昇型交換レートモデル

通常の交換レートは常に一定のレートでの交換を提供します。
上昇型交換レートでは、交換回数に応じてコストが上昇していくレートを定義することができます。
例えば、1回目の交換では 1:1 で交換できるが、2回目の交換では 2:1 で交換できる、といったレートを定義することができます。
このようなレートを定義することで、プレイヤーがゲームを進めることで得られるリソースの価値を上げることができます。

交換回数は現実時間の経過でリセットすることができます。
この機能を利用することで、毎日あるいは毎週交換に必要なコストをリセットすることができます。

有効化条件必須デフォルト値の制限説明
incrementalRateModelIdstring~ 1024文字コスト上昇型交換レートモデルGRN
namestring~ 128文字コスト上昇型交換レートの名前
metadatastring~ 2048文字メタデータ
consumeActionConsumeAction消費アクション(数量/値は上書きされるため設定不要です)
calculateTypeenum {
    “linear”,
    “power”,
    “gs2_script”
}
~ 128文字コスト上昇量の計算方式
baseValuelong{calculateType} == “linear”~ 9223372036854775805ベース値
coefficientValuelong{calculateType} in [“linear”, “power”]~ 9223372036854775805係数
calculateScriptIdstring{calculateType} == “gs2_script”~ 1024文字コスト計算スクリプトのGRN
exchangeCountIdstring~ 1024文字交換実行回数を管理する GS2-Limit の回数制限モデルGRN
maximumExchangeCountint2147483646~ 2147483646交換回数の上限
acquireActionsList<AcquireAction>[]~ 100 items入手アクションリスト

calculateType に指定する列挙型の定義

定義説明
linearベース値 + (係数 * 交換回数)
power係数 * (交換回数 + 1) ^ 2
gs2_scriptGS2-Script による任意のロジック

IncrementalRateModelMaster

コスト上昇型交換レートモデルマスター

通常の交換レートは常に一定のレートでの交換を提供します。
上昇型交換レートでは、交換回数に応じてコストが上昇していくレートを定義することができます。
例えば、1回目の交換では 1:1 で交換できるが、2回目の交換では 2:1 で交換できる、といったレートを定義することができます。
このようなレートを定義することで、プレイヤーがゲームを進めることで得られるリソースの価値を上げることができます。

交換回数は現実時間の経過でリセットすることができます。
この機能を利用することで、毎日あるいは毎週交換に必要なコストをリセットすることができます。

有効化条件必須デフォルト値の制限説明
incrementalRateModelIdstring~ 1024文字交換レートマスターGRN
namestring~ 128文字交換レート名
descriptionstring~ 1024文字説明文
metadatastring~ 2048文字メタデータ
consumeActionConsumeAction消費アクション(数量/値は上書きされるため設定不要です)
calculateTypeenum {
    “linear”,
    “power”,
    “gs2_script”
}
~ 128文字コスト上昇量の計算方式
baseValuelong{calculateType} == “linear”~ 9223372036854775805ベース値
coefficientValuelong{calculateType} in [“linear”, “power”]~ 9223372036854775805係数
calculateScriptIdstring{calculateType} == “gs2_script”~ 1024文字コスト計算スクリプトのGRN
exchangeCountIdstring~ 1024文字交換実行回数を管理する GS2-Limit の回数制限モデルGRN
maximumExchangeCountint2147483646~ 2147483646交換回数の上限
acquireActionsList<AcquireAction>[]~ 100 items入手アクションリスト
createdAtlong現在時刻作成日時 (UNIX時間 単位:ミリ秒)
updatedAtlong現在時刻最終更新日時 (UNIX時間 単位:ミリ秒)
revisionlong0~ 9223372036854775805リビジョン

calculateType に指定する列挙型の定義

定義説明
linearベース値 + (係数 * 交換回数)
power係数 * (交換回数 + 1) ^ 2
gs2_scriptGS2-Script による任意のロジック

CurrentRateMaster

現在有効なマスターデータ

GS2ではマスターデータの管理にJSON形式のファイルを使用します。
ファイルをアップロードすることで、実際にサーバーに設定を反映することができます。

JSONファイルを作成する方法として、マネージメントコンソール上でのマスターデータエディタを提供していますが
よりゲームの運営に相応しいツールを作成し、適切なフォーマットのJSONファイルを書き出すことでもサービスを利用可能です。

有効化条件必須デフォルト値の制限説明
namespaceIdstring~ 1024文字現在有効な交換レート設定GRN
settingsstring~ 5242880文字マスターデータ

Await

交換待機

交換待機は、現実時間での時間経過が交換条件となる交換処理の実行状態を表すエンティティです。

有効化条件必須デフォルト値の制限説明
awaitIdstring~ 1024文字交換待機GRN
userIdstring~ 128文字ユーザーID
rateNamestring~ 128文字交換レートの名前
namestringUUID~ 36文字交換待機の名前
countint11 ~ 10000交換数
skipSecondsint0~ 2147483646スキップ秒数
configList<Config>[]~ 32 items報酬取得時に適用する設定値のデフォルト値
acquirableAtlong報酬を受け取れるようになる時間 (UNIX時間 単位:ミリ秒)
exchangedAtlong現在時刻作成日時 (UNIX時間 単位:ミリ秒)
revisionlong0~ 9223372036854775805リビジョン

LogCost

対数を使用したコスト計算結果

有効化条件必須デフォルト値の制限説明
basedouble~ 10
addsList<double>1 ~ 10000 items加算する対数のリスト
subsList<double>~ 10000 items減算する対数のリスト

LogRate

対数を使用した入手量補正

有効化条件必須デフォルト値の制限説明
basedouble~ 10
logsList<double>1 ~ 10000 items対数のリスト

AcquireAction

入手アクション

有効化条件必須デフォルト値の制限説明
actionenum {
"Gs2AdReward:AcquirePointByUserId",
"Gs2Dictionary:AddEntriesByUserId",
"Gs2Enchant:ReDrawBalanceParameterStatusByUserId",
"Gs2Enchant:SetBalanceParameterStatusByUserId",
"Gs2Enchant:ReDrawRarityParameterStatusByUserId",
"Gs2Enchant:AddRarityParameterStatusByUserId",
"Gs2Enchant:SetRarityParameterStatusByUserId",
"Gs2Enhance:DirectEnhanceByUserId",
"Gs2Enhance:UnleashByUserId",
"Gs2Enhance:CreateProgressByUserId",
"Gs2Exchange:ExchangeByUserId",
"Gs2Exchange:IncrementalExchangeByUserId",
"Gs2Exchange:CreateAwaitByUserId",
"Gs2Exchange:AcquireForceByUserId",
"Gs2Exchange:SkipByUserId",
"Gs2Experience:AddExperienceByUserId",
"Gs2Experience:SetExperienceByUserId",
"Gs2Experience:AddRankCapByUserId",
"Gs2Experience:SetRankCapByUserId",
"Gs2Experience:MultiplyAcquireActionsByUserId",
"Gs2Formation:AddMoldCapacityByUserId",
"Gs2Formation:SetMoldCapacityByUserId",
"Gs2Formation:AcquireActionsToFormProperties",
"Gs2Formation:SetFormByUserId",
"Gs2Formation:AcquireActionsToPropertyFormProperties",
"Gs2Friend:UpdateProfileByUserId",
"Gs2Grade:AddGradeByUserId",
"Gs2Grade:ApplyRankCapByUserId",
"Gs2Grade:MultiplyAcquireActionsByUserId",
"Gs2Guild:IncreaseMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Guild:SetMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Idle:IncreaseMaximumIdleMinutesByUserId",
"Gs2Idle:SetMaximumIdleMinutesByUserId",
"Gs2Idle:ReceiveByUserId",
"Gs2Inbox:SendMessageByUserId",
"Gs2Inventory:AddCapacityByUserId",
"Gs2Inventory:SetCapacityByUserId",
"Gs2Inventory:AcquireItemSetByUserId",
"Gs2Inventory:AcquireItemSetWithGradeByUserId",
"Gs2Inventory:AddReferenceOfByUserId",
"Gs2Inventory:DeleteReferenceOfByUserId",
"Gs2Inventory:AcquireSimpleItemsByUserId",
"Gs2Inventory:SetSimpleItemsByUserId",
"Gs2Inventory:AcquireBigItemByUserId",
"Gs2Inventory:SetBigItemByUserId",
"Gs2JobQueue:PushByUserId",
"Gs2Limit:CountDownByUserId",
"Gs2Limit:DeleteCounterByUserId",
"Gs2LoginReward:DeleteReceiveStatusByUserId",
"Gs2LoginReward:UnmarkReceivedByUserId",
"Gs2Lottery:DrawByUserId",
"Gs2Lottery:ResetBoxByUserId",
"Gs2Mission:RevertReceiveByUserId",
"Gs2Mission:IncreaseCounterByUserId",
"Gs2Mission:SetCounterByUserId",
"Gs2Money:DepositByUserId",
"Gs2Money:RevertRecordReceipt",
"Gs2Money2:DepositByUserId",
"Gs2Quest:CreateProgressByUserId",
"Gs2Schedule:TriggerByUserId",
"Gs2Script:InvokeScript",
"Gs2SerialKey:RevertUseByUserId",
"Gs2SerialKey:IssueOnce",
"Gs2Showcase:DecrementPurchaseCountByUserId",
"Gs2Showcase:ForceReDrawByUserId",
"Gs2SkillTree:MarkReleaseByUserId",
"Gs2Stamina:RecoverStaminaByUserId",
"Gs2Stamina:RaiseMaxValueByUserId",
"Gs2Stamina:SetMaxValueByUserId",
"Gs2Stamina:SetRecoverIntervalByUserId",
"Gs2Stamina:SetRecoverValueByUserId",
"Gs2StateMachine:StartStateMachineByUserId",
}
~ 128文字入手アクションで実行するアクションの種類
requeststring~ 1048576文字リクエストのJSON

ConsumeAction

消費アクション

有効化条件必須デフォルト値の制限説明
actionenum {
"Gs2AdReward:ConsumePointByUserId",
"Gs2Dictionary:DeleteEntriesByUserId",
"Gs2Enhance:DeleteProgressByUserId",
"Gs2Exchange:DeleteAwaitByUserId",
"Gs2Experience:SubExperienceByUserId",
"Gs2Experience:SubRankCapByUserId",
"Gs2Formation:SubMoldCapacityByUserId",
"Gs2Grade:SubGradeByUserId",
"Gs2Guild:DecreaseMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Idle:DecreaseMaximumIdleMinutesByUserId",
"Gs2Inbox:OpenMessageByUserId",
"Gs2Inbox:DeleteMessageByUserId",
"Gs2Inventory:ConsumeItemSetByUserId",
"Gs2Inventory:ConsumeSimpleItemsByUserId",
"Gs2Inventory:ConsumeBigItemByUserId",
"Gs2JobQueue:DeleteJobByUserId",
"Gs2Limit:CountUpByUserId",
"Gs2LoginReward:MarkReceivedByUserId",
"Gs2Mission:ReceiveByUserId",
"Gs2Mission:BatchReceiveByUserId",
"Gs2Mission:DecreaseCounterByUserId",
"Gs2Money:WithdrawByUserId",
"Gs2Money:RecordReceipt",
"Gs2Money2:WithdrawByUserId",
"Gs2Money2:VerifyReceiptByUserId",
"Gs2Quest:DeleteProgressByUserId",
"Gs2Ranking2:CreateGlobalRankingReceivedRewardByUserId",
"Gs2Ranking2:CreateClusterRankingReceivedRewardByUserId",
"Gs2Schedule:DeleteTriggerByUserId",
"Gs2SerialKey:UseByUserId",
"Gs2Showcase:IncrementPurchaseCountByUserId",
"Gs2SkillTree:MarkRestrainByUserId",
"Gs2Stamina:DecreaseMaxValueByUserId",
"Gs2Stamina:ConsumeStaminaByUserId",
}
~ 128文字消費アクションで実行するアクションの種類
requeststring~ 1048576文字リクエストのJSON

VerifyAction

検証アクション

有効化条件必須デフォルト値の制限説明
actionenum {
"Gs2Dictionary:VerifyEntryByUserId",
"Gs2Distributor:IfExpressionByUserId",
"Gs2Distributor:AndExpressionByUserId",
"Gs2Distributor:OrExpressionByUserId",
"Gs2Enchant:VerifyRarityParameterStatusByUserId",
"Gs2Experience:VerifyRankByUserId",
"Gs2Experience:VerifyRankCapByUserId",
"Gs2Grade:VerifyGradeByUserId",
"Gs2Grade:VerifyGradeUpMaterialByUserId",
"Gs2Guild:VerifyCurrentMaximumMemberCountByGuildName",
"Gs2Guild:VerifyIncludeMemberByUserId",
"Gs2Inventory:VerifyInventoryCurrentMaxCapacityByUserId",
"Gs2Inventory:VerifyItemSetByUserId",
"Gs2Inventory:VerifyReferenceOfByUserId",
"Gs2Inventory:VerifySimpleItemByUserId",
"Gs2Inventory:VerifyBigItemByUserId",
"Gs2Limit:VerifyCounterByUserId",
"Gs2Matchmaking:VerifyIncludeParticipantByUserId",
"Gs2Mission:VerifyCompleteByUserId",
"Gs2Mission:VerifyCounterValueByUserId",
"Gs2Ranking2:VerifyGlobalRankingScoreByUserId",
"Gs2Ranking2:VerifyClusterRankingScoreByUserId",
"Gs2Ranking2:VerifySubscribeRankingScoreByUserId",
"Gs2Schedule:VerifyTriggerByUserId",
"Gs2Schedule:VerifyEventByUserId",
"Gs2SerialKey:VerifyCodeByUserId",
}
~ 128文字検証アクションで実行するアクションの種類
requeststring~ 1048576文字リクエストのJSON

Config

コンフィグ設定

トランザクションの変数に適用する設定値

有効化条件必須デフォルト値の制限説明
keystring~ 64文字名前
valuestring~ 51200文字

VerifyActionResult

検証アクションの実行結果

有効化条件必須デフォルト値の制限説明
actionenum {
}
~ 128文字検証アクションで実行するアクションの種類
verifyRequeststring~ 1048576文字リクエストのJSON
statusCodeint~ 999ステータスコード
verifyResultstring~ 1048576文字結果内容

action に指定する列挙型の定義

定義説明

ConsumeActionResult

消費アクションの実行結果

有効化条件必須デフォルト値の制限説明
actionenum {
}
~ 128文字消費アクションで実行するアクションの種類
consumeRequeststring~ 1048576文字リクエストのJSON
statusCodeint~ 999ステータスコード
consumeResultstring~ 1048576文字結果内容

action に指定する列挙型の定義

定義説明

AcquireActionResult

入手アクションの実行結果

有効化条件必須デフォルト値の制限説明
actionenum {
}
~ 128文字入手アクションで実行するアクションの種類
acquireRequeststring~ 1048576文字リクエストのJSON
statusCodeint~ 999ステータスコード
acquireResultstring~ 1048576文字結果内容

action に指定する列挙型の定義

定義説明

TransactionResult

トランザクション実行結果

サーバーサイドでのトランザクションの自動実行機能を利用して実行されたトランザクションの実行結果

有効化条件必須デフォルト値の制限説明
transactionIdstring36 ~ 36文字トランザクションID
verifyResultsList<VerifyActionResult>~ 10 items検証アクションの実行結果リスト
consumeResultsList<ConsumeActionResult>~ 10 items消費アクションの実行結果リスト
acquireResultsList<AcquireActionResult>~ 100 items入手アクションの実行結果リスト

GitHubCheckoutSetting

GitHubからマスターデータをチェックアウトする設定

有効化条件必須デフォルト値の制限説明
apiKeyIdstring~ 1024文字GitHub のAPIキーGRN
repositoryNamestring~ 1024文字リポジトリ名
sourcePathstring~ 1024文字ソースコードのファイルパス
referenceTypeenum {
    “commit_hash”,
    “branch”,
    “tag”
}
~ 128文字コードの取得元
commitHashstring{referenceType} == “commit_hash”~ 1024文字コミットハッシュ
branchNamestring{referenceType} == “branch”~ 1024文字ブランチ名
tagNamestring{referenceType} == “tag”~ 1024文字タグ名

referenceType に指定する列挙型の定義

定義説明
commit_hashコミットハッシュ
branchブランチ
tagタグ

ScriptSetting

スクリプト設定

GS2 ではマイクロサービスのイベントに関連づけて、カスタムスクリプトを実行することができます。
このモデルは、スクリプトの実行をトリガーするための設定を保持します。

スクリプトの実行方式は大きく2種類あり、それは「同期実行」と「非同期実行」です。
同期実行は、スクリプトの実行が完了するまで処理がブロックされます。
かわりに、スクリプトの実行結果を使ってAPIの実行を止めたり、APIの結果を改ざんすることができます。

一方、非同期実行は、スクリプトの実行が完了するまで処理がブロックされません。
かわりに、スクリプトの実行結果を使ってAPIの実行を止めたり、APIの結果を改ざんすることはできません。
しかし、非同期実行は、スクリプトの実行が完了するまで処理がブロックされないため、APIの応答に影響を与えないため、原則非同期実行を使用することをおすすめします。

非同期実行には実行方式が2種類あり、GS2-Script と Amazon EventBridge があります。
Amazon EventBridge を使用することで、Lua 以外の言語で処理を記述することができます。

有効化条件必須デフォルト値の制限説明
triggerScriptIdstring~ 1024文字スクリプトGRN
doneTriggerTargetTypeenum {
    “none”,
    “gs2_script”,
    “aws”
}
“none”~ 128文字完了通知の通知先
doneTriggerScriptIdstring{doneTriggerTargetType} == “gs2_script”~ 1024文字スクリプトGRN
doneTriggerQueueNamespaceIdstring{doneTriggerTargetType} == “gs2_script”~ 1024文字ネームスペースGRN

doneTriggerTargetType に指定する列挙型の定義

定義説明
noneなし
gs2_scriptGS2-Script
awsAmazon EventBridge

LogSetting

ログの書き出し設定

ログデータの書き出し設定を管理します。この型は、ログデータを書き出すために使用されるログ名前空間の識別子(Namespace ID)を保持します。
ログ名前空間IDは、ログデータを集約し、保存する対象の GS2-Log の名前空間を指定します。
この設定を通じて、この名前空間以下のAPIリクエスト・レスポンスログデータが対象の GS2-Log へ出力されるようになります。
GS2-Log にはリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。

有効化条件必須デフォルト値の制限説明
loggingNamespaceIdstring~ 1024文字ネームスペースGRN

TransactionSetting

トランザクション設定

有効化条件必須デフォルト値の制限説明
enableAutoRunboolfalse発行したトランザクションをサーバーサイドで自動的に実行するか
enableAtomicCommitbool{enableAutoRun} == truefalseトランザクションの実行をアトミックにコミットするか
transactionUseDistributorbool{enableAtomicCommit} == truefalseトランザクションを非同期処理で実行する
acquireActionUseJobQueuebool{enableAtomicCommit} == truefalse入手アクションを実行する際に GS2-JobQueue を使用するか
distributorNamespaceIdstring“grn:gs2:{region}:{ownerId}:distributor:default”~ 1024文字トランザクションの実行に使用する GS2-Distributor ネームスペース
queueNamespaceIdstring“grn:gs2:{region}:{ownerId}:queue:default”~ 1024文字トランザクションの実行に使用する GS2-JobQueue のネームスペース

メソッド

describeNamespaces

ネームスペースの一覧を取得

Request

有効化条件必須デフォルト値の制限説明
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<Namespace>ネームスペースのリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

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

有効化条件必須デフォルト値の制限説明
namestring~ 128文字ネームスペース名
descriptionstring~ 1024文字説明文
enableAwaitExchangeboolfalse交換結果の受け取りに待ち時間の発生する交換機能を利用するか
enableDirectExchangebooltrue直接交換APIの呼び出しを許可する。許可しない場合はスタンプシート経由でしか交換できない
transactionSettingTransactionSettingトランザクション設定
exchangeScriptScriptSetting交換を実行しようとした時に実行するスクリプト
incrementalExchangeScriptScriptSettingレート上昇型交換を実行しようとした時に実行するスクリプト
logSettingLogSettingログの出力設定
queueNamespaceIdstring~ 1024文字トランザクションの実行に使用する GS2-JobQueue のネームスペース
keyIdstring~ 1024文字スタンプシートの発行に使用する GS2-Key のネームスペース

Result

説明
itemNamespace作成したネームスペース

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名

Result

説明
statusstring

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名

Result

説明
itemNamespaceネームスペース

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
descriptionstring~ 1024文字説明文
enableAwaitExchangeboolfalse交換結果の受け取りに待ち時間の発生する交換機能を利用するか
enableDirectExchangebooltrue直接交換APIの呼び出しを許可する。許可しない場合はスタンプシート経由でしか交換できない
transactionSettingTransactionSettingトランザクション設定
exchangeScriptScriptSetting交換を実行しようとした時に実行するスクリプト
incrementalExchangeScriptScriptSettingレート上昇型交換を実行しようとした時に実行するスクリプト
logSettingLogSettingログの出力設定
queueNamespaceIdstring~ 1024文字トランザクションの実行に使用する GS2-JobQueue のネームスペース
keyIdstring~ 1024文字スタンプシートの発行に使用する GS2-Key のネームスペース

Result

説明
itemNamespace更新したネームスペース

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名

Result

説明
itemNamespace削除したネームスペース

実装例

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

有効化条件必須デフォルト値の制限説明
userIdstring~ 128文字ユーザーID
timeOffsetTokenstring~ 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

有効化条件必須デフォルト値の制限説明
userIdstring~ 128文字ユーザーID
timeOffsetTokenstring~ 1024文字タイムオフセットトークン

Result

説明
urlstring出力データの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

有効化条件必須デフォルト値の制限説明
userIdstring~ 128文字ユーザーID
timeOffsetTokenstring~ 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

有効化条件必須デフォルト値の制限説明
userIdstring~ 128文字ユーザーID
timeOffsetTokenstring~ 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

有効化条件必須デフォルト値の制限説明
userIdstring~ 128文字ユーザーID
timeOffsetTokenstring~ 1024文字タイムオフセットトークン

Result

説明
uploadTokenstringアップロード後に結果を反映する際に使用するトークン
uploadUrlstringユーザーデータアップロード処理の実行に使用する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

有効化条件必須デフォルト値の制限説明
userIdstring~ 128文字ユーザーID
uploadTokenstring~ 1024文字アップロード準備で受け取ったトークン
timeOffsetTokenstring~ 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

有効化条件必須デフォルト値の制限説明
userIdstring~ 128文字ユーザーID
uploadTokenstring~ 1024文字アップロード準備で受け取ったトークン
timeOffsetTokenstring~ 1024文字タイムオフセットトークン

Result

説明
urlstring出力ログの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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名

Result

説明
itemsList<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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
rateNamestring~ 128文字交換レートの名前

Result

説明
itemRateModel交換レートモデル

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<RateModelMaster>交換レートマスターのリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
namestring~ 128文字交換レート名
descriptionstring~ 1024文字説明文
metadatastring~ 2048文字メタデータ
timingTypeenum {
    “immediate”,
    “await”
}
“immediate”~ 128文字交換の種類
lockTimeint{timingType} == “await”~ 538214400交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分)
acquireActionsList<AcquireAction>[]~ 100 items入手アクションリスト
verifyActionsList<VerifyAction>[]~ 10 items検証アクションリスト
consumeActionsList<ConsumeAction>[]~ 10 items消費アクションリスト

timingType に指定する列挙型の定義

定義説明
immediate即時
await現実時間の経過待ち

Result

説明
itemRateModelMaster作成した交換レートマスター

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
rateNamestring~ 128文字交換レート名

Result

説明
itemRateModelMaster交換レートマスター

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
rateNamestring~ 128文字交換レート名
descriptionstring~ 1024文字説明文
metadatastring~ 2048文字メタデータ
timingTypeenum {
    “immediate”,
    “await”
}
“immediate”~ 128文字交換の種類
lockTimeint{timingType} == “await”~ 538214400交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分)
acquireActionsList<AcquireAction>[]~ 100 items入手アクションリスト
verifyActionsList<VerifyAction>[]~ 10 items検証アクションリスト
consumeActionsList<ConsumeAction>[]~ 10 items消費アクションリスト

timingType に指定する列挙型の定義

定義説明
immediate即時
await現実時間の経過待ち

Result

説明
itemRateModelMaster更新した交換レートマスター

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
rateNamestring~ 128文字交換レート名

Result

説明
itemRateModelMaster削除した交換レートマスター

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名

Result

説明
itemsList<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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
rateNamestring~ 128文字コスト上昇型交換レートの名前

Result

説明
itemIncrementalRateModelコスト上昇型交換レートモデル

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<IncrementalRateModelMaster>コスト上昇型交換レートマスターのリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
namestring~ 128文字交換レート名
descriptionstring~ 1024文字説明文
metadatastring~ 2048文字メタデータ
consumeActionConsumeAction消費アクション(数量/値は上書きされるため設定不要です)
calculateTypeenum {
    “linear”,
    “power”,
    “gs2_script”
}
~ 128文字コスト上昇量の計算方式
baseValuelong{calculateType} == “linear”~ 9223372036854775805ベース値
coefficientValuelong{calculateType} in [“linear”, “power”]~ 9223372036854775805係数
calculateScriptIdstring{calculateType} == “gs2_script”~ 1024文字コスト計算スクリプトのGRN
exchangeCountIdstring~ 1024文字交換実行回数を管理する GS2-Limit の回数制限モデルGRN
maximumExchangeCountint2147483646~ 2147483646交換回数の上限
acquireActionsList<AcquireAction>[]~ 100 items入手アクションリスト

calculateType に指定する列挙型の定義

定義説明
linearベース値 + (係数 * 交換回数)
power係数 * (交換回数 + 1) ^ 2
gs2_scriptGS2-Script による任意のロジック

Result

説明
itemIncrementalRateModelMaster作成したコスト上昇型交換レートマスター

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
rateNamestring~ 128文字交換レート名

Result

説明
itemIncrementalRateModelMasterコスト上昇型交換レートマスター

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
rateNamestring~ 128文字交換レート名
descriptionstring~ 1024文字説明文
metadatastring~ 2048文字メタデータ
consumeActionConsumeAction消費アクション(数量/値は上書きされるため設定不要です)
calculateTypeenum {
    “linear”,
    “power”,
    “gs2_script”
}
~ 128文字コスト上昇量の計算方式
baseValuelong{calculateType} == “linear”~ 9223372036854775805ベース値
coefficientValuelong{calculateType} in [“linear”, “power”]~ 9223372036854775805係数
calculateScriptIdstring{calculateType} == “gs2_script”~ 1024文字コスト計算スクリプトのGRN
exchangeCountIdstring~ 1024文字交換実行回数を管理する GS2-Limit の回数制限モデルGRN
maximumExchangeCountint2147483646~ 2147483646交換回数の上限
acquireActionsList<AcquireAction>[]~ 100 items入手アクションリスト

calculateType に指定する列挙型の定義

定義説明
linearベース値 + (係数 * 交換回数)
power係数 * (交換回数 + 1) ^ 2
gs2_scriptGS2-Script による任意のロジック

Result

説明
itemIncrementalRateModelMaster更新したコスト上昇型交換レートマスター

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
rateNamestring~ 128文字交換レート名

Result

説明
itemIncrementalRateModelMaster削除したコスト上昇型交換レートマスター

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
rateNamestring~ 128文字交換レートの名前
accessTokenstring~ 128文字ユーザーID
countint1 ~ 1073741821交換するロット数
configList<Config>[]~ 32 itemsトランザクションの変数に適用する設定値

Result

説明
itemRateModel交換レートモデル
transactionIdstring発行されたトランザクションID
stampSheetstring交換処理の実行に使用するスタンプシート
stampSheetEncryptionKeyIdstringスタンプシートの署名計算に使用した暗号鍵GRN
autoRunStampSheetbool?トランザクションの自動実行が有効か
atomicCommitbool?トランザクションをアトミックにコミットするか
transactionstring発行されたトランザクション
transactionResultTransactionResultトランザクション実行結果

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
rateNamestring~ 128文字交換レートの名前
userIdstring~ 128文字ユーザーID
countint1 ~ 1073741821交換するロット数
configList<Config>[]~ 32 itemsトランザクションの変数に適用する設定値
timeOffsetTokenstring~ 1024文字タイムオフセットトークン

Result

説明
itemRateModel交換レートモデル
transactionIdstring発行されたトランザクションID
stampSheetstring交換処理の実行に使用するスタンプシート
stampSheetEncryptionKeyIdstringスタンプシートの署名計算に使用した暗号鍵GRN
autoRunStampSheetbool?トランザクションの自動実行が有効か
atomicCommitbool?トランザクションをアトミックにコミットするか
transactionstring発行されたトランザクション
transactionResultTransactionResultトランザクション実行結果

実装例

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

有効化条件必須デフォルト値の制限説明
stampSheetstring~ 5242880文字トランザクション
keyIdstring~ 1024文字暗号鍵GRN

Result

説明
itemRateModel交換レートモデル
transactionIdstring発行されたトランザクションID
stampSheetstring交換処理の実行に使用するスタンプシート
stampSheetEncryptionKeyIdstringスタンプシートの署名計算に使用した暗号鍵GRN
autoRunStampSheetbool?トランザクションの自動実行が有効か
atomicCommitbool?トランザクションをアトミックにコミットするか
transactionstring発行されたトランザクション
transactionResultTransactionResultトランザクション実行結果

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
rateNamestring~ 128文字コスト上昇型交換レートの名前
accessTokenstring~ 128文字ユーザーID
countint1 ~ 1073741821交換するロット数
configList<Config>[]~ 32 itemsトランザクションの変数に適用する設定値

Result

説明
itemIncrementalRateModelコスト上昇型交換レートモデル
transactionIdstring発行されたトランザクションID
stampSheetstring交換処理の実行に使用するスタンプシート
stampSheetEncryptionKeyIdstringスタンプシートの署名計算に使用した暗号鍵GRN
autoRunStampSheetbool?トランザクションの自動実行が有効か
atomicCommitbool?トランザクションをアトミックにコミットするか
transactionstring発行されたトランザクション
transactionResultTransactionResultトランザクション実行結果

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
rateNamestring~ 128文字コスト上昇型交換レートの名前
userIdstring~ 128文字ユーザーID
countint1 ~ 1073741821交換するロット数
configList<Config>[]~ 32 itemsトランザクションの変数に適用する設定値
timeOffsetTokenstring~ 1024文字タイムオフセットトークン

Result

説明
itemIncrementalRateModelコスト上昇型交換レートモデル
transactionIdstring発行されたトランザクションID
stampSheetstring交換処理の実行に使用するスタンプシート
stampSheetEncryptionKeyIdstringスタンプシートの署名計算に使用した暗号鍵GRN
autoRunStampSheetbool?トランザクションの自動実行が有効か
atomicCommitbool?トランザクションをアトミックにコミットするか
transactionstring発行されたトランザクション
transactionResultTransactionResultトランザクション実行結果

実装例

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

有効化条件必須デフォルト値の制限説明
stampSheetstring~ 5242880文字トランザクション
keyIdstring~ 1024文字暗号鍵GRN

Result

説明
itemIncrementalRateModelコスト上昇型交換レートモデル
transactionIdstring発行されたトランザクションID
stampSheetstring交換処理の実行に使用するスタンプシート
stampSheetEncryptionKeyIdstringスタンプシートの署名計算に使用した暗号鍵GRN
autoRunStampSheetbool?トランザクションの自動実行が有効か
atomicCommitbool?トランザクションをアトミックにコミットするか
transactionstring発行されたトランザクション
transactionResultTransactionResultトランザクション実行結果

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名

Result

説明
itemCurrentRateMaster現在有効な交換レート設定

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名

Result

説明
itemCurrentRateMaster現在有効な交換レート設定

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
settingsstring~ 5242880文字マスターデータ

Result

説明
itemCurrentRateMaster更新した現在有効な交換レート設定

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
checkoutSettingGitHubCheckoutSettingGitHubからマスターデータをチェックアウトしてくる設定

Result

説明
itemCurrentRateMaster更新した現在有効な交換レート設定

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
userIdstring~ 128文字ユーザーID
rateNamestring~ 128文字交換レートの名前
countint11 ~ 10000交換数
configList<Config>[]~ 32 items報酬取得時に適用する設定値のデフォルト値
timeOffsetTokenstring~ 1024文字タイムオフセットトークン

Result

説明
itemAwait交換待機

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
rateNamestring~ 128文字交換レートの名前
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<Await>交換待機のリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
userIdstring~ 128文字ユーザーID
rateNamestring~ 128文字交換レートの名前
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数
timeOffsetTokenstring~ 1024文字タイムオフセットトークン

Result

説明
itemsList<Await>交換待機のリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
awaitNamestringUUID~ 36文字交換待機の名前

Result

説明
itemAwait交換待機

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
userIdstring~ 128文字ユーザーID
awaitNamestringUUID~ 36文字交換待機の名前
timeOffsetTokenstring~ 1024文字タイムオフセットトークン

Result

説明
itemAwait交換待機

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
awaitNamestringUUID~ 36文字交換待機の名前
configList<Config>[]~ 32 itemsトランザクションの変数に適用する設定値

Result

説明
itemAwait交換待機
transactionIdstring発行されたトランザクションID
stampSheetstring報酬取得処理の実行に使用するスタンプシート
stampSheetEncryptionKeyIdstringスタンプシートの署名計算に使用した暗号鍵GRN
autoRunStampSheetbool?トランザクションの自動実行が有効か
atomicCommitbool?トランザクションをアトミックにコミットするか
transactionstring発行されたトランザクション
transactionResultTransactionResultトランザクション実行結果

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
userIdstring~ 128文字ユーザーID
awaitNamestringUUID~ 36文字交換待機の名前
configList<Config>[]~ 32 itemsトランザクションの変数に適用する設定値
timeOffsetTokenstring~ 1024文字タイムオフセットトークン

Result

説明
itemAwait交換待機
transactionIdstring発行されたトランザクションID
stampSheetstring報酬取得処理の実行に使用するスタンプシート
stampSheetEncryptionKeyIdstringスタンプシートの署名計算に使用した暗号鍵GRN
autoRunStampSheetbool?トランザクションの自動実行が有効か
atomicCommitbool?トランザクションをアトミックにコミットするか
transactionstring発行されたトランザクション
transactionResultTransactionResultトランザクション実行結果

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
userIdstring~ 128文字ユーザーID
awaitNamestringUUID~ 36文字交換待機の名前
configList<Config>[]~ 32 itemsトランザクションの変数に適用する設定値
timeOffsetTokenstring~ 1024文字タイムオフセットトークン

Result

説明
itemAwait交換待機
transactionIdstring発行されたトランザクションID
stampSheetstring報酬取得処理の実行に使用するスタンプシート
stampSheetEncryptionKeyIdstringスタンプシートの署名計算に使用した暗号鍵GRN
autoRunStampSheetbool?トランザクションの自動実行が有効か
atomicCommitbool?トランザクションをアトミックにコミットするか
transactionstring発行されたトランザクション
transactionResultTransactionResultトランザクション実行結果

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
userIdstring~ 128文字ユーザーID
awaitNamestringUUID~ 36文字交換待機の名前
skipTypeenum {
    “complete”,
    “minutes”,
    “totalRate”,
    “remainRate”
}
“complete”~ 128文字スキップ方法
minutesint{skipType} == “minutes”~ 2147483646スキップする分数
ratefloat{skipType} == “totalRate” or {skipType} == “remainRate”~ 1スキップする割合
timeOffsetTokenstring~ 1024文字タイムオフセットトークン

skipType に指定する列挙型の定義

定義説明
complete完全にスキップ
minutes時間を指定してスキップ(分)
totalRate全体の待機時間の割合を指定してスキップ
remainRate残りの待機時間の割合を指定してスキップ

Result

説明
itemAwait交換待機

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
awaitNamestringUUID~ 36文字交換待機の名前

Result

説明
itemAwait交換待機

実装例

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
userIdstring~ 128文字ユーザーID
awaitNamestringUUID~ 36文字交換待機の名前
timeOffsetTokenstring~ 1024文字タイムオフセットトークン

Result

説明
itemAwait交換待機

実装例

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

有効化条件必須デフォルト値の制限説明
stampSheetstring~ 5242880文字トランザクション
keyIdstring~ 1024文字暗号鍵GRN

Result

説明
itemAwait交換待機

実装例

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

有効化条件必須デフォルト値の制限説明
stampSheetstring~ 5242880文字トランザクション
keyIdstring~ 1024文字暗号鍵GRN

Result

説明
itemAwait交換待機
transactionIdstring発行されたトランザクションID
stampSheetstring報酬取得処理の実行に使用するスタンプシート
stampSheetEncryptionKeyIdstringスタンプシートの署名計算に使用した暗号鍵GRN
autoRunStampSheetbool?トランザクションの自動実行が有効か
atomicCommitbool?トランザクションをアトミックにコミットするか
transactionstring発行されたトランザクション
transactionResultTransactionResultトランザクション実行結果

実装例

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

有効化条件必須デフォルト値の制限説明
stampSheetstring~ 5242880文字トランザクション
keyIdstring~ 1024文字暗号鍵GRN

Result

説明
itemAwait交換待機

実装例

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

有効化条件必須デフォルト値の制限説明
stampTaskstring~ 5242880文字消費アクション
keyIdstring~ 1024文字暗号鍵GRN

Result

説明
itemAwait交換待機
newContextStackstring消費アクションの実行結果を記録したコンテキスト

実装例

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;