GS2-Inventory SDK API リファレンス
モデル
Namespace
ネームスペース
ネームスペースは、一つのプロジェクト内で同じサービスを異なる用途で複数利用するためのエンティティです。
GS2 の各サービスはネームスペース単位で管理されます。ネームスペースが異なれば、同じサービスでも完全に独立したデータ空間として扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceId | string | ※ | ~ 1024文字 | ネームスペース
GRN ※ サーバーが自動で設定 | ||
| name | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| transactionSetting | TransactionSetting | トランザクション設定 アイテムの入手や消費などのインベントリ操作に対する分散トランザクション処理を設定します。シームレスな実行のための自動実行モード、複数リソースの一貫した操作のためのアトミックコミット、大規模な報酬配布のための非同期処理をサポートします。 | ||||
| acquireScript | ScriptSetting | アイテムを入手したときに実行するスクリプトの設定 Script トリガーリファレンス - acquire | ||||
| overflowScript | ScriptSetting | 入手上限に当たって入手できなかったときに実行するスクリプトの設定 Script トリガーリファレンス - overflowDone | ||||
| consumeScript | ScriptSetting | アイテムを消費するときに実行するスクリプトの設定 Script トリガーリファレンス - consume | ||||
| simpleItemAcquireScript | ScriptSetting | シンプルアイテムを入手したときに実行するスクリプトの設定 Script トリガーリファレンス - simpleItemAcquire | ||||
| simpleItemConsumeScript | ScriptSetting | シンプルアイテムを消費するときに実行するスクリプトの設定 Script トリガーリファレンス - simpleItemConsume | ||||
| bigItemAcquireScript | ScriptSetting | 巨大アイテムを入手したときに実行するスクリプトの設定 Script トリガーリファレンス - bigItemAcquire | ||||
| bigItemConsumeScript | ScriptSetting | 巨大アイテムを消費するときに実行するスクリプトの設定 Script トリガーリファレンス - bigItemConsume | ||||
| logSetting | LogSetting | ログの出力設定 インベントリ操作のAPIリクエスト・レスポンスログを出力するためのGS2-Logネームスペースを指定します。デバッグや分析のためにアイテムの入手、消費、容量変更の追跡に便利です。 | ||||
| createdAt | long | ※ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| updatedAt | long | ※ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
TransactionSetting
トランザクション設定
トランザクション設定は、トランザクションの実行方法・整合性・非同期処理・競合回避の仕組みを制御する設定です。
自動実行(AutoRun)、アトミック実行(AtomicCommit)、GS2-Distributor を利用した非同期実行、スクリプト結果の一括適用、GS2-JobQueue による入手アクションの非同期化などを組み合わせ、ゲームロジックに応じた堅牢なトランザクション管理を可能にします。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| enableAutoRun | bool | false | 発行したトランザクションをサーバーサイドで自動的に実行するか | |||
| enableAtomicCommit | bool | {enableAutoRun} == true | false | トランザクションの実行をアトミックにコミットするか ※ enableAutoRun が true であれば 有効 | ||
| transactionUseDistributor | bool | {enableAtomicCommit} == true | false | トランザクションを非同期処理で実行する ※ enableAtomicCommit が true であれば 有効 | ||
| commitScriptResultInUseDistributor | bool | {transactionUseDistributor} == true | false | スクリプトの結果コミット処理を非同期処理で実行するか ※ transactionUseDistributor が true であれば 有効 | ||
| acquireActionUseJobQueue | bool | {enableAtomicCommit} == true | false | 入手アクションを実行する際に GS2-JobQueue を使用するか ※ enableAtomicCommit が true であれば 有効 | ||
| distributorNamespaceId | string | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024文字 | トランザクションの実行に使用する GS2-Distributor ネームスペース GRN | ||
| queueNamespaceId | string | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024文字 | トランザクションの実行に使用する GS2-JobQueue のネームスペース GRN |
ScriptSetting
スクリプト設定
GS2 ではマイクロサービスのイベントに関連づけて、カスタムスクリプトを実行することができます。
このモデルは、スクリプトの実行をトリガーするための設定を保持します。
スクリプトの実行方式は大きく2種類あり、それは「同期実行」と「非同期実行」です。
同期実行は、スクリプトの実行が完了するまで処理がブロックされます。
代わりに、スクリプトの実行結果を使って API の実行を止めたり、API のレスポンス内容を制御することができます。
一方、非同期実行ではスクリプトの完了を待つために処理がブロックされることはありません。
ただし、スクリプトの実行結果を利用して API の実行を停止したり、API の応答内容を変更することはできません。
非同期実行は API の応答フローに影響を与えないため、原則として非同期実行を推奨します。
非同期実行には実行方式が2種類あり、GS2-Script と Amazon EventBridge があります。
Amazon EventBridge を使用することで、Lua 以外の言語で処理を記述することができます。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| triggerScriptId | string | ~ 1024文字 | API 実行時に同期的に実行される GS2-Script のスクリプト
GRN 「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。 | |||||||||||
| doneTriggerTargetType | 文字列列挙型 enum { “none”, “gs2_script”, “aws” } | “none” | 非同期スクリプトの実行方法 非同期実行で使用するスクリプトの種類を指定します。 「非同期実行のスクリプトを使用しない(none)」「GS2-Scriptを使用する(gs2_script)」「Amazon EventBridgeを使用する(aws)」が選択できます。
| |||||||||||
| doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024文字 | 非同期実行する GS2-Script スクリプト
GRN 「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。 ※ doneTriggerTargetType が “gs2_script” であれば 有効 | ||||||||||
| doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024文字 | 非同期実行スクリプトを実行する GS2-JobQueue ネームスペース
GRN 非同期実行スクリプトを直接実行するのではなく、GS2-JobQueue を経由する場合は GS2-JobQueue のネームスペースGRN を指定します。 GS2-JobQueue を利用する理由は多くはありませんので、特に理由がなければ指定する必要はありません。 ※ doneTriggerTargetType が “gs2_script” であれば 有効 |
LogSetting
ログの出力設定
ログデータの出力設定を管理します。この型は、ログデータを書き出すために使用される GS2-Log ネームスペースの識別子(Namespace ID)を保持します。
ログネームスペースID(loggingNamespaceId)には、ログデータを収集し保存する GS2-Log のネームスペースを、GRNの形式で指定します。
この設定をすることで、設定されたネームスペース内で発生したAPIリクエスト・レスポンスのログデータが、対象の GS2-Log ネームスペース側へ出力されるようになります。
GS2-Log ではリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| loggingNamespaceId | string | ✓ | ~ 1024文字 | ログを出力する GS2-Log のネームスペース
GRN 「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。 |
GitHubCheckoutSetting
GitHubからマスターデータをチェックアウトする設定
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| apiKeyId | string | ✓ | ~ 1024文字 | GitHub APIキーの GRN | ||||||||||
| repositoryName | string | ✓ | ~ 1024文字 | リポジトリ名 | ||||||||||
| sourcePath | string | ✓ | ~ 1024文字 | マスターデータ(JSON)ファイルのパス | ||||||||||
| referenceType | 文字列列挙型 enum { “commit_hash”, “branch”, “tag” } | ✓ | コードの取得元
| |||||||||||
| commitHash | string | {referenceType} == “commit_hash” | ✓※ | ~ 1024文字 | コミットハッシュ ※ referenceType が “commit_hash” であれば 必須 | |||||||||
| branchName | string | {referenceType} == “branch” | ✓※ | ~ 1024文字 | ブランチ名 ※ referenceType が “branch” であれば 必須 | |||||||||
| tagName | string | {referenceType} == “tag” | ✓※ | ~ 1024文字 | タグ名 ※ referenceType が “tag” であれば 必須 |
Inventory
インベントリ
インベントリは、ゲームプレイヤーが所有するアイテムを格納するためのカバンのようなものです。
カバンには容量があり、プレイヤーごとに容量を拡張することができます。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| inventoryId | string | ※ | ~ 1024文字 | インベントリ
GRN ※ サーバーが自動で設定 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このインベントリの構造と容量設定を定義するインベントリモデルの名前です。ユーザーのインベントリインスタンスをモデル定義にリンクし、使用可能なアイテムの種類と容量制限を決定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| currentInventoryCapacityUsage | int | 0 | 0 ~ 2147483646 | キャパシティ使用量 アイテムセットによって現在使用されているインベントリ枠の数です。新しいアイテムスタックが追加された時(例:allowMultipleStacksで新しい枠が作成された時)にインクリメントされ、アイテムセットが完全に消費または削除された時にデクリメントされます。currentInventoryMaxCapacityを超えることはできません。 | ||
| currentInventoryMaxCapacity | int | ✓ | 1 ~ 2147483646 | 最大キャパシティ このユーザーが使用可能なインベントリ枠の現在の最大数です。インベントリモデルのinitialCapacityから初期化され、入手アクションまたは直接のAPI呼び出しを通じてモデルのmaxCapacityまで拡張できます。 | ||
| createdAt | long | ※ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| updatedAt | long | ※ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
ItemSet
アイテムセット
アイテムセットはゲームプレイヤーのインベントリ内に保存されている所有物を表しています。
インベントリモデル名とアイテムモデル名、所持数量、有効期限等を保持します。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| itemSetId | string | ※ | ~ 1024文字 | アイテムセット
GRN ※ サーバーが自動で設定 | ||
| name | string | ✓ | UUID | ~ 36文字 | アイテムセットを識別する名前 アイテムセットの一意な名前を保持します。 名前は UUID(Universally Unique Identifier)フォーマットで自動的に生成され、各アイテムセットを識別するために使用されます。 | |
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| count | long | ✓ | 1 ~ 9223372036854775805 | 所持数量 このスタック内のアイテム数です。1からアイテムモデルのスタック上限までの範囲です。アイテムを入手するとスタック上限までカウントが増加し、消費すると減少します。カウントが0になるとアイテムセットは削除され、インベントリ枠が解放されます。 | ||
| referenceOf | List<string> | [] | 0 ~ 24 items | 参照元リスト このアイテムセットに登録された外部参照です。どのシステムがこのアイテムを使用しているか(例:武器として装備、編成に割り当て)を追跡するために使用されます。アイテムセットあたり最大24参照です。 | ||
| sortValue | int | ✓ | 0 ~ 2147483646 | 表示順番 アイテムモデルのsortValueからコピーされた数値で、インベントリ内のアイテムセットを表示用にソートするために使用されます。値が小さいほど先に表示されます。 | ||
| expiresAt | long | 0 | 有効期限 UNIX 時間・ミリ秒 | |||
| createdAt | long | ※ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| updatedAt | long | ※ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 |
ReferenceOf
所持品の参照元
装備スロットや編成バインドなど、アイテムセットに登録された外部参照を表します。インベントリモデルでprotectReferencedItemが有効な場合、アクティブな参照元を持つアイテムセットは消費や削除から保護され、使用中のアイテムが誤って削除されることを防ぎます。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| referenceOfId | string | ※ | ~ 1024文字 | 参照
GRN ※ サーバーが自動で設定 | ||
| name | string | ✓ | ~ 128文字 | アイテムセットを識別する名前 この参照が付加されているアイテムセットのUUID名です。インベントリ内のどの特定のアイテムスタックが外部システムから参照されているかを識別するために使用されます。 |
SimpleInventory
シンプルインベントリ
シンプルインベントリは、ゲームプレイヤーが所有するシンプルアイテムを格納するためのカバンのようなものです。
シンプルインベントリにはアイテム所持数の上限やインベントリの容量といった機能はありませんが、複数のアイテムをまとめて増減することができます。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| inventoryId | string | ※ | ~ 1024文字 | シンプルインベントリ
GRN ※ サーバーが自動で設定 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 このインベントリのアイテムの種類を定義するシンプルインベントリモデルの名前です。ユーザーのシンプルインベントリインスタンスをモデル定義にリンクします。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| simpleItems | List<SimpleItem> | [] | 0 ~ 1000 items | シンプルアイテム一覧 このシンプルインベントリに格納されたすべてのアイテム所持品です。複数のアイテムを1回のバッチ操作で入手または消費できます。シンプルインベントリあたり最大1000アイテムです。 | ||
| createdAt | long | ※ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| updatedAt | long | ※ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
SimpleItem
シンプルアイテム
シンプルアイテムはゲームプレイヤーのインベントリー内に保存されている所有物を表しています。
シンプルアイテムモデル名と所持数量を持ちます。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| itemId | string | ※ | ~ 1024文字 | シンプルアイテム
GRN ※ サーバーが自動で設定 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 このレコードに格納されているアイテムの種類を定義するシンプルアイテムモデルの名前です。この所持品がどのアイテム定義に対応するかを識別するために使用されます。 | ||
| count | long | ✓ | 0 ~ 9223372036854775805 | 所持数量 ユーザーが所持するこのアイテムの種類の数です。通常のインベントリアイテムと異なり、シンプルアイテムにはスタック上限がなく、カウントはint64の範囲内で任意の値を取ることができます。他のシンプルアイテムとともにバッチ操作で増減できます。 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
BigInventory
巨大インベントリ
巨大インベントリは、通常のインベントリでは扱えない大きな数量のアイテムを、ゲームプレイヤーごとに管理するためのカバンのような仕組みです。
巨大アイテムはアイテムの所持数量をint64の範囲を超えて保持できます。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| inventoryId | string | ※ | ~ 1024文字 | 巨大インベントリ
GRN ※ サーバーが自動で設定 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 このインベントリのアイテムの種類を定義する巨大インベントリモデルの名前です。ユーザーの巨大インベントリインスタンスをモデル定義にリンクします。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| bigItems | List<BigItem> | 0 ~ 1000 items | 巨大アイテム一覧 この巨大インベントリに格納されたすべての巨大アイテム所持品です。各アイテムは巨大十進整数文字列として数量を保持します。巨大インベントリあたり最大1000アイテムです。 | |||
| createdAt | long | ※ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| updatedAt | long | ※ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 |
BigItem
巨大アイテム
巨大アイテムはゲームプレイヤーの巨大インベントリー内に保存されている所有物を表しています。
巨大アイテムモデル名と、所持数量をint64の範囲を超えて保持できます。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| itemId | string | ※ | ~ 1024文字 | 巨大アイテム
GRN ※ サーバーが自動で設定 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 このレコードに格納されているアイテムの種類を定義する巨大アイテムモデルの名前です。この巨大アイテムの所持品がどのアイテム定義に対応するかを識別するために使用されます。 | ||
| count | string | ✓ | ~ 1024文字 | 所持数量 最大1024桁までの整数値文字列 | ||
| createdAt | long | ※ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| updatedAt | long | ※ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
InventoryModel
インベントリモデル
インベントリはゲームプレイヤーが所有しているアイテムを格納するカバンのようなものです。
インベントリには容量が設定でき、容量を超えては所有できません。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| inventoryModelId | string | ※ | ~ 1024文字 | インベントリモデル
GRN ※ サーバーが自動で設定 | ||
| name | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 | |||
| initialCapacity | int | ✓ | 0 ~ 2147483646 | 初期サイズ インベントリが初めて作成される際にユーザーに提供されるインベントリ枠の数です。各枠には1つのアイテムスタックを格納できます。ユーザーはゲームプレイのアクションを通じてmaxCapacityまで容量を拡張できます。 | ||
| maxCapacity | int | ✓ | 0 ~ 2147483646 | 最大サイズ ユーザーが拡張可能なインベントリ枠の上限値です。この値を超えて容量を増やすことはできません。すべての枠が使用中でアイテムをこれ以上スタックできない場合、オーバーフロースクリプトが超過分を処理しない限り、入手は失敗します。 | ||
| protectReferencedItem | bool? | false | 参照元保護 有効にすると、(referenceOf メカニズムで)参照元が登録されているアイテムセットは消費または削除できなくなります。他のシステムで使用中のアイテム(例:装備中のギア、編成にバインドされたアイテム)が誤って削除されることを防ぎます。 | |||
| itemModels | List<ItemModel> | [] | 1 ~ 1000 items | アイテムモデル一覧 このインベントリに格納可能なアイテムの種類です。各アイテムモデルは1種類のアイテムのスタックおよび入手動作を定義します。インベントリモデルあたり最大1000アイテムモデルです。 |
ItemModel
アイテムモデル
アイテムは、ポーション ×99 のように、1つのインベントリ枠に複数個まとめて所持できます。
このように 1枠に複数個まとめることを「スタック」 と呼び、アイテムごとに スタックできる上限数 を設定できます。
スタック上限に達した場合の挙動もアイテムごとに設定できます。
具体的には、以下のどちらかを選べます:
- 新しいインベントリ枠を追加して、さらに所持できるようにする
- 上限に達したため、これ以上入手できないようにする
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| itemModelId | string | ※ | ~ 1024文字 | アイテムモデル
GRN ※ サーバーが自動で設定 | ||
| name | string | ✓ | ~ 128文字 | アイテムモデル名 アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| metadata | string | ~ 2048文字 | メタデータ GS2-EnhanceにはGS2-Inventoryと連携して強化を行う仕組みがあり、ItemModelのメタデータにJSON形式で、強化素材として使用した場合の経験値量を設定します。 詳細は マイクロサービス紹介 / GS2-Enhance の項で解説しています。 | |||
| stackingLimit | long | ✓ | 1 ~ 9223372036854775805 | スタック可能な最大数量 1つのインベントリ枠(スタック)に保持できるこのアイテムの最大数です。この上限に達した場合の動作はallowMultipleStacks設定に依存し、新しい枠が割り当てられるか、それ以上の入手がブロックされます。 | ||
| allowMultipleStacks | bool | ✓ | 複数スタック許可 有効にすると、スタック上限に達した場合に新しいインベントリ枠が自動的に割り当てられ、このアイテムの追加数量を格納します(追加の容量を消費します)。無効の場合、既存の枠でスタック上限に達すると入手がブロックされます。 | |||
| sortValue | int | ✓ | 0 ~ 2147483646 | 表示順番 インベントリ内のアイテムを表示用にソートするための数値です。値が小さいほど先に表示されます。この値はItemSetレコードにもコピーされ、所持アイテムの一貫した順序付けを可能にします。 |
SimpleInventoryModel
シンプルインベントリモデル
通常の InventoryModel では、インベントリ内に格納できるアイテムの容量制限ができました。
しかし、シンプルインベントリ ではそのような機能はなく、単純にアイテムの所持数量を保持するのみとなります。
ただし、シンプルインベントリでは、複数のアイテムの増減処理を1回の処理で実行可能なAPIが利用できます。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| inventoryModelId | string | ※ | ~ 1024文字 | シンプルインベントリモデル
GRN ※ サーバーが自動で設定 | ||
| name | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 | |||
| simpleItemModels | List<SimpleItemModel> | [] | 1 ~ 1000 items | シンプルアイテムモデル一覧 このシンプルインベントリに格納可能なアイテムの種類です。通常のインベントリと異なり、シンプルアイテムにはスタック上限や容量制約がありません。シンプルインベントリモデルあたり最大1000アイテムモデルです。 |
SimpleItemModel
シンプルアイテムモデル
ItemModel では、スタックできる数量の最大値を設定でき、一定数を超える場合は複数のスタックに分けるような実装が可能でした。
シンプルアイテム にはそのような機能はなく、単純にアイテムの所持数量を保持するのみとなります。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| itemModelId | string | ※ | ~ 1024文字 | シンプルアイテムモデル
GRN ※ サーバーが自動で設定 | ||
| name | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 シンプルアイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
BigInventoryModel
巨大インベントリモデル
通常の InventoryModel や SimpleInventoryModel では、インベントリに格納できるアイテムの数は int64 の範囲に限られました。
インフレ系ゲームでは、もっと広い値の範囲を必要とする場合があります。
巨大インベントリモデルでは、インベントリに格納できるアイテムの数には1024桁の整数値を持たせることができます。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| inventoryModelId | string | ※ | ~ 1024文字 | 巨大インベントリモデル
GRN ※ サーバーが自動で設定 | ||
| name | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 | |||
| bigItemModels | List<BigItemModel> | [] | 1 ~ 1000 items | 巨大アイテムモデル一覧 この巨大インベントリに格納可能なアイテムの種類です。各巨大アイテムモデルは最大1024桁の整数文字列として表される数量を保持できます。巨大インベントリモデルあたり最大1000アイテムモデルです。 |
BigItemModel
巨大アイテムモデル
巨大アイテムモデルは、巨大インベントリモデルに格納される巨大アイテムを定義するモデルです。
巨大アイテムは、所持数量を int64 の範囲を超えて保持することができます。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| itemModelId | string | ※ | ~ 1024文字 | 巨大アイテムモデル
GRN ※ サーバーが自動で設定 | ||
| name | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 巨大アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
AcquireCount
シンプルアイテムの入手数量
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| itemName | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 このレコードに格納されているアイテムの種類を定義するシンプルアイテムモデルの名前です。この所持品がどのアイテム定義に対応するかを識別するために使用されます。 | ||
| count | long | ✓ | 1 ~ 9223372036854775805 | 入手する量 |
ConsumeCount
シンプルアイテムの消費数量
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| itemName | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 このレコードに格納されているアイテムの種類を定義するシンプルアイテムモデルの名前です。この所持品がどのアイテム定義に対応するかを識別するために使用されます。 | ||
| count | long | ✓ | 1 ~ 9223372036854775805 | 消費する量 |
HeldCount
シンプルアイテムの所持数量
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| itemName | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 このレコードに格納されているアイテムの種類を定義するシンプルアイテムモデルの名前です。この所持品がどのアイテム定義に対応するかを識別するために使用されます。 | ||
| count | long | ✓ | 0 ~ 9223372036854775805 | 所持数量 |
CurrentItemModelMaster
現在アクティブなアイテムモデルのマスターデータ
現在ネームスペース内で有効な、アイテムモデルの定義を記述したマスターデータです。
GS2ではマスターデータの管理にJSON形式のファイルを使用します。
ファイルをアップロードすることで、実際にサーバーに設定を反映することができます。
JSONファイルを作成する方法として、マネージメントコンソール内にマスターデータエディタを提供しています。
また、よりゲームの運営に相応しいツールを作成し、適切なフォーマットのJSONファイルを書き出すことでもサービスを利用可能です。
Note
JSONファイルの形式については GS2-Inventory マスターデータリファレンス をご参照ください。詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceId | string | ※ | ~ 1024文字 | ネームスペース
GRN ※ サーバーが自動で設定 | ||
| settings | string | ✓ | ~ 5242880 バイト (5MB) | マスターデータ |
InventoryModelMaster
インベントリモデルマスター
インベントリモデルマスターは、ゲーム内で使用されるインベントリモデルの編集・管理用データで、マネージメントコンソールのマスターデータエディタで一時的に保持されます。
インポート・更新処理を行うことで、実際にゲームから参照されるインベントリモデルとして反映されます。
インベントリはゲームプレイヤーが所有しているアイテムを格納する鞄のようなものです。
インベントリには容量が設定でき、容量を超えては所有できません。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| inventoryModelId | string | ※ | ~ 1024文字 | インベントリモデルマスター
GRN ※ サーバーが自動で設定 | ||
| name | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 | |||
| description | string | ~ 1024文字 | 説明文 | |||
| initialCapacity | int | ✓ | 0 ~ 2147483646 | 初期サイズ インベントリが初めて作成される際にユーザーに提供されるインベントリ枠の数です。各枠には1つのアイテムスタックを格納できます。ユーザーはゲームプレイのアクションを通じてmaxCapacityまで容量を拡張できます。 | ||
| maxCapacity | int | ✓ | 0 ~ 2147483646 | 最大サイズ ユーザーが拡張可能なインベントリ枠の上限値です。この値を超えて容量を増やすことはできません。すべての枠が使用中でアイテムをこれ以上スタックできない場合、オーバーフロースクリプトが超過分を処理しない限り、入手は失敗します。 | ||
| protectReferencedItem | bool | false | 参照元保護 有効にすると、(referenceOf メカニズムで)参照元が登録されているアイテムセットは消費または削除できなくなります。他のシステムで使用中のアイテム(例:装備中のギア、編成にバインドされたアイテム)が誤って削除されることを防ぎます。 | |||
| createdAt | long | ※ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| updatedAt | long | ※ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
ItemModelMaster
アイテムモデルマスター
アイテムモデルマスターは、ゲーム内で使用されるアイテムモデルの編集・管理用データで、マネージメントコンソールのマスターデータエディタで一時的に保持されます。
インポート・更新処理を行うことで、実際にゲームから参照されるアイテムモデルとして反映されます。
アイテムは、ポーション ×99 のように、1つのインベントリ枠に複数個まとめて所持できます。
このように 1枠に複数個まとめることを「スタック」 と呼び、アイテムごとに スタックできる上限数 を設定できます。
スタック上限に達した場合の挙動もアイテムごとに設定できます。
具体的には、以下のどちらかを選べます:
- 新しいインベントリ枠を追加して、さらに所持できるようにする
- 上限に達したため、これ以上入手できないようにする
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| itemModelId | string | ※ | ~ 1024文字 | アイテムモデルマスター
GRN ※ サーバーが自動で設定 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムが属するインベントリモデルの名前です。このアイテムの種類を格納できるインベントリを決定し、インベントリの容量設定や保護設定と関連付けます。 | ||
| name | string | ✓ | ~ 128文字 | アイテムモデル名 アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ GS2-EnhanceにはGS2-Inventoryと連携して強化を行う処理があり、ItemModelのメタデータにJSON形式で、強化素材として使用した場合の経験値量を設定します。 詳細は マイクロサービス紹介 / GS2-Enhance の項で解説しています。 | |||
| stackingLimit | long | ✓ | 1 ~ 9223372036854775805 | スタック可能な最大数量 1つのインベントリ枠(スタック)に保持できるこのアイテムの最大数です。この上限に達した場合の動作はallowMultipleStacks設定に依存し、新しい枠が割り当てられるか、それ以上の入手がブロックされます。 | ||
| allowMultipleStacks | bool | ✓ | 複数スタック許可 有効にすると、スタック上限に達した場合に新しいインベントリ枠が自動的に割り当てられ、このアイテムの追加数量を格納します(追加の容量を消費します)。無効の場合、既存の枠でスタック上限に達すると入手がブロックされます。 | |||
| sortValue | int | ✓ | 0 ~ 2147483646 | 表示順番 インベントリ内のアイテムを表示用にソートするための数値です。値が小さいほど先に表示されます。この値はItemSetレコードにもコピーされ、所持アイテムの一貫した順序付けを可能にします。 | ||
| createdAt | long | ※ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| updatedAt | long | ※ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
SimpleInventoryModelMaster
シンプルインベントリモデルマスター
シンプルインベントリモデルマスターは、ゲーム内で使用されるシンプルインベントリモデルの編集・管理用データで、マネージメントコンソールのマスターデータエディタで一時的に保持されます。
インポート・更新処理を行うことで、実際にゲームから参照されるシンプルインベントリモデルとして反映されます。
通常の InventoryModel では、インベントリ内に格納できるアイテムの容量制限ができました。
しかし、シンプルインベントリ ではそのような機能はなく、単純にアイテムの所持数量を保持するのみとなります。
ただし、シンプルインベントリでは、複数のアイテムの増減処理を1回の処理で実行可能なAPIが利用できます。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| inventoryModelId | string | ※ | ~ 1024文字 | シンプルインベントリモデルマスター
GRN ※ サーバーが自動で設定 | ||
| name | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 | |||
| description | string | ~ 1024文字 | 説明文 | |||
| createdAt | long | ※ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| updatedAt | long | ※ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
SimpleItemModelMaster
シンプルアイテムモデルマスター
シンプルアイテムモデルマスターは、ゲーム内で使用されるシンプルアイテムモデルの編集・管理用データで、マネージメントコンソールのマスターデータエディタで一時的に保持されます。
インポート・更新処理を行うことで、実際にゲームから参照されるシンプルアイテムモデルとして反映されます。
ItemModel では、スタックできる数量の最大値を設定でき、一定数を超える場合は複数のスタックに分けるような実装が可能でした。
シンプルアイテム にはそのような機能はなく、単純にアイテムの所持数量を保持するのみとなります。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| itemModelId | string | ※ | ~ 1024文字 | シンプルアイテムモデルマスター
GRN ※ サーバーが自動で設定 | ||
| name | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 シンプルアイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 | |||
| createdAt | long | ※ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| updatedAt | long | ※ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
BigInventoryModelMaster
巨大インベントリモデルマスター
巨大インベントリモデルマスターは、ゲーム内で使用される巨大インベントリモデルの編集・管理用データで、マネージメントコンソールのマスターデータエディタで一時的に保持されます。
インポート・更新処理を行うことで、実際にゲームから参照される巨大インベントリモデルとして反映されます。
通常の InventoryModel や SimpleInventoryModel では、インベントリに格納できるアイテムの数は int64 の範囲に限られました。
インフレ系ゲームでは、もっと広い値の範囲を必要とする場合があります。
巨大インベントリモデルでは、インベントリに格納できるアイテムの数には1024桁の整数値を持たせることができます。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| inventoryModelId | string | ※ | ~ 1024文字 | 巨大インベントリモデルマスター
GRN ※ サーバーが自動で設定 | ||
| name | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 | |||
| description | string | ~ 1024文字 | 説明文 | |||
| createdAt | long | ※ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| updatedAt | long | ※ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
BigItemModelMaster
巨大アイテムモデルマスター
巨大アイテムモデルマスターは、ゲーム内で使用される巨大アイテムモデルの編集・管理用データで、マネージメントコンソールのマスターデータエディタで一時的に保持されます。
インポート・更新処理を行うことで、実際にゲームから参照される巨大アイテムモデルとして反映されます。
巨大アイテムモデルは、巨大インベントリモデルに格納される巨大アイテムを定義するモデルです。
巨大アイテムは、所持数量を int64 の範囲を超えて保持することができます。
詳細
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| itemModelId | string | ※ | ~ 1024文字 | 巨大アイテムモデルマスター
GRN ※ サーバーが自動で設定 | ||
| name | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 巨大アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 | |||
| createdAt | long | ※ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| updatedAt | long | ※ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 ※ サーバーが自動で設定 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
メソッド
describeNamespaces
ネームスペースの一覧を取得
プロジェクト内において、サービス単位で作成されたネームスペースの一覧を取得します。
オプションのページトークンを使用して、リストの特定の位置からデータの取得を開始できます。
また、取得するネームスペースの数を制限することも可能です。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namePrefix | string | ~ 64文字 | ネームスペース名のフィルター接頭辞 | |||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<Namespace> | ネームスペースのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&inventory.DescribeNamespacesRequest {
NamePrefix: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeNamespacesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeNamespaces(
(new DescribeNamespacesRequest())
->withNamePrefix(null)
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeNamespacesRequest;
import io.gs2.inventory.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeNamespacesResult result = client.describeNamespaces(
new DescribeNamespacesRequest()
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
List<Namespace> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Inventory.Request.DescribeNamespacesRequest()
.WithNamePrefix(null)
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2Inventory.DescribeNamespacesRequest()
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_namespaces(
inventory.DescribeNamespacesRequest()
.with_name_prefix(None)
.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('inventory')
api_result = client.describe_namespaces({
namePrefix=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_namespaces_async({
namePrefix=nil,
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['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;createNamespace
ネームスペースを新規作成
指定された設定で新しいインベントリネームスペースを作成します。
標準インベントリアイテムに対して、アイテム入手(acquireScript)、オーバーフロー処理(overflowScript)、消費(consumeScript)の GS2-Script トリガーを設定できます。
シンプルアイテム(simpleItemAcquireScript, simpleItemConsumeScript)と巨大アイテム(bigItemAcquireScript, bigItemConsumeScript)には個別のスクリプト設定が利用可能です。
オーバーフロースクリプトはアイテム入手がインベントリ容量を超える場合に呼び出され、GS2-Inbox などへの転送を可能にします。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| transactionSetting | TransactionSetting | トランザクション設定 アイテムの入手や消費などのインベントリ操作に対する分散トランザクション処理を設定します。シームレスな実行のための自動実行モード、複数リソースの一貫した操作のためのアトミックコミット、大規模な報酬配布のための非同期処理をサポートします。 | ||||
| acquireScript | ScriptSetting | アイテムを入手したときに実行するスクリプトの設定 Script トリガーリファレンス - acquire | ||||
| overflowScript | ScriptSetting | 入手上限に当たって入手できなかったときに実行するスクリプトの設定 Script トリガーリファレンス - overflowDone | ||||
| consumeScript | ScriptSetting | アイテムを消費するときに実行するスクリプトの設定 Script トリガーリファレンス - consume | ||||
| simpleItemAcquireScript | ScriptSetting | シンプルアイテムを入手したときに実行するスクリプトの設定 Script トリガーリファレンス - simpleItemAcquire | ||||
| simpleItemConsumeScript | ScriptSetting | シンプルアイテムを消費するときに実行するスクリプトの設定 Script トリガーリファレンス - simpleItemConsume | ||||
| bigItemAcquireScript | ScriptSetting | 巨大アイテムを入手したときに実行するスクリプトの設定 Script トリガーリファレンス - bigItemAcquire | ||||
| bigItemConsumeScript | ScriptSetting | 巨大アイテムを消費するときに実行するスクリプトの設定 Script トリガーリファレンス - bigItemConsume | ||||
| logSetting | LogSetting | ログの出力設定 インベントリ操作のAPIリクエスト・レスポンスログを出力するためのGS2-Logネームスペースを指定します。デバッグや分析のためにアイテムの入手、消費、容量変更の追跡に便利です。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | Namespace | 作成したネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&inventory.CreateNamespaceRequest {
Name: pointy.String("namespace-0001"),
Description: nil,
TransactionSetting: nil,
AcquireScript: nil,
OverflowScript: nil,
ConsumeScript: nil,
SimpleItemAcquireScript: nil,
SimpleItemConsumeScript: nil,
BigItemAcquireScript: nil,
BigItemConsumeScript: nil,
LogSetting: &inventory.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\CreateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->createNamespace(
(new CreateNamespaceRequest())
->withName("namespace-0001")
->withDescription(null)
->withTransactionSetting(null)
->withAcquireScript(null)
->withOverflowScript(null)
->withConsumeScript(null)
->withSimpleItemAcquireScript(null)
->withSimpleItemConsumeScript(null)
->withBigItemAcquireScript(null)
->withBigItemConsumeScript(null)
->withLogSetting((new \Gs2\Inventory\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.CreateNamespaceRequest;
import io.gs2.inventory.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace-0001")
.withDescription(null)
.withTransactionSetting(null)
.withAcquireScript(null)
.withOverflowScript(null)
.withConsumeScript(null)
.withSimpleItemAcquireScript(null)
.withSimpleItemConsumeScript(null)
.withBigItemAcquireScript(null)
.withBigItemConsumeScript(null)
.withLogSetting(new io.gs2.inventory.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Inventory.Request.CreateNamespaceRequest()
.WithName("namespace-0001")
.WithDescription(null)
.WithTransactionSetting(null)
.WithAcquireScript(null)
.WithOverflowScript(null)
.WithConsumeScript(null)
.WithSimpleItemAcquireScript(null)
.WithSimpleItemConsumeScript(null)
.WithBigItemAcquireScript(null)
.WithBigItemConsumeScript(null)
.WithLogSetting(new Gs2.Gs2Inventory.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.createNamespace(
new Gs2Inventory.CreateNamespaceRequest()
.withName("namespace-0001")
.withDescription(null)
.withTransactionSetting(null)
.withAcquireScript(null)
.withOverflowScript(null)
.withConsumeScript(null)
.withSimpleItemAcquireScript(null)
.withSimpleItemConsumeScript(null)
.withBigItemAcquireScript(null)
.withBigItemConsumeScript(null)
.withLogSetting(new Gs2Inventory.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.create_namespace(
inventory.CreateNamespaceRequest()
.with_name('namespace-0001')
.with_description(None)
.with_transaction_setting(None)
.with_acquire_script(None)
.with_overflow_script(None)
.with_consume_script(None)
.with_simple_item_acquire_script(None)
.with_simple_item_consume_script(None)
.with_big_item_acquire_script(None)
.with_big_item_consume_script(None)
.with_log_setting(
inventory.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.create_namespace({
name="namespace-0001",
description=nil,
transactionSetting=nil,
acquireScript=nil,
overflowScript=nil,
consumeScript=nil,
simpleItemAcquireScript=nil,
simpleItemConsumeScript=nil,
bigItemAcquireScript=nil,
bigItemConsumeScript=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.create_namespace_async({
name="namespace-0001",
description=nil,
transactionSetting=nil,
acquireScript=nil,
overflowScript=nil,
consumeScript=nil,
simpleItemAcquireScript=nil,
simpleItemConsumeScript=nil,
bigItemAcquireScript=nil,
bigItemConsumeScript=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getNamespaceStatus
ネームスペースの状態を取得
指定されたネームスペースの現在の状態を取得します。
これには、ネームスペースがアクティブか、保留中か、またはその他の状態にあるかが含まれます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| status | string |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&inventory.GetNamespaceStatusRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
status := result.Statususe Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetNamespaceStatusRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getNamespaceStatus(
(new GetNamespaceStatusRequest())
->withNamespaceName("namespace-0001")
);
$status = $result->getStatus();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetNamespaceStatusRequest;
import io.gs2.inventory.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetNamespaceStatusResult result = client.getNamespaceStatus(
new GetNamespaceStatusRequest()
.withNamespaceName("namespace-0001")
);
String status = result.getStatus();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Inventory.Request.GetNamespaceStatusRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2Inventory.GetNamespaceStatusRequest()
.withNamespaceName("namespace-0001")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_namespace_status(
inventory.GetNamespaceStatusRequest()
.with_namespace_name('namespace-0001')
)
status = result.status
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_namespace_status({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
status = result.status;client = gs2('inventory')
api_result_handler = client.get_namespace_status_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
status = result.status;getNamespace
ネームスペースを取得
指定されたネームスペースの詳細情報を取得します。
これには、ネームスペースの名前、説明、およびその他の設定情報が含まれます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | Namespace | ネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&inventory.GetNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getNamespace(
(new GetNamespaceRequest())
->withNamespaceName("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetNamespaceRequest;
import io.gs2.inventory.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetNamespaceResult result = client.getNamespace(
new GetNamespaceRequest()
.withNamespaceName("namespace-0001")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Inventory.Request.GetNamespaceRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getNamespace(
new Gs2Inventory.GetNamespaceRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_namespace(
inventory.GetNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_namespace({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_namespace_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;updateNamespace
ネームスペースを更新
指定されたインベントリネームスペースの設定を更新します。
標準、シンプル、巨大アイテムに対するアイテム入手、オーバーフロー処理、消費の GS2-Script トリガーを変更できます。
スクリプト設定の変更は、以降の操作に対して即座に反映されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| transactionSetting | TransactionSetting | トランザクション設定 アイテムの入手や消費などのインベントリ操作に対する分散トランザクション処理を設定します。シームレスな実行のための自動実行モード、複数リソースの一貫した操作のためのアトミックコミット、大規模な報酬配布のための非同期処理をサポートします。 | ||||
| acquireScript | ScriptSetting | アイテムを入手したときに実行するスクリプトの設定 Script トリガーリファレンス - acquire | ||||
| overflowScript | ScriptSetting | 入手上限に当たって入手できなかったときに実行するスクリプトの設定 Script トリガーリファレンス - overflowDone | ||||
| consumeScript | ScriptSetting | アイテムを消費するときに実行するスクリプトの設定 Script トリガーリファレンス - consume | ||||
| simpleItemAcquireScript | ScriptSetting | シンプルアイテムを入手したときに実行するスクリプトの設定 Script トリガーリファレンス - simpleItemAcquire | ||||
| simpleItemConsumeScript | ScriptSetting | シンプルアイテムを消費するときに実行するスクリプトの設定 Script トリガーリファレンス - simpleItemConsume | ||||
| bigItemAcquireScript | ScriptSetting | 巨大アイテムを入手したときに実行するスクリプトの設定 Script トリガーリファレンス - bigItemAcquire | ||||
| bigItemConsumeScript | ScriptSetting | 巨大アイテムを消費するときに実行するスクリプトの設定 Script トリガーリファレンス - bigItemConsume | ||||
| logSetting | LogSetting | ログの出力設定 インベントリ操作のAPIリクエスト・レスポンスログを出力するためのGS2-Logネームスペースを指定します。デバッグや分析のためにアイテムの入手、消費、容量変更の追跡に便利です。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | Namespace | 更新したネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&inventory.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
Description: pointy.String("description1"),
TransactionSetting: nil,
AcquireScript: &inventory.ScriptSetting{
TriggerScriptId: pointy.String("script-1001"),
DoneTriggerScriptId: pointy.String("script-1002"),
DoneTriggerQueueNamespaceId: pointy.String("namespace-1001"),
},
OverflowScript: &inventory.ScriptSetting{
DoneTriggerScriptId: pointy.String("script-1003"),
DoneTriggerQueueNamespaceId: pointy.String("script-1004"),
},
ConsumeScript: &inventory.ScriptSetting{
TriggerScriptId: pointy.String("script-1005"),
DoneTriggerScriptId: pointy.String("script-1006"),
DoneTriggerQueueNamespaceId: pointy.String("namespace-1001"),
},
SimpleItemAcquireScript: nil,
SimpleItemConsumeScript: nil,
BigItemAcquireScript: nil,
BigItemConsumeScript: nil,
LogSetting: &inventory.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\UpdateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->updateNamespace(
(new UpdateNamespaceRequest())
->withNamespaceName("namespace-0001")
->withDescription("description1")
->withTransactionSetting(null)
->withAcquireScript((new \Gs2\Inventory\Model\ScriptSetting())
->withTriggerScriptId("script-1001")
->withDoneTriggerScriptId("script-1002")
->withDoneTriggerQueueNamespaceId("namespace-1001"))
->withOverflowScript((new \Gs2\Inventory\Model\ScriptSetting())
->withDoneTriggerScriptId("script-1003")
->withDoneTriggerQueueNamespaceId("script-1004"))
->withConsumeScript((new \Gs2\Inventory\Model\ScriptSetting())
->withTriggerScriptId("script-1005")
->withDoneTriggerScriptId("script-1006")
->withDoneTriggerQueueNamespaceId("namespace-1001"))
->withSimpleItemAcquireScript(null)
->withSimpleItemConsumeScript(null)
->withBigItemAcquireScript(null)
->withBigItemConsumeScript(null)
->withLogSetting((new \Gs2\Inventory\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.UpdateNamespaceRequest;
import io.gs2.inventory.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace-0001")
.withDescription("description1")
.withTransactionSetting(null)
.withAcquireScript(new io.gs2.inventory.model.ScriptSetting()
.withTriggerScriptId("script-1001")
.withDoneTriggerScriptId("script-1002")
.withDoneTriggerQueueNamespaceId("namespace-1001"))
.withOverflowScript(new io.gs2.inventory.model.ScriptSetting()
.withDoneTriggerScriptId("script-1003")
.withDoneTriggerQueueNamespaceId("script-1004"))
.withConsumeScript(new io.gs2.inventory.model.ScriptSetting()
.withTriggerScriptId("script-1005")
.withDoneTriggerScriptId("script-1006")
.withDoneTriggerQueueNamespaceId("namespace-1001"))
.withSimpleItemAcquireScript(null)
.withSimpleItemConsumeScript(null)
.withBigItemAcquireScript(null)
.withBigItemConsumeScript(null)
.withLogSetting(new io.gs2.inventory.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Inventory.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace-0001")
.WithDescription("description1")
.WithTransactionSetting(null)
.WithAcquireScript(new Gs2.Gs2Inventory.Model.ScriptSetting()
.WithTriggerScriptId("script-1001")
.WithDoneTriggerScriptId("script-1002")
.WithDoneTriggerQueueNamespaceId("namespace-1001"))
.WithOverflowScript(new Gs2.Gs2Inventory.Model.ScriptSetting()
.WithDoneTriggerScriptId("script-1003")
.WithDoneTriggerQueueNamespaceId("script-1004"))
.WithConsumeScript(new Gs2.Gs2Inventory.Model.ScriptSetting()
.WithTriggerScriptId("script-1005")
.WithDoneTriggerScriptId("script-1006")
.WithDoneTriggerQueueNamespaceId("namespace-1001"))
.WithSimpleItemAcquireScript(null)
.WithSimpleItemConsumeScript(null)
.WithBigItemAcquireScript(null)
.WithBigItemConsumeScript(null)
.WithLogSetting(new Gs2.Gs2Inventory.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2Inventory.UpdateNamespaceRequest()
.withNamespaceName("namespace-0001")
.withDescription("description1")
.withTransactionSetting(null)
.withAcquireScript(new Gs2Inventory.model.ScriptSetting()
.withTriggerScriptId("script-1001")
.withDoneTriggerScriptId("script-1002")
.withDoneTriggerQueueNamespaceId("namespace-1001"))
.withOverflowScript(new Gs2Inventory.model.ScriptSetting()
.withDoneTriggerScriptId("script-1003")
.withDoneTriggerQueueNamespaceId("script-1004"))
.withConsumeScript(new Gs2Inventory.model.ScriptSetting()
.withTriggerScriptId("script-1005")
.withDoneTriggerScriptId("script-1006")
.withDoneTriggerQueueNamespaceId("namespace-1001"))
.withSimpleItemAcquireScript(null)
.withSimpleItemConsumeScript(null)
.withBigItemAcquireScript(null)
.withBigItemConsumeScript(null)
.withLogSetting(new Gs2Inventory.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.update_namespace(
inventory.UpdateNamespaceRequest()
.with_namespace_name('namespace-0001')
.with_description('description1')
.with_transaction_setting(None)
.with_acquire_script(
inventory.ScriptSetting()
.with_trigger_script_id('script-1001')
.with_done_trigger_script_id('script-1002')
.with_done_trigger_queue_namespace_id('namespace-1001'))
.with_overflow_script(
inventory.ScriptSetting()
.with_done_trigger_script_id('script-1003')
.with_done_trigger_queue_namespace_id('script-1004'))
.with_consume_script(
inventory.ScriptSetting()
.with_trigger_script_id('script-1005')
.with_done_trigger_script_id('script-1006')
.with_done_trigger_queue_namespace_id('namespace-1001'))
.with_simple_item_acquire_script(None)
.with_simple_item_consume_script(None)
.with_big_item_acquire_script(None)
.with_big_item_consume_script(None)
.with_log_setting(
inventory.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.update_namespace({
namespaceName="namespace-0001",
description="description1",
transactionSetting=nil,
acquireScript={
triggerScriptId="script-1001",
doneTriggerScriptId="script-1002",
doneTriggerQueueNamespaceId="namespace-1001",
},
overflowScript={
doneTriggerScriptId="script-1003",
doneTriggerQueueNamespaceId="script-1004",
},
consumeScript={
triggerScriptId="script-1005",
doneTriggerScriptId="script-1006",
doneTriggerQueueNamespaceId="namespace-1001",
},
simpleItemAcquireScript=nil,
simpleItemConsumeScript=nil,
bigItemAcquireScript=nil,
bigItemConsumeScript=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.update_namespace_async({
namespaceName="namespace-0001",
description="description1",
transactionSetting=nil,
acquireScript={
triggerScriptId="script-1001",
doneTriggerScriptId="script-1002",
doneTriggerQueueNamespaceId="namespace-1001",
},
overflowScript={
doneTriggerScriptId="script-1003",
doneTriggerQueueNamespaceId="script-1004",
},
consumeScript={
triggerScriptId="script-1005",
doneTriggerScriptId="script-1006",
doneTriggerQueueNamespaceId="namespace-1001",
},
simpleItemAcquireScript=nil,
simpleItemConsumeScript=nil,
bigItemAcquireScript=nil,
bigItemConsumeScript=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;deleteNamespace
ネームスペースを削除
指定されたネームスペースを削除します。
この操作は不可逆であり、削除されたネームスペースに関連するすべてのデータは回復不能になります。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | Namespace | 削除したネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&inventory.DeleteNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DeleteNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->deleteNamespace(
(new DeleteNamespaceRequest())
->withNamespaceName("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DeleteNamespaceRequest;
import io.gs2.inventory.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DeleteNamespaceResult result = client.deleteNamespace(
new DeleteNamespaceRequest()
.withNamespaceName("namespace-0001")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Inventory.Request.DeleteNamespaceRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2Inventory.DeleteNamespaceRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_namespace(
inventory.DeleteNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.delete_namespace({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.delete_namespace_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getServiceVersion
マイクロサービスのバージョンを取得
詳細
Request
Request parameters: None
Result
| 型 | 説明 | |
|---|---|---|
| item | string | バージョン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetServiceVersion(
&inventory.GetServiceVersionRequest {
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetServiceVersionRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getServiceVersion(
(new GetServiceVersionRequest())
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetServiceVersionRequest;
import io.gs2.inventory.result.GetServiceVersionResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetServiceVersionResult result = client.getServiceVersion(
new GetServiceVersionRequest()
);
String item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
new Gs2.Gs2Inventory.Request.GetServiceVersionRequest(),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getServiceVersion(
new Gs2Inventory.GetServiceVersionRequest()
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_service_version(
inventory.GetServiceVersionRequest()
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_service_version({
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_service_version_async({
})
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['errorMessage'])
end
result = api_result.result
item = result.item;dumpUserDataByUserId
指定したユーザーIDに紐づくデータのダンプを取得
個人情報保護の法的要件を満たすために使用したり、データのバックアップや移行に使用できます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 |
|---|
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DumpUserDataByUserId(
&inventory.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\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DumpUserDataByUserIdRequest;
import io.gs2.inventory.result.DumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DumpUserDataByUserIdResult result = client.dumpUserDataByUserId(
new DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
new Gs2.Gs2Inventory.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.dumpUserDataByUserId(
new Gs2Inventory.DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.dump_user_data_by_user_id(
inventory.DumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
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['errorMessage'])
end
result = api_result.resultclient = gs2('inventory')
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['errorMessage'])
end
result = api_result.resultcheckDumpUserDataByUserId
指定したユーザーIDに紐づくデータのダンプが完了しているか確認
以前に開始されたユーザーデータダンプ操作の進捗を確認します。
ダンプにはユーザーが所有するすべてのインベントリデータ、アイテムセット、シンプルアイテム、巨大アイテムが含まれます。
完了時にはエクスポートされたデータをダウンロードするURLを返します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| url | string | 出力データのURL |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
&inventory.CheckDumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.Urluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\CheckDumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.inventory.result.CheckDumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
new Gs2.Gs2Inventory.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.checkDumpUserDataByUserId(
new Gs2Inventory.CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.check_dump_user_data_by_user_id(
inventory.CheckDumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
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['errorMessage'])
end
result = api_result.result
url = result.url;client = gs2('inventory')
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['errorMessage'])
end
result = api_result.result
url = result.url;cleanUserDataByUserId
ユーザーデータの完全削除
指定されたユーザーIDに紐づくデータのクリーニングを実行します。
これにより、特定のユーザーデータをプロジェクトから安全に削除できます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 |
|---|
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.CleanUserDataByUserId(
&inventory.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\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\CleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.CleanUserDataByUserIdRequest;
import io.gs2.inventory.result.CleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
CleanUserDataByUserIdResult result = client.cleanUserDataByUserId(
new CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
new Gs2.Gs2Inventory.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.cleanUserDataByUserId(
new Gs2Inventory.CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.clean_user_data_by_user_id(
inventory.CleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
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['errorMessage'])
end
result = api_result.resultclient = gs2('inventory')
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['errorMessage'])
end
result = api_result.resultcheckCleanUserDataByUserId
指定したユーザーIDのユーザーデータの完全削除が完了しているか確認
以前に開始されたユーザーデータクリーニング操作の進捗を確認します。
クリーニングにより、このサービスのすべてのネームスペースにわたるユーザーのインベントリデータ、アイテムセット、シンプルアイテム、巨大アイテムがすべて削除されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 |
|---|
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
&inventory.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\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\CheckCleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.inventory.result.CheckCleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
CheckCleanUserDataByUserIdResult result = client.checkCleanUserDataByUserId(
new CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
new Gs2.Gs2Inventory.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.checkCleanUserDataByUserId(
new Gs2Inventory.CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.check_clean_user_data_by_user_id(
inventory.CheckCleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
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['errorMessage'])
end
result = api_result.resultclient = gs2('inventory')
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['errorMessage'])
end
result = api_result.resultprepareImportUserDataByUserId
指定したユーザーIDに紐づくデータのインポートを実行
インポートに使用できるデータは GS2 によってエクスポートして取得したデータに限定され、古いデータはインポートに失敗する可能性があります。
エクスポートしたユーザーIDと異なるユーザーIDでインポートすることができますが、ユーザーデータのペイロード内にユーザーIDが含まれる場合はその限りではありません。
このAPIの戻り値で応答されたURLにエクスポートした zip ファイルをアップロードし、importUserDataByUserId を呼び出すことで実際のインポート処理を開始できます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| uploadToken | string | アップロード後に結果を反映する際に使用するトークン |
| uploadUrl | string | ユーザーデータアップロード処理の実行に使用するURL |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
&inventory.PrepareImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\PrepareImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.inventory.result.PrepareImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
new Gs2.Gs2Inventory.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.prepareImportUserDataByUserId(
new Gs2Inventory.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 inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.prepare_import_user_data_by_user_id(
inventory.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('inventory')
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['errorMessage'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;client = gs2('inventory')
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['errorMessage'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;importUserDataByUserId
指定したユーザーIDに紐づくデータのインポートを実行
インポートに使用できるデータは GS2 によってエクスポートして取得したデータに限定され、古いデータはインポートに失敗する可能性があります。
エクスポートしたユーザーIDと異なるユーザーIDでインポートすることができますが、ユーザーデータのペイロード内にユーザーIDが含まれる場合はその限りではありません。
このAPIを呼び出す前に prepareImportUserDataByUserId を呼び出して、アップロード準備を完了させる必要があります。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| uploadToken | string | ✓ | ~ 1024文字 | アップロード準備で受け取ったトークン | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 |
|---|
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.ImportUserDataByUserId(
&inventory.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\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\ImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.ImportUserDataByUserIdRequest;
import io.gs2.inventory.result.ImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
new Gs2.Gs2Inventory.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.importUserDataByUserId(
new Gs2Inventory.ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.import_user_data_by_user_id(
inventory.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('inventory')
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['errorMessage'])
end
result = api_result.resultclient = gs2('inventory')
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['errorMessage'])
end
result = api_result.resultcheckImportUserDataByUserId
指定したユーザーIDに紐づくデータのインポートが完了しているか確認
以前に開始されたユーザーデータインポート操作の進捗を確認します。
インポートにより、以前エクスポートされたデータからインベントリデータ、アイテムセット、シンプルアイテム、巨大アイテムが復元されます。
完了時にはインポートログをダウンロードするURLを返します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| uploadToken | string | ✓ | ~ 1024文字 | アップロード準備で受け取ったトークン | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| url | string | 出力ログのURL |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
&inventory.CheckImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.Urluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\CheckImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.CheckImportUserDataByUserIdRequest;
import io.gs2.inventory.result.CheckImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
new Gs2.Gs2Inventory.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.checkImportUserDataByUserId(
new Gs2Inventory.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 inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.check_import_user_data_by_user_id(
inventory.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('inventory')
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['errorMessage'])
end
result = api_result.result
url = result.url;client = gs2('inventory')
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['errorMessage'])
end
result = api_result.result
url = result.url;describeInventories
インベントリの一覧を取得
リクエストしたユーザーのインベントリのページネーション付きリストを取得します。
各インベントリは、特定のインベントリモデルに対する現在の容量(アイテムスロット数)を追跡します。
インベントリはユーザーが初めてアイテムを入手した際に自動的に作成され、初期容量はインベントリモデルの initialCapacity によって設定されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<Inventory> | インベントリのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeInventories(
&inventory.DescribeInventoriesRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeInventoriesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeInventories(
(new DescribeInventoriesRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeInventoriesRequest;
import io.gs2.inventory.result.DescribeInventoriesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeInventoriesResult result = client.describeInventories(
new DescribeInventoriesRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withPageToken(null)
.withLimit(null)
);
List<Inventory> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeInventoriesResult> asyncResult = null;
yield return client.DescribeInventories(
new Gs2.Gs2Inventory.Request.DescribeInventoriesRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeInventories(
new Gs2Inventory.DescribeInventoriesRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_inventories(
inventory.DescribeInventoriesRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.describe_inventories({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_inventories_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;describeInventoriesByUserId
ユーザーIDを指定してインベントリの一覧を取得
指定されたユーザーのインベントリのページネーション付きリストを取得します。
各インベントリは、特定のインベントリモデルに対する現在の容量(アイテムスロット数)を追跡します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<Inventory> | インベントリのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeInventoriesByUserId(
&inventory.DescribeInventoriesByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeInventoriesByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeInventoriesByUserId(
(new DescribeInventoriesByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeInventoriesByUserIdRequest;
import io.gs2.inventory.result.DescribeInventoriesByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeInventoriesByUserIdResult result = client.describeInventoriesByUserId(
new DescribeInventoriesByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<Inventory> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeInventoriesByUserIdResult> asyncResult = null;
yield return client.DescribeInventoriesByUserId(
new Gs2.Gs2Inventory.Request.DescribeInventoriesByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeInventoriesByUserId(
new Gs2Inventory.DescribeInventoriesByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.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 inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_inventories_by_user_id(
inventory.DescribeInventoriesByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.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('inventory')
api_result = client.describe_inventories_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_inventories_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
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['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;getInventory
インベントリを取得
指定されたインベントリモデルに対するリクエストユーザーのインベントリ(現在の容量を含む)を取得します。
このインベントリでアイテムを一度も入手したことがない場合、データは返されません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このインベントリの構造と容量設定を定義するインベントリモデルの名前です。ユーザーのインベントリインスタンスをモデル定義にリンクし、使用可能なアイテムの種類と容量制限を決定します。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetInventory(
&inventory.GetInventoryRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
AccessToken: pointy.String("accessToken-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetInventoryRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getInventory(
(new GetInventoryRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withAccessToken("accessToken-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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetInventoryRequest;
import io.gs2.inventory.result.GetInventoryResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetInventoryResult result = client.getInventory(
new GetInventoryRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
);
Inventory item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetInventoryResult> asyncResult = null;
yield return client.GetInventory(
new Gs2.Gs2Inventory.Request.GetInventoryRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithAccessToken("accessToken-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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getInventory(
new Gs2Inventory.GetInventoryRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_inventory(
inventory.GetInventoryRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_access_token('accessToken-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_inventory({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_inventory_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getInventoryByUserId
ユーザーIDを指定してインベントリを取得
指定されたインベントリモデルに対するユーザーのインベントリ(現在の容量を含む)を取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このインベントリの構造と容量設定を定義するインベントリモデルの名前です。ユーザーのインベントリインスタンスをモデル定義にリンクし、使用可能なアイテムの種類と容量制限を決定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetInventoryByUserId(
&inventory.GetInventoryByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetInventoryByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getInventoryByUserId(
(new GetInventoryByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetInventoryByUserIdRequest;
import io.gs2.inventory.result.GetInventoryByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetInventoryByUserIdResult result = client.getInventoryByUserId(
new GetInventoryByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
Inventory item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetInventoryByUserIdResult> asyncResult = null;
yield return client.GetInventoryByUserId(
new Gs2.Gs2Inventory.Request.GetInventoryByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getInventoryByUserId(
new Gs2Inventory.GetInventoryByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_inventory_by_user_id(
inventory.GetInventoryByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_inventory_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_inventory_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
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['errorMessage'])
end
result = api_result.result
item = result.item;addCapacityByUserId
ユーザーIDを指定してインベントリのキャパシティサイズを加算
指定された量だけユーザーのインベントリ容量を増加させます。
結果の容量はインベントリモデルの maxCapacity を超えることはできません。
インベントリがまだ存在しない場合、initialCapacity で自動的に作成された後、指定された値が加算されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このインベントリの構造と容量設定を定義するインベントリモデルの名前です。ユーザーのインベントリインスタンスをモデル定義にリンクし、使用可能なアイテムの種類と容量制限を決定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| addCapacityValue | int | ✓ | 1 ~ 2147483646 | 加算するキャパシティサイズ | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | Inventory | キャパシティ加算後のインベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.AddCapacityByUserId(
&inventory.AddCapacityByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
AddCapacityValue: pointy.Int32(1),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\AddCapacityByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->addCapacityByUserId(
(new AddCapacityByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withAddCapacityValue(1)
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.AddCapacityByUserIdRequest;
import io.gs2.inventory.result.AddCapacityByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
AddCapacityByUserIdResult result = client.addCapacityByUserId(
new AddCapacityByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withAddCapacityValue(1)
.withTimeOffsetToken(null)
);
Inventory item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.AddCapacityByUserIdResult> asyncResult = null;
yield return client.AddCapacityByUserId(
new Gs2.Gs2Inventory.Request.AddCapacityByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithAddCapacityValue(1)
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.addCapacityByUserId(
new Gs2Inventory.AddCapacityByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withAddCapacityValue(1)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.add_capacity_by_user_id(
inventory.AddCapacityByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_add_capacity_value(1)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.add_capacity_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
addCapacityValue=1,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.add_capacity_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
addCapacityValue=1,
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['errorMessage'])
end
result = api_result.result
item = result.item;setCapacityByUserId
ユーザーIDを指定してインベントリのキャパシティサイズを設定
ユーザーのインベントリ容量を指定された絶対値に設定します。
更新前後のインベントリ状態を両方返すため、新旧の容量値を比較できます。
新しい容量値はインベントリモデルの maxCapacity を超えることはできません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このインベントリの構造と容量設定を定義するインベントリモデルの名前です。ユーザーのインベントリインスタンスをモデル定義にリンクし、使用可能なアイテムの種類と容量制限を決定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| newCapacityValue | int | ✓ | 1 ~ 2147483646 | インベントリの新しい最大キャパシティ | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | Inventory | 更新後のインベントリ |
| old | Inventory | 更新前のインベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.SetCapacityByUserId(
&inventory.SetCapacityByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
NewCapacityValue: pointy.Int32(10),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
old := result.Olduse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\SetCapacityByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->setCapacityByUserId(
(new SetCapacityByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withNewCapacityValue(10)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$old = $result->getOld();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.SetCapacityByUserIdRequest;
import io.gs2.inventory.result.SetCapacityByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
SetCapacityByUserIdResult result = client.setCapacityByUserId(
new SetCapacityByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withNewCapacityValue(10)
.withTimeOffsetToken(null)
);
Inventory item = result.getItem();
Inventory old = result.getOld();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.SetCapacityByUserIdResult> asyncResult = null;
yield return client.SetCapacityByUserId(
new Gs2.Gs2Inventory.Request.SetCapacityByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithNewCapacityValue(10)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var old = result.Old;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.setCapacityByUserId(
new Gs2Inventory.SetCapacityByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withNewCapacityValue(10)
.withTimeOffsetToken(null)
);
const item = result.getItem();
const old = result.getOld();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.set_capacity_by_user_id(
inventory.SetCapacityByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_new_capacity_value(10)
.with_time_offset_token(None)
)
item = result.item
old = result.old
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.set_capacity_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
newCapacityValue=10,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
old = result.old;client = gs2('inventory')
api_result_handler = client.set_capacity_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
newCapacityValue=10,
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['errorMessage'])
end
result = api_result.result
item = result.item;
old = result.old;deleteInventoryByUserId
インベントリを削除
指定されたユーザーのインベントリと、それに関連するすべてのアイテムセットを削除します。
この操作はインベントリとその中に格納されているすべてのアイテムを永久に削除します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このインベントリの構造と容量設定を定義するインベントリモデルの名前です。ユーザーのインベントリインスタンスをモデル定義にリンクし、使用可能なアイテムの種類と容量制限を決定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DeleteInventoryByUserId(
&inventory.DeleteInventoryByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DeleteInventoryByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->deleteInventoryByUserId(
(new DeleteInventoryByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DeleteInventoryByUserIdRequest;
import io.gs2.inventory.result.DeleteInventoryByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DeleteInventoryByUserIdResult result = client.deleteInventoryByUserId(
new DeleteInventoryByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
Inventory item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DeleteInventoryByUserIdResult> asyncResult = null;
yield return client.DeleteInventoryByUserId(
new Gs2.Gs2Inventory.Request.DeleteInventoryByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.deleteInventoryByUserId(
new Gs2Inventory.DeleteInventoryByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_inventory_by_user_id(
inventory.DeleteInventoryByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.delete_inventory_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.delete_inventory_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
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['errorMessage'])
end
result = api_result.result
item = result.item;verifyInventoryCurrentMaxCapacity
現在のインベントリの最大容量を検証
ユーザーの現在の最大インベントリ容量が指定された条件を満たすことを検証します。
6つの比較演算子をサポートします:less、lessEqual、greater、greaterEqual、equal、notEqual。
検証には、保存された生の値ではなく、バフ適用後の容量値(GS2-Buff からのアクティブなバフ効果を反映)が使用されます。
条件が満たされない場合、エラーが返されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||||||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||||||||||||||||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このインベントリの構造と容量設定を定義するインベントリモデルの名前です。ユーザーのインベントリインスタンスをモデル定義にリンクし、使用可能なアイテムの種類と容量制限を決定します。 | ||||||||||||||||
| verifyType | 文字列列挙型 enum { “less”, “lessEqual”, “greater”, “greaterEqual”, “equal”, “notEqual” } | ✓ | 検証の種類
| |||||||||||||||||
| currentInventoryMaxCapacity | int | ✓ | 0 ~ 2147483646 | 現在のインベントリの最大容量 | ||||||||||||||||
| multiplyValueSpecifyingQuantity | bool | true | 数量指定した際に、検証に使用する値も乗算するか |
Result
| 型 | 説明 | |
|---|---|---|
| item | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.VerifyInventoryCurrentMaxCapacity(
&inventory.VerifyInventoryCurrentMaxCapacityRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
InventoryName: pointy.String("inventory-0001"),
VerifyType: pointy.String("less"),
CurrentInventoryMaxCapacity: pointy.Int32(10),
MultiplyValueSpecifyingQuantity: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\VerifyInventoryCurrentMaxCapacityRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->verifyInventoryCurrentMaxCapacity(
(new VerifyInventoryCurrentMaxCapacityRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withInventoryName("inventory-0001")
->withVerifyType("less")
->withCurrentInventoryMaxCapacity(10)
->withMultiplyValueSpecifyingQuantity(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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.VerifyInventoryCurrentMaxCapacityRequest;
import io.gs2.inventory.result.VerifyInventoryCurrentMaxCapacityResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
VerifyInventoryCurrentMaxCapacityResult result = client.verifyInventoryCurrentMaxCapacity(
new VerifyInventoryCurrentMaxCapacityRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withInventoryName("inventory-0001")
.withVerifyType("less")
.withCurrentInventoryMaxCapacity(10)
.withMultiplyValueSpecifyingQuantity(null)
);
Inventory item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.VerifyInventoryCurrentMaxCapacityResult> asyncResult = null;
yield return client.VerifyInventoryCurrentMaxCapacity(
new Gs2.Gs2Inventory.Request.VerifyInventoryCurrentMaxCapacityRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithInventoryName("inventory-0001")
.WithVerifyType("less")
.WithCurrentInventoryMaxCapacity(10)
.WithMultiplyValueSpecifyingQuantity(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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.verifyInventoryCurrentMaxCapacity(
new Gs2Inventory.VerifyInventoryCurrentMaxCapacityRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withInventoryName("inventory-0001")
.withVerifyType("less")
.withCurrentInventoryMaxCapacity(10)
.withMultiplyValueSpecifyingQuantity(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.verify_inventory_current_max_capacity(
inventory.VerifyInventoryCurrentMaxCapacityRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_inventory_name('inventory-0001')
.with_verify_type('less')
.with_current_inventory_max_capacity(10)
.with_multiply_value_specifying_quantity(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.verify_inventory_current_max_capacity({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
inventoryName="inventory-0001",
verifyType="less",
currentInventoryMaxCapacity=10,
multiplyValueSpecifyingQuantity=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.verify_inventory_current_max_capacity_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
inventoryName="inventory-0001",
verifyType="less",
currentInventoryMaxCapacity=10,
multiplyValueSpecifyingQuantity=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['errorMessage'])
end
result = api_result.result
item = result.item;verifyInventoryCurrentMaxCapacityByUserId
ユーザーIDを指定してインベントリの最大容量を検証
指定されたユーザーの現在の最大インベントリ容量が指定された条件を満たすことを検証します。
6つの比較演算子をサポートします:less、lessEqual、greater、greaterEqual、equal、notEqual。
検証にはバフ適用後の容量値(GS2-Buff からのアクティブなバフ効果を反映)が使用されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||||||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||||||||||||||||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このインベントリの構造と容量設定を定義するインベントリモデルの名前です。ユーザーのインベントリインスタンスをモデル定義にリンクし、使用可能なアイテムの種類と容量制限を決定します。 | ||||||||||||||||
| verifyType | 文字列列挙型 enum { “less”, “lessEqual”, “greater”, “greaterEqual”, “equal”, “notEqual” } | ✓ | 検証の種類
| |||||||||||||||||
| currentInventoryMaxCapacity | int | ✓ | 0 ~ 2147483646 | 現在のインベントリの最大容量 | ||||||||||||||||
| multiplyValueSpecifyingQuantity | bool | true | 数量指定した際に、検証に使用する値も乗算するか | |||||||||||||||||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.VerifyInventoryCurrentMaxCapacityByUserId(
&inventory.VerifyInventoryCurrentMaxCapacityByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
InventoryName: pointy.String("inventory-0001"),
VerifyType: pointy.String("less"),
CurrentInventoryMaxCapacity: pointy.Int32(10),
MultiplyValueSpecifyingQuantity: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\VerifyInventoryCurrentMaxCapacityByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->verifyInventoryCurrentMaxCapacityByUserId(
(new VerifyInventoryCurrentMaxCapacityByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withInventoryName("inventory-0001")
->withVerifyType("less")
->withCurrentInventoryMaxCapacity(10)
->withMultiplyValueSpecifyingQuantity(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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.VerifyInventoryCurrentMaxCapacityByUserIdRequest;
import io.gs2.inventory.result.VerifyInventoryCurrentMaxCapacityByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
VerifyInventoryCurrentMaxCapacityByUserIdResult result = client.verifyInventoryCurrentMaxCapacityByUserId(
new VerifyInventoryCurrentMaxCapacityByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withInventoryName("inventory-0001")
.withVerifyType("less")
.withCurrentInventoryMaxCapacity(10)
.withMultiplyValueSpecifyingQuantity(null)
.withTimeOffsetToken(null)
);
Inventory item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.VerifyInventoryCurrentMaxCapacityByUserIdResult> asyncResult = null;
yield return client.VerifyInventoryCurrentMaxCapacityByUserId(
new Gs2.Gs2Inventory.Request.VerifyInventoryCurrentMaxCapacityByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithInventoryName("inventory-0001")
.WithVerifyType("less")
.WithCurrentInventoryMaxCapacity(10)
.WithMultiplyValueSpecifyingQuantity(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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.verifyInventoryCurrentMaxCapacityByUserId(
new Gs2Inventory.VerifyInventoryCurrentMaxCapacityByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withInventoryName("inventory-0001")
.withVerifyType("less")
.withCurrentInventoryMaxCapacity(10)
.withMultiplyValueSpecifyingQuantity(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.verify_inventory_current_max_capacity_by_user_id(
inventory.VerifyInventoryCurrentMaxCapacityByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_inventory_name('inventory-0001')
.with_verify_type('less')
.with_current_inventory_max_capacity(10)
.with_multiply_value_specifying_quantity(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.verify_inventory_current_max_capacity_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
inventoryName="inventory-0001",
verifyType="less",
currentInventoryMaxCapacity=10,
multiplyValueSpecifyingQuantity=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.verify_inventory_current_max_capacity_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
inventoryName="inventory-0001",
verifyType="less",
currentInventoryMaxCapacity=10,
multiplyValueSpecifyingQuantity=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['errorMessage'])
end
result = api_result.result
item = result.item;describeItemSets
アイテムセットの一覧を取得
指定されたインベントリ内のリクエストユーザーのアイテムセットのページネーション付きリストを取得します。
各アイテムセットは、特定の数量、オプションの有効期限、およびオプションの参照を持つアイテムのスタックを表します。
アイテムモデルが複数スタックを許可する場合、同じアイテムタイプが異なる数量と有効期限を持つ複数のアイテムセットエントリとして表示されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<ItemSet> | アイテムセットのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeItemSets(
&inventory.DescribeItemSetsRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
AccessToken: pointy.String("accessToken-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeItemSetsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeItemSets(
(new DescribeItemSetsRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withAccessToken("accessToken-0001")
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeItemSetsRequest;
import io.gs2.inventory.result.DescribeItemSetsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeItemSetsResult result = client.describeItemSets(
new DescribeItemSetsRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withAccessToken("accessToken-0001")
.withPageToken(null)
.withLimit(null)
);
List<ItemSet> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeItemSetsResult> asyncResult = null;
yield return client.DescribeItemSets(
new Gs2.Gs2Inventory.Request.DescribeItemSetsRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithAccessToken("accessToken-0001")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeItemSets(
new Gs2Inventory.DescribeItemSetsRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withAccessToken("accessToken-0001")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_item_sets(
inventory.DescribeItemSetsRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_access_token('accessToken-0001')
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.describe_item_sets({
namespaceName="namespace-0001",
inventoryName="item",
accessToken="accessToken-0001",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_item_sets_async({
namespaceName="namespace-0001",
inventoryName="item",
accessToken="accessToken-0001",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;describeItemSetsByUserId
ユーザーIDを指定してアイテムセットの一覧を取得
指定されたインベントリ内のユーザーのアイテムセットのページネーション付きリストを取得します。
各アイテムセットは、特定の数量、オプションの有効期限、およびオプションの参照を持つアイテムのスタックを表します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<ItemSet> | アイテムセットのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeItemSetsByUserId(
&inventory.DescribeItemSetsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeItemSetsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeItemSetsByUserId(
(new DescribeItemSetsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeItemSetsByUserIdRequest;
import io.gs2.inventory.result.DescribeItemSetsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeItemSetsByUserIdResult result = client.describeItemSetsByUserId(
new DescribeItemSetsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<ItemSet> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeItemSetsByUserIdResult> asyncResult = null;
yield return client.DescribeItemSetsByUserId(
new Gs2.Gs2Inventory.Request.DescribeItemSetsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeItemSetsByUserId(
new Gs2Inventory.DescribeItemSetsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.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 inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_item_sets_by_user_id(
inventory.DescribeItemSetsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.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('inventory')
api_result = client.describe_item_sets_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_item_sets_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
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['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;getItemSet
アイテムセットを取得
リクエストユーザーのインベントリ内の指定されたアイテムのアイテムセットを取得します。
オプションの itemSetName で特定のスタックにフィルタリングできます。指定しない場合、そのアイテムのすべてのスタックが返されます。
関連するアイテムモデルとインベントリ情報も返されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| itemSetName | string | ~ 36文字 | アイテムセットを識別する名前 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<ItemSet> | アイテムセットのリスト |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetItemSet(
&inventory.GetItemSetRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
AccessToken: pointy.String("accessToken-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: pointy.String("itemSet-0001"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetItemSetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getItemSet(
(new GetItemSetRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withAccessToken("accessToken-0001")
->withItemName("item-0001")
->withItemSetName("itemSet-0001")
);
$items = $result->getItems();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetItemSetRequest;
import io.gs2.inventory.result.GetItemSetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetItemSetResult result = client.getItemSet(
new GetItemSetRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withItemSetName("itemSet-0001")
);
List<ItemSet> items = result.getItems();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetItemSetResult> asyncResult = null;
yield return client.GetItemSet(
new Gs2.Gs2Inventory.Request.GetItemSetRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithAccessToken("accessToken-0001")
.WithItemName("item-0001")
.WithItemSetName("itemSet-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getItemSet(
new Gs2Inventory.GetItemSetRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withItemSetName("itemSet-0001")
);
const items = result.getItems();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_item_set(
inventory.GetItemSetRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_access_token('accessToken-0001')
.with_item_name('item-0001')
.with_item_set_name('itemSet-0001')
)
items = result.items
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_item_set({
namespaceName="namespace-0001",
inventoryName="item",
accessToken="accessToken-0001",
itemName="item-0001",
itemSetName="itemSet-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.get_item_set_async({
namespaceName="namespace-0001",
inventoryName="item",
accessToken="accessToken-0001",
itemName="item-0001",
itemSetName="itemSet-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['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;getItemSetByUserId
ユーザーIDを指定してアイテムセットを取得
指定されたユーザーのインベントリ内の特定アイテムのアイテムセットを取得します。
オプションの itemSetName で特定のスタックにフィルタリングできます。指定しない場合、そのアイテムのすべてのスタックが返されます。
関連するアイテムモデルとインベントリ情報も返されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| itemSetName | string | ~ 36文字 | アイテムセットを識別する名前 | |||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<ItemSet> | アイテムセットのリスト |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetItemSetByUserId(
&inventory.GetItemSetByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetItemSetByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getItemSetByUserId(
(new GetItemSetByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withItemName("item-0001")
->withItemSetName(null)
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetItemSetByUserIdRequest;
import io.gs2.inventory.result.GetItemSetByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetItemSetByUserIdResult result = client.getItemSetByUserId(
new GetItemSetByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName(null)
.withTimeOffsetToken(null)
);
List<ItemSet> items = result.getItems();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetItemSetByUserIdResult> asyncResult = null;
yield return client.GetItemSetByUserId(
new Gs2.Gs2Inventory.Request.GetItemSetByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithItemSetName(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getItemSetByUserId(
new Gs2Inventory.GetItemSetByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_item_set_by_user_id(
inventory.GetItemSetByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_item_set_name(None)
.with_time_offset_token(None)
)
items = result.items
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_item_set_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
itemSetName=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.get_item_set_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
itemSetName=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['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;getItemWithSignature
署名と共にアイテムセットを取得
データの真正性を検証するために使用できる暗号署名付きでアイテムセットを取得します。
署名は指定された暗号鍵を使用して生成され、外部システムがアイテムデータが改ざんされていないことを検証できます。
アイテムの所持を第三者が検証する必要があるサーバー権威的な検証シナリオに有用です。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| itemSetName | string | ~ 36文字 | アイテムセットを識別する名前 | |||
| keyId | string | “grn:gs2:{region}:{ownerId}:key:default:key:default” | ~ 1024文字 | 暗号鍵 GRN |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<ItemSet> | アイテムセットのリスト |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
| body | string | 署名対象のアイテムセット情報 |
| signature | string | 署名 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetItemWithSignature(
&inventory.GetItemWithSignatureRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
AccessToken: pointy.String("accessToken-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: nil,
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
itemModel := result.ItemModel
inventory := result.Inventory
body := result.Body
signature := result.Signatureuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetItemWithSignatureRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getItemWithSignature(
(new GetItemWithSignatureRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withAccessToken("accessToken-0001")
->withItemName("item-0001")
->withItemSetName(null)
->withKeyId("key-0001")
);
$items = $result->getItems();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
$body = $result->getBody();
$signature = $result->getSignature();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetItemWithSignatureRequest;
import io.gs2.inventory.result.GetItemWithSignatureResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetItemWithSignatureResult result = client.getItemWithSignature(
new GetItemWithSignatureRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withItemSetName(null)
.withKeyId("key-0001")
);
List<ItemSet> items = result.getItems();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
String body = result.getBody();
String signature = result.getSignature();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetItemWithSignatureResult> asyncResult = null;
yield return client.GetItemWithSignature(
new Gs2.Gs2Inventory.Request.GetItemWithSignatureRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithAccessToken("accessToken-0001")
.WithItemName("item-0001")
.WithItemSetName(null)
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var itemModel = result.ItemModel;
var inventory = result.Inventory;
var body = result.Body;
var signature = result.Signature;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getItemWithSignature(
new Gs2Inventory.GetItemWithSignatureRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withItemSetName(null)
.withKeyId("key-0001")
);
const items = result.getItems();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
const body = result.getBody();
const signature = result.getSignature();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_item_with_signature(
inventory.GetItemWithSignatureRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_access_token('accessToken-0001')
.with_item_name('item-0001')
.with_item_set_name(None)
.with_key_id('key-0001')
)
items = result.items
item_model = result.item_model
inventory = result.inventory
body = result.body
signature = result.signature
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_item_with_signature({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
itemSetName=nil,
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;
body = result.body;
signature = result.signature;client = gs2('inventory')
api_result_handler = client.get_item_with_signature_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
itemSetName=nil,
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['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;
body = result.body;
signature = result.signature;getItemWithSignatureByUserId
ユーザーIDを指定して署名付きアイテムセットを取得
指定されたユーザーの暗号署名付きアイテムセットを取得します。
署名は外部の真正性検証のために、指定された暗号鍵を使用して生成されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| itemSetName | string | ~ 36文字 | アイテムセットを識別する名前 | |||
| keyId | string | “grn:gs2:{region}:{ownerId}:key:default:key:default” | ~ 1024文字 | 暗号鍵 GRN | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<ItemSet> | アイテムセットのリスト |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
| body | string | 署名対象のアイテムセット情報 |
| signature | string | 署名 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetItemWithSignatureByUserId(
&inventory.GetItemWithSignatureByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: nil,
KeyId: pointy.String("key-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
itemModel := result.ItemModel
inventory := result.Inventory
body := result.Body
signature := result.Signatureuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetItemWithSignatureByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getItemWithSignatureByUserId(
(new GetItemWithSignatureByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withItemName("item-0001")
->withItemSetName(null)
->withKeyId("key-0001")
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
$body = $result->getBody();
$signature = $result->getSignature();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetItemWithSignatureByUserIdRequest;
import io.gs2.inventory.result.GetItemWithSignatureByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetItemWithSignatureByUserIdResult result = client.getItemWithSignatureByUserId(
new GetItemWithSignatureByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName(null)
.withKeyId("key-0001")
.withTimeOffsetToken(null)
);
List<ItemSet> items = result.getItems();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
String body = result.getBody();
String signature = result.getSignature();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetItemWithSignatureByUserIdResult> asyncResult = null;
yield return client.GetItemWithSignatureByUserId(
new Gs2.Gs2Inventory.Request.GetItemWithSignatureByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithItemSetName(null)
.WithKeyId("key-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var itemModel = result.ItemModel;
var inventory = result.Inventory;
var body = result.Body;
var signature = result.Signature;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getItemWithSignatureByUserId(
new Gs2Inventory.GetItemWithSignatureByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName(null)
.withKeyId("key-0001")
.withTimeOffsetToken(null)
);
const items = result.getItems();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
const body = result.getBody();
const signature = result.getSignature();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_item_with_signature_by_user_id(
inventory.GetItemWithSignatureByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_item_set_name(None)
.with_key_id('key-0001')
.with_time_offset_token(None)
)
items = result.items
item_model = result.item_model
inventory = result.inventory
body = result.body
signature = result.signature
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_item_with_signature_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
itemSetName=nil,
keyId="key-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;
body = result.body;
signature = result.signature;client = gs2('inventory')
api_result_handler = client.get_item_with_signature_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
itemSetName=nil,
keyId="key-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['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;
body = result.body;
signature = result.signature;acquireItemSetByUserId
ユーザーIDを指定してアイテムセットを入手
ユーザーのインベントリにアイテムを追加します。既存のアイテムセットに空き(スタック制限未満)がある場合はそこに追加され、そうでない場合は複数スタックが許可されていれば新しいアイテムセットが作成されます。
オプションの expiresAt で、新しく作成されるアイテムセットの有効期限を設定できます。有効期限が既に過去のアイテムは空として扱われます。
createNewItemSet が true の場合、既存のセットに空きがあっても常に新しいアイテムセットが作成されます。
合計数量がインベントリ容量を超える場合、オーバーフロー数量が返され、ネームスペースの設定に応じてオーバーフロー分が GS2-Inbox に転送される場合があります。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| acquireCount | long | ✓ | 1 ~ 9223372036854775805 | 入手する量 | ||
| expiresAt | long | 0 | 有効期限 UNIX 時間・ミリ秒 | |||
| createNewItemSet | bool | false | 既存のアイテムセットに空きがあったとしても、新しいアイテムセットを作成するか | |||
| itemSetName | string | ~ 36文字 | アイテムセットを識別する名前 | |||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<ItemSet> | 加算後のアイテムセットのリスト |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
| overflowCount | long | 所持数量の上限を超えて受け取れずに GS2-Inbox に転送したアイテムの数量 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.AcquireItemSetByUserId(
&inventory.AcquireItemSetByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
ItemName: pointy.String("item-0001"),
UserId: pointy.String("user-0001"),
AcquireCount: pointy.Int64(5),
ExpiresAt: pointy.Int64(0),
CreateNewItemSet: nil,
ItemSetName: pointy.String("itemSet-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
itemModel := result.ItemModel
inventory := result.Inventory
overflowCount := result.OverflowCountuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\AcquireItemSetByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->acquireItemSetByUserId(
(new AcquireItemSetByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withItemName("item-0001")
->withUserId("user-0001")
->withAcquireCount(5)
->withExpiresAt(0)
->withCreateNewItemSet(null)
->withItemSetName("itemSet-0001")
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
$overflowCount = $result->getOverflowCount();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.AcquireItemSetByUserIdRequest;
import io.gs2.inventory.result.AcquireItemSetByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
AcquireItemSetByUserIdResult result = client.acquireItemSetByUserId(
new AcquireItemSetByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-0001")
.withUserId("user-0001")
.withAcquireCount(5L)
.withExpiresAt(0L)
.withCreateNewItemSet(null)
.withItemSetName("itemSet-0001")
.withTimeOffsetToken(null)
);
List<ItemSet> items = result.getItems();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
long overflowCount = result.getOverflowCount();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.AcquireItemSetByUserIdResult> asyncResult = null;
yield return client.AcquireItemSetByUserId(
new Gs2.Gs2Inventory.Request.AcquireItemSetByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithItemName("item-0001")
.WithUserId("user-0001")
.WithAcquireCount(5L)
.WithExpiresAt(0L)
.WithCreateNewItemSet(null)
.WithItemSetName("itemSet-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var itemModel = result.ItemModel;
var inventory = result.Inventory;
var overflowCount = result.OverflowCount;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.acquireItemSetByUserId(
new Gs2Inventory.AcquireItemSetByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-0001")
.withUserId("user-0001")
.withAcquireCount(5)
.withExpiresAt(0)
.withCreateNewItemSet(null)
.withItemSetName("itemSet-0001")
.withTimeOffsetToken(null)
);
const items = result.getItems();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
const overflowCount = result.getOverflowCount();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.acquire_item_set_by_user_id(
inventory.AcquireItemSetByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_item_name('item-0001')
.with_user_id('user-0001')
.with_acquire_count(5)
.with_expires_at(0)
.with_create_new_item_set(None)
.with_item_set_name('itemSet-0001')
.with_time_offset_token(None)
)
items = result.items
item_model = result.item_model
inventory = result.inventory
overflow_count = result.overflow_count
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.acquire_item_set_by_user_id({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-0001",
userId="user-0001",
acquireCount=5,
expiresAt=0,
createNewItemSet=nil,
itemSetName="itemSet-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;
overflowCount = result.overflowCount;client = gs2('inventory')
api_result_handler = client.acquire_item_set_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-0001",
userId="user-0001",
acquireCount=5,
expiresAt=0,
createNewItemSet=nil,
itemSetName="itemSet-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['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;
overflowCount = result.overflowCount;acquireItemSetWithGradeByUserId
ユーザーIDを指定して GS2-Grade にグレードを設定しつつ、アイテムセットを1つ入手
アイテムを1つ入手すると同時に、GS2-Grade を通じてグレード値を設定します。
各アイテムが異なるグレード値を持つ品質/ランクシステム(例:異なるステータスの装備)を持つアイテムに使用されます。
常に新しいアイテムセットが作成され(createNewItemSet の動作)、アイテム入手後に GS2-Grade の SetGradeByUserId を通じてグレードが設定されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| gradeModelId | string | ✓ | ~ 1024文字 | グレードモデル GRN | ||
| gradeValue | long | ✓ | 1 ~ 9223372036854775805 | 設定するグレード値 | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | ItemSet | 加算後のアイテムセット |
| status | Status | 設定したグレードステータス |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
| overflowCount | long | 所持数量の上限を超えて受け取れずに GS2-Inbox に転送したアイテムの数量 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.AcquireItemSetWithGradeByUserId(
&inventory.AcquireItemSetWithGradeByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
ItemName: pointy.String("item-0001"),
UserId: pointy.String("user-0001"),
GradeModelId: pointy.String("grn:ap-northeast-1:YourOwnerId:grade:namespace-0001:model:grade-0001"),
GradeValue: pointy.Int64(1),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
status := result.Status
itemModel := result.ItemModel
inventory := result.Inventory
overflowCount := result.OverflowCountuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\AcquireItemSetWithGradeByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->acquireItemSetWithGradeByUserId(
(new AcquireItemSetWithGradeByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withItemName("item-0001")
->withUserId("user-0001")
->withGradeModelId("grn:ap-northeast-1:YourOwnerId:grade:namespace-0001:model:grade-0001")
->withGradeValue(1)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$status = $result->getStatus();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
$overflowCount = $result->getOverflowCount();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.AcquireItemSetWithGradeByUserIdRequest;
import io.gs2.inventory.result.AcquireItemSetWithGradeByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
AcquireItemSetWithGradeByUserIdResult result = client.acquireItemSetWithGradeByUserId(
new AcquireItemSetWithGradeByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withItemName("item-0001")
.withUserId("user-0001")
.withGradeModelId("grn:ap-northeast-1:YourOwnerId:grade:namespace-0001:model:grade-0001")
.withGradeValue(1L)
.withTimeOffsetToken(null)
);
ItemSet item = result.getItem();
Status status = result.getStatus();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
long overflowCount = result.getOverflowCount();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.AcquireItemSetWithGradeByUserIdResult> asyncResult = null;
yield return client.AcquireItemSetWithGradeByUserId(
new Gs2.Gs2Inventory.Request.AcquireItemSetWithGradeByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithItemName("item-0001")
.WithUserId("user-0001")
.WithGradeModelId("grn:ap-northeast-1:YourOwnerId:grade:namespace-0001:model:grade-0001")
.WithGradeValue(1L)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var status = result.Status;
var itemModel = result.ItemModel;
var inventory = result.Inventory;
var overflowCount = result.OverflowCount;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.acquireItemSetWithGradeByUserId(
new Gs2Inventory.AcquireItemSetWithGradeByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withItemName("item-0001")
.withUserId("user-0001")
.withGradeModelId("grn:ap-northeast-1:YourOwnerId:grade:namespace-0001:model:grade-0001")
.withGradeValue(1)
.withTimeOffsetToken(null)
);
const item = result.getItem();
const status = result.getStatus();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
const overflowCount = result.getOverflowCount();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.acquire_item_set_with_grade_by_user_id(
inventory.AcquireItemSetWithGradeByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_item_name('item-0001')
.with_user_id('user-0001')
.with_grade_model_id('grn:ap-northeast-1:YourOwnerId:grade:namespace-0001:model:grade-0001')
.with_grade_value(1)
.with_time_offset_token(None)
)
item = result.item
status = result.status
item_model = result.item_model
inventory = result.inventory
overflow_count = result.overflow_count
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.acquire_item_set_with_grade_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
itemName="item-0001",
userId="user-0001",
gradeModelId="grn:ap-northeast-1:YourOwnerId:grade:namespace-0001:model:grade-0001",
gradeValue=1,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
status = result.status;
itemModel = result.itemModel;
inventory = result.inventory;
overflowCount = result.overflowCount;client = gs2('inventory')
api_result_handler = client.acquire_item_set_with_grade_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
itemName="item-0001",
userId="user-0001",
gradeModelId="grn:ap-northeast-1:YourOwnerId:grade:namespace-0001:model:grade-0001",
gradeValue=1,
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['errorMessage'])
end
result = api_result.result
item = result.item;
status = result.status;
itemModel = result.itemModel;
inventory = result.inventory;
overflowCount = result.overflowCount;consumeItemSet
アイテムセットを消費
リクエストユーザーのインベントリ内の指定されたアイテムの数量を減少させます。
itemSetName を指定すると、その特定のスタックのみが消費対象になります。指定しない場合、そのアイテムタイプのすべてのスタックから消費されます。
アイテムセットの数量がゼロになると、自動的に削除されます。
要求された量を消費するのに十分なアイテムがない場合、Insufficient エラーが返されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| consumeCount | long | ✓ | 1 ~ 9223372036854775805 | 消費する量 | ||
| itemSetName | string | ~ 36文字 | アイテムセットを識別する名前 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<ItemSet> | 消費後のアイテムセットのリスト |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.ConsumeItemSet(
&inventory.ConsumeItemSetRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
AccessToken: pointy.String("accessToken-0001"),
ItemName: pointy.String("item-0001"),
ConsumeCount: pointy.Int64(1),
ItemSetName: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\ConsumeItemSetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->consumeItemSet(
(new ConsumeItemSetRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withAccessToken("accessToken-0001")
->withItemName("item-0001")
->withConsumeCount(1)
->withItemSetName(null)
);
$items = $result->getItems();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.ConsumeItemSetRequest;
import io.gs2.inventory.result.ConsumeItemSetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
ConsumeItemSetResult result = client.consumeItemSet(
new ConsumeItemSetRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withConsumeCount(1L)
.withItemSetName(null)
);
List<ItemSet> items = result.getItems();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.ConsumeItemSetResult> asyncResult = null;
yield return client.ConsumeItemSet(
new Gs2.Gs2Inventory.Request.ConsumeItemSetRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithAccessToken("accessToken-0001")
.WithItemName("item-0001")
.WithConsumeCount(1L)
.WithItemSetName(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.consumeItemSet(
new Gs2Inventory.ConsumeItemSetRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withConsumeCount(1)
.withItemSetName(null)
);
const items = result.getItems();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.consume_item_set(
inventory.ConsumeItemSetRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_access_token('accessToken-0001')
.with_item_name('item-0001')
.with_consume_count(1)
.with_item_set_name(None)
)
items = result.items
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.consume_item_set({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
consumeCount=1,
itemSetName=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.consume_item_set_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
consumeCount=1,
itemSetName=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['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;consumeItemSetByUserId
ユーザーIDを指定してアイテムセットを消費
指定されたユーザーのインベントリ内の特定アイテムの数量を減少させます。
itemSetName を指定すると、その特定のスタックのみが消費対象になります。指定しない場合、そのアイテムタイプのすべてのスタックから消費されます。
アイテムセットの数量がゼロになると、自動的に削除されます。
十分なアイテムがない場合、Insufficient エラーが返されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| consumeCount | long | ✓ | 1 ~ 9223372036854775805 | 消費する量 | ||
| itemSetName | string | ~ 36文字 | アイテムセットを識別する名前 | |||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<ItemSet> | 消費後のアイテムセットのリスト |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.ConsumeItemSetByUserId(
&inventory.ConsumeItemSetByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
ConsumeCount: pointy.Int64(1),
ItemSetName: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\ConsumeItemSetByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->consumeItemSetByUserId(
(new ConsumeItemSetByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withItemName("item-0001")
->withConsumeCount(1)
->withItemSetName(null)
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.ConsumeItemSetByUserIdRequest;
import io.gs2.inventory.result.ConsumeItemSetByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
ConsumeItemSetByUserIdResult result = client.consumeItemSetByUserId(
new ConsumeItemSetByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withConsumeCount(1L)
.withItemSetName(null)
.withTimeOffsetToken(null)
);
List<ItemSet> items = result.getItems();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.ConsumeItemSetByUserIdResult> asyncResult = null;
yield return client.ConsumeItemSetByUserId(
new Gs2.Gs2Inventory.Request.ConsumeItemSetByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithConsumeCount(1L)
.WithItemSetName(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.consumeItemSetByUserId(
new Gs2Inventory.ConsumeItemSetByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withConsumeCount(1)
.withItemSetName(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.consume_item_set_by_user_id(
inventory.ConsumeItemSetByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_consume_count(1)
.with_item_set_name(None)
.with_time_offset_token(None)
)
items = result.items
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.consume_item_set_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
consumeCount=1,
itemSetName=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.consume_item_set_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
consumeCount=1,
itemSetName=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['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;deleteItemSetByUserId
アイテムセットを削除
指定されたアイテムをユーザーのインベントリから永久に削除します。
itemSetName を指定すると、その特定のスタックのみが削除されます。指定しない場合、そのアイテムタイプのすべてのスタックが削除されます。
消費とは異なり、この操作は特定の数量を必要とせず、数量に関係なくアイテムセット全体を削除します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| itemSetName | string | ~ 36文字 | アイテムセットを識別する名前 | |||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<ItemSet> | 削除したアイテムセットのリスト |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DeleteItemSetByUserId(
&inventory.DeleteItemSetByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: pointy.String("itemSet-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DeleteItemSetByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->deleteItemSetByUserId(
(new DeleteItemSetByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withUserId("user-0001")
->withItemName("item-0001")
->withItemSetName("itemSet-0001")
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DeleteItemSetByUserIdRequest;
import io.gs2.inventory.result.DeleteItemSetByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DeleteItemSetByUserIdResult result = client.deleteItemSetByUserId(
new DeleteItemSetByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName("itemSet-0001")
.withTimeOffsetToken(null)
);
List<ItemSet> items = result.getItems();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DeleteItemSetByUserIdResult> asyncResult = null;
yield return client.DeleteItemSetByUserId(
new Gs2.Gs2Inventory.Request.DeleteItemSetByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithItemSetName("itemSet-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.deleteItemSetByUserId(
new Gs2Inventory.DeleteItemSetByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName("itemSet-0001")
.withTimeOffsetToken(null)
);
const items = result.getItems();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_item_set_by_user_id(
inventory.DeleteItemSetByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_item_set_name('itemSet-0001')
.with_time_offset_token(None)
)
items = result.items
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.delete_item_set_by_user_id({
namespaceName="namespace-0001",
inventoryName="item",
userId="user-0001",
itemName="item-0001",
itemSetName="itemSet-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.delete_item_set_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="item",
userId="user-0001",
itemName="item-0001",
itemSetName="itemSet-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['errorMessage'])
end
result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;verifyItemSet
アイテムセットの所持数量の検証
リクエストユーザーの合計アイテム数量が指定された条件を満たすことを検証します。
数量は指定されたアイテムタイプのすべてのアイテムセットを合算して計算されます。
6つの比較演算子をサポートします:less、lessEqual、greater、greaterEqual、equal、notEqual。
条件が満たされない場合、反転した条件名でエラーが返されます(例:「less」チェックの失敗は「greaterEqual」エラーを返します)。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||||||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||||||||||||||||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||||||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||||||||||||||||
| verifyType | 文字列列挙型 enum { “less”, “lessEqual”, “greater”, “greaterEqual”, “equal”, “notEqual” } | ✓ | 検証の種類
| |||||||||||||||||
| itemSetName | string | ~ 36文字 | アイテムセットを識別する名前 | |||||||||||||||||
| count | long | ✓ | 0 ~ 9223372036854775805 | 所持数量 | ||||||||||||||||
| multiplyValueSpecifyingQuantity | bool | true | 数量指定した際に、検証に使用する値も乗算するか |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<ItemSet> | 削除したアイテムセットのリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.VerifyItemSet(
&inventory.VerifyItemSetRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
InventoryName: pointy.String("inventory-0001"),
ItemName: pointy.String("item-0001"),
VerifyType: pointy.String("less"),
ItemSetName: nil,
Count: pointy.Int64(10),
MultiplyValueSpecifyingQuantity: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Itemsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\VerifyItemSetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->verifyItemSet(
(new VerifyItemSetRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withInventoryName("inventory-0001")
->withItemName("item-0001")
->withVerifyType("less")
->withItemSetName(null)
->withCount(10)
->withMultiplyValueSpecifyingQuantity(null)
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.VerifyItemSetRequest;
import io.gs2.inventory.result.VerifyItemSetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
VerifyItemSetResult result = client.verifyItemSet(
new VerifyItemSetRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withInventoryName("inventory-0001")
.withItemName("item-0001")
.withVerifyType("less")
.withItemSetName(null)
.withCount(10L)
.withMultiplyValueSpecifyingQuantity(null)
);
List<ItemSet> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.VerifyItemSetResult> asyncResult = null;
yield return client.VerifyItemSet(
new Gs2.Gs2Inventory.Request.VerifyItemSetRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithInventoryName("inventory-0001")
.WithItemName("item-0001")
.WithVerifyType("less")
.WithItemSetName(null)
.WithCount(10L)
.WithMultiplyValueSpecifyingQuantity(null),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.verifyItemSet(
new Gs2Inventory.VerifyItemSetRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withInventoryName("inventory-0001")
.withItemName("item-0001")
.withVerifyType("less")
.withItemSetName(null)
.withCount(10)
.withMultiplyValueSpecifyingQuantity(null)
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.verify_item_set(
inventory.VerifyItemSetRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_inventory_name('inventory-0001')
.with_item_name('item-0001')
.with_verify_type('less')
.with_item_set_name(None)
.with_count(10)
.with_multiply_value_specifying_quantity(None)
)
items = result.items
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.verify_item_set({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
inventoryName="inventory-0001",
itemName="item-0001",
verifyType="less",
itemSetName=nil,
count=10,
multiplyValueSpecifyingQuantity=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;client = gs2('inventory')
api_result_handler = client.verify_item_set_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
inventoryName="inventory-0001",
itemName="item-0001",
verifyType="less",
itemSetName=nil,
count=10,
multiplyValueSpecifyingQuantity=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['errorMessage'])
end
result = api_result.result
items = result.items;verifyItemSetByUserId
ユーザーIDを指定してアイテムセットの所持数量の検証
指定されたユーザーの合計アイテム数量が指定された条件を満たすことを検証します。
数量は指定されたアイテムタイプのすべてのアイテムセットを合算して計算されます。
6つの比較演算子をサポートします:less、lessEqual、greater、greaterEqual、equal、notEqual。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||||||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||||||||||||||||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||||||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||||||||||||||||
| verifyType | 文字列列挙型 enum { “less”, “lessEqual”, “greater”, “greaterEqual”, “equal”, “notEqual” } | ✓ | 検証の種類
| |||||||||||||||||
| itemSetName | string | ~ 36文字 | アイテムセットを識別する名前 | |||||||||||||||||
| count | long | ✓ | 0 ~ 9223372036854775805 | 所持数量 | ||||||||||||||||
| multiplyValueSpecifyingQuantity | bool | true | 数量指定した際に、検証に使用する値も乗算するか | |||||||||||||||||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<ItemSet> | 削除したアイテムセットのリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.VerifyItemSetByUserId(
&inventory.VerifyItemSetByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
InventoryName: pointy.String("inventory-0001"),
ItemName: pointy.String("item-0001"),
VerifyType: pointy.String("less"),
ItemSetName: nil,
Count: pointy.Int64(10),
MultiplyValueSpecifyingQuantity: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Itemsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\VerifyItemSetByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->verifyItemSetByUserId(
(new VerifyItemSetByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withInventoryName("inventory-0001")
->withItemName("item-0001")
->withVerifyType("less")
->withItemSetName(null)
->withCount(10)
->withMultiplyValueSpecifyingQuantity(null)
->withTimeOffsetToken(null)
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.VerifyItemSetByUserIdRequest;
import io.gs2.inventory.result.VerifyItemSetByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
VerifyItemSetByUserIdResult result = client.verifyItemSetByUserId(
new VerifyItemSetByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withInventoryName("inventory-0001")
.withItemName("item-0001")
.withVerifyType("less")
.withItemSetName(null)
.withCount(10L)
.withMultiplyValueSpecifyingQuantity(null)
.withTimeOffsetToken(null)
);
List<ItemSet> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.VerifyItemSetByUserIdResult> asyncResult = null;
yield return client.VerifyItemSetByUserId(
new Gs2.Gs2Inventory.Request.VerifyItemSetByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithInventoryName("inventory-0001")
.WithItemName("item-0001")
.WithVerifyType("less")
.WithItemSetName(null)
.WithCount(10L)
.WithMultiplyValueSpecifyingQuantity(null)
.WithTimeOffsetToken(null),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.verifyItemSetByUserId(
new Gs2Inventory.VerifyItemSetByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withInventoryName("inventory-0001")
.withItemName("item-0001")
.withVerifyType("less")
.withItemSetName(null)
.withCount(10)
.withMultiplyValueSpecifyingQuantity(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.verify_item_set_by_user_id(
inventory.VerifyItemSetByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_inventory_name('inventory-0001')
.with_item_name('item-0001')
.with_verify_type('less')
.with_item_set_name(None)
.with_count(10)
.with_multiply_value_specifying_quantity(None)
.with_time_offset_token(None)
)
items = result.items
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.verify_item_set_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
inventoryName="inventory-0001",
itemName="item-0001",
verifyType="less",
itemSetName=nil,
count=10,
multiplyValueSpecifyingQuantity=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;client = gs2('inventory')
api_result_handler = client.verify_item_set_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
inventoryName="inventory-0001",
itemName="item-0001",
verifyType="less",
itemSetName=nil,
count=10,
multiplyValueSpecifyingQuantity=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['errorMessage'])
end
result = api_result.result
items = result.items;describeReferenceOf
参照元の一覧を取得
リクエストユーザーの特定のアイテムセットに登録されている参照元文字列のリストを取得します。
参照元はアイテムセットを外部エンティティ(装備スロットなど)に関連付けるために使用され、インベントリモデルで protectReferencedItem が有効な場合、参照元を持つアイテムは消費・削除できなくなります。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| itemSetName | string | ✓ | UUID | ~ 36文字 | アイテムセットを識別する名前 アイテムセットの一意な名前を保持します。 名前は UUID(Universally Unique Identifier)フォーマットで自動的に生成され、各アイテムセットを識別するために使用されます。 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<string> | この所持品の参照元リスト |
| itemSet | ItemSet | アイテムセット |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeReferenceOf(
&inventory.DescribeReferenceOfRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
AccessToken: pointy.String("accessToken-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: pointy.String("item-set-0001"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
itemSet := result.ItemSet
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeReferenceOfRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeReferenceOf(
(new DescribeReferenceOfRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withAccessToken("accessToken-0001")
->withItemName("item-0001")
->withItemSetName("item-set-0001")
);
$items = $result->getItems();
$itemSet = $result->getItemSet();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeReferenceOfRequest;
import io.gs2.inventory.result.DescribeReferenceOfResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeReferenceOfResult result = client.describeReferenceOf(
new DescribeReferenceOfRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
);
List<String> items = result.getItems();
ItemSet itemSet = result.getItemSet();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeReferenceOfResult> asyncResult = null;
yield return client.DescribeReferenceOf(
new Gs2.Gs2Inventory.Request.DescribeReferenceOfRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithAccessToken("accessToken-0001")
.WithItemName("item-0001")
.WithItemSetName("item-set-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var itemSet = result.ItemSet;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeReferenceOf(
new Gs2Inventory.DescribeReferenceOfRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
);
const items = result.getItems();
const itemSet = result.getItemSet();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_reference_of(
inventory.DescribeReferenceOfRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_access_token('accessToken-0001')
.with_item_name('item-0001')
.with_item_set_name('item-set-0001')
)
items = result.items
item_set = result.item_set
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.describe_reference_of({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
itemSetName="item-set-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.describe_reference_of_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
itemSetName="item-set-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['errorMessage'])
end
result = api_result.result
items = result.items;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;describeReferenceOfByUserId
ユーザーIDを指定して参照元の一覧を取得
指定ユーザーの特定のアイテムセットに登録されている参照元文字列のリストを取得します。
参照元はアイテムセットを外部エンティティ(装備スロットなど)に関連付けるために使用され、インベントリモデルで protectReferencedItem が有効な場合、参照元を持つアイテムは消費・削除できなくなります。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| itemSetName | string | ✓ | UUID | ~ 36文字 | アイテムセットを識別する名前 アイテムセットの一意な名前を保持します。 名前は UUID(Universally Unique Identifier)フォーマットで自動的に生成され、各アイテムセットを識別するために使用されます。 | |
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<string> | この所持品の参照元リスト |
| itemSet | ItemSet | アイテムセット |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeReferenceOfByUserId(
&inventory.DescribeReferenceOfByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: pointy.String("item-set-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
itemSet := result.ItemSet
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeReferenceOfByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeReferenceOfByUserId(
(new DescribeReferenceOfByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withItemName("item-0001")
->withItemSetName("item-set-0001")
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$itemSet = $result->getItemSet();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeReferenceOfByUserIdRequest;
import io.gs2.inventory.result.DescribeReferenceOfByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeReferenceOfByUserIdResult result = client.describeReferenceOfByUserId(
new DescribeReferenceOfByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withTimeOffsetToken(null)
);
List<String> items = result.getItems();
ItemSet itemSet = result.getItemSet();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeReferenceOfByUserIdResult> asyncResult = null;
yield return client.DescribeReferenceOfByUserId(
new Gs2.Gs2Inventory.Request.DescribeReferenceOfByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithItemSetName("item-set-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var itemSet = result.ItemSet;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeReferenceOfByUserId(
new Gs2Inventory.DescribeReferenceOfByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withTimeOffsetToken(null)
);
const items = result.getItems();
const itemSet = result.getItemSet();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_reference_of_by_user_id(
inventory.DescribeReferenceOfByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_item_set_name('item-set-0001')
.with_time_offset_token(None)
)
items = result.items
item_set = result.item_set
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.describe_reference_of_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
itemSetName="item-set-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.describe_reference_of_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
itemSetName="item-set-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['errorMessage'])
end
result = api_result.result
items = result.items;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;getReferenceOf
参照元を取得
リクエストユーザーのアイテムセットに登録されている特定の参照元文字列を取得します。
関連するアイテムセット、アイテムモデル、インベントリデータも併せて返します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| itemSetName | string | ✓ | UUID | ~ 36文字 | アイテムセットを識別する名前 アイテムセットの一意な名前を保持します。 名前は UUID(Universally Unique Identifier)フォーマットで自動的に生成され、各アイテムセットを識別するために使用されます。 | |
| referenceOf | string | ✓ | ~ 1024文字 | 参照元 装備スロットや編成バインドなど、このアイテムセットへの外部参照を表す文字列識別子です。インベントリモデルでprotectReferencedItemが有効な場合、参照元を持つアイテムセットは消費または削除できません。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | string | この所持品の参照元 |
| itemSet | ItemSet | アイテムセット |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetReferenceOf(
&inventory.GetReferenceOfRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
AccessToken: pointy.String("accessToken-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: pointy.String("item-set-0001"),
ReferenceOf: ['resource-0001'],
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
itemSet := result.ItemSet
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetReferenceOfRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getReferenceOf(
(new GetReferenceOfRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withAccessToken("accessToken-0001")
->withItemName("item-0001")
->withItemSetName("item-set-0001")
->withReferenceOf(['resource-0001'])
);
$item = $result->getItem();
$itemSet = $result->getItemSet();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetReferenceOfRequest;
import io.gs2.inventory.result.GetReferenceOfResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetReferenceOfResult result = client.getReferenceOf(
new GetReferenceOfRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf(['resource-0001'])
);
String item = result.getItem();
ItemSet itemSet = result.getItemSet();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetReferenceOfResult> asyncResult = null;
yield return client.GetReferenceOf(
new Gs2.Gs2Inventory.Request.GetReferenceOfRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithAccessToken("accessToken-0001")
.WithItemName("item-0001")
.WithItemSetName("item-set-0001")
.WithReferenceOf(['resource-0001']),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var itemSet = result.ItemSet;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getReferenceOf(
new Gs2Inventory.GetReferenceOfRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf(['resource-0001'])
);
const item = result.getItem();
const itemSet = result.getItemSet();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_reference_of(
inventory.GetReferenceOfRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_access_token('accessToken-0001')
.with_item_name('item-0001')
.with_item_set_name('item-set-0001')
.with_reference_of(['resource-0001'])
)
item = result.item
item_set = result.item_set
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_reference_of({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf=['resource-0001'],
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.get_reference_of_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf=['resource-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['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;getReferenceOfByUserId
ユーザーIDを指定して参照元を取得
指定ユーザーのアイテムセットに登録されている特定の参照元文字列を取得します。
関連するアイテムセット、アイテムモデル、インベントリデータも併せて返します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| itemSetName | string | ✓ | UUID | ~ 36文字 | アイテムセットを識別する名前 アイテムセットの一意な名前を保持します。 名前は UUID(Universally Unique Identifier)フォーマットで自動的に生成され、各アイテムセットを識別するために使用されます。 | |
| referenceOf | string | ✓ | ~ 1024文字 | 参照元 装備スロットや編成バインドなど、このアイテムセットへの外部参照を表す文字列識別子です。インベントリモデルでprotectReferencedItemが有効な場合、参照元を持つアイテムセットは消費または削除できません。 | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | string | この所持品の参照元 |
| itemSet | ItemSet | アイテムセット |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetReferenceOfByUserId(
&inventory.GetReferenceOfByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: pointy.String("item-set-0001"),
ReferenceOf: ['resource-0001'],
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
itemSet := result.ItemSet
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetReferenceOfByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getReferenceOfByUserId(
(new GetReferenceOfByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withItemName("item-0001")
->withItemSetName("item-set-0001")
->withReferenceOf(['resource-0001'])
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$itemSet = $result->getItemSet();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetReferenceOfByUserIdRequest;
import io.gs2.inventory.result.GetReferenceOfByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetReferenceOfByUserIdResult result = client.getReferenceOfByUserId(
new GetReferenceOfByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf(['resource-0001'])
.withTimeOffsetToken(null)
);
String item = result.getItem();
ItemSet itemSet = result.getItemSet();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetReferenceOfByUserIdResult> asyncResult = null;
yield return client.GetReferenceOfByUserId(
new Gs2.Gs2Inventory.Request.GetReferenceOfByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithItemSetName("item-set-0001")
.WithReferenceOf(['resource-0001'])
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var itemSet = result.ItemSet;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getReferenceOfByUserId(
new Gs2Inventory.GetReferenceOfByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf(['resource-0001'])
.withTimeOffsetToken(null)
);
const item = result.getItem();
const itemSet = result.getItemSet();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_reference_of_by_user_id(
inventory.GetReferenceOfByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_item_set_name('item-set-0001')
.with_reference_of(['resource-0001'])
.with_time_offset_token(None)
)
item = result.item
item_set = result.item_set
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_reference_of_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf=['resource-0001'],
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.get_reference_of_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf=['resource-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['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;verifyReferenceOf
アイテムの参照元を検証
リクエストユーザーのアイテムセット上の参照元の状態を検証します。
4つの検証タイプをサポート: not_entry(参照元が未登録)、already_entry(参照元が登録済み)、empty(参照元がゼロ)、not_empty(参照元が1つ以上存在)。
条件が満たされない場合はエラーが返されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||||||||||||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||||||||||||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||||||||||||
| itemSetName | string | ✓ | UUID | ~ 36文字 | アイテムセットを識別する名前 アイテムセットの一意な名前を保持します。 名前は UUID(Universally Unique Identifier)フォーマットで自動的に生成され、各アイテムセットを識別するために使用されます。 | |||||||||||
| referenceOf | string | ✓ | ~ 1024文字 | 参照元 装備スロットや編成バインドなど、このアイテムセットへの外部参照を表す文字列識別子です。インベントリモデルでprotectReferencedItemが有効な場合、参照元を持つアイテムセットは消費または削除できません。 | ||||||||||||
| verifyType | 文字列列挙型 enum { “not_entry”, “already_entry”, “empty”, “not_empty” } | ✓ | 検証の種類
|
Result
| 型 | 説明 | |
|---|---|---|
| item | string | この所持品の参照元 |
| itemSet | ItemSet | アイテムセット |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.VerifyReferenceOf(
&inventory.VerifyReferenceOfRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
AccessToken: pointy.String("accessToken-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: pointy.String("item-set-0001"),
ReferenceOf: pointy.String("resource-0001"),
VerifyType: pointy.String("not_entry"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
itemSet := result.ItemSet
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\VerifyReferenceOfRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->verifyReferenceOf(
(new VerifyReferenceOfRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withAccessToken("accessToken-0001")
->withItemName("item-0001")
->withItemSetName("item-set-0001")
->withReferenceOf("resource-0001")
->withVerifyType("not_entry")
);
$item = $result->getItem();
$itemSet = $result->getItemSet();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.VerifyReferenceOfRequest;
import io.gs2.inventory.result.VerifyReferenceOfResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
VerifyReferenceOfResult result = client.verifyReferenceOf(
new VerifyReferenceOfRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf("resource-0001")
.withVerifyType("not_entry")
);
String item = result.getItem();
ItemSet itemSet = result.getItemSet();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.VerifyReferenceOfResult> asyncResult = null;
yield return client.VerifyReferenceOf(
new Gs2.Gs2Inventory.Request.VerifyReferenceOfRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithAccessToken("accessToken-0001")
.WithItemName("item-0001")
.WithItemSetName("item-set-0001")
.WithReferenceOf("resource-0001")
.WithVerifyType("not_entry"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var itemSet = result.ItemSet;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.verifyReferenceOf(
new Gs2Inventory.VerifyReferenceOfRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf("resource-0001")
.withVerifyType("not_entry")
);
const item = result.getItem();
const itemSet = result.getItemSet();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.verify_reference_of(
inventory.VerifyReferenceOfRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_access_token('accessToken-0001')
.with_item_name('item-0001')
.with_item_set_name('item-set-0001')
.with_reference_of('resource-0001')
.with_verify_type('not_entry')
)
item = result.item
item_set = result.item_set
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.verify_reference_of({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf="resource-0001",
verifyType="not_entry",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.verify_reference_of_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf="resource-0001",
verifyType="not_entry",
})
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['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;verifyReferenceOfByUserId
ユーザーIDを指定してアイテムの参照元を検証
指定ユーザーのアイテムセット上の参照元の状態を検証します。
4つの検証タイプをサポート: not_entry(参照元が未登録)、already_entry(参照元が登録済み)、empty(参照元がゼロ)、not_empty(参照元が1つ以上存在)。
条件が満たされない場合はエラーが返されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||||||||||||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||||||||||||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||||||||||||
| itemSetName | string | ✓ | UUID | ~ 36文字 | アイテムセットを識別する名前 アイテムセットの一意な名前を保持します。 名前は UUID(Universally Unique Identifier)フォーマットで自動的に生成され、各アイテムセットを識別するために使用されます。 | |||||||||||
| referenceOf | string | ✓ | ~ 1024文字 | 参照元 装備スロットや編成バインドなど、このアイテムセットへの外部参照を表す文字列識別子です。インベントリモデルでprotectReferencedItemが有効な場合、参照元を持つアイテムセットは消費または削除できません。 | ||||||||||||
| verifyType | 文字列列挙型 enum { “not_entry”, “already_entry”, “empty”, “not_empty” } | ✓ | 検証の種類
| |||||||||||||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | string | この所持品の参照元 |
| itemSet | ItemSet | アイテムセット |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.VerifyReferenceOfByUserId(
&inventory.VerifyReferenceOfByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: pointy.String("item-set-0001"),
ReferenceOf: pointy.String("resource-0001"),
VerifyType: pointy.String("not_entry"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
itemSet := result.ItemSet
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\VerifyReferenceOfByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->verifyReferenceOfByUserId(
(new VerifyReferenceOfByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withItemName("item-0001")
->withItemSetName("item-set-0001")
->withReferenceOf("resource-0001")
->withVerifyType("not_entry")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$itemSet = $result->getItemSet();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.VerifyReferenceOfByUserIdRequest;
import io.gs2.inventory.result.VerifyReferenceOfByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
VerifyReferenceOfByUserIdResult result = client.verifyReferenceOfByUserId(
new VerifyReferenceOfByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf("resource-0001")
.withVerifyType("not_entry")
.withTimeOffsetToken(null)
);
String item = result.getItem();
ItemSet itemSet = result.getItemSet();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.VerifyReferenceOfByUserIdResult> asyncResult = null;
yield return client.VerifyReferenceOfByUserId(
new Gs2.Gs2Inventory.Request.VerifyReferenceOfByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithItemSetName("item-set-0001")
.WithReferenceOf("resource-0001")
.WithVerifyType("not_entry")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var itemSet = result.ItemSet;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.verifyReferenceOfByUserId(
new Gs2Inventory.VerifyReferenceOfByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf("resource-0001")
.withVerifyType("not_entry")
.withTimeOffsetToken(null)
);
const item = result.getItem();
const itemSet = result.getItemSet();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.verify_reference_of_by_user_id(
inventory.VerifyReferenceOfByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_item_set_name('item-set-0001')
.with_reference_of('resource-0001')
.with_verify_type('not_entry')
.with_time_offset_token(None)
)
item = result.item
item_set = result.item_set
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.verify_reference_of_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf="resource-0001",
verifyType="not_entry",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.verify_reference_of_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf="resource-0001",
verifyType="not_entry",
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['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;addReferenceOf
参照元を追加
リクエストユーザーの指定されたアイテムセットに参照元文字列を登録します。
参照元はアイテムセットを外部エンティティ(装備スロットやキャラクターなど)に関連付けます。
インベントリモデルで protectReferencedItem が有効な場合、参照元を持つアイテムは消費・削除できなくなり、装備中のアイテムの誤消費を防止できます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| itemSetName | string | ✓ | UUID | ~ 36文字 | アイテムセットを識別する名前 アイテムセットの一意な名前を保持します。 名前は UUID(Universally Unique Identifier)フォーマットで自動的に生成され、各アイテムセットを識別するために使用されます。 | |
| referenceOf | string | ✓ | ~ 1024文字 | 参照元 装備スロットや編成バインドなど、このアイテムセットへの外部参照を表す文字列識別子です。インベントリモデルでprotectReferencedItemが有効な場合、参照元を持つアイテムセットは消費または削除できません。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | string | この所持品の参照元 |
| itemSet | ItemSet | 参照元追加後のアイテムセット |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.AddReferenceOf(
&inventory.AddReferenceOfRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
AccessToken: pointy.String("accessToken-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: pointy.String("item-set-0001"),
ReferenceOf: ['resource-0001'],
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
itemSet := result.ItemSet
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\AddReferenceOfRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->addReferenceOf(
(new AddReferenceOfRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withAccessToken("accessToken-0001")
->withItemName("item-0001")
->withItemSetName("item-set-0001")
->withReferenceOf(['resource-0001'])
);
$item = $result->getItem();
$itemSet = $result->getItemSet();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.AddReferenceOfRequest;
import io.gs2.inventory.result.AddReferenceOfResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
AddReferenceOfResult result = client.addReferenceOf(
new AddReferenceOfRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf(['resource-0001'])
);
String item = result.getItem();
ItemSet itemSet = result.getItemSet();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.AddReferenceOfResult> asyncResult = null;
yield return client.AddReferenceOf(
new Gs2.Gs2Inventory.Request.AddReferenceOfRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithAccessToken("accessToken-0001")
.WithItemName("item-0001")
.WithItemSetName("item-set-0001")
.WithReferenceOf(['resource-0001']),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var itemSet = result.ItemSet;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.addReferenceOf(
new Gs2Inventory.AddReferenceOfRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf(['resource-0001'])
);
const item = result.getItem();
const itemSet = result.getItemSet();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.add_reference_of(
inventory.AddReferenceOfRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_access_token('accessToken-0001')
.with_item_name('item-0001')
.with_item_set_name('item-set-0001')
.with_reference_of(['resource-0001'])
)
item = result.item
item_set = result.item_set
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.add_reference_of({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf=['resource-0001'],
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.add_reference_of_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf=['resource-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['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;addReferenceOfByUserId
ユーザーIDを指定してアイテムに参照元を追加
指定ユーザーの指定されたアイテムセットに参照元文字列を登録します。
参照元はアイテムセットを外部エンティティ(装備スロットやキャラクターなど)に関連付けます。
インベントリモデルで protectReferencedItem が有効な場合、参照元を持つアイテムは消費・削除できなくなり、装備中のアイテムの誤消費を防止できます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| itemSetName | string | ✓ | UUID | ~ 36文字 | アイテムセットを識別する名前 アイテムセットの一意な名前を保持します。 名前は UUID(Universally Unique Identifier)フォーマットで自動的に生成され、各アイテムセットを識別するために使用されます。 | |
| referenceOf | string | ✓ | ~ 1024文字 | 参照元 装備スロットや編成バインドなど、このアイテムセットへの外部参照を表す文字列識別子です。インベントリモデルでprotectReferencedItemが有効な場合、参照元を持つアイテムセットは消費または削除できません。 | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | string | この所持品の参照元 |
| itemSet | ItemSet | 参照元追加後のアイテムセット |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.AddReferenceOfByUserId(
&inventory.AddReferenceOfByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: pointy.String("item-set-0001"),
ReferenceOf: ['resource-0001'],
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
itemSet := result.ItemSet
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\AddReferenceOfByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->addReferenceOfByUserId(
(new AddReferenceOfByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withItemName("item-0001")
->withItemSetName("item-set-0001")
->withReferenceOf(['resource-0001'])
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$itemSet = $result->getItemSet();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.AddReferenceOfByUserIdRequest;
import io.gs2.inventory.result.AddReferenceOfByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
AddReferenceOfByUserIdResult result = client.addReferenceOfByUserId(
new AddReferenceOfByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf(['resource-0001'])
.withTimeOffsetToken(null)
);
String item = result.getItem();
ItemSet itemSet = result.getItemSet();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.AddReferenceOfByUserIdResult> asyncResult = null;
yield return client.AddReferenceOfByUserId(
new Gs2.Gs2Inventory.Request.AddReferenceOfByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithItemSetName("item-set-0001")
.WithReferenceOf(['resource-0001'])
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var itemSet = result.ItemSet;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.addReferenceOfByUserId(
new Gs2Inventory.AddReferenceOfByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf(['resource-0001'])
.withTimeOffsetToken(null)
);
const item = result.getItem();
const itemSet = result.getItemSet();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.add_reference_of_by_user_id(
inventory.AddReferenceOfByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_item_set_name('item-set-0001')
.with_reference_of(['resource-0001'])
.with_time_offset_token(None)
)
item = result.item
item_set = result.item_set
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.add_reference_of_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf=['resource-0001'],
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.add_reference_of_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf=['resource-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['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;deleteReferenceOf
参照元を削除
リクエストユーザーの指定されたアイテムセットから特定の参照元文字列を削除します。
削除後、protectReferencedItem が有効で他の参照元が残っていない場合、アイテムは再び消費・削除が可能になります。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| itemSetName | string | ✓ | UUID | ~ 36文字 | アイテムセットを識別する名前 アイテムセットの一意な名前を保持します。 名前は UUID(Universally Unique Identifier)フォーマットで自動的に生成され、各アイテムセットを識別するために使用されます。 | |
| referenceOf | string | ✓ | ~ 1024文字 | 参照元 装備スロットや編成バインドなど、このアイテムセットへの外部参照を表す文字列識別子です。インベントリモデルでprotectReferencedItemが有効な場合、参照元を持つアイテムセットは消費または削除できません。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | string | この所持品の参照元 |
| itemSet | ItemSet | 参照元削除後のアイテムセット |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DeleteReferenceOf(
&inventory.DeleteReferenceOfRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
AccessToken: pointy.String("accessToken-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: pointy.String("item-set-0001"),
ReferenceOf: pointy.String("resource-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
itemSet := result.ItemSet
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DeleteReferenceOfRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->deleteReferenceOf(
(new DeleteReferenceOfRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withAccessToken("accessToken-0001")
->withItemName("item-0001")
->withItemSetName("item-set-0001")
->withReferenceOf("resource-0001")
);
$item = $result->getItem();
$itemSet = $result->getItemSet();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DeleteReferenceOfRequest;
import io.gs2.inventory.result.DeleteReferenceOfResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DeleteReferenceOfResult result = client.deleteReferenceOf(
new DeleteReferenceOfRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf("resource-0001")
);
String item = result.getItem();
ItemSet itemSet = result.getItemSet();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DeleteReferenceOfResult> asyncResult = null;
yield return client.DeleteReferenceOf(
new Gs2.Gs2Inventory.Request.DeleteReferenceOfRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithAccessToken("accessToken-0001")
.WithItemName("item-0001")
.WithItemSetName("item-set-0001")
.WithReferenceOf("resource-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var itemSet = result.ItemSet;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.deleteReferenceOf(
new Gs2Inventory.DeleteReferenceOfRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf("resource-0001")
);
const item = result.getItem();
const itemSet = result.getItemSet();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_reference_of(
inventory.DeleteReferenceOfRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_access_token('accessToken-0001')
.with_item_name('item-0001')
.with_item_set_name('item-set-0001')
.with_reference_of('resource-0001')
)
item = result.item
item_set = result.item_set
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.delete_reference_of({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf="resource-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.delete_reference_of_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf="resource-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['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;deleteReferenceOfByUserId
ユーザーIDを指定してアイテムの参照元を削除
指定ユーザーの指定されたアイテムセットから特定の参照元文字列を削除します。
削除後、protectReferencedItem が有効で他の参照元が残っていない場合、アイテムは再び消費・削除が可能になります。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムセットを含むインベントリモデルの名前です。itemNameと組み合わせて、この所持品がどのインベントリとアイテムの種類に属するかを識別するために使用されます。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 このセットに格納されているアイテムの種類を定義するアイテムモデルの名前です。inventoryNameと組み合わせて、このアイテムセットのスタック上限と複数スタック動作を決定します。 | ||
| itemSetName | string | ✓ | UUID | ~ 36文字 | アイテムセットを識別する名前 アイテムセットの一意な名前を保持します。 名前は UUID(Universally Unique Identifier)フォーマットで自動的に生成され、各アイテムセットを識別するために使用されます。 | |
| referenceOf | string | ✓ | ~ 1024文字 | 参照元 装備スロットや編成バインドなど、このアイテムセットへの外部参照を表す文字列識別子です。インベントリモデルでprotectReferencedItemが有効な場合、参照元を持つアイテムセットは消費または削除できません。 | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | string | この所持品の参照元 |
| itemSet | ItemSet | 参照元削除後のアイテムセット |
| itemModel | ItemModel | アイテムモデル |
| inventory | Inventory | インベントリ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DeleteReferenceOfByUserId(
&inventory.DeleteReferenceOfByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
ItemSetName: pointy.String("item-set-0001"),
ReferenceOf: pointy.String("resource-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
itemSet := result.ItemSet
itemModel := result.ItemModel
inventory := result.Inventoryuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DeleteReferenceOfByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->deleteReferenceOfByUserId(
(new DeleteReferenceOfByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withItemName("item-0001")
->withItemSetName("item-set-0001")
->withReferenceOf("resource-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$itemSet = $result->getItemSet();
$itemModel = $result->getItemModel();
$inventory = $result->getInventory();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DeleteReferenceOfByUserIdRequest;
import io.gs2.inventory.result.DeleteReferenceOfByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DeleteReferenceOfByUserIdResult result = client.deleteReferenceOfByUserId(
new DeleteReferenceOfByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf("resource-0001")
.withTimeOffsetToken(null)
);
String item = result.getItem();
ItemSet itemSet = result.getItemSet();
ItemModel itemModel = result.getItemModel();
Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DeleteReferenceOfByUserIdResult> asyncResult = null;
yield return client.DeleteReferenceOfByUserId(
new Gs2.Gs2Inventory.Request.DeleteReferenceOfByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithItemSetName("item-set-0001")
.WithReferenceOf("resource-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var itemSet = result.ItemSet;
var itemModel = result.ItemModel;
var inventory = result.Inventory;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.deleteReferenceOfByUserId(
new Gs2Inventory.DeleteReferenceOfByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withItemSetName("item-set-0001")
.withReferenceOf("resource-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
const itemSet = result.getItemSet();
const itemModel = result.getItemModel();
const inventory = result.getInventory();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_reference_of_by_user_id(
inventory.DeleteReferenceOfByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_item_set_name('item-set-0001')
.with_reference_of('resource-0001')
.with_time_offset_token(None)
)
item = result.item
item_set = result.item_set
item_model = result.item_model
inventory = result.inventory
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.delete_reference_of_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf="resource-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;client = gs2('inventory')
api_result_handler = client.delete_reference_of_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
itemSetName="item-set-0001",
referenceOf="resource-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['errorMessage'])
end
result = api_result.result
item = result.item;
itemSet = result.itemSet;
itemModel = result.itemModel;
inventory = result.inventory;describeSimpleItems
シンプルアイテムの一覧を取得
指定されたシンプルインベントリ内のリクエストユーザーのシンプルアイテムのページネーション付きリストを取得します。
各シンプルアイテムは、スタック、有効期限、参照を持たず、アイテムタイプごとに単一の数量値を追跡します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<SimpleItem> | シンプルアイテムのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeSimpleItems(
&inventory.DescribeSimpleItemsRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
AccessToken: pointy.String("accessToken-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeSimpleItemsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeSimpleItems(
(new DescribeSimpleItemsRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withAccessToken("accessToken-0001")
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeSimpleItemsRequest;
import io.gs2.inventory.result.DescribeSimpleItemsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeSimpleItemsResult result = client.describeSimpleItems(
new DescribeSimpleItemsRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withAccessToken("accessToken-0001")
.withPageToken(null)
.withLimit(null)
);
List<SimpleItem> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeSimpleItemsResult> asyncResult = null;
yield return client.DescribeSimpleItems(
new Gs2.Gs2Inventory.Request.DescribeSimpleItemsRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithAccessToken("accessToken-0001")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeSimpleItems(
new Gs2Inventory.DescribeSimpleItemsRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withAccessToken("accessToken-0001")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_simple_items(
inventory.DescribeSimpleItemsRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_access_token('accessToken-0001')
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.describe_simple_items({
namespaceName="namespace-0001",
inventoryName="item",
accessToken="accessToken-0001",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_simple_items_async({
namespaceName="namespace-0001",
inventoryName="item",
accessToken="accessToken-0001",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;describeSimpleItemsByUserId
ユーザーIDを指定してシンプルアイテムの一覧を取得
指定されたシンプルインベントリ内のユーザーのシンプルアイテムのページネーション付きリストを取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<SimpleItem> | シンプルアイテムのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeSimpleItemsByUserId(
&inventory.DescribeSimpleItemsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeSimpleItemsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeSimpleItemsByUserId(
(new DescribeSimpleItemsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeSimpleItemsByUserIdRequest;
import io.gs2.inventory.result.DescribeSimpleItemsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeSimpleItemsByUserIdResult result = client.describeSimpleItemsByUserId(
new DescribeSimpleItemsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<SimpleItem> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeSimpleItemsByUserIdResult> asyncResult = null;
yield return client.DescribeSimpleItemsByUserId(
new Gs2.Gs2Inventory.Request.DescribeSimpleItemsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeSimpleItemsByUserId(
new Gs2Inventory.DescribeSimpleItemsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.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 inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_simple_items_by_user_id(
inventory.DescribeSimpleItemsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.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('inventory')
api_result = client.describe_simple_items_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_simple_items_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
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['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;getSimpleItem
シンプルアイテムを取得
指定された名前のリクエストユーザーのシンプルアイテム(現在の数量と関連するアイテムモデルを含む)を取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| itemName | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 このレコードに格納されているアイテムの種類を定義するシンプルアイテムモデルの名前です。この所持品がどのアイテム定義に対応するかを識別するために使用されます。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleItem | シンプルアイテム |
| itemModel | SimpleItemModel | シンプルアイテムモデル |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetSimpleItem(
&inventory.GetSimpleItemRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
AccessToken: pointy.String("accessToken-0001"),
ItemName: pointy.String("item-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
itemModel := result.ItemModeluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetSimpleItemRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getSimpleItem(
(new GetSimpleItemRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withAccessToken("accessToken-0001")
->withItemName("item-0001")
);
$item = $result->getItem();
$itemModel = $result->getItemModel();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetSimpleItemRequest;
import io.gs2.inventory.result.GetSimpleItemResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetSimpleItemResult result = client.getSimpleItem(
new GetSimpleItemRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
);
SimpleItem item = result.getItem();
SimpleItemModel itemModel = result.getItemModel();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetSimpleItemResult> asyncResult = null;
yield return client.GetSimpleItem(
new Gs2.Gs2Inventory.Request.GetSimpleItemRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithAccessToken("accessToken-0001")
.WithItemName("item-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var itemModel = result.ItemModel;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getSimpleItem(
new Gs2Inventory.GetSimpleItemRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
);
const item = result.getItem();
const itemModel = result.getItemModel();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_simple_item(
inventory.GetSimpleItemRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_access_token('accessToken-0001')
.with_item_name('item-0001')
)
item = result.item
item_model = result.item_model
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_simple_item({
namespaceName="namespace-0001",
inventoryName="item",
accessToken="accessToken-0001",
itemName="item-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
itemModel = result.itemModel;client = gs2('inventory')
api_result_handler = client.get_simple_item_async({
namespaceName="namespace-0001",
inventoryName="item",
accessToken="accessToken-0001",
itemName="item-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['errorMessage'])
end
result = api_result.result
item = result.item;
itemModel = result.itemModel;getSimpleItemByUserId
ユーザーIDを指定してシンプルアイテムを取得
指定されたユーザーの特定の名前のシンプルアイテム(現在の数量と関連するアイテムモデルを含む)を取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 このレコードに格納されているアイテムの種類を定義するシンプルアイテムモデルの名前です。この所持品がどのアイテム定義に対応するかを識別するために使用されます。 | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleItem | シンプルアイテム |
| itemModel | SimpleItemModel | シンプルアイテムモデル |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetSimpleItemByUserId(
&inventory.GetSimpleItemByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
itemModel := result.ItemModeluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetSimpleItemByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getSimpleItemByUserId(
(new GetSimpleItemByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withItemName("item-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$itemModel = $result->getItemModel();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetSimpleItemByUserIdRequest;
import io.gs2.inventory.result.GetSimpleItemByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetSimpleItemByUserIdResult result = client.getSimpleItemByUserId(
new GetSimpleItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withTimeOffsetToken(null)
);
SimpleItem item = result.getItem();
SimpleItemModel itemModel = result.getItemModel();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetSimpleItemByUserIdResult> asyncResult = null;
yield return client.GetSimpleItemByUserId(
new Gs2.Gs2Inventory.Request.GetSimpleItemByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var itemModel = result.ItemModel;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getSimpleItemByUserId(
new Gs2Inventory.GetSimpleItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
const itemModel = result.getItemModel();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_simple_item_by_user_id(
inventory.GetSimpleItemByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_time_offset_token(None)
)
item = result.item
item_model = result.item_model
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_simple_item_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
itemModel = result.itemModel;client = gs2('inventory')
api_result_handler = client.get_simple_item_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-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['errorMessage'])
end
result = api_result.result
item = result.item;
itemModel = result.itemModel;getSimpleItemWithSignature
署名と共にシンプルアイテムを取得
真正性検証のための暗号署名付きでシンプルアイテムを取得します。
署名は指定された暗号鍵を使用して生成され、外部システムがアイテムデータを検証できます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| itemName | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 このレコードに格納されているアイテムの種類を定義するシンプルアイテムモデルの名前です。この所持品がどのアイテム定義に対応するかを識別するために使用されます。 | ||
| keyId | string | “grn:gs2:{region}:{ownerId}:key:default:key:default” | ~ 1024文字 | 暗号鍵 GRN |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleItem | シンプルアイテム |
| simpleItemModel | SimpleItemModel | シンプルアイテムモデル |
| body | string | 署名対象のシンプルアイテム情報 |
| signature | string | 署名 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetSimpleItemWithSignature(
&inventory.GetSimpleItemWithSignatureRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
AccessToken: pointy.String("accessToken-0001"),
ItemName: pointy.String("item-0001"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
simpleItemModel := result.SimpleItemModel
body := result.Body
signature := result.Signatureuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetSimpleItemWithSignatureRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getSimpleItemWithSignature(
(new GetSimpleItemWithSignatureRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withAccessToken("accessToken-0001")
->withItemName("item-0001")
->withKeyId("key-0001")
);
$item = $result->getItem();
$simpleItemModel = $result->getSimpleItemModel();
$body = $result->getBody();
$signature = $result->getSignature();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetSimpleItemWithSignatureRequest;
import io.gs2.inventory.result.GetSimpleItemWithSignatureResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetSimpleItemWithSignatureResult result = client.getSimpleItemWithSignature(
new GetSimpleItemWithSignatureRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withKeyId("key-0001")
);
SimpleItem item = result.getItem();
SimpleItemModel simpleItemModel = result.getSimpleItemModel();
String body = result.getBody();
String signature = result.getSignature();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetSimpleItemWithSignatureResult> asyncResult = null;
yield return client.GetSimpleItemWithSignature(
new Gs2.Gs2Inventory.Request.GetSimpleItemWithSignatureRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithAccessToken("accessToken-0001")
.WithItemName("item-0001")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var simpleItemModel = result.SimpleItemModel;
var body = result.Body;
var signature = result.Signature;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getSimpleItemWithSignature(
new Gs2Inventory.GetSimpleItemWithSignatureRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withKeyId("key-0001")
);
const item = result.getItem();
const simpleItemModel = result.getSimpleItemModel();
const body = result.getBody();
const signature = result.getSignature();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_simple_item_with_signature(
inventory.GetSimpleItemWithSignatureRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_access_token('accessToken-0001')
.with_item_name('item-0001')
.with_key_id('key-0001')
)
item = result.item
simple_item_model = result.simple_item_model
body = result.body
signature = result.signature
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_simple_item_with_signature({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
simpleItemModel = result.simpleItemModel;
body = result.body;
signature = result.signature;client = gs2('inventory')
api_result_handler = client.get_simple_item_with_signature_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
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['errorMessage'])
end
result = api_result.result
item = result.item;
simpleItemModel = result.simpleItemModel;
body = result.body;
signature = result.signature;getSimpleItemWithSignatureByUserId
ユーザーIDを指定して署名付きシンプルアイテムを取得
外部の真正性検証のための暗号署名付きで、指定されたユーザーのシンプルアイテムを取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 このレコードに格納されているアイテムの種類を定義するシンプルアイテムモデルの名前です。この所持品がどのアイテム定義に対応するかを識別するために使用されます。 | ||
| keyId | string | “grn:gs2:{region}:{ownerId}:key:default:key:default” | ~ 1024文字 | 暗号鍵 GRN | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleItem | シンプルアイテム |
| simpleItemModel | SimpleItemModel | シンプルアイテムモデル |
| body | string | 署名対象のシンプルアイテム情報 |
| signature | string | 署名 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetSimpleItemWithSignatureByUserId(
&inventory.GetSimpleItemWithSignatureByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
KeyId: pointy.String("key-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
simpleItemModel := result.SimpleItemModel
body := result.Body
signature := result.Signatureuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetSimpleItemWithSignatureByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getSimpleItemWithSignatureByUserId(
(new GetSimpleItemWithSignatureByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withItemName("item-0001")
->withKeyId("key-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$simpleItemModel = $result->getSimpleItemModel();
$body = $result->getBody();
$signature = $result->getSignature();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetSimpleItemWithSignatureByUserIdRequest;
import io.gs2.inventory.result.GetSimpleItemWithSignatureByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetSimpleItemWithSignatureByUserIdResult result = client.getSimpleItemWithSignatureByUserId(
new GetSimpleItemWithSignatureByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withKeyId("key-0001")
.withTimeOffsetToken(null)
);
SimpleItem item = result.getItem();
SimpleItemModel simpleItemModel = result.getSimpleItemModel();
String body = result.getBody();
String signature = result.getSignature();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetSimpleItemWithSignatureByUserIdResult> asyncResult = null;
yield return client.GetSimpleItemWithSignatureByUserId(
new Gs2.Gs2Inventory.Request.GetSimpleItemWithSignatureByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithKeyId("key-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var simpleItemModel = result.SimpleItemModel;
var body = result.Body;
var signature = result.Signature;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getSimpleItemWithSignatureByUserId(
new Gs2Inventory.GetSimpleItemWithSignatureByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withKeyId("key-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
const simpleItemModel = result.getSimpleItemModel();
const body = result.getBody();
const signature = result.getSignature();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_simple_item_with_signature_by_user_id(
inventory.GetSimpleItemWithSignatureByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_key_id('key-0001')
.with_time_offset_token(None)
)
item = result.item
simple_item_model = result.simple_item_model
body = result.body
signature = result.signature
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_simple_item_with_signature_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
keyId="key-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
simpleItemModel = result.simpleItemModel;
body = result.body;
signature = result.signature;client = gs2('inventory')
api_result_handler = client.get_simple_item_with_signature_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
keyId="key-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['errorMessage'])
end
result = api_result.result
item = result.item;
simpleItemModel = result.simpleItemModel;
body = result.body;
signature = result.signature;acquireSimpleItemsByUserId
ユーザーIDを指定してシンプルアイテムを入手
入手数量のバッチを使用して、ユーザーのシンプルインベントリにアイテムを追加します。
単一のアトミック操作で複数のアイテムを入手できます。acquireCounts 配列で各アイテムの名前と数量を指定します。
通常のアイテムセットとは異なり、シンプルアイテムには容量制限、スタック制限、有効期限がありません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| acquireCounts | List<AcquireCount> | ✓ | 1 ~ 100 items | シンプルアイテムの入手数量リスト | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<SimpleItem> | 加算後のシンプルアイテムのリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.AcquireSimpleItemsByUserId(
&inventory.AcquireSimpleItemsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
UserId: pointy.String("user-0001"),
AcquireCounts: []inventory.AcquireCount{
inventory.AcquireCount{
ItemName: pointy.String("item-0001"),
Count: pointy.Int64(5),
},
},
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Itemsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\AcquireSimpleItemsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->acquireSimpleItemsByUserId(
(new AcquireSimpleItemsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withUserId("user-0001")
->withAcquireCounts([
(new \Gs2\Inventory\Model\AcquireCount())
->withItemName("item-0001")
->withCount(5),
])
->withTimeOffsetToken(null)
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.AcquireSimpleItemsByUserIdRequest;
import io.gs2.inventory.result.AcquireSimpleItemsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
AcquireSimpleItemsByUserIdResult result = client.acquireSimpleItemsByUserId(
new AcquireSimpleItemsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withUserId("user-0001")
.withAcquireCounts(Arrays.asList(
new io.gs2.inventory.model.AcquireCount()
.withItemName("item-0001")
.withCount(5L)
))
.withTimeOffsetToken(null)
);
List<SimpleItem> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.AcquireSimpleItemsByUserIdResult> asyncResult = null;
yield return client.AcquireSimpleItemsByUserId(
new Gs2.Gs2Inventory.Request.AcquireSimpleItemsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithUserId("user-0001")
.WithAcquireCounts(new Gs2.Gs2Inventory.Model.AcquireCount[] {
new Gs2.Gs2Inventory.Model.AcquireCount()
.WithItemName("item-0001")
.WithCount(5L),
})
.WithTimeOffsetToken(null),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.acquireSimpleItemsByUserId(
new Gs2Inventory.AcquireSimpleItemsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withUserId("user-0001")
.withAcquireCounts([
new Gs2Inventory.model.AcquireCount()
.withItemName("item-0001")
.withCount(5),
])
.withTimeOffsetToken(null)
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.acquire_simple_items_by_user_id(
inventory.AcquireSimpleItemsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_user_id('user-0001')
.with_acquire_counts([
inventory.AcquireCount()
.with_item_name('item-0001')
.with_count(5),
])
.with_time_offset_token(None)
)
items = result.items
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.acquire_simple_items_by_user_id({
namespaceName="namespace-0001",
inventoryName="item",
userId="user-0001",
acquireCounts={
{
itemName="item-0001",
count=5,
}
},
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;client = gs2('inventory')
api_result_handler = client.acquire_simple_items_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="item",
userId="user-0001",
acquireCounts={
{
itemName="item-0001",
count=5,
}
},
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['errorMessage'])
end
result = api_result.result
items = result.items;consumeSimpleItems
シンプルアイテムを消費
消費数量のバッチを使用して、リクエストユーザーのシンプルインベントリ内のアイテム数量を減少させます。
単一のアトミック操作で複数のアイテムを消費できます。いずれかのアイテムの数量が不足している場合、操作全体が失敗します。
指定されたいずれかのアイテムが十分にない場合、Insufficient エラーが返されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| consumeCounts | List<ConsumeCount> | ✓ | 1 ~ 100 items | シンプルアイテムの消費数量のリスト |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<SimpleItem> | 消費後のシンプルアイテムのリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.ConsumeSimpleItems(
&inventory.ConsumeSimpleItemsRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
AccessToken: pointy.String("accessToken-0001"),
ConsumeCounts: []inventory.ConsumeCount{
inventory.ConsumeCount{
ItemName: pointy.String("item-0001"),
Count: pointy.Int64(5),
},
inventory.ConsumeCount{
ItemName: pointy.String("item-0002"),
Count: pointy.Int64(3),
},
},
}
)
if err != nil {
panic("error occurred")
}
items := result.Itemsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\ConsumeSimpleItemsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->consumeSimpleItems(
(new ConsumeSimpleItemsRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withAccessToken("accessToken-0001")
->withConsumeCounts([
(new ConsumeCount())
->withItemName("item-0001")
->withCount(5),
(new ConsumeCount())
->withItemName("item-0002")
->withCount(3),
])
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.ConsumeSimpleItemsRequest;
import io.gs2.inventory.result.ConsumeSimpleItemsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
ConsumeSimpleItemsResult result = client.consumeSimpleItems(
new ConsumeSimpleItemsRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withConsumeCounts(Arrays.asList(
new ConsumeCount()
.withItemName("item-0001")
.withCount(5L),
new ConsumeCount()
.withItemName("item-0002")
.withCount(3L)
))
);
List<SimpleItem> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.ConsumeSimpleItemsResult> asyncResult = null;
yield return client.ConsumeSimpleItems(
new Gs2.Gs2Inventory.Request.ConsumeSimpleItemsRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithAccessToken("accessToken-0001")
.WithConsumeCounts(new Gs2.Gs2Inventory.Model.ConsumeCount[] {
new Gs2.Gs2Inventory.Model.ConsumeCount()
.WithItemName("item-0001")
.WithCount(5L),
new Gs2.Gs2Inventory.Model.ConsumeCount()
.WithItemName("item-0002")
.WithCount(3L),
}),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.consumeSimpleItems(
new Gs2Inventory.ConsumeSimpleItemsRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withConsumeCounts([
new Gs2Inventory.model.ConsumeCount()
.withItemName("item-0001")
.withCount(5),
new Gs2Inventory.model.ConsumeCount()
.withItemName("item-0002")
.withCount(3),
])
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.consume_simple_items(
inventory.ConsumeSimpleItemsRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_access_token('accessToken-0001')
.with_consume_counts([
inventory.ConsumeCount()
.with_item_name('item-0001')
.with_count(5),
inventory.ConsumeCount()
.with_item_name('item-0002')
.with_count(3),
])
)
items = result.items
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.consume_simple_items({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
consumeCounts={
{
item_name="item-0001",
count=5,
},
{
item_name="item-0002",
count=3,
}
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;client = gs2('inventory')
api_result_handler = client.consume_simple_items_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
consumeCounts={
{
item_name="item-0001",
count=5,
},
{
item_name="item-0002",
count=3,
}
},
})
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['errorMessage'])
end
result = api_result.result
items = result.items;consumeSimpleItemsByUserId
ユーザーIDを指定してシンプルアイテムを消費
消費数量のバッチを使用して、指定されたユーザーのシンプルインベントリ内のアイテム数量を減少させます。
単一のアトミック操作で複数のアイテムを消費できます。いずれかのアイテムの数量が不足している場合、操作全体が失敗します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| consumeCounts | List<ConsumeCount> | ✓ | 1 ~ 100 items | シンプルアイテムの消費数量のリスト | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<SimpleItem> | 消費後のシンプルアイテムのリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.ConsumeSimpleItemsByUserId(
&inventory.ConsumeSimpleItemsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
ConsumeCounts: []inventory.ConsumeCount{
inventory.ConsumeCount{
ItemName: pointy.String("item-0001"),
Count: pointy.Int64(5),
},
inventory.ConsumeCount{
ItemName: pointy.String("item-0002"),
Count: pointy.Int64(3),
},
},
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Itemsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\ConsumeSimpleItemsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->consumeSimpleItemsByUserId(
(new ConsumeSimpleItemsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withConsumeCounts([
(new ConsumeCount())
->withItemName("item-0001")
->withCount(5),
(new ConsumeCount())
->withItemName("item-0002")
->withCount(3),
])
->withTimeOffsetToken(null)
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.ConsumeSimpleItemsByUserIdRequest;
import io.gs2.inventory.result.ConsumeSimpleItemsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
ConsumeSimpleItemsByUserIdResult result = client.consumeSimpleItemsByUserId(
new ConsumeSimpleItemsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withConsumeCounts(Arrays.asList(
new ConsumeCount()
.withItemName("item-0001")
.withCount(5L),
new ConsumeCount()
.withItemName("item-0002")
.withCount(3L)
))
.withTimeOffsetToken(null)
);
List<SimpleItem> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.ConsumeSimpleItemsByUserIdResult> asyncResult = null;
yield return client.ConsumeSimpleItemsByUserId(
new Gs2.Gs2Inventory.Request.ConsumeSimpleItemsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithConsumeCounts(new Gs2.Gs2Inventory.Model.ConsumeCount[] {
new Gs2.Gs2Inventory.Model.ConsumeCount()
.WithItemName("item-0001")
.WithCount(5L),
new Gs2.Gs2Inventory.Model.ConsumeCount()
.WithItemName("item-0002")
.WithCount(3L),
})
.WithTimeOffsetToken(null),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.consumeSimpleItemsByUserId(
new Gs2Inventory.ConsumeSimpleItemsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withConsumeCounts([
new Gs2Inventory.model.ConsumeCount()
.withItemName("item-0001")
.withCount(5),
new Gs2Inventory.model.ConsumeCount()
.withItemName("item-0002")
.withCount(3),
])
.withTimeOffsetToken(null)
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.consume_simple_items_by_user_id(
inventory.ConsumeSimpleItemsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_consume_counts([
inventory.ConsumeCount()
.with_item_name('item-0001')
.with_count(5),
inventory.ConsumeCount()
.with_item_name('item-0002')
.with_count(3),
])
.with_time_offset_token(None)
)
items = result.items
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.consume_simple_items_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
consumeCounts={
{
item_name="item-0001",
count=5,
},
{
item_name="item-0002",
count=3,
}
},
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;client = gs2('inventory')
api_result_handler = client.consume_simple_items_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
consumeCounts={
{
item_name="item-0001",
count=5,
},
{
item_name="item-0002",
count=3,
}
},
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['errorMessage'])
end
result = api_result.result
items = result.items;setSimpleItemsByUserId
ユーザーIDを指定してシンプルアイテムを設定
単一のアトミック操作で複数のシンプルアイテムの絶対数量を設定します。
counts 配列で各アイテムの名前とターゲット数量を指定します。
入手/消費が相対的な操作であるのに対し、こちらは現在の数量を完全に上書きします。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| counts | List<HeldCount> | ✓ | 1 ~ 100 items | シンプルアイテムの所持数量リスト | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<SimpleItem> | 更新後のシンプルアイテムのリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.SetSimpleItemsByUserId(
&inventory.SetSimpleItemsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
Counts: []inventory.HeldCount{
inventory.HeldCount{
ItemName: pointy.String("item-0001"),
Count: pointy.Int64(5),
},
inventory.HeldCount{
ItemName: pointy.String("item-0002"),
Count: pointy.Int64(3),
},
},
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Itemsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\SetSimpleItemsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->setSimpleItemsByUserId(
(new SetSimpleItemsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withCounts([
(new HeldCount())
->withItemName("item-0001")
->withCount(5),
(new HeldCount())
->withItemName("item-0002")
->withCount(3),
])
->withTimeOffsetToken(null)
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.SetSimpleItemsByUserIdRequest;
import io.gs2.inventory.result.SetSimpleItemsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
SetSimpleItemsByUserIdResult result = client.setSimpleItemsByUserId(
new SetSimpleItemsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withCounts(Arrays.asList(
new HeldCount()
.withItemName("item-0001")
.withCount(5L),
new HeldCount()
.withItemName("item-0002")
.withCount(3L)
))
.withTimeOffsetToken(null)
);
List<SimpleItem> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.SetSimpleItemsByUserIdResult> asyncResult = null;
yield return client.SetSimpleItemsByUserId(
new Gs2.Gs2Inventory.Request.SetSimpleItemsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithCounts(new Gs2.Gs2Inventory.Model.HeldCount[] {
new Gs2.Gs2Inventory.Model.HeldCount()
.WithItemName("item-0001")
.WithCount(5L),
new Gs2.Gs2Inventory.Model.HeldCount()
.WithItemName("item-0002")
.WithCount(3L),
})
.WithTimeOffsetToken(null),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.setSimpleItemsByUserId(
new Gs2Inventory.SetSimpleItemsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withCounts([
new Gs2Inventory.model.HeldCount()
.withItemName("item-0001")
.withCount(5),
new Gs2Inventory.model.HeldCount()
.withItemName("item-0002")
.withCount(3),
])
.withTimeOffsetToken(null)
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.set_simple_items_by_user_id(
inventory.SetSimpleItemsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_counts([
inventory.HeldCount()
.with_item_name('item-0001')
.with_count(5),
inventory.HeldCount()
.with_item_name('item-0002')
.with_count(3),
])
.with_time_offset_token(None)
)
items = result.items
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.set_simple_items_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
counts={
{
item_name="item-0001",
count=5,
},
{
item_name="item-0002",
count=3,
}
},
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;client = gs2('inventory')
api_result_handler = client.set_simple_items_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
counts={
{
item_name="item-0001",
count=5,
},
{
item_name="item-0002",
count=3,
}
},
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['errorMessage'])
end
result = api_result.result
items = result.items;deleteSimpleItemsByUserId
シンプルアイテムを削除
指定されたユーザーの指定されたシンプルインベントリ内のすべてのシンプルアイテムを削除します。
インベントリ内のすべてのアイテムデータが永久に削除されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 |
|---|
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DeleteSimpleItemsByUserId(
&inventory.DeleteSimpleItemsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
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\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DeleteSimpleItemsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->deleteSimpleItemsByUserId(
(new DeleteSimpleItemsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DeleteSimpleItemsByUserIdRequest;
import io.gs2.inventory.result.DeleteSimpleItemsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DeleteSimpleItemsByUserIdResult result = client.deleteSimpleItemsByUserId(
new DeleteSimpleItemsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DeleteSimpleItemsByUserIdResult> asyncResult = null;
yield return client.DeleteSimpleItemsByUserId(
new Gs2.Gs2Inventory.Request.DeleteSimpleItemsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.deleteSimpleItemsByUserId(
new Gs2Inventory.DeleteSimpleItemsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_simple_items_by_user_id(
inventory.DeleteSimpleItemsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.delete_simple_items_by_user_id({
namespaceName="namespace-0001",
inventoryName="item",
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultclient = gs2('inventory')
api_result_handler = client.delete_simple_items_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="item",
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['errorMessage'])
end
result = api_result.resultverifySimpleItem
シンプルアイテムの所持数量を検証
リクエストユーザーのシンプルアイテムの数量が指定された条件を満たすことを検証します。
6つの比較演算子をサポートします:less、lessEqual、greater、greaterEqual、equal、notEqual。
条件が満たされない場合、エラーが返されます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||||||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||||||||||||||||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||||||
| itemName | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 このレコードに格納されているアイテムの種類を定義するシンプルアイテムモデルの名前です。この所持品がどのアイテム定義に対応するかを識別するために使用されます。 | ||||||||||||||||
| verifyType | 文字列列挙型 enum { “less”, “lessEqual”, “greater”, “greaterEqual”, “equal”, “notEqual” } | ✓ | 検証の種類
| |||||||||||||||||
| count | long | ✓ | 0 ~ 9223372036854775805 | 所持数量 | ||||||||||||||||
| multiplyValueSpecifyingQuantity | bool | true | 数量指定した際に、検証に使用する値も乗算するか |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleItem | シンプルアイテム |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.VerifySimpleItem(
&inventory.VerifySimpleItemRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
InventoryName: pointy.String("inventory-0001"),
ItemName: pointy.String("item-0001"),
VerifyType: pointy.String("less"),
Count: pointy.Int64(10),
MultiplyValueSpecifyingQuantity: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\VerifySimpleItemRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->verifySimpleItem(
(new VerifySimpleItemRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withInventoryName("inventory-0001")
->withItemName("item-0001")
->withVerifyType("less")
->withCount(10)
->withMultiplyValueSpecifyingQuantity(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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.VerifySimpleItemRequest;
import io.gs2.inventory.result.VerifySimpleItemResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
VerifySimpleItemResult result = client.verifySimpleItem(
new VerifySimpleItemRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withInventoryName("inventory-0001")
.withItemName("item-0001")
.withVerifyType("less")
.withCount(10L)
.withMultiplyValueSpecifyingQuantity(null)
);
SimpleItem item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.VerifySimpleItemResult> asyncResult = null;
yield return client.VerifySimpleItem(
new Gs2.Gs2Inventory.Request.VerifySimpleItemRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithInventoryName("inventory-0001")
.WithItemName("item-0001")
.WithVerifyType("less")
.WithCount(10L)
.WithMultiplyValueSpecifyingQuantity(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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.verifySimpleItem(
new Gs2Inventory.VerifySimpleItemRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withInventoryName("inventory-0001")
.withItemName("item-0001")
.withVerifyType("less")
.withCount(10)
.withMultiplyValueSpecifyingQuantity(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.verify_simple_item(
inventory.VerifySimpleItemRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_inventory_name('inventory-0001')
.with_item_name('item-0001')
.with_verify_type('less')
.with_count(10)
.with_multiply_value_specifying_quantity(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.verify_simple_item({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
inventoryName="inventory-0001",
itemName="item-0001",
verifyType="less",
count=10,
multiplyValueSpecifyingQuantity=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.verify_simple_item_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
inventoryName="inventory-0001",
itemName="item-0001",
verifyType="less",
count=10,
multiplyValueSpecifyingQuantity=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['errorMessage'])
end
result = api_result.result
item = result.item;verifySimpleItemByUserId
ユーザーIDを指定してシンプルアイテムの所持数量を検証
指定されたユーザーのシンプルアイテムの数量が指定された条件を満たすことを検証します。
6つの比較演算子をサポートします:less、lessEqual、greater、greaterEqual、equal、notEqual。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||||||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||||||||||||||||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||||||
| itemName | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 このレコードに格納されているアイテムの種類を定義するシンプルアイテムモデルの名前です。この所持品がどのアイテム定義に対応するかを識別するために使用されます。 | ||||||||||||||||
| verifyType | 文字列列挙型 enum { “less”, “lessEqual”, “greater”, “greaterEqual”, “equal”, “notEqual” } | ✓ | 検証の種類
| |||||||||||||||||
| count | long | ✓ | 0 ~ 9223372036854775805 | 所持数量 | ||||||||||||||||
| multiplyValueSpecifyingQuantity | bool | true | 数量指定した際に、検証に使用する値も乗算するか | |||||||||||||||||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleItem | シンプルアイテム |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.VerifySimpleItemByUserId(
&inventory.VerifySimpleItemByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
InventoryName: pointy.String("inventory-0001"),
ItemName: pointy.String("item-0001"),
VerifyType: pointy.String("less"),
Count: pointy.Int64(10),
MultiplyValueSpecifyingQuantity: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\VerifySimpleItemByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->verifySimpleItemByUserId(
(new VerifySimpleItemByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withInventoryName("inventory-0001")
->withItemName("item-0001")
->withVerifyType("less")
->withCount(10)
->withMultiplyValueSpecifyingQuantity(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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.VerifySimpleItemByUserIdRequest;
import io.gs2.inventory.result.VerifySimpleItemByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
VerifySimpleItemByUserIdResult result = client.verifySimpleItemByUserId(
new VerifySimpleItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withInventoryName("inventory-0001")
.withItemName("item-0001")
.withVerifyType("less")
.withCount(10L)
.withMultiplyValueSpecifyingQuantity(null)
.withTimeOffsetToken(null)
);
SimpleItem item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.VerifySimpleItemByUserIdResult> asyncResult = null;
yield return client.VerifySimpleItemByUserId(
new Gs2.Gs2Inventory.Request.VerifySimpleItemByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithInventoryName("inventory-0001")
.WithItemName("item-0001")
.WithVerifyType("less")
.WithCount(10L)
.WithMultiplyValueSpecifyingQuantity(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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.verifySimpleItemByUserId(
new Gs2Inventory.VerifySimpleItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withInventoryName("inventory-0001")
.withItemName("item-0001")
.withVerifyType("less")
.withCount(10)
.withMultiplyValueSpecifyingQuantity(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.verify_simple_item_by_user_id(
inventory.VerifySimpleItemByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_inventory_name('inventory-0001')
.with_item_name('item-0001')
.with_verify_type('less')
.with_count(10)
.with_multiply_value_specifying_quantity(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.verify_simple_item_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
inventoryName="inventory-0001",
itemName="item-0001",
verifyType="less",
count=10,
multiplyValueSpecifyingQuantity=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.verify_simple_item_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
inventoryName="inventory-0001",
itemName="item-0001",
verifyType="less",
count=10,
multiplyValueSpecifyingQuantity=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['errorMessage'])
end
result = api_result.result
item = result.item;describeBigItems
巨大アイテムのリストを取得
指定された巨大インベントリ内でリクエストユーザーが所持する巨大アイテムのページネーション付きリストを取得します。
巨大アイテムは文字列ベースの任意精度数量を使用し、標準的な整数の限界を超える値に適しています。
一度も入手したことのないアイテムは結果に含まれません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<BigItem> | 巨大アイテムのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeBigItems(
&inventory.DescribeBigItemsRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
AccessToken: pointy.String("accessToken-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeBigItemsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeBigItems(
(new DescribeBigItemsRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withAccessToken("accessToken-0001")
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeBigItemsRequest;
import io.gs2.inventory.result.DescribeBigItemsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeBigItemsResult result = client.describeBigItems(
new DescribeBigItemsRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withAccessToken("accessToken-0001")
.withPageToken(null)
.withLimit(null)
);
List<BigItem> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeBigItemsResult> asyncResult = null;
yield return client.DescribeBigItems(
new Gs2.Gs2Inventory.Request.DescribeBigItemsRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithAccessToken("accessToken-0001")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeBigItems(
new Gs2Inventory.DescribeBigItemsRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withAccessToken("accessToken-0001")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_big_items(
inventory.DescribeBigItemsRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_access_token('accessToken-0001')
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.describe_big_items({
namespaceName="namespace-0001",
inventoryName="item",
accessToken="accessToken-0001",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_big_items_async({
namespaceName="namespace-0001",
inventoryName="item",
accessToken="accessToken-0001",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;describeBigItemsByUserId
ユーザーIDを指定して巨大アイテムのリストを取得
指定された巨大インベントリ内で指定ユーザーが所持する巨大アイテムのページネーション付きリストを取得します。
巨大アイテムは文字列ベースの任意精度数量を使用し、標準的な整数の限界を超える値に適しています。
一度も入手したことのないアイテムは結果に含まれません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<BigItem> | 巨大アイテムのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeBigItemsByUserId(
&inventory.DescribeBigItemsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeBigItemsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeBigItemsByUserId(
(new DescribeBigItemsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeBigItemsByUserIdRequest;
import io.gs2.inventory.result.DescribeBigItemsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeBigItemsByUserIdResult result = client.describeBigItemsByUserId(
new DescribeBigItemsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<BigItem> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeBigItemsByUserIdResult> asyncResult = null;
yield return client.DescribeBigItemsByUserId(
new Gs2.Gs2Inventory.Request.DescribeBigItemsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeBigItemsByUserId(
new Gs2Inventory.DescribeBigItemsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.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 inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_big_items_by_user_id(
inventory.DescribeBigItemsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.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('inventory')
api_result = client.describe_big_items_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_big_items_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
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['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;getBigItem
巨大アイテムを取得
リクエストユーザーの特定の巨大アイテムとその文字列ベースの任意精度数量を取得します。
レスポンスには巨大アイテムデータとその関連する巨大アイテムモデル定義の両方が含まれます。
一度も入手したことのないアイテムの場合、データは返されません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| itemName | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 このレコードに格納されているアイテムの種類を定義する巨大アイテムモデルの名前です。この巨大アイテムの所持品がどのアイテム定義に対応するかを識別するために使用されます。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigItem | 巨大アイテム |
| itemModel | BigItemModel | 巨大アイテムモデル |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetBigItem(
&inventory.GetBigItemRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
AccessToken: pointy.String("accessToken-0001"),
ItemName: pointy.String("item-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
itemModel := result.ItemModeluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetBigItemRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getBigItem(
(new GetBigItemRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withAccessToken("accessToken-0001")
->withItemName("item-0001")
);
$item = $result->getItem();
$itemModel = $result->getItemModel();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetBigItemRequest;
import io.gs2.inventory.result.GetBigItemResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetBigItemResult result = client.getBigItem(
new GetBigItemRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
);
BigItem item = result.getItem();
BigItemModel itemModel = result.getItemModel();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetBigItemResult> asyncResult = null;
yield return client.GetBigItem(
new Gs2.Gs2Inventory.Request.GetBigItemRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithAccessToken("accessToken-0001")
.WithItemName("item-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var itemModel = result.ItemModel;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getBigItem(
new Gs2Inventory.GetBigItemRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
);
const item = result.getItem();
const itemModel = result.getItemModel();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_big_item(
inventory.GetBigItemRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_access_token('accessToken-0001')
.with_item_name('item-0001')
)
item = result.item
item_model = result.item_model
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_big_item({
namespaceName="namespace-0001",
inventoryName="item",
accessToken="accessToken-0001",
itemName="item-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
itemModel = result.itemModel;client = gs2('inventory')
api_result_handler = client.get_big_item_async({
namespaceName="namespace-0001",
inventoryName="item",
accessToken="accessToken-0001",
itemName="item-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['errorMessage'])
end
result = api_result.result
item = result.item;
itemModel = result.itemModel;getBigItemByUserId
ユーザーIDを指定して巨大アイテムを取得
指定ユーザーの特定の巨大アイテムとその文字列ベースの任意精度数量を取得します。
レスポンスには巨大アイテムデータとその関連する巨大アイテムモデル定義の両方が含まれます。
一度も入手したことのないアイテムの場合、データは返されません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 このレコードに格納されているアイテムの種類を定義する巨大アイテムモデルの名前です。この巨大アイテムの所持品がどのアイテム定義に対応するかを識別するために使用されます。 | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigItem | 巨大アイテム |
| itemModel | BigItemModel | 巨大アイテムモデル |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetBigItemByUserId(
&inventory.GetBigItemByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
itemModel := result.ItemModeluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetBigItemByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getBigItemByUserId(
(new GetBigItemByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withItemName("item-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$itemModel = $result->getItemModel();
} 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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetBigItemByUserIdRequest;
import io.gs2.inventory.result.GetBigItemByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetBigItemByUserIdResult result = client.getBigItemByUserId(
new GetBigItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withTimeOffsetToken(null)
);
BigItem item = result.getItem();
BigItemModel itemModel = result.getItemModel();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetBigItemByUserIdResult> asyncResult = null;
yield return client.GetBigItemByUserId(
new Gs2.Gs2Inventory.Request.GetBigItemByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var itemModel = result.ItemModel;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getBigItemByUserId(
new Gs2Inventory.GetBigItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
const itemModel = result.getItemModel();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_big_item_by_user_id(
inventory.GetBigItemByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_time_offset_token(None)
)
item = result.item
item_model = result.item_model
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_big_item_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
itemModel = result.itemModel;client = gs2('inventory')
api_result_handler = client.get_big_item_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-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['errorMessage'])
end
result = api_result.result
item = result.item;
itemModel = result.itemModel;acquireBigItemByUserId
ユーザーIDを指定して巨大アイテムを入手
任意精度演算を使用して、ユーザーの巨大アイテム数量に指定された数量を加算します。
acquireCount は最大1024桁の有効な整数文字列でなければならず、無効な形式はエラーになります。
アイテムがまだ存在しない場合は自動的に作成されます。
ネームスペース設定により、巨大アイテム入手時にカスタムロジックを実行する GS2-Script を設定できます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 巨大アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| acquireCount | string | ✓ | ~ 1024文字 | 巨大アイテムの入手数量 最大1024桁までの整数値文字列 | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigItem | 加算後の巨大アイテム |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.AcquireBigItemByUserId(
&inventory.AcquireBigItemByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
AcquireCount: pointy.String("1234567890123456789012345678901234567890"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\AcquireBigItemByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->acquireBigItemByUserId(
(new AcquireBigItemByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withUserId("user-0001")
->withItemName("item-0001")
->withAcquireCount("1234567890123456789012345678901234567890")
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.AcquireBigItemByUserIdRequest;
import io.gs2.inventory.result.AcquireBigItemByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
AcquireBigItemByUserIdResult result = client.acquireBigItemByUserId(
new AcquireBigItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withUserId("user-0001")
.withItemName("item-0001")
.withAcquireCount("1234567890123456789012345678901234567890")
.withTimeOffsetToken(null)
);
BigItem item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.AcquireBigItemByUserIdResult> asyncResult = null;
yield return client.AcquireBigItemByUserId(
new Gs2.Gs2Inventory.Request.AcquireBigItemByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithAcquireCount("1234567890123456789012345678901234567890")
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.acquireBigItemByUserId(
new Gs2Inventory.AcquireBigItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withUserId("user-0001")
.withItemName("item-0001")
.withAcquireCount("1234567890123456789012345678901234567890")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.acquire_big_item_by_user_id(
inventory.AcquireBigItemByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_acquire_count('1234567890123456789012345678901234567890')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.acquire_big_item_by_user_id({
namespaceName="namespace-0001",
inventoryName="item",
userId="user-0001",
itemName="item-0001",
acquireCount="1234567890123456789012345678901234567890",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.acquire_big_item_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="item",
userId="user-0001",
itemName="item-0001",
acquireCount="1234567890123456789012345678901234567890",
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['errorMessage'])
end
result = api_result.result
item = result.item;consumeBigItem
巨大アイテムを消費
任意精度演算を使用して、リクエストユーザーの巨大アイテム数量から指定された数量を減算します。
consumeCount は最大1024桁の有効な整数文字列でなければなりません。
現在の数量が不足している場合、Insufficient エラーが返され、減算は行われません。
ネームスペース設定により、巨大アイテム消費時にカスタムロジックを実行する GS2-Script を設定できます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| itemName | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 巨大アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| consumeCount | string | ✓ | ~ 1024文字 | 巨大アイテムの消費数量 最大1024桁までの整数値文字列 |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigItem | 消費後の巨大アイテム |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.ConsumeBigItem(
&inventory.ConsumeBigItemRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
AccessToken: pointy.String("accessToken-0001"),
ItemName: pointy.String("item-0001"),
ConsumeCount: pointy.String("1234567890123456789012345678901234567890"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\ConsumeBigItemRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->consumeBigItem(
(new ConsumeBigItemRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withAccessToken("accessToken-0001")
->withItemName("item-0001")
->withConsumeCount("1234567890123456789012345678901234567890")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.ConsumeBigItemRequest;
import io.gs2.inventory.result.ConsumeBigItemResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
ConsumeBigItemResult result = client.consumeBigItem(
new ConsumeBigItemRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withConsumeCount("1234567890123456789012345678901234567890")
);
BigItem item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.ConsumeBigItemResult> asyncResult = null;
yield return client.ConsumeBigItem(
new Gs2.Gs2Inventory.Request.ConsumeBigItemRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithAccessToken("accessToken-0001")
.WithItemName("item-0001")
.WithConsumeCount("1234567890123456789012345678901234567890"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.consumeBigItem(
new Gs2Inventory.ConsumeBigItemRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withAccessToken("accessToken-0001")
.withItemName("item-0001")
.withConsumeCount("1234567890123456789012345678901234567890")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.consume_big_item(
inventory.ConsumeBigItemRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_access_token('accessToken-0001')
.with_item_name('item-0001')
.with_consume_count('1234567890123456789012345678901234567890')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.consume_big_item({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
consumeCount="1234567890123456789012345678901234567890",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.consume_big_item_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
accessToken="accessToken-0001",
itemName="item-0001",
consumeCount="1234567890123456789012345678901234567890",
})
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['errorMessage'])
end
result = api_result.result
item = result.item;consumeBigItemByUserId
ユーザーIDを指定して巨大アイテムを消費
任意精度演算を使用して、指定ユーザーの巨大アイテム数量から指定された数量を減算します。
consumeCount は最大1024桁の有効な整数文字列でなければなりません。
現在の数量が不足している場合、Insufficient エラーが返され、減算は行われません。
ネームスペース設定により、巨大アイテム消費時にカスタムロジックを実行する GS2-Script を設定できます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 巨大アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| consumeCount | string | ✓ | ~ 1024文字 | 巨大アイテムの消費数量 最大1024桁までの整数値文字列 | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigItem | 消費後の巨大アイテム |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.ConsumeBigItemByUserId(
&inventory.ConsumeBigItemByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
ConsumeCount: pointy.String("1234567890123456789012345678901234567890"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\ConsumeBigItemByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->consumeBigItemByUserId(
(new ConsumeBigItemByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withItemName("item-0001")
->withConsumeCount("1234567890123456789012345678901234567890")
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.ConsumeBigItemByUserIdRequest;
import io.gs2.inventory.result.ConsumeBigItemByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
ConsumeBigItemByUserIdResult result = client.consumeBigItemByUserId(
new ConsumeBigItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withConsumeCount("1234567890123456789012345678901234567890")
.withTimeOffsetToken(null)
);
BigItem item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.ConsumeBigItemByUserIdResult> asyncResult = null;
yield return client.ConsumeBigItemByUserId(
new Gs2.Gs2Inventory.Request.ConsumeBigItemByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithConsumeCount("1234567890123456789012345678901234567890")
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.consumeBigItemByUserId(
new Gs2Inventory.ConsumeBigItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withConsumeCount("1234567890123456789012345678901234567890")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.consume_big_item_by_user_id(
inventory.ConsumeBigItemByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_consume_count('1234567890123456789012345678901234567890')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.consume_big_item_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
consumeCount="1234567890123456789012345678901234567890",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.consume_big_item_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
consumeCount="1234567890123456789012345678901234567890",
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['errorMessage'])
end
result = api_result.result
item = result.item;setBigItemByUserId
ユーザーIDを指定して巨大アイテムを設定
巨大アイテムの数量を指定された絶対値に設定し、現在の数量を完全に置き換えます。
数量は最大1024桁の有効な整数文字列でなければなりません。
アイテムがまだ存在しない場合は自動的に作成されます。
入手・消費のような相対操作とは異なり、正確な値を直接設定します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 巨大アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| count | string | ✓ | ~ 1024文字 | 巨大アイテムの数量 最大1024桁までの整数値文字列 | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigItem | 更新後の巨大アイテム |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.SetBigItemByUserId(
&inventory.SetBigItemByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("inventory-0001"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
Count: pointy.String("1234567890123456789012345678901234567890"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\SetBigItemByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->setBigItemByUserId(
(new SetBigItemByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("inventory-0001")
->withUserId("user-0001")
->withItemName("item-0001")
->withCount("1234567890123456789012345678901234567890")
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.SetBigItemByUserIdRequest;
import io.gs2.inventory.result.SetBigItemByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
SetBigItemByUserIdResult result = client.setBigItemByUserId(
new SetBigItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withCount("1234567890123456789012345678901234567890")
.withTimeOffsetToken(null)
);
BigItem item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.SetBigItemByUserIdResult> asyncResult = null;
yield return client.SetBigItemByUserId(
new Gs2.Gs2Inventory.Request.SetBigItemByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("inventory-0001")
.WithUserId("user-0001")
.WithItemName("item-0001")
.WithCount("1234567890123456789012345678901234567890")
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.setBigItemByUserId(
new Gs2Inventory.SetBigItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("inventory-0001")
.withUserId("user-0001")
.withItemName("item-0001")
.withCount("1234567890123456789012345678901234567890")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.set_big_item_by_user_id(
inventory.SetBigItemByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('inventory-0001')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_count('1234567890123456789012345678901234567890')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.set_big_item_by_user_id({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
count="1234567890123456789012345678901234567890",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.set_big_item_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="inventory-0001",
userId="user-0001",
itemName="item-0001",
count="1234567890123456789012345678901234567890",
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['errorMessage'])
end
result = api_result.result
item = result.item;deleteBigItemByUserId
巨大アイテムを削除
指定ユーザーの巨大アイテムデータを完全に削除します。
現在の数量に関係なく、アイテムレコードが完全に削除されます。
この操作は元に戻すことができません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||
| itemName | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 巨大アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigItem | 消費後の巨大アイテム |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DeleteBigItemByUserId(
&inventory.DeleteBigItemByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
UserId: pointy.String("user-0001"),
ItemName: pointy.String("item-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DeleteBigItemByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->deleteBigItemByUserId(
(new DeleteBigItemByUserIdRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withUserId("user-0001")
->withItemName("item-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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DeleteBigItemByUserIdRequest;
import io.gs2.inventory.result.DeleteBigItemByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DeleteBigItemByUserIdResult result = client.deleteBigItemByUserId(
new DeleteBigItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withUserId("user-0001")
.withItemName("item-0001")
.withTimeOffsetToken(null)
);
BigItem item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DeleteBigItemByUserIdResult> asyncResult = null;
yield return client.DeleteBigItemByUserId(
new Gs2.Gs2Inventory.Request.DeleteBigItemByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithUserId("user-0001")
.WithItemName("item-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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.deleteBigItemByUserId(
new Gs2Inventory.DeleteBigItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withUserId("user-0001")
.withItemName("item-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_big_item_by_user_id(
inventory.DeleteBigItemByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_user_id('user-0001')
.with_item_name('item-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.delete_big_item_by_user_id({
namespaceName="namespace-0001",
inventoryName="item",
userId="user-0001",
itemName="item-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.delete_big_item_by_user_id_async({
namespaceName="namespace-0001",
inventoryName="item",
userId="user-0001",
itemName="item-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['errorMessage'])
end
result = api_result.result
item = result.item;verifyBigItem
巨大アイテムの所持数量を検証
リクエストユーザーの巨大アイテム数量が指定された条件を満たすかどうかを検証します。
6つの比較演算子をサポート: less, lessEqual, greater, greaterEqual, equal, notEqual。
比較は文字列ベースの数量に対して任意精度演算で実行されます。
条件が満たされない場合はエラーが返され、満たされる場合はリクエストが成功します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||||||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||||||||||||||||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||||||
| itemName | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 このレコードに格納されているアイテムの種類を定義する巨大アイテムモデルの名前です。この巨大アイテムの所持品がどのアイテム定義に対応するかを識別するために使用されます。 | ||||||||||||||||
| verifyType | 文字列列挙型 enum { “less”, “lessEqual”, “greater”, “greaterEqual”, “equal”, “notEqual” } | ✓ | 検証の種類
| |||||||||||||||||
| count | string | ✓ | ~ 1024文字 | 所持数量 最大1024桁までの整数値文字列 | ||||||||||||||||
| multiplyValueSpecifyingQuantity | bool | true | 数量指定した際に、検証に使用する値も乗算するか |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigItem | 更新後の巨大アイテム |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.VerifyBigItem(
&inventory.VerifyBigItemRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
InventoryName: pointy.String("inventory-0001"),
ItemName: pointy.String("item-0001"),
VerifyType: pointy.String("less"),
Count: 10,
MultiplyValueSpecifyingQuantity: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\VerifyBigItemRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->verifyBigItem(
(new VerifyBigItemRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withInventoryName("inventory-0001")
->withItemName("item-0001")
->withVerifyType("less")
->withCount(10)
->withMultiplyValueSpecifyingQuantity(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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.VerifyBigItemRequest;
import io.gs2.inventory.result.VerifyBigItemResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
VerifyBigItemResult result = client.verifyBigItem(
new VerifyBigItemRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withInventoryName("inventory-0001")
.withItemName("item-0001")
.withVerifyType("less")
.withCount(10)
.withMultiplyValueSpecifyingQuantity(null)
);
BigItem item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.VerifyBigItemResult> asyncResult = null;
yield return client.VerifyBigItem(
new Gs2.Gs2Inventory.Request.VerifyBigItemRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithInventoryName("inventory-0001")
.WithItemName("item-0001")
.WithVerifyType("less")
.WithCount(10)
.WithMultiplyValueSpecifyingQuantity(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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.verifyBigItem(
new Gs2Inventory.VerifyBigItemRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withInventoryName("inventory-0001")
.withItemName("item-0001")
.withVerifyType("less")
.withCount(10)
.withMultiplyValueSpecifyingQuantity(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.verify_big_item(
inventory.VerifyBigItemRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_inventory_name('inventory-0001')
.with_item_name('item-0001')
.with_verify_type('less')
.with_count(10)
.with_multiply_value_specifying_quantity(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.verify_big_item({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
inventoryName="inventory-0001",
itemName="item-0001",
verifyType="less",
count=10,
multiplyValueSpecifyingQuantity=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.verify_big_item_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
inventoryName="inventory-0001",
itemName="item-0001",
verifyType="less",
count=10,
multiplyValueSpecifyingQuantity=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['errorMessage'])
end
result = api_result.result
item = result.item;verifyBigItemByUserId
ユーザーIDを指定して巨大アイテムの所持数量を検証
指定ユーザーの巨大アイテム数量が指定された条件を満たすかどうかを検証します。
6つの比較演算子をサポート: less, lessEqual, greater, greaterEqual, equal, notEqual。
比較は文字列ベースの数量に対して任意精度演算で実行されます。
条件が満たされない場合はエラーが返され、満たされる場合はリクエストが成功します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||||||
| userId | string | ✓ | ~ 128文字 | ユーザーID | ||||||||||||||||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||||||||||
| itemName | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 このレコードに格納されているアイテムの種類を定義する巨大アイテムモデルの名前です。この巨大アイテムの所持品がどのアイテム定義に対応するかを識別するために使用されます。 | ||||||||||||||||
| verifyType | 文字列列挙型 enum { “less”, “lessEqual”, “greater”, “greaterEqual”, “equal”, “notEqual” } | ✓ | 検証の種類
| |||||||||||||||||
| count | string | ✓ | ~ 1024文字 | 所持数量 最大1024桁までの整数値文字列 | ||||||||||||||||
| multiplyValueSpecifyingQuantity | bool | true | 数量指定した際に、検証に使用する値も乗算するか | |||||||||||||||||
| timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigItem | 更新後の巨大アイテム |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.VerifyBigItemByUserId(
&inventory.VerifyBigItemByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
InventoryName: pointy.String("inventory-0001"),
ItemName: pointy.String("item-0001"),
VerifyType: pointy.String("less"),
Count: 10,
MultiplyValueSpecifyingQuantity: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\VerifyBigItemByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->verifyBigItemByUserId(
(new VerifyBigItemByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withInventoryName("inventory-0001")
->withItemName("item-0001")
->withVerifyType("less")
->withCount(10)
->withMultiplyValueSpecifyingQuantity(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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.VerifyBigItemByUserIdRequest;
import io.gs2.inventory.result.VerifyBigItemByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
VerifyBigItemByUserIdResult result = client.verifyBigItemByUserId(
new VerifyBigItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withInventoryName("inventory-0001")
.withItemName("item-0001")
.withVerifyType("less")
.withCount(10)
.withMultiplyValueSpecifyingQuantity(null)
.withTimeOffsetToken(null)
);
BigItem item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.VerifyBigItemByUserIdResult> asyncResult = null;
yield return client.VerifyBigItemByUserId(
new Gs2.Gs2Inventory.Request.VerifyBigItemByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithInventoryName("inventory-0001")
.WithItemName("item-0001")
.WithVerifyType("less")
.WithCount(10)
.WithMultiplyValueSpecifyingQuantity(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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.verifyBigItemByUserId(
new Gs2Inventory.VerifyBigItemByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withInventoryName("inventory-0001")
.withItemName("item-0001")
.withVerifyType("less")
.withCount(10)
.withMultiplyValueSpecifyingQuantity(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.verify_big_item_by_user_id(
inventory.VerifyBigItemByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_inventory_name('inventory-0001')
.with_item_name('item-0001')
.with_verify_type('less')
.with_count(10)
.with_multiply_value_specifying_quantity(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.verify_big_item_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
inventoryName="inventory-0001",
itemName="item-0001",
verifyType="less",
count=10,
multiplyValueSpecifyingQuantity=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.verify_big_item_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
inventoryName="inventory-0001",
itemName="item-0001",
verifyType="less",
count=10,
multiplyValueSpecifyingQuantity=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['errorMessage'])
end
result = api_result.result
item = result.item;describeInventoryModels
インベントリモデルの一覧を取得
ネームスペース内で現在アクティブなインベントリモデルのリストを取得します。
これらはマスターデータの更新プロセスを通じて有効化されたモデルであり、各インベントリタイプの容量設定(initialCapacity、maxCapacity)とアイテム保護ルール(protectReferencedItem)を定義します。
各インベントリモデルには、そのインベントリ内のアイテムのスタック制限やソート順を定義する関連アイテムモデルが含まれます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<InventoryModel> | インベントリモデルのリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeInventoryModels(
&inventory.DescribeInventoryModelsRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Itemsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeInventoryModelsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeInventoryModels(
(new DescribeInventoryModelsRequest())
->withNamespaceName("namespace-0001")
);
$items = $result->getItems();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeInventoryModelsRequest;
import io.gs2.inventory.result.DescribeInventoryModelsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeInventoryModelsResult result = client.describeInventoryModels(
new DescribeInventoryModelsRequest()
.withNamespaceName("namespace-0001")
);
List<InventoryModel> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeInventoryModelsResult> asyncResult = null;
yield return client.DescribeInventoryModels(
new Gs2.Gs2Inventory.Request.DescribeInventoryModelsRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeInventoryModels(
new Gs2Inventory.DescribeInventoryModelsRequest()
.withNamespaceName("namespace-0001")
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_inventory_models(
inventory.DescribeInventoryModelsRequest()
.with_namespace_name('namespace-0001')
)
items = result.items
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.describe_inventory_models({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;client = gs2('inventory')
api_result_handler = client.describe_inventory_models_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;getInventoryModel
インベントリモデルを取得
初期容量・最大容量、アイテム保護設定、および関連するすべてのアイテムモデルを含む、特定のアクティブなインベントリモデルを取得します。
アイテムモデルは、このインベントリ内でのアイテムの格納方法(スタック制限、複数スタック許可、ソート値)を定義します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | InventoryModel | インベントリモデル |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetInventoryModel(
&inventory.GetInventoryModelRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetInventoryModelRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getInventoryModel(
(new GetInventoryModelRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetInventoryModelRequest;
import io.gs2.inventory.result.GetInventoryModelResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetInventoryModelResult result = client.getInventoryModel(
new GetInventoryModelRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
InventoryModel item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetInventoryModelResult> asyncResult = null;
yield return client.GetInventoryModel(
new Gs2.Gs2Inventory.Request.GetInventoryModelRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getInventoryModel(
new Gs2Inventory.GetInventoryModelRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_inventory_model(
inventory.GetInventoryModelRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_inventory_model({
namespaceName="namespace-0001",
inventoryName="item",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_inventory_model_async({
namespaceName="namespace-0001",
inventoryName="item",
})
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['errorMessage'])
end
result = api_result.result
item = result.item;describeItemModels
アイテムモデルの一覧を取得
指定されたインベントリモデルに属する、現在アクティブなアイテムモデルのリストを取得します。
各アイテムモデルは、スタック制限(スタックあたりの最大数量)、複数スタックの許可有無、および表示順序のソート値を定義します。
これらはマスターデータの更新プロセスを通じて有効化されたモデルです。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<ItemModel> | アイテムモデルのリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeItemModels(
&inventory.DescribeItemModelsRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Itemsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeItemModelsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeItemModels(
(new DescribeItemModelsRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeItemModelsRequest;
import io.gs2.inventory.result.DescribeItemModelsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeItemModelsResult result = client.describeItemModels(
new DescribeItemModelsRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
List<ItemModel> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeItemModelsResult> asyncResult = null;
yield return client.DescribeItemModels(
new Gs2.Gs2Inventory.Request.DescribeItemModelsRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeItemModels(
new Gs2Inventory.DescribeItemModelsRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_item_models(
inventory.DescribeItemModelsRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
)
items = result.items
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.describe_item_models({
namespaceName="namespace-0001",
inventoryName="item",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;client = gs2('inventory')
api_result_handler = client.describe_item_models_async({
namespaceName="namespace-0001",
inventoryName="item",
})
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['errorMessage'])
end
result = api_result.result
items = result.items;getItemModel
アイテムモデルを取得
スタック制限、複数スタック許可、ソート値、その他の設定を含む、特定のアクティブなアイテムモデルを取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | ItemModel |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetItemModel(
&inventory.GetItemModelRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
ItemName: pointy.String("item-master-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetItemModelRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getItemModel(
(new GetItemModelRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withItemName("item-master-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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetItemModelRequest;
import io.gs2.inventory.result.GetItemModelResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetItemModelResult result = client.getItemModel(
new GetItemModelRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
ItemModel item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetItemModelResult> asyncResult = null;
yield return client.GetItemModel(
new Gs2.Gs2Inventory.Request.GetItemModelRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithItemName("item-master-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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getItemModel(
new Gs2Inventory.GetItemModelRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_item_model(
inventory.GetItemModelRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_item_name('item-master-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_item_model({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_item_model_async({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-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['errorMessage'])
end
result = api_result.result
item = result.item;describeSimpleInventoryModels
シンプルインベントリモデルの一覧を取得
ネームスペース内で現在アクティブなシンプルインベントリモデルのリストを取得します。
シンプルインベントリモデルは、容量制限、有効期限、参照を持たない簡素化されたアイテム管理システムを提供し、アイテムは名前と数量のペアとして追跡されます。
各モデルには関連するシンプルアイテムモデルが含まれます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<SimpleInventoryModel> | シンプルインベントリモデルのリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeSimpleInventoryModels(
&inventory.DescribeSimpleInventoryModelsRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Itemsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeSimpleInventoryModelsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeSimpleInventoryModels(
(new DescribeSimpleInventoryModelsRequest())
->withNamespaceName("namespace-0001")
);
$items = $result->getItems();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeSimpleInventoryModelsRequest;
import io.gs2.inventory.result.DescribeSimpleInventoryModelsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeSimpleInventoryModelsResult result = client.describeSimpleInventoryModels(
new DescribeSimpleInventoryModelsRequest()
.withNamespaceName("namespace-0001")
);
List<SimpleInventoryModel> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeSimpleInventoryModelsResult> asyncResult = null;
yield return client.DescribeSimpleInventoryModels(
new Gs2.Gs2Inventory.Request.DescribeSimpleInventoryModelsRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeSimpleInventoryModels(
new Gs2Inventory.DescribeSimpleInventoryModelsRequest()
.withNamespaceName("namespace-0001")
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_simple_inventory_models(
inventory.DescribeSimpleInventoryModelsRequest()
.with_namespace_name('namespace-0001')
)
items = result.items
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.describe_simple_inventory_models({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;client = gs2('inventory')
api_result_handler = client.describe_simple_inventory_models_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;getSimpleInventoryModel
シンプルインベントリモデルを取得
関連するシンプルアイテムモデルを含む、特定のアクティブなシンプルインベントリモデルを取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleInventoryModel | シンプルインベントリモデル |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetSimpleInventoryModel(
&inventory.GetSimpleInventoryModelRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetSimpleInventoryModelRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getSimpleInventoryModel(
(new GetSimpleInventoryModelRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetSimpleInventoryModelRequest;
import io.gs2.inventory.result.GetSimpleInventoryModelResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetSimpleInventoryModelResult result = client.getSimpleInventoryModel(
new GetSimpleInventoryModelRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
SimpleInventoryModel item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetSimpleInventoryModelResult> asyncResult = null;
yield return client.GetSimpleInventoryModel(
new Gs2.Gs2Inventory.Request.GetSimpleInventoryModelRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getSimpleInventoryModel(
new Gs2Inventory.GetSimpleInventoryModelRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_simple_inventory_model(
inventory.GetSimpleInventoryModelRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_simple_inventory_model({
namespaceName="namespace-0001",
inventoryName="item",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_simple_inventory_model_async({
namespaceName="namespace-0001",
inventoryName="item",
})
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['errorMessage'])
end
result = api_result.result
item = result.item;describeSimpleItemModels
シンプルアイテムモデルの一覧を取得
指定されたシンプルインベントリモデルに属する、現在アクティブなシンプルアイテムモデルのリストを取得します。
シンプルアイテムモデルは、スタック制限、有効期限、参照を持たない名前と数量のペアとして追跡されるアイテムタイプを定義します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<SimpleItemModel> | シンプルアイテムモデルのリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeSimpleItemModels(
&inventory.DescribeSimpleItemModelsRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Itemsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeSimpleItemModelsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeSimpleItemModels(
(new DescribeSimpleItemModelsRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeSimpleItemModelsRequest;
import io.gs2.inventory.result.DescribeSimpleItemModelsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeSimpleItemModelsResult result = client.describeSimpleItemModels(
new DescribeSimpleItemModelsRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
List<SimpleItemModel> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeSimpleItemModelsResult> asyncResult = null;
yield return client.DescribeSimpleItemModels(
new Gs2.Gs2Inventory.Request.DescribeSimpleItemModelsRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeSimpleItemModels(
new Gs2Inventory.DescribeSimpleItemModelsRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_simple_item_models(
inventory.DescribeSimpleItemModelsRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
)
items = result.items
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.describe_simple_item_models({
namespaceName="namespace-0001",
inventoryName="item",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;client = gs2('inventory')
api_result_handler = client.describe_simple_item_models_async({
namespaceName="namespace-0001",
inventoryName="item",
})
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['errorMessage'])
end
result = api_result.result
items = result.items;getSimpleItemModel
シンプルアイテムモデルを取得
特定のアクティブなシンプルアイテムモデルとその設定を取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| itemName | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 シンプルアイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleItemModel |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetSimpleItemModel(
&inventory.GetSimpleItemModelRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
ItemName: pointy.String("item-master-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetSimpleItemModelRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getSimpleItemModel(
(new GetSimpleItemModelRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withItemName("item-master-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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetSimpleItemModelRequest;
import io.gs2.inventory.result.GetSimpleItemModelResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetSimpleItemModelResult result = client.getSimpleItemModel(
new GetSimpleItemModelRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
SimpleItemModel item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetSimpleItemModelResult> asyncResult = null;
yield return client.GetSimpleItemModel(
new Gs2.Gs2Inventory.Request.GetSimpleItemModelRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithItemName("item-master-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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getSimpleItemModel(
new Gs2Inventory.GetSimpleItemModelRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_simple_item_model(
inventory.GetSimpleItemModelRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_item_name('item-master-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_simple_item_model({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_simple_item_model_async({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-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['errorMessage'])
end
result = api_result.result
item = result.item;describeBigInventoryModels
巨大インベントリモデルの一覧を取得
ネームスペース内で現在アクティブな巨大インベントリモデルのリストを取得します。
巨大インベントリモデルは、標準的な整数の限界を超える極めて大きな数量が必要なゲーム向けに、文字列ベースの数値を使用した任意精度のアイテム数量をサポートします。
各モデルには関連する巨大アイテムモデルが含まれます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<BigInventoryModel> | 巨大インベントリモデルのリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeBigInventoryModels(
&inventory.DescribeBigInventoryModelsRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Itemsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeBigInventoryModelsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeBigInventoryModels(
(new DescribeBigInventoryModelsRequest())
->withNamespaceName("namespace-0001")
);
$items = $result->getItems();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeBigInventoryModelsRequest;
import io.gs2.inventory.result.DescribeBigInventoryModelsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeBigInventoryModelsResult result = client.describeBigInventoryModels(
new DescribeBigInventoryModelsRequest()
.withNamespaceName("namespace-0001")
);
List<BigInventoryModel> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeBigInventoryModelsResult> asyncResult = null;
yield return client.DescribeBigInventoryModels(
new Gs2.Gs2Inventory.Request.DescribeBigInventoryModelsRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeBigInventoryModels(
new Gs2Inventory.DescribeBigInventoryModelsRequest()
.withNamespaceName("namespace-0001")
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_big_inventory_models(
inventory.DescribeBigInventoryModelsRequest()
.with_namespace_name('namespace-0001')
)
items = result.items
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.describe_big_inventory_models({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;client = gs2('inventory')
api_result_handler = client.describe_big_inventory_models_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;getBigInventoryModel
巨大インベントリモデルを取得
関連する巨大アイテムモデルを含む、特定のアクティブな巨大インベントリモデルを取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigInventoryModel | 巨大インベントリモデル |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetBigInventoryModel(
&inventory.GetBigInventoryModelRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetBigInventoryModelRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getBigInventoryModel(
(new GetBigInventoryModelRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetBigInventoryModelRequest;
import io.gs2.inventory.result.GetBigInventoryModelResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetBigInventoryModelResult result = client.getBigInventoryModel(
new GetBigInventoryModelRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
BigInventoryModel item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetBigInventoryModelResult> asyncResult = null;
yield return client.GetBigInventoryModel(
new Gs2.Gs2Inventory.Request.GetBigInventoryModelRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getBigInventoryModel(
new Gs2Inventory.GetBigInventoryModelRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_big_inventory_model(
inventory.GetBigInventoryModelRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_big_inventory_model({
namespaceName="namespace-0001",
inventoryName="item",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_big_inventory_model_async({
namespaceName="namespace-0001",
inventoryName="item",
})
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['errorMessage'])
end
result = api_result.result
item = result.item;describeBigItemModels
巨大アイテムモデルの一覧を取得
指定された巨大インベントリモデルに属する、現在アクティブな巨大アイテムモデルのリストを取得します。
巨大アイテムモデルは、文字列ベースの任意精度数量を使用するアイテムタイプを定義します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<BigItemModel> | 巨大アイテムモデルのリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeBigItemModels(
&inventory.DescribeBigItemModelsRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Itemsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeBigItemModelsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeBigItemModels(
(new DescribeBigItemModelsRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeBigItemModelsRequest;
import io.gs2.inventory.result.DescribeBigItemModelsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeBigItemModelsResult result = client.describeBigItemModels(
new DescribeBigItemModelsRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
List<BigItemModel> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeBigItemModelsResult> asyncResult = null;
yield return client.DescribeBigItemModels(
new Gs2.Gs2Inventory.Request.DescribeBigItemModelsRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeBigItemModels(
new Gs2Inventory.DescribeBigItemModelsRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_big_item_models(
inventory.DescribeBigItemModelsRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
)
items = result.items
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.describe_big_item_models({
namespaceName="namespace-0001",
inventoryName="item",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;client = gs2('inventory')
api_result_handler = client.describe_big_item_models_async({
namespaceName="namespace-0001",
inventoryName="item",
})
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['errorMessage'])
end
result = api_result.result
items = result.items;getBigItemModel
巨大アイテムモデルを取得
特定のアクティブな巨大アイテムモデルとその設定を取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| itemName | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 巨大アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigItemModel |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetBigItemModel(
&inventory.GetBigItemModelRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
ItemName: pointy.String("item-master-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetBigItemModelRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getBigItemModel(
(new GetBigItemModelRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withItemName("item-master-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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetBigItemModelRequest;
import io.gs2.inventory.result.GetBigItemModelResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetBigItemModelResult result = client.getBigItemModel(
new GetBigItemModelRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
BigItemModel item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetBigItemModelResult> asyncResult = null;
yield return client.GetBigItemModel(
new Gs2.Gs2Inventory.Request.GetBigItemModelRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithItemName("item-master-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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getBigItemModel(
new Gs2Inventory.GetBigItemModelRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_big_item_model(
inventory.GetBigItemModelRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_item_name('item-master-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_big_item_model({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_big_item_model_async({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-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['errorMessage'])
end
result = api_result.result
item = result.item;exportMaster
アイテムモデルマスターを有効化可能なマスターデータ形式でエクスポート
ネームスペースから現在のインベントリモデルマスター、アイテムモデルマスター、シンプルインベントリ/アイテムモデルマスター、巨大インベントリ/アイテムモデルマスターをJSON形式でエクスポートします。
エクスポートされたデータは、変更を有効化するためのマスターデータ更新APIの入力として使用できます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | CurrentItemModelMaster | 有効化可能なアイテムモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.ExportMaster(
&inventory.ExportMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\ExportMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->exportMaster(
(new ExportMasterRequest())
->withNamespaceName("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.ExportMasterRequest;
import io.gs2.inventory.result.ExportMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
ExportMasterResult result = client.exportMaster(
new ExportMasterRequest()
.withNamespaceName("namespace-0001")
);
CurrentItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.ExportMasterResult> asyncResult = null;
yield return client.ExportMaster(
new Gs2.Gs2Inventory.Request.ExportMasterRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.exportMaster(
new Gs2Inventory.ExportMasterRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.export_master(
inventory.ExportMasterRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.export_master({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.export_master_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getCurrentItemModelMaster
現在アクティブなアイテムモデルのマスターデータを取得
ネームスペースで最後に有効化されたマスターデータを取得します。
サービスで現在使用されているすべてのインベントリモデル(標準、シンプル、巨大)とその関連アイテムモデルが含まれます。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | CurrentItemModelMaster | 現在アクティブなアイテムモデルのマスターデータ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetCurrentItemModelMaster(
&inventory.GetCurrentItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetCurrentItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getCurrentItemModelMaster(
(new GetCurrentItemModelMasterRequest())
->withNamespaceName("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetCurrentItemModelMasterRequest;
import io.gs2.inventory.result.GetCurrentItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetCurrentItemModelMasterResult result = client.getCurrentItemModelMaster(
new GetCurrentItemModelMasterRequest()
.withNamespaceName("namespace-0001")
);
CurrentItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetCurrentItemModelMasterResult> asyncResult = null;
yield return client.GetCurrentItemModelMaster(
new Gs2.Gs2Inventory.Request.GetCurrentItemModelMasterRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getCurrentItemModelMaster(
new Gs2Inventory.GetCurrentItemModelMasterRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_current_item_model_master(
inventory.GetCurrentItemModelMasterRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_current_item_model_master({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_current_item_model_master_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;preUpdateCurrentItemModelMaster
現在アクティブなアイテムモデルのマスターデータを更新(3フェーズ版)
1MBを超えるマスターデータをアップロードする場合は、3フェーズで更新を行います。
- このAPIを実行し、アップロード用のトークンとURLを取得します。
- 取得したURLに対して、マスターデータをアップロードします。
- UpdateCurrentModelMaster にアップロードで取得したトークンを渡して実行し、マスターデータを反映します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| uploadToken | string | アップロード後に結果を反映する際に使用するトークン |
| uploadUrl | string | アップロード処理の実行に使用するURL |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.PreUpdateCurrentItemModelMaster(
&inventory.PreUpdateCurrentItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\PreUpdateCurrentItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->preUpdateCurrentItemModelMaster(
(new PreUpdateCurrentItemModelMasterRequest())
->withNamespaceName("namespace-0001")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.PreUpdateCurrentItemModelMasterRequest;
import io.gs2.inventory.result.PreUpdateCurrentItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
PreUpdateCurrentItemModelMasterResult result = client.preUpdateCurrentItemModelMaster(
new PreUpdateCurrentItemModelMasterRequest()
.withNamespaceName("namespace-0001")
);
String uploadToken = result.getUploadToken();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.PreUpdateCurrentItemModelMasterResult> asyncResult = null;
yield return client.PreUpdateCurrentItemModelMaster(
new Gs2.Gs2Inventory.Request.PreUpdateCurrentItemModelMasterRequest()
.WithNamespaceName("namespace-0001"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.preUpdateCurrentItemModelMaster(
new Gs2Inventory.PreUpdateCurrentItemModelMasterRequest()
.withNamespaceName("namespace-0001")
);
const uploadToken = result.getUploadToken();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.pre_update_current_item_model_master(
inventory.PreUpdateCurrentItemModelMasterRequest()
.with_namespace_name('namespace-0001')
)
upload_token = result.upload_token
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.pre_update_current_item_model_master({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;client = gs2('inventory')
api_result_handler = client.pre_update_current_item_model_master_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;updateCurrentItemModelMaster
現在アクティブなアイテムモデルのマスターデータを更新
現在アクティブなインベントリおよびアイテムモデル定義を置き換える新しいマスターデータを有効化します。
2つのモードをサポート: ‘direct’(1MB未満のデータに適したインライン形式)、‘preUpload’(事前アップロードAPIでアップロードされたデータ用)。
有効化後、すべてのインベントリ操作は新しいモデル定義を使用します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||
| mode | 文字列列挙型 enum { “direct”, “preUpload” } | “direct” | 更新モード
| |||||||||
| settings | string | {mode} == “direct” | ✓※ | ~ 5242880文字 | マスターデータ ※ mode が “direct” であれば必須 | |||||||
| uploadToken | string | {mode} == “preUpload” | ✓※ | ~ 1024文字 | 事前アップロードで取得したトークン アップロードしたマスターデータを適用するために使用されます。 ※ mode が “preUpload” であれば必須 |
Result
| 型 | 説明 | |
|---|---|---|
| item | CurrentItemModelMaster | 更新された現在アクティブなアイテムモデルのマスターデータ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.UpdateCurrentItemModelMaster(
&inventory.UpdateCurrentItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
Mode: pointy.String("direct"),
Settings: pointy.String("{\"version\": \"2019-02-05\", \"inventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"initialCapacity\": 100, \"maxCapacity\": 999, \"itemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\", \"stackingLimit\": 99, \"allowMultipleStacks\": false, \"sortValue\": 1}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\", \"stackingLimit\": 49, \"allowMultipleStacks\": true, \"sortValue\": 2}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\", \"stackingLimit\": 9, \"allowMultipleStacks\": false, \"sortValue\": 3}]}, {\"name\": \"character\", \"metadata\": \"INVENTORY_CHARACTER\", \"initialCapacity\": 50, \"maxCapacity\": 99, \"itemModels\": [{\"name\": \"character-0001\", \"metadata\": \"CHARACTER_0001\", \"stackingLimit\": 99, \"allowMultipleStacks\": false, \"sortValue\": 1}, {\"name\": \"character-0002\", \"metadata\": \"CHARACTER_0002\", \"stackingLimit\": 49, \"allowMultipleStacks\": true, \"sortValue\": 2}, {\"name\": \"character-0003\", \"metadata\": \"CHARACTER_0003\", \"stackingLimit\": 9, \"allowMultipleStacks\": false, \"sortValue\": 3}]}], \"simpleInventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"simpleItemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\"}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\"}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\"}]}], \"bigInventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"bigItemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\"}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\"}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\"}]}]}"),
UploadToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\UpdateCurrentItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->updateCurrentItemModelMaster(
(new UpdateCurrentItemModelMasterRequest())
->withNamespaceName("namespace-0001")
->withMode("direct")
->withSettings("{\"version\": \"2019-02-05\", \"inventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"initialCapacity\": 100, \"maxCapacity\": 999, \"itemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\", \"stackingLimit\": 99, \"allowMultipleStacks\": false, \"sortValue\": 1}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\", \"stackingLimit\": 49, \"allowMultipleStacks\": true, \"sortValue\": 2}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\", \"stackingLimit\": 9, \"allowMultipleStacks\": false, \"sortValue\": 3}]}, {\"name\": \"character\", \"metadata\": \"INVENTORY_CHARACTER\", \"initialCapacity\": 50, \"maxCapacity\": 99, \"itemModels\": [{\"name\": \"character-0001\", \"metadata\": \"CHARACTER_0001\", \"stackingLimit\": 99, \"allowMultipleStacks\": false, \"sortValue\": 1}, {\"name\": \"character-0002\", \"metadata\": \"CHARACTER_0002\", \"stackingLimit\": 49, \"allowMultipleStacks\": true, \"sortValue\": 2}, {\"name\": \"character-0003\", \"metadata\": \"CHARACTER_0003\", \"stackingLimit\": 9, \"allowMultipleStacks\": false, \"sortValue\": 3}]}], \"simpleInventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"simpleItemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\"}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\"}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\"}]}], \"bigInventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"bigItemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\"}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\"}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\"}]}]}")
->withUploadToken(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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.UpdateCurrentItemModelMasterRequest;
import io.gs2.inventory.result.UpdateCurrentItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
UpdateCurrentItemModelMasterResult result = client.updateCurrentItemModelMaster(
new UpdateCurrentItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withMode("direct")
.withSettings("{\"version\": \"2019-02-05\", \"inventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"initialCapacity\": 100, \"maxCapacity\": 999, \"itemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\", \"stackingLimit\": 99, \"allowMultipleStacks\": false, \"sortValue\": 1}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\", \"stackingLimit\": 49, \"allowMultipleStacks\": true, \"sortValue\": 2}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\", \"stackingLimit\": 9, \"allowMultipleStacks\": false, \"sortValue\": 3}]}, {\"name\": \"character\", \"metadata\": \"INVENTORY_CHARACTER\", \"initialCapacity\": 50, \"maxCapacity\": 99, \"itemModels\": [{\"name\": \"character-0001\", \"metadata\": \"CHARACTER_0001\", \"stackingLimit\": 99, \"allowMultipleStacks\": false, \"sortValue\": 1}, {\"name\": \"character-0002\", \"metadata\": \"CHARACTER_0002\", \"stackingLimit\": 49, \"allowMultipleStacks\": true, \"sortValue\": 2}, {\"name\": \"character-0003\", \"metadata\": \"CHARACTER_0003\", \"stackingLimit\": 9, \"allowMultipleStacks\": false, \"sortValue\": 3}]}], \"simpleInventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"simpleItemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\"}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\"}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\"}]}], \"bigInventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"bigItemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\"}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\"}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\"}]}]}")
.withUploadToken(null)
);
CurrentItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.UpdateCurrentItemModelMasterResult> asyncResult = null;
yield return client.UpdateCurrentItemModelMaster(
new Gs2.Gs2Inventory.Request.UpdateCurrentItemModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithMode("direct")
.WithSettings("{\"version\": \"2019-02-05\", \"inventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"initialCapacity\": 100, \"maxCapacity\": 999, \"itemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\", \"stackingLimit\": 99, \"allowMultipleStacks\": false, \"sortValue\": 1}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\", \"stackingLimit\": 49, \"allowMultipleStacks\": true, \"sortValue\": 2}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\", \"stackingLimit\": 9, \"allowMultipleStacks\": false, \"sortValue\": 3}]}, {\"name\": \"character\", \"metadata\": \"INVENTORY_CHARACTER\", \"initialCapacity\": 50, \"maxCapacity\": 99, \"itemModels\": [{\"name\": \"character-0001\", \"metadata\": \"CHARACTER_0001\", \"stackingLimit\": 99, \"allowMultipleStacks\": false, \"sortValue\": 1}, {\"name\": \"character-0002\", \"metadata\": \"CHARACTER_0002\", \"stackingLimit\": 49, \"allowMultipleStacks\": true, \"sortValue\": 2}, {\"name\": \"character-0003\", \"metadata\": \"CHARACTER_0003\", \"stackingLimit\": 9, \"allowMultipleStacks\": false, \"sortValue\": 3}]}], \"simpleInventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"simpleItemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\"}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\"}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\"}]}], \"bigInventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"bigItemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\"}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\"}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\"}]}]}")
.WithUploadToken(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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.updateCurrentItemModelMaster(
new Gs2Inventory.UpdateCurrentItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withMode("direct")
.withSettings("{\"version\": \"2019-02-05\", \"inventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"initialCapacity\": 100, \"maxCapacity\": 999, \"itemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\", \"stackingLimit\": 99, \"allowMultipleStacks\": false, \"sortValue\": 1}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\", \"stackingLimit\": 49, \"allowMultipleStacks\": true, \"sortValue\": 2}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\", \"stackingLimit\": 9, \"allowMultipleStacks\": false, \"sortValue\": 3}]}, {\"name\": \"character\", \"metadata\": \"INVENTORY_CHARACTER\", \"initialCapacity\": 50, \"maxCapacity\": 99, \"itemModels\": [{\"name\": \"character-0001\", \"metadata\": \"CHARACTER_0001\", \"stackingLimit\": 99, \"allowMultipleStacks\": false, \"sortValue\": 1}, {\"name\": \"character-0002\", \"metadata\": \"CHARACTER_0002\", \"stackingLimit\": 49, \"allowMultipleStacks\": true, \"sortValue\": 2}, {\"name\": \"character-0003\", \"metadata\": \"CHARACTER_0003\", \"stackingLimit\": 9, \"allowMultipleStacks\": false, \"sortValue\": 3}]}], \"simpleInventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"simpleItemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\"}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\"}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\"}]}], \"bigInventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"bigItemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\"}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\"}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\"}]}]}")
.withUploadToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.update_current_item_model_master(
inventory.UpdateCurrentItemModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_mode('direct')
.with_settings('{"version": "2019-02-05", "inventoryModels": [{"name": "item", "metadata": "INVENTORY_ITEM", "initialCapacity": 100, "maxCapacity": 999, "itemModels": [{"name": "item-0001", "metadata": "ITEM_0001", "stackingLimit": 99, "allowMultipleStacks": false, "sortValue": 1}, {"name": "item-0002", "metadata": "ITEM_0002", "stackingLimit": 49, "allowMultipleStacks": true, "sortValue": 2}, {"name": "item-0003", "metadata": "ITEM_0003", "stackingLimit": 9, "allowMultipleStacks": false, "sortValue": 3}]}, {"name": "character", "metadata": "INVENTORY_CHARACTER", "initialCapacity": 50, "maxCapacity": 99, "itemModels": [{"name": "character-0001", "metadata": "CHARACTER_0001", "stackingLimit": 99, "allowMultipleStacks": false, "sortValue": 1}, {"name": "character-0002", "metadata": "CHARACTER_0002", "stackingLimit": 49, "allowMultipleStacks": true, "sortValue": 2}, {"name": "character-0003", "metadata": "CHARACTER_0003", "stackingLimit": 9, "allowMultipleStacks": false, "sortValue": 3}]}], "simpleInventoryModels": [{"name": "item", "metadata": "INVENTORY_ITEM", "simpleItemModels": [{"name": "item-0001", "metadata": "ITEM_0001"}, {"name": "item-0002", "metadata": "ITEM_0002"}, {"name": "item-0003", "metadata": "ITEM_0003"}]}], "bigInventoryModels": [{"name": "item", "metadata": "INVENTORY_ITEM", "bigItemModels": [{"name": "item-0001", "metadata": "ITEM_0001"}, {"name": "item-0002", "metadata": "ITEM_0002"}, {"name": "item-0003", "metadata": "ITEM_0003"}]}]}')
.with_upload_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.update_current_item_model_master({
namespaceName="namespace-0001",
mode="direct",
settings="{\"version\": \"2019-02-05\", \"inventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"initialCapacity\": 100, \"maxCapacity\": 999, \"itemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\", \"stackingLimit\": 99, \"allowMultipleStacks\": false, \"sortValue\": 1}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\", \"stackingLimit\": 49, \"allowMultipleStacks\": true, \"sortValue\": 2}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\", \"stackingLimit\": 9, \"allowMultipleStacks\": false, \"sortValue\": 3}]}, {\"name\": \"character\", \"metadata\": \"INVENTORY_CHARACTER\", \"initialCapacity\": 50, \"maxCapacity\": 99, \"itemModels\": [{\"name\": \"character-0001\", \"metadata\": \"CHARACTER_0001\", \"stackingLimit\": 99, \"allowMultipleStacks\": false, \"sortValue\": 1}, {\"name\": \"character-0002\", \"metadata\": \"CHARACTER_0002\", \"stackingLimit\": 49, \"allowMultipleStacks\": true, \"sortValue\": 2}, {\"name\": \"character-0003\", \"metadata\": \"CHARACTER_0003\", \"stackingLimit\": 9, \"allowMultipleStacks\": false, \"sortValue\": 3}]}], \"simpleInventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"simpleItemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\"}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\"}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\"}]}], \"bigInventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"bigItemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\"}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\"}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\"}]}]}",
uploadToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.update_current_item_model_master_async({
namespaceName="namespace-0001",
mode="direct",
settings="{\"version\": \"2019-02-05\", \"inventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"initialCapacity\": 100, \"maxCapacity\": 999, \"itemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\", \"stackingLimit\": 99, \"allowMultipleStacks\": false, \"sortValue\": 1}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\", \"stackingLimit\": 49, \"allowMultipleStacks\": true, \"sortValue\": 2}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\", \"stackingLimit\": 9, \"allowMultipleStacks\": false, \"sortValue\": 3}]}, {\"name\": \"character\", \"metadata\": \"INVENTORY_CHARACTER\", \"initialCapacity\": 50, \"maxCapacity\": 99, \"itemModels\": [{\"name\": \"character-0001\", \"metadata\": \"CHARACTER_0001\", \"stackingLimit\": 99, \"allowMultipleStacks\": false, \"sortValue\": 1}, {\"name\": \"character-0002\", \"metadata\": \"CHARACTER_0002\", \"stackingLimit\": 49, \"allowMultipleStacks\": true, \"sortValue\": 2}, {\"name\": \"character-0003\", \"metadata\": \"CHARACTER_0003\", \"stackingLimit\": 9, \"allowMultipleStacks\": false, \"sortValue\": 3}]}], \"simpleInventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"simpleItemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\"}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\"}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\"}]}], \"bigInventoryModels\": [{\"name\": \"item\", \"metadata\": \"INVENTORY_ITEM\", \"bigItemModels\": [{\"name\": \"item-0001\", \"metadata\": \"ITEM_0001\"}, {\"name\": \"item-0002\", \"metadata\": \"ITEM_0002\"}, {\"name\": \"item-0003\", \"metadata\": \"ITEM_0003\"}]}]}",
uploadToken=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['errorMessage'])
end
result = api_result.result
item = result.item;updateCurrentItemModelMasterFromGitHub
現在アクティブなアイテムモデルのマスターデータをGitHubから更新
指定されたGitHubリポジトリからマスターデータを取得して有効化します。
チェックアウト設定でリポジトリ、ブランチ/タグ、取得するファイルパスを指定します。
マスターデータ内のテンプレート変数は有効化時に設定された値に置き換えられます。
Gitワークフローによるバージョン管理されたマスターデータ管理を可能にします。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| checkoutSetting | GitHubCheckoutSetting | ✓ | GitHubからマスターデータをチェックアウトする設定 |
Result
| 型 | 説明 | |
|---|---|---|
| item | CurrentItemModelMaster | 更新された現在アクティブなアイテムモデルのマスターデータ |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.UpdateCurrentItemModelMasterFromGitHub(
&inventory.UpdateCurrentItemModelMasterFromGitHubRequest {
NamespaceName: pointy.String("namespace-0001"),
CheckoutSetting: &inventory.GitHubCheckoutSetting{
ApiKeyId: pointy.String("apiKeyId-0001"),
RepositoryName: pointy.String("gs2io/master-data"),
SourcePath: pointy.String("path/to/file.json"),
ReferenceType: pointy.String("branch"),
BranchName: pointy.String("develop"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\UpdateCurrentItemModelMasterFromGitHubRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->updateCurrentItemModelMasterFromGitHub(
(new UpdateCurrentItemModelMasterFromGitHubRequest())
->withNamespaceName("namespace-0001")
->withCheckoutSetting((new GitHubCheckoutSetting())
->withApiKeyId("apiKeyId-0001")
->withRepositoryName("gs2io/master-data")
->withSourcePath("path/to/file.json")
->withReferenceType("branch")
->withBranchName("develop")
)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.UpdateCurrentItemModelMasterFromGitHubRequest;
import io.gs2.inventory.result.UpdateCurrentItemModelMasterFromGitHubResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
UpdateCurrentItemModelMasterFromGitHubResult result = client.updateCurrentItemModelMasterFromGitHub(
new UpdateCurrentItemModelMasterFromGitHubRequest()
.withNamespaceName("namespace-0001")
.withCheckoutSetting(new GitHubCheckoutSetting()
.withApiKeyId("apiKeyId-0001")
.withRepositoryName("gs2io/master-data")
.withSourcePath("path/to/file.json")
.withReferenceType("branch")
.withBranchName("develop")
)
);
CurrentItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.UpdateCurrentItemModelMasterFromGitHubResult> asyncResult = null;
yield return client.UpdateCurrentItemModelMasterFromGitHub(
new Gs2.Gs2Inventory.Request.UpdateCurrentItemModelMasterFromGitHubRequest()
.WithNamespaceName("namespace-0001")
.WithCheckoutSetting(new Gs2.Gs2Inventory.Model.GitHubCheckoutSetting()
.WithApiKeyId("apiKeyId-0001")
.WithRepositoryName("gs2io/master-data")
.WithSourcePath("path/to/file.json")
.WithReferenceType("branch")
.WithBranchName("develop")
),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.updateCurrentItemModelMasterFromGitHub(
new Gs2Inventory.UpdateCurrentItemModelMasterFromGitHubRequest()
.withNamespaceName("namespace-0001")
.withCheckoutSetting(new Gs2Inventory.model.GitHubCheckoutSetting()
.withApiKeyId("apiKeyId-0001")
.withRepositoryName("gs2io/master-data")
.withSourcePath("path/to/file.json")
.withReferenceType("branch")
.withBranchName("develop")
)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.update_current_item_model_master_from_git_hub(
inventory.UpdateCurrentItemModelMasterFromGitHubRequest()
.with_namespace_name('namespace-0001')
.with_checkout_setting(inventory.GitHubCheckoutSetting()
.with_api_key_id('apiKeyId-0001')
.with_repository_name('gs2io/master-data')
.with_source_path('path/to/file.json')
.with_reference_type('branch')
.with_branch_name('develop')
)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.update_current_item_model_master_from_git_hub({
namespaceName="namespace-0001",
checkoutSetting={
api_key_id="apiKeyId-0001",
repository_name="gs2io/master-data",
source_path="path/to/file.json",
reference_type="branch",
branch_name="develop",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.update_current_item_model_master_from_git_hub_async({
namespaceName="namespace-0001",
checkoutSetting={
api_key_id="apiKeyId-0001",
repository_name="gs2io/master-data",
source_path="path/to/file.json",
reference_type="branch",
branch_name="develop",
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;describeInventoryModelMasters
インベントリモデルマスターの一覧を取得
ネームスペース内の編集可能なインベントリモデルマスターのページネーション付きリストを取得します。
これらは有効化前に変更可能なドラフト定義です。各マスターはインベントリタイプの容量設定(initialCapacity、maxCapacity)とアイテム保護ルールを定義します。
名前の接頭辞によるオプションのフィルタリングをサポートします。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| namePrefix | string | ~ 64文字 | インベントリモデル名のフィルター接頭辞 | |||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<InventoryModelMaster> | インベントリモデルマスターのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeInventoryModelMasters(
&inventory.DescribeInventoryModelMastersRequest {
NamespaceName: pointy.String("namespace-0001"),
NamePrefix: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeInventoryModelMastersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeInventoryModelMasters(
(new DescribeInventoryModelMastersRequest())
->withNamespaceName("namespace-0001")
->withNamePrefix(null)
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeInventoryModelMastersRequest;
import io.gs2.inventory.result.DescribeInventoryModelMastersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeInventoryModelMastersResult result = client.describeInventoryModelMasters(
new DescribeInventoryModelMastersRequest()
.withNamespaceName("namespace-0001")
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
List<InventoryModelMaster> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeInventoryModelMastersResult> asyncResult = null;
yield return client.DescribeInventoryModelMasters(
new Gs2.Gs2Inventory.Request.DescribeInventoryModelMastersRequest()
.WithNamespaceName("namespace-0001")
.WithNamePrefix(null)
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeInventoryModelMasters(
new Gs2Inventory.DescribeInventoryModelMastersRequest()
.withNamespaceName("namespace-0001")
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_inventory_model_masters(
inventory.DescribeInventoryModelMastersRequest()
.with_namespace_name('namespace-0001')
.with_name_prefix(None)
.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('inventory')
api_result = client.describe_inventory_model_masters({
namespaceName="namespace-0001",
namePrefix=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_inventory_model_masters_async({
namespaceName="namespace-0001",
namePrefix=nil,
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['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;createInventoryModelMaster
インベントリモデルマスターを新規作成
新しいインベントリタイプを定義する編集可能なインベントリモデルマスターを作成します。
主な設定には、initialCapacity(新規ユーザーの初期アイテムスロット数)、maxCapacity(容量拡張の上限)、protectReferencedItem(有効にすると、アクティブな参照を持つアイテムの消費を防止)が含まれます。
作成したマスターは、マスターデータの更新プロセスを通じて有効化する必要があります。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| name | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 | |||
| initialCapacity | int | ✓ | 0 ~ 2147483646 | 初期サイズ インベントリが初めて作成される際にユーザーに提供されるインベントリ枠の数です。各枠には1つのアイテムスタックを格納できます。ユーザーはゲームプレイのアクションを通じてmaxCapacityまで容量を拡張できます。 | ||
| maxCapacity | int | ✓ | 0 ~ 2147483646 | 最大サイズ ユーザーが拡張可能なインベントリ枠の上限値です。この値を超えて容量を増やすことはできません。すべての枠が使用中でアイテムをこれ以上スタックできない場合、オーバーフロースクリプトが超過分を処理しない限り、入手は失敗します。 | ||
| protectReferencedItem | bool | false | 参照元保護 有効にすると、(referenceOf メカニズムで)参照元が登録されているアイテムセットは消費または削除できなくなります。他のシステムで使用中のアイテム(例:装備中のギア、編成にバインドされたアイテム)が誤って削除されることを防ぎます。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | InventoryModelMaster | 作成したインベントリモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.CreateInventoryModelMaster(
&inventory.CreateInventoryModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
Name: pointy.String("item"),
Description: nil,
Metadata: nil,
InitialCapacity: pointy.Int32(50),
MaxCapacity: pointy.Int32(100),
ProtectReferencedItem: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\CreateInventoryModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->createInventoryModelMaster(
(new CreateInventoryModelMasterRequest())
->withNamespaceName("namespace-0001")
->withName("item")
->withDescription(null)
->withMetadata(null)
->withInitialCapacity(50)
->withMaxCapacity(100)
->withProtectReferencedItem(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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.CreateInventoryModelMasterRequest;
import io.gs2.inventory.result.CreateInventoryModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
CreateInventoryModelMasterResult result = client.createInventoryModelMaster(
new CreateInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withName("item")
.withDescription(null)
.withMetadata(null)
.withInitialCapacity(50)
.withMaxCapacity(100)
.withProtectReferencedItem(null)
);
InventoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.CreateInventoryModelMasterResult> asyncResult = null;
yield return client.CreateInventoryModelMaster(
new Gs2.Gs2Inventory.Request.CreateInventoryModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithName("item")
.WithDescription(null)
.WithMetadata(null)
.WithInitialCapacity(50)
.WithMaxCapacity(100)
.WithProtectReferencedItem(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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.createInventoryModelMaster(
new Gs2Inventory.CreateInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withName("item")
.withDescription(null)
.withMetadata(null)
.withInitialCapacity(50)
.withMaxCapacity(100)
.withProtectReferencedItem(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.create_inventory_model_master(
inventory.CreateInventoryModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_name('item')
.with_description(None)
.with_metadata(None)
.with_initial_capacity(50)
.with_max_capacity(100)
.with_protect_referenced_item(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.create_inventory_model_master({
namespaceName="namespace-0001",
name="item",
description=nil,
metadata=nil,
initialCapacity=50,
maxCapacity=100,
protectReferencedItem=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.create_inventory_model_master_async({
namespaceName="namespace-0001",
name="item",
description=nil,
metadata=nil,
initialCapacity=50,
maxCapacity=100,
protectReferencedItem=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['errorMessage'])
end
result = api_result.result
item = result.item;getInventoryModelMaster
インベントリモデルマスターを取得
容量設定、メタデータ、アイテム保護ルールを含む、特定の編集可能なインベントリモデルマスターの完全な設定を取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | InventoryModelMaster | インベントリモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetInventoryModelMaster(
&inventory.GetInventoryModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetInventoryModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getInventoryModelMaster(
(new GetInventoryModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetInventoryModelMasterRequest;
import io.gs2.inventory.result.GetInventoryModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetInventoryModelMasterResult result = client.getInventoryModelMaster(
new GetInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
InventoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetInventoryModelMasterResult> asyncResult = null;
yield return client.GetInventoryModelMaster(
new Gs2.Gs2Inventory.Request.GetInventoryModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getInventoryModelMaster(
new Gs2Inventory.GetInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_inventory_model_master(
inventory.GetInventoryModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_inventory_model_master({
namespaceName="namespace-0001",
inventoryName="item",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_inventory_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
})
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['errorMessage'])
end
result = api_result.result
item = result.item;updateInventoryModelMaster
インベントリモデルマスターを更新
容量設定(initialCapacity、maxCapacity)、メタデータ、protectReferencedItem を含む既存のインベントリモデルマスターのプロパティを更新します。
変更は、マスターデータの更新プロセスを通じて再有効化するまで反映されません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 | |||
| initialCapacity | int | ✓ | 0 ~ 2147483646 | 初期サイズ インベントリが初めて作成される際にユーザーに提供されるインベントリ枠の数です。各枠には1つのアイテムスタックを格納できます。ユーザーはゲームプレイのアクションを通じてmaxCapacityまで容量を拡張できます。 | ||
| maxCapacity | int | ✓ | 0 ~ 2147483646 | 最大サイズ ユーザーが拡張可能なインベントリ枠の上限値です。この値を超えて容量を増やすことはできません。すべての枠が使用中でアイテムをこれ以上スタックできない場合、オーバーフロースクリプトが超過分を処理しない限り、入手は失敗します。 | ||
| protectReferencedItem | bool | false | 参照元保護 有効にすると、(referenceOf メカニズムで)参照元が登録されているアイテムセットは消費または削除できなくなります。他のシステムで使用中のアイテム(例:装備中のギア、編成にバインドされたアイテム)が誤って削除されることを防ぎます。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | InventoryModelMaster | 更新したインベントリモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.UpdateInventoryModelMaster(
&inventory.UpdateInventoryModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
Description: pointy.String("description1"),
Metadata: pointy.String("ITEM_INVENTORY_MASTER"),
InitialCapacity: pointy.Int32(150),
MaxCapacity: pointy.Int32(250),
ProtectReferencedItem: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\UpdateInventoryModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->updateInventoryModelMaster(
(new UpdateInventoryModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withDescription("description1")
->withMetadata("ITEM_INVENTORY_MASTER")
->withInitialCapacity(150)
->withMaxCapacity(250)
->withProtectReferencedItem(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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.UpdateInventoryModelMasterRequest;
import io.gs2.inventory.result.UpdateInventoryModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
UpdateInventoryModelMasterResult result = client.updateInventoryModelMaster(
new UpdateInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withDescription("description1")
.withMetadata("ITEM_INVENTORY_MASTER")
.withInitialCapacity(150)
.withMaxCapacity(250)
.withProtectReferencedItem(null)
);
InventoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.UpdateInventoryModelMasterResult> asyncResult = null;
yield return client.UpdateInventoryModelMaster(
new Gs2.Gs2Inventory.Request.UpdateInventoryModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithDescription("description1")
.WithMetadata("ITEM_INVENTORY_MASTER")
.WithInitialCapacity(150)
.WithMaxCapacity(250)
.WithProtectReferencedItem(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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.updateInventoryModelMaster(
new Gs2Inventory.UpdateInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withDescription("description1")
.withMetadata("ITEM_INVENTORY_MASTER")
.withInitialCapacity(150)
.withMaxCapacity(250)
.withProtectReferencedItem(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.update_inventory_model_master(
inventory.UpdateInventoryModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_description('description1')
.with_metadata('ITEM_INVENTORY_MASTER')
.with_initial_capacity(150)
.with_max_capacity(250)
.with_protect_referenced_item(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.update_inventory_model_master({
namespaceName="namespace-0001",
inventoryName="item",
description="description1",
metadata="ITEM_INVENTORY_MASTER",
initialCapacity=150,
maxCapacity=250,
protectReferencedItem=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.update_inventory_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
description="description1",
metadata="ITEM_INVENTORY_MASTER",
initialCapacity=150,
maxCapacity=250,
protectReferencedItem=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['errorMessage'])
end
result = api_result.result
item = result.item;deleteInventoryModelMaster
インベントリモデルマスターを削除
指定されたインベントリモデルマスターを削除します。
削除はマスターデータが再有効化されるまで、現在アクティブなモデルに影響しません。
このモデルに関連する既存のユーザーインベントリやアイテムは自動的には削除されません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | InventoryModelMaster | 削除したインベントリモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DeleteInventoryModelMaster(
&inventory.DeleteInventoryModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DeleteInventoryModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->deleteInventoryModelMaster(
(new DeleteInventoryModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DeleteInventoryModelMasterRequest;
import io.gs2.inventory.result.DeleteInventoryModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DeleteInventoryModelMasterResult result = client.deleteInventoryModelMaster(
new DeleteInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
InventoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DeleteInventoryModelMasterResult> asyncResult = null;
yield return client.DeleteInventoryModelMaster(
new Gs2.Gs2Inventory.Request.DeleteInventoryModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.deleteInventoryModelMaster(
new Gs2Inventory.DeleteInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_inventory_model_master(
inventory.DeleteInventoryModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.delete_inventory_model_master({
namespaceName="namespace-0001",
inventoryName="item",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.delete_inventory_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
})
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['errorMessage'])
end
result = api_result.result
item = result.item;describeItemModelMasters
アイテムモデルマスターの一覧を取得
指定されたインベントリモデルマスターに属する、編集可能なアイテムモデルマスターのページネーション付きリストを取得します。
これらは有効化前に変更可能なドラフト定義であり、インベントリ内のアイテムのスタック制限、複数スタック許可、ソート値を定義します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<ItemModelMaster> | アイテムモデルマスターのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeItemModelMasters(
&inventory.DescribeItemModelMastersRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeItemModelMastersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeItemModelMasters(
(new DescribeItemModelMastersRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeItemModelMastersRequest;
import io.gs2.inventory.result.DescribeItemModelMastersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeItemModelMastersResult result = client.describeItemModelMasters(
new DescribeItemModelMastersRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withPageToken(null)
.withLimit(null)
);
List<ItemModelMaster> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeItemModelMastersResult> asyncResult = null;
yield return client.DescribeItemModelMasters(
new Gs2.Gs2Inventory.Request.DescribeItemModelMastersRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeItemModelMasters(
new Gs2Inventory.DescribeItemModelMastersRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_item_model_masters(
inventory.DescribeItemModelMastersRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.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('inventory')
api_result = client.describe_item_model_masters({
namespaceName="namespace-0001",
inventoryName="item",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_item_model_masters_async({
namespaceName="namespace-0001",
inventoryName="item",
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['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;createItemModelMaster
アイテムモデルマスターを新規作成
指定されたインベントリ内の新しいアイテムタイプを定義する編集可能なアイテムモデルマスターを作成します。
主な設定には、stackingLimit(スタックあたりの最大数量)、allowMultipleStacks(同じアイテムが複数のインベントリスロットを占有できるかどうか)、sortValue(表示順序の優先度)が含まれます。
allowMultipleStacks が有効な場合、スタック制限を超えるアイテムの入手は失敗せず、追加の ItemSet エントリを作成します。
作成したマスターは、マスターデータの更新プロセスを通じて有効化する必要があります。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 このアイテムが属するインベントリモデルの名前です。このアイテムの種類を格納できるインベントリを決定し、インベントリの容量設定や保護設定と関連付けます。 | ||
| name | string | ✓ | ~ 128文字 | アイテムモデル名 アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ GS2-EnhanceにはGS2-Inventoryと連携して強化を行う処理があり、ItemModelのメタデータにJSON形式で、強化素材として使用した場合の経験値量を設定します。 詳細は マイクロサービス紹介 / GS2-Enhance の項で解説しています。 | |||
| stackingLimit | long | ✓ | 1 ~ 9223372036854775805 | スタック可能な最大数量 1つのインベントリ枠(スタック)に保持できるこのアイテムの最大数です。この上限に達した場合の動作はallowMultipleStacks設定に依存し、新しい枠が割り当てられるか、それ以上の入手がブロックされます。 | ||
| allowMultipleStacks | bool | ✓ | 複数スタック許可 有効にすると、スタック上限に達した場合に新しいインベントリ枠が自動的に割り当てられ、このアイテムの追加数量を格納します(追加の容量を消費します)。無効の場合、既存の枠でスタック上限に達すると入手がブロックされます。 | |||
| sortValue | int | ✓ | 0 ~ 2147483646 | 表示順番 インベントリ内のアイテムを表示用にソートするための数値です。値が小さいほど先に表示されます。この値はItemSetレコードにもコピーされ、所持アイテムの一貫した順序付けを可能にします。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | ItemModelMaster | 作成したアイテムモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.CreateItemModelMaster(
&inventory.CreateItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
Name: pointy.String("item-master-0001"),
Description: nil,
Metadata: nil,
StackingLimit: pointy.Int64(99),
AllowMultipleStacks: pointy.Bool(false),
SortValue: pointy.Int32(10),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\CreateItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->createItemModelMaster(
(new CreateItemModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withName("item-master-0001")
->withDescription(null)
->withMetadata(null)
->withStackingLimit(99)
->withAllowMultipleStacks(False)
->withSortValue(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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.CreateItemModelMasterRequest;
import io.gs2.inventory.result.CreateItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
CreateItemModelMasterResult result = client.createItemModelMaster(
new CreateItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withName("item-master-0001")
.withDescription(null)
.withMetadata(null)
.withStackingLimit(99L)
.withAllowMultipleStacks(false)
.withSortValue(10)
);
ItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.CreateItemModelMasterResult> asyncResult = null;
yield return client.CreateItemModelMaster(
new Gs2.Gs2Inventory.Request.CreateItemModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithName("item-master-0001")
.WithDescription(null)
.WithMetadata(null)
.WithStackingLimit(99L)
.WithAllowMultipleStacks(false)
.WithSortValue(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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.createItemModelMaster(
new Gs2Inventory.CreateItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withName("item-master-0001")
.withDescription(null)
.withMetadata(null)
.withStackingLimit(99)
.withAllowMultipleStacks(false)
.withSortValue(10)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.create_item_model_master(
inventory.CreateItemModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_name('item-master-0001')
.with_description(None)
.with_metadata(None)
.with_stacking_limit(99)
.with_allow_multiple_stacks(False)
.with_sort_value(10)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.create_item_model_master({
namespaceName="namespace-0001",
inventoryName="item",
name="item-master-0001",
description=nil,
metadata=nil,
stackingLimit=99,
allowMultipleStacks=false,
sortValue=10,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.create_item_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
name="item-master-0001",
description=nil,
metadata=nil,
stackingLimit=99,
allowMultipleStacks=false,
sortValue=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['errorMessage'])
end
result = api_result.result
item = result.item;getItemModelMaster
アイテムモデルマスターを取得
スタック制限、複数スタック許可、ソート値、メタデータを含む、特定の編集可能なアイテムモデルマスターの完全な設定を取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | ItemModelMaster | アイテムモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetItemModelMaster(
&inventory.GetItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
ItemName: pointy.String("item-master-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getItemModelMaster(
(new GetItemModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withItemName("item-master-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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetItemModelMasterRequest;
import io.gs2.inventory.result.GetItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetItemModelMasterResult result = client.getItemModelMaster(
new GetItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
ItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetItemModelMasterResult> asyncResult = null;
yield return client.GetItemModelMaster(
new Gs2.Gs2Inventory.Request.GetItemModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithItemName("item-master-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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getItemModelMaster(
new Gs2Inventory.GetItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_item_model_master(
inventory.GetItemModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_item_name('item-master-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_item_model_master({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_item_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-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['errorMessage'])
end
result = api_result.result
item = result.item;updateItemModelMaster
アイテムモデルマスターを更新
スタック制限、複数スタック許可、ソート値、メタデータを含む既存のアイテムモデルマスターのプロパティを更新します。
変更は、マスターデータの更新プロセスを通じて再有効化するまで反映されません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ GS2-EnhanceにはGS2-Inventoryと連携して強化を行う処理があり、ItemModelのメタデータにJSON形式で、強化素材として使用した場合の経験値量を設定します。 詳細は マイクロサービス紹介 / GS2-Enhance の項で解説しています。 | |||
| stackingLimit | long | ✓ | 1 ~ 9223372036854775805 | スタック可能な最大数量 1つのインベントリ枠(スタック)に保持できるこのアイテムの最大数です。この上限に達した場合の動作はallowMultipleStacks設定に依存し、新しい枠が割り当てられるか、それ以上の入手がブロックされます。 | ||
| allowMultipleStacks | bool | ✓ | 複数スタック許可 有効にすると、スタック上限に達した場合に新しいインベントリ枠が自動的に割り当てられ、このアイテムの追加数量を格納します(追加の容量を消費します)。無効の場合、既存の枠でスタック上限に達すると入手がブロックされます。 | |||
| sortValue | int | ✓ | 0 ~ 2147483646 | 表示順番 インベントリ内のアイテムを表示用にソートするための数値です。値が小さいほど先に表示されます。この値はItemSetレコードにもコピーされ、所持アイテムの一貫した順序付けを可能にします。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | ItemModelMaster | 更新したアイテムモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.UpdateItemModelMaster(
&inventory.UpdateItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
ItemName: pointy.String("item-master-0001"),
Description: pointy.String("description1"),
Metadata: pointy.String("ITEM_MASTER_0001"),
StackingLimit: pointy.Int64(49),
AllowMultipleStacks: pointy.Bool(true),
SortValue: pointy.Int32(30),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\UpdateItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->updateItemModelMaster(
(new UpdateItemModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withItemName("item-master-0001")
->withDescription("description1")
->withMetadata("ITEM_MASTER_0001")
->withStackingLimit(49)
->withAllowMultipleStacks(True)
->withSortValue(30)
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.UpdateItemModelMasterRequest;
import io.gs2.inventory.result.UpdateItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
UpdateItemModelMasterResult result = client.updateItemModelMaster(
new UpdateItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
.withDescription("description1")
.withMetadata("ITEM_MASTER_0001")
.withStackingLimit(49L)
.withAllowMultipleStacks(true)
.withSortValue(30)
);
ItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.UpdateItemModelMasterResult> asyncResult = null;
yield return client.UpdateItemModelMaster(
new Gs2.Gs2Inventory.Request.UpdateItemModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithItemName("item-master-0001")
.WithDescription("description1")
.WithMetadata("ITEM_MASTER_0001")
.WithStackingLimit(49L)
.WithAllowMultipleStacks(true)
.WithSortValue(30),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.updateItemModelMaster(
new Gs2Inventory.UpdateItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
.withDescription("description1")
.withMetadata("ITEM_MASTER_0001")
.withStackingLimit(49)
.withAllowMultipleStacks(true)
.withSortValue(30)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.update_item_model_master(
inventory.UpdateItemModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_item_name('item-master-0001')
.with_description('description1')
.with_metadata('ITEM_MASTER_0001')
.with_stacking_limit(49)
.with_allow_multiple_stacks(True)
.with_sort_value(30)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.update_item_model_master({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
description="description1",
metadata="ITEM_MASTER_0001",
stackingLimit=49,
allowMultipleStacks=true,
sortValue=30,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.update_item_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
description="description1",
metadata="ITEM_MASTER_0001",
stackingLimit=49,
allowMultipleStacks=true,
sortValue=30,
})
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['errorMessage'])
end
result = api_result.result
item = result.item;deleteItemModelMaster
アイテムモデルマスターを削除
指定されたアイテムモデルマスターを削除します。
削除はマスターデータが再有効化されるまで、現在アクティブなモデルに影響しません。
このモデルに関連する既存のユーザーアイテムは自動的には削除されません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | インベントリモデル名 インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| itemName | string | ✓ | ~ 128文字 | アイテムモデル名 アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | ItemModelMaster | 削除したアイテムモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DeleteItemModelMaster(
&inventory.DeleteItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
ItemName: pointy.String("item-master-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DeleteItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->deleteItemModelMaster(
(new DeleteItemModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withItemName("item-master-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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DeleteItemModelMasterRequest;
import io.gs2.inventory.result.DeleteItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DeleteItemModelMasterResult result = client.deleteItemModelMaster(
new DeleteItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
ItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DeleteItemModelMasterResult> asyncResult = null;
yield return client.DeleteItemModelMaster(
new Gs2.Gs2Inventory.Request.DeleteItemModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithItemName("item-master-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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.deleteItemModelMaster(
new Gs2Inventory.DeleteItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_item_model_master(
inventory.DeleteItemModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_item_name('item-master-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.delete_item_model_master({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.delete_item_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-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['errorMessage'])
end
result = api_result.result
item = result.item;describeSimpleInventoryModelMasters
シンプルインベントリモデルマスターの一覧を取得
ネームスペース内の編集可能なシンプルインベントリモデルマスターのページネーション付きリストを取得します。
これらはマスターデータの更新プロセスを通じた有効化前に変更可能なドラフト定義です。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| namePrefix | string | ~ 64文字 | シンプルインベントリモデル名のフィルター接頭辞 | |||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<SimpleInventoryModelMaster> | シンプルインベントリモデルマスターのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeSimpleInventoryModelMasters(
&inventory.DescribeSimpleInventoryModelMastersRequest {
NamespaceName: pointy.String("namespace-0001"),
NamePrefix: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeSimpleInventoryModelMastersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeSimpleInventoryModelMasters(
(new DescribeSimpleInventoryModelMastersRequest())
->withNamespaceName("namespace-0001")
->withNamePrefix(null)
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeSimpleInventoryModelMastersRequest;
import io.gs2.inventory.result.DescribeSimpleInventoryModelMastersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeSimpleInventoryModelMastersResult result = client.describeSimpleInventoryModelMasters(
new DescribeSimpleInventoryModelMastersRequest()
.withNamespaceName("namespace-0001")
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
List<SimpleInventoryModelMaster> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeSimpleInventoryModelMastersResult> asyncResult = null;
yield return client.DescribeSimpleInventoryModelMasters(
new Gs2.Gs2Inventory.Request.DescribeSimpleInventoryModelMastersRequest()
.WithNamespaceName("namespace-0001")
.WithNamePrefix(null)
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeSimpleInventoryModelMasters(
new Gs2Inventory.DescribeSimpleInventoryModelMastersRequest()
.withNamespaceName("namespace-0001")
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_simple_inventory_model_masters(
inventory.DescribeSimpleInventoryModelMastersRequest()
.with_namespace_name('namespace-0001')
.with_name_prefix(None)
.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('inventory')
api_result = client.describe_simple_inventory_model_masters({
namespaceName="namespace-0001",
namePrefix=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_simple_inventory_model_masters_async({
namespaceName="namespace-0001",
namePrefix=nil,
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['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;createSimpleInventoryModelMaster
シンプルインベントリモデルマスターを新規作成
編集可能なシンプルインベントリモデルマスターを作成します。
通常のインベントリモデルとは異なり、シンプルインベントリモデルには容量制限、アイテムの有効期限、参照管理がありません。
作成したマスターは、マスターデータの更新プロセスを通じて有効化する必要があります。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| name | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleInventoryModelMaster | 作成したシンプルインベントリモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.CreateSimpleInventoryModelMaster(
&inventory.CreateSimpleInventoryModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
Name: pointy.String("item"),
Description: nil,
Metadata: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\CreateSimpleInventoryModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->createSimpleInventoryModelMaster(
(new CreateSimpleInventoryModelMasterRequest())
->withNamespaceName("namespace-0001")
->withName("item")
->withDescription(null)
->withMetadata(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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.CreateSimpleInventoryModelMasterRequest;
import io.gs2.inventory.result.CreateSimpleInventoryModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
CreateSimpleInventoryModelMasterResult result = client.createSimpleInventoryModelMaster(
new CreateSimpleInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withName("item")
.withDescription(null)
.withMetadata(null)
);
SimpleInventoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.CreateSimpleInventoryModelMasterResult> asyncResult = null;
yield return client.CreateSimpleInventoryModelMaster(
new Gs2.Gs2Inventory.Request.CreateSimpleInventoryModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithName("item")
.WithDescription(null)
.WithMetadata(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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.createSimpleInventoryModelMaster(
new Gs2Inventory.CreateSimpleInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withName("item")
.withDescription(null)
.withMetadata(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.create_simple_inventory_model_master(
inventory.CreateSimpleInventoryModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_name('item')
.with_description(None)
.with_metadata(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.create_simple_inventory_model_master({
namespaceName="namespace-0001",
name="item",
description=nil,
metadata=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.create_simple_inventory_model_master_async({
namespaceName="namespace-0001",
name="item",
description=nil,
metadata=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['errorMessage'])
end
result = api_result.result
item = result.item;getSimpleInventoryModelMaster
シンプルインベントリモデルマスターを取得
特定の編集可能なシンプルインベントリモデルマスターの完全な設定を取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleInventoryModelMaster | シンプルインベントリモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetSimpleInventoryModelMaster(
&inventory.GetSimpleInventoryModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetSimpleInventoryModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getSimpleInventoryModelMaster(
(new GetSimpleInventoryModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetSimpleInventoryModelMasterRequest;
import io.gs2.inventory.result.GetSimpleInventoryModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetSimpleInventoryModelMasterResult result = client.getSimpleInventoryModelMaster(
new GetSimpleInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
SimpleInventoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetSimpleInventoryModelMasterResult> asyncResult = null;
yield return client.GetSimpleInventoryModelMaster(
new Gs2.Gs2Inventory.Request.GetSimpleInventoryModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getSimpleInventoryModelMaster(
new Gs2Inventory.GetSimpleInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_simple_inventory_model_master(
inventory.GetSimpleInventoryModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_simple_inventory_model_master({
namespaceName="namespace-0001",
inventoryName="item",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_simple_inventory_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
})
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['errorMessage'])
end
result = api_result.result
item = result.item;updateSimpleInventoryModelMaster
シンプルインベントリモデルマスターを更新
既存のシンプルインベントリモデルマスターのプロパティを更新します。
変更はマスターデータが再有効化されるまで反映されません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleInventoryModelMaster | 更新したシンプルインベントリモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.UpdateSimpleInventoryModelMaster(
&inventory.UpdateSimpleInventoryModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
Description: pointy.String("description1"),
Metadata: pointy.String("ITEM_INVENTORY_MASTER"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\UpdateSimpleInventoryModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->updateSimpleInventoryModelMaster(
(new UpdateSimpleInventoryModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withDescription("description1")
->withMetadata("ITEM_INVENTORY_MASTER")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.UpdateSimpleInventoryModelMasterRequest;
import io.gs2.inventory.result.UpdateSimpleInventoryModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
UpdateSimpleInventoryModelMasterResult result = client.updateSimpleInventoryModelMaster(
new UpdateSimpleInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withDescription("description1")
.withMetadata("ITEM_INVENTORY_MASTER")
);
SimpleInventoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.UpdateSimpleInventoryModelMasterResult> asyncResult = null;
yield return client.UpdateSimpleInventoryModelMaster(
new Gs2.Gs2Inventory.Request.UpdateSimpleInventoryModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithDescription("description1")
.WithMetadata("ITEM_INVENTORY_MASTER"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.updateSimpleInventoryModelMaster(
new Gs2Inventory.UpdateSimpleInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withDescription("description1")
.withMetadata("ITEM_INVENTORY_MASTER")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.update_simple_inventory_model_master(
inventory.UpdateSimpleInventoryModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_description('description1')
.with_metadata('ITEM_INVENTORY_MASTER')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.update_simple_inventory_model_master({
namespaceName="namespace-0001",
inventoryName="item",
description="description1",
metadata="ITEM_INVENTORY_MASTER",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.update_simple_inventory_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
description="description1",
metadata="ITEM_INVENTORY_MASTER",
})
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['errorMessage'])
end
result = api_result.result
item = result.item;deleteSimpleInventoryModelMaster
シンプルインベントリモデルマスターを削除
指定されたシンプルインベントリモデルマスターを削除します。
削除はマスターデータが再有効化されるまで、現在アクティブなモデルに影響しません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleInventoryModelMaster | 削除したシンプルインベントリモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DeleteSimpleInventoryModelMaster(
&inventory.DeleteSimpleInventoryModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DeleteSimpleInventoryModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->deleteSimpleInventoryModelMaster(
(new DeleteSimpleInventoryModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DeleteSimpleInventoryModelMasterRequest;
import io.gs2.inventory.result.DeleteSimpleInventoryModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DeleteSimpleInventoryModelMasterResult result = client.deleteSimpleInventoryModelMaster(
new DeleteSimpleInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
SimpleInventoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DeleteSimpleInventoryModelMasterResult> asyncResult = null;
yield return client.DeleteSimpleInventoryModelMaster(
new Gs2.Gs2Inventory.Request.DeleteSimpleInventoryModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.deleteSimpleInventoryModelMaster(
new Gs2Inventory.DeleteSimpleInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_simple_inventory_model_master(
inventory.DeleteSimpleInventoryModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.delete_simple_inventory_model_master({
namespaceName="namespace-0001",
inventoryName="item",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.delete_simple_inventory_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
})
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['errorMessage'])
end
result = api_result.result
item = result.item;describeSimpleItemModelMasters
シンプルアイテムモデルマスターの一覧を取得
指定されたシンプルインベントリモデルマスターに属する、編集可能なシンプルアイテムモデルマスターのページネーション付きリストを取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| namePrefix | string | ~ 64文字 | シンプルアイテムモデル名のフィルター接頭辞 | |||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<SimpleItemModelMaster> | シンプルアイテムモデルマスターのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeSimpleItemModelMasters(
&inventory.DescribeSimpleItemModelMastersRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
NamePrefix: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeSimpleItemModelMastersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeSimpleItemModelMasters(
(new DescribeSimpleItemModelMastersRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withNamePrefix(null)
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeSimpleItemModelMastersRequest;
import io.gs2.inventory.result.DescribeSimpleItemModelMastersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeSimpleItemModelMastersResult result = client.describeSimpleItemModelMasters(
new DescribeSimpleItemModelMastersRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
List<SimpleItemModelMaster> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeSimpleItemModelMastersResult> asyncResult = null;
yield return client.DescribeSimpleItemModelMasters(
new Gs2.Gs2Inventory.Request.DescribeSimpleItemModelMastersRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithNamePrefix(null)
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeSimpleItemModelMasters(
new Gs2Inventory.DescribeSimpleItemModelMastersRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_simple_item_model_masters(
inventory.DescribeSimpleItemModelMastersRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_name_prefix(None)
.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('inventory')
api_result = client.describe_simple_item_model_masters({
namespaceName="namespace-0001",
inventoryName="item",
namePrefix=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_simple_item_model_masters_async({
namespaceName="namespace-0001",
inventoryName="item",
namePrefix=nil,
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['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;createSimpleItemModelMaster
シンプルアイテムモデルマスターを新規作成
指定されたシンプルインベントリ内の新しいアイテムタイプを定義する編集可能なシンプルアイテムモデルマスターを作成します。
作成したマスターは、マスターデータの更新プロセスを通じて有効化する必要があります。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| name | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 シンプルアイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleItemModelMaster | 作成したシンプルアイテムモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.CreateSimpleItemModelMaster(
&inventory.CreateSimpleItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
Name: pointy.String("item-master-0001"),
Description: nil,
Metadata: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\CreateSimpleItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->createSimpleItemModelMaster(
(new CreateSimpleItemModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withName("item-master-0001")
->withDescription(null)
->withMetadata(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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.CreateSimpleItemModelMasterRequest;
import io.gs2.inventory.result.CreateSimpleItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
CreateSimpleItemModelMasterResult result = client.createSimpleItemModelMaster(
new CreateSimpleItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withName("item-master-0001")
.withDescription(null)
.withMetadata(null)
);
SimpleItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.CreateSimpleItemModelMasterResult> asyncResult = null;
yield return client.CreateSimpleItemModelMaster(
new Gs2.Gs2Inventory.Request.CreateSimpleItemModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithName("item-master-0001")
.WithDescription(null)
.WithMetadata(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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.createSimpleItemModelMaster(
new Gs2Inventory.CreateSimpleItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withName("item-master-0001")
.withDescription(null)
.withMetadata(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.create_simple_item_model_master(
inventory.CreateSimpleItemModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_name('item-master-0001')
.with_description(None)
.with_metadata(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.create_simple_item_model_master({
namespaceName="namespace-0001",
inventoryName="item",
name="item-master-0001",
description=nil,
metadata=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.create_simple_item_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
name="item-master-0001",
description=nil,
metadata=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['errorMessage'])
end
result = api_result.result
item = result.item;getSimpleItemModelMaster
シンプルアイテムモデルマスターを取得
特定の編集可能なシンプルアイテムモデルマスターの完全な設定を取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| itemName | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 シンプルアイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleItemModelMaster | シンプルアイテムモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetSimpleItemModelMaster(
&inventory.GetSimpleItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
ItemName: pointy.String("item-master-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetSimpleItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getSimpleItemModelMaster(
(new GetSimpleItemModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withItemName("item-master-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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetSimpleItemModelMasterRequest;
import io.gs2.inventory.result.GetSimpleItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetSimpleItemModelMasterResult result = client.getSimpleItemModelMaster(
new GetSimpleItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
SimpleItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetSimpleItemModelMasterResult> asyncResult = null;
yield return client.GetSimpleItemModelMaster(
new Gs2.Gs2Inventory.Request.GetSimpleItemModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithItemName("item-master-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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getSimpleItemModelMaster(
new Gs2Inventory.GetSimpleItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_simple_item_model_master(
inventory.GetSimpleItemModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_item_name('item-master-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_simple_item_model_master({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_simple_item_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-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['errorMessage'])
end
result = api_result.result
item = result.item;updateSimpleItemModelMaster
シンプルアイテムモデルマスターを更新
既存のシンプルアイテムモデルマスターのプロパティを更新します。
変更はマスターデータが再有効化されるまで反映されません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| itemName | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 シンプルアイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleItemModelMaster | 更新したシンプルアイテムモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.UpdateSimpleItemModelMaster(
&inventory.UpdateSimpleItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
ItemName: pointy.String("item-master-0001"),
Description: pointy.String("description1"),
Metadata: pointy.String("ITEM_MASTER_0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\UpdateSimpleItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->updateSimpleItemModelMaster(
(new UpdateSimpleItemModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withItemName("item-master-0001")
->withDescription("description1")
->withMetadata("ITEM_MASTER_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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.UpdateSimpleItemModelMasterRequest;
import io.gs2.inventory.result.UpdateSimpleItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
UpdateSimpleItemModelMasterResult result = client.updateSimpleItemModelMaster(
new UpdateSimpleItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
.withDescription("description1")
.withMetadata("ITEM_MASTER_0001")
);
SimpleItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.UpdateSimpleItemModelMasterResult> asyncResult = null;
yield return client.UpdateSimpleItemModelMaster(
new Gs2.Gs2Inventory.Request.UpdateSimpleItemModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithItemName("item-master-0001")
.WithDescription("description1")
.WithMetadata("ITEM_MASTER_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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.updateSimpleItemModelMaster(
new Gs2Inventory.UpdateSimpleItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
.withDescription("description1")
.withMetadata("ITEM_MASTER_0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.update_simple_item_model_master(
inventory.UpdateSimpleItemModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_item_name('item-master-0001')
.with_description('description1')
.with_metadata('ITEM_MASTER_0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.update_simple_item_model_master({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
description="description1",
metadata="ITEM_MASTER_0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.update_simple_item_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
description="description1",
metadata="ITEM_MASTER_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['errorMessage'])
end
result = api_result.result
item = result.item;deleteSimpleItemModelMaster
シンプルアイテムモデルマスターを削除
指定されたシンプルアイテムモデルマスターを削除します。
削除はマスターデータが再有効化されるまで、現在アクティブなモデルに影響しません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | シンプルインベントリモデル名 シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| itemName | string | ✓ | ~ 128文字 | シンプルアイテムモデル名 シンプルアイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | SimpleItemModelMaster | 削除したシンプルアイテムモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DeleteSimpleItemModelMaster(
&inventory.DeleteSimpleItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
ItemName: pointy.String("item-master-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DeleteSimpleItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->deleteSimpleItemModelMaster(
(new DeleteSimpleItemModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withItemName("item-master-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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DeleteSimpleItemModelMasterRequest;
import io.gs2.inventory.result.DeleteSimpleItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DeleteSimpleItemModelMasterResult result = client.deleteSimpleItemModelMaster(
new DeleteSimpleItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
SimpleItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DeleteSimpleItemModelMasterResult> asyncResult = null;
yield return client.DeleteSimpleItemModelMaster(
new Gs2.Gs2Inventory.Request.DeleteSimpleItemModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithItemName("item-master-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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.deleteSimpleItemModelMaster(
new Gs2Inventory.DeleteSimpleItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_simple_item_model_master(
inventory.DeleteSimpleItemModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_item_name('item-master-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.delete_simple_item_model_master({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.delete_simple_item_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-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['errorMessage'])
end
result = api_result.result
item = result.item;describeBigInventoryModelMasters
巨大インベントリモデルマスターの一覧を取得
ネームスペース内の編集可能な巨大インベントリモデルマスターのページネーション付きリストを取得します。
これらは任意精度のアイテム数量を使用するインベントリタイプのドラフト定義です。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| namePrefix | string | ~ 64文字 | 巨大インベントリモデル名のフィルター接頭辞 | |||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<BigInventoryModelMaster> | 巨大インベントリモデルマスターのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeBigInventoryModelMasters(
&inventory.DescribeBigInventoryModelMastersRequest {
NamespaceName: pointy.String("namespace-0001"),
NamePrefix: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeBigInventoryModelMastersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeBigInventoryModelMasters(
(new DescribeBigInventoryModelMastersRequest())
->withNamespaceName("namespace-0001")
->withNamePrefix(null)
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeBigInventoryModelMastersRequest;
import io.gs2.inventory.result.DescribeBigInventoryModelMastersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeBigInventoryModelMastersResult result = client.describeBigInventoryModelMasters(
new DescribeBigInventoryModelMastersRequest()
.withNamespaceName("namespace-0001")
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
List<BigInventoryModelMaster> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeBigInventoryModelMastersResult> asyncResult = null;
yield return client.DescribeBigInventoryModelMasters(
new Gs2.Gs2Inventory.Request.DescribeBigInventoryModelMastersRequest()
.WithNamespaceName("namespace-0001")
.WithNamePrefix(null)
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeBigInventoryModelMasters(
new Gs2Inventory.DescribeBigInventoryModelMastersRequest()
.withNamespaceName("namespace-0001")
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_big_inventory_model_masters(
inventory.DescribeBigInventoryModelMastersRequest()
.with_namespace_name('namespace-0001')
.with_name_prefix(None)
.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('inventory')
api_result = client.describe_big_inventory_model_masters({
namespaceName="namespace-0001",
namePrefix=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_big_inventory_model_masters_async({
namespaceName="namespace-0001",
namePrefix=nil,
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['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;createBigInventoryModelMaster
巨大インベントリモデルマスターを新規作成
任意精度のアイテム管理のための編集可能な巨大インベントリモデルマスターを作成します。
作成したマスターは、マスターデータの更新プロセスを通じて有効化する必要があります。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| name | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigInventoryModelMaster | 作成した巨大インベントリモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.CreateBigInventoryModelMaster(
&inventory.CreateBigInventoryModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
Name: pointy.String("item"),
Description: nil,
Metadata: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\CreateBigInventoryModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->createBigInventoryModelMaster(
(new CreateBigInventoryModelMasterRequest())
->withNamespaceName("namespace-0001")
->withName("item")
->withDescription(null)
->withMetadata(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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.CreateBigInventoryModelMasterRequest;
import io.gs2.inventory.result.CreateBigInventoryModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
CreateBigInventoryModelMasterResult result = client.createBigInventoryModelMaster(
new CreateBigInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withName("item")
.withDescription(null)
.withMetadata(null)
);
BigInventoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.CreateBigInventoryModelMasterResult> asyncResult = null;
yield return client.CreateBigInventoryModelMaster(
new Gs2.Gs2Inventory.Request.CreateBigInventoryModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithName("item")
.WithDescription(null)
.WithMetadata(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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.createBigInventoryModelMaster(
new Gs2Inventory.CreateBigInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withName("item")
.withDescription(null)
.withMetadata(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.create_big_inventory_model_master(
inventory.CreateBigInventoryModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_name('item')
.with_description(None)
.with_metadata(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.create_big_inventory_model_master({
namespaceName="namespace-0001",
name="item",
description=nil,
metadata=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.create_big_inventory_model_master_async({
namespaceName="namespace-0001",
name="item",
description=nil,
metadata=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['errorMessage'])
end
result = api_result.result
item = result.item;getBigInventoryModelMaster
巨大インベントリモデルマスターを取得
特定の編集可能な巨大インベントリモデルマスターの完全な設定を取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigInventoryModelMaster | 巨大インベントリモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetBigInventoryModelMaster(
&inventory.GetBigInventoryModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetBigInventoryModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getBigInventoryModelMaster(
(new GetBigInventoryModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetBigInventoryModelMasterRequest;
import io.gs2.inventory.result.GetBigInventoryModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetBigInventoryModelMasterResult result = client.getBigInventoryModelMaster(
new GetBigInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
BigInventoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetBigInventoryModelMasterResult> asyncResult = null;
yield return client.GetBigInventoryModelMaster(
new Gs2.Gs2Inventory.Request.GetBigInventoryModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getBigInventoryModelMaster(
new Gs2Inventory.GetBigInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_big_inventory_model_master(
inventory.GetBigInventoryModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_big_inventory_model_master({
namespaceName="namespace-0001",
inventoryName="item",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_big_inventory_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
})
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['errorMessage'])
end
result = api_result.result
item = result.item;updateBigInventoryModelMaster
巨大インベントリモデルマスターを更新
既存の巨大インベントリモデルマスターのプロパティを更新します。
変更はマスターデータが再有効化されるまで反映されません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigInventoryModelMaster | 更新した巨大インベントリモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.UpdateBigInventoryModelMaster(
&inventory.UpdateBigInventoryModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
Description: pointy.String("description1"),
Metadata: pointy.String("ITEM_INVENTORY_MASTER"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\UpdateBigInventoryModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->updateBigInventoryModelMaster(
(new UpdateBigInventoryModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withDescription("description1")
->withMetadata("ITEM_INVENTORY_MASTER")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.UpdateBigInventoryModelMasterRequest;
import io.gs2.inventory.result.UpdateBigInventoryModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
UpdateBigInventoryModelMasterResult result = client.updateBigInventoryModelMaster(
new UpdateBigInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withDescription("description1")
.withMetadata("ITEM_INVENTORY_MASTER")
);
BigInventoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.UpdateBigInventoryModelMasterResult> asyncResult = null;
yield return client.UpdateBigInventoryModelMaster(
new Gs2.Gs2Inventory.Request.UpdateBigInventoryModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithDescription("description1")
.WithMetadata("ITEM_INVENTORY_MASTER"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.updateBigInventoryModelMaster(
new Gs2Inventory.UpdateBigInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withDescription("description1")
.withMetadata("ITEM_INVENTORY_MASTER")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.update_big_inventory_model_master(
inventory.UpdateBigInventoryModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_description('description1')
.with_metadata('ITEM_INVENTORY_MASTER')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.update_big_inventory_model_master({
namespaceName="namespace-0001",
inventoryName="item",
description="description1",
metadata="ITEM_INVENTORY_MASTER",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.update_big_inventory_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
description="description1",
metadata="ITEM_INVENTORY_MASTER",
})
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['errorMessage'])
end
result = api_result.result
item = result.item;deleteBigInventoryModelMaster
巨大インベントリモデルマスターを削除
指定された巨大インベントリモデルマスターを削除します。
削除はマスターデータが再有効化されるまで、現在アクティブなモデルに影響しません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigInventoryModelMaster | 削除した巨大インベントリモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DeleteBigInventoryModelMaster(
&inventory.DeleteBigInventoryModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DeleteBigInventoryModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->deleteBigInventoryModelMaster(
(new DeleteBigInventoryModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
);
$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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DeleteBigInventoryModelMasterRequest;
import io.gs2.inventory.result.DeleteBigInventoryModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DeleteBigInventoryModelMasterResult result = client.deleteBigInventoryModelMaster(
new DeleteBigInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
BigInventoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DeleteBigInventoryModelMasterResult> asyncResult = null;
yield return client.DeleteBigInventoryModelMaster(
new Gs2.Gs2Inventory.Request.DeleteBigInventoryModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item"),
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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.deleteBigInventoryModelMaster(
new Gs2Inventory.DeleteBigInventoryModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_big_inventory_model_master(
inventory.DeleteBigInventoryModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.delete_big_inventory_model_master({
namespaceName="namespace-0001",
inventoryName="item",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.delete_big_inventory_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
})
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['errorMessage'])
end
result = api_result.result
item = result.item;describeBigItemModelMasters
巨大アイテムモデルマスターの一覧を取得
指定された巨大インベントリモデルマスターに属する、編集可能な巨大アイテムモデルマスターのページネーション付きリストを取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| namePrefix | string | ~ 64文字 | 巨大アイテムモデル名のフィルター接頭辞 | |||
| pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
| limit | int | 30 | 1 ~ 1000 | データの取得件数 |
Result
| 型 | 説明 | |
|---|---|---|
| items | List<BigItemModelMaster> | 巨大アイテムモデルマスターのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DescribeBigItemModelMasters(
&inventory.DescribeBigItemModelMastersRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
NamePrefix: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DescribeBigItemModelMastersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->describeBigItemModelMasters(
(new DescribeBigItemModelMastersRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withNamePrefix(null)
->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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DescribeBigItemModelMastersRequest;
import io.gs2.inventory.result.DescribeBigItemModelMastersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DescribeBigItemModelMastersResult result = client.describeBigItemModelMasters(
new DescribeBigItemModelMastersRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
List<BigItemModelMaster> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DescribeBigItemModelMastersResult> asyncResult = null;
yield return client.DescribeBigItemModelMasters(
new Gs2.Gs2Inventory.Request.DescribeBigItemModelMastersRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithNamePrefix(null)
.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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.describeBigItemModelMasters(
new Gs2Inventory.DescribeBigItemModelMastersRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_big_item_model_masters(
inventory.DescribeBigItemModelMastersRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_name_prefix(None)
.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('inventory')
api_result = client.describe_big_item_model_masters({
namespaceName="namespace-0001",
inventoryName="item",
namePrefix=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('inventory')
api_result_handler = client.describe_big_item_model_masters_async({
namespaceName="namespace-0001",
inventoryName="item",
namePrefix=nil,
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['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;createBigItemModelMaster
巨大アイテムモデルマスターを新規作成
指定された巨大インベントリ内の任意精度数量を持つ新しいアイテムタイプを定義する編集可能な巨大アイテムモデルマスターを作成します。
作成したマスターは、マスターデータの更新プロセスを通じて有効化する必要があります。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| name | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 巨大アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigItemModelMaster | 作成した巨大アイテムモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.CreateBigItemModelMaster(
&inventory.CreateBigItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
Name: pointy.String("item-master-0001"),
Description: nil,
Metadata: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\CreateBigItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->createBigItemModelMaster(
(new CreateBigItemModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withName("item-master-0001")
->withDescription(null)
->withMetadata(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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.CreateBigItemModelMasterRequest;
import io.gs2.inventory.result.CreateBigItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
CreateBigItemModelMasterResult result = client.createBigItemModelMaster(
new CreateBigItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withName("item-master-0001")
.withDescription(null)
.withMetadata(null)
);
BigItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.CreateBigItemModelMasterResult> asyncResult = null;
yield return client.CreateBigItemModelMaster(
new Gs2.Gs2Inventory.Request.CreateBigItemModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithName("item-master-0001")
.WithDescription(null)
.WithMetadata(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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.createBigItemModelMaster(
new Gs2Inventory.CreateBigItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withName("item-master-0001")
.withDescription(null)
.withMetadata(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.create_big_item_model_master(
inventory.CreateBigItemModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_name('item-master-0001')
.with_description(None)
.with_metadata(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.create_big_item_model_master({
namespaceName="namespace-0001",
inventoryName="item",
name="item-master-0001",
description=nil,
metadata=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.create_big_item_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
name="item-master-0001",
description=nil,
metadata=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['errorMessage'])
end
result = api_result.result
item = result.item;getBigItemModelMaster
巨大アイテムモデルマスターを取得
特定の編集可能な巨大アイテムモデルマスターの完全な設定を取得します。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| itemName | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 巨大アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigItemModelMaster | 巨大アイテムモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.GetBigItemModelMaster(
&inventory.GetBigItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
ItemName: pointy.String("item-master-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\GetBigItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->getBigItemModelMaster(
(new GetBigItemModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withItemName("item-master-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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.GetBigItemModelMasterRequest;
import io.gs2.inventory.result.GetBigItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
GetBigItemModelMasterResult result = client.getBigItemModelMaster(
new GetBigItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
BigItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.GetBigItemModelMasterResult> asyncResult = null;
yield return client.GetBigItemModelMaster(
new Gs2.Gs2Inventory.Request.GetBigItemModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithItemName("item-master-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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.getBigItemModelMaster(
new Gs2Inventory.GetBigItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_big_item_model_master(
inventory.GetBigItemModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_item_name('item-master-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.get_big_item_model_master({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.get_big_item_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-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['errorMessage'])
end
result = api_result.result
item = result.item;updateBigItemModelMaster
巨大アイテムモデルマスターを更新
既存の巨大アイテムモデルマスターのプロパティを更新します。
変更はマスターデータが再有効化されるまで反映されません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| itemName | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 巨大アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigItemModelMaster | 更新した巨大アイテムモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.UpdateBigItemModelMaster(
&inventory.UpdateBigItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
ItemName: pointy.String("item-master-0001"),
Description: pointy.String("description1"),
Metadata: pointy.String("ITEM_MASTER_0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\UpdateBigItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->updateBigItemModelMaster(
(new UpdateBigItemModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withItemName("item-master-0001")
->withDescription("description1")
->withMetadata("ITEM_MASTER_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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.UpdateBigItemModelMasterRequest;
import io.gs2.inventory.result.UpdateBigItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
UpdateBigItemModelMasterResult result = client.updateBigItemModelMaster(
new UpdateBigItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
.withDescription("description1")
.withMetadata("ITEM_MASTER_0001")
);
BigItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.UpdateBigItemModelMasterResult> asyncResult = null;
yield return client.UpdateBigItemModelMaster(
new Gs2.Gs2Inventory.Request.UpdateBigItemModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithItemName("item-master-0001")
.WithDescription("description1")
.WithMetadata("ITEM_MASTER_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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.updateBigItemModelMaster(
new Gs2Inventory.UpdateBigItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
.withDescription("description1")
.withMetadata("ITEM_MASTER_0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.update_big_item_model_master(
inventory.UpdateBigItemModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_item_name('item-master-0001')
.with_description('description1')
.with_metadata('ITEM_MASTER_0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.update_big_item_model_master({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
description="description1",
metadata="ITEM_MASTER_0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.update_big_item_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
description="description1",
metadata="ITEM_MASTER_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['errorMessage'])
end
result = api_result.result
item = result.item;deleteBigItemModelMaster
巨大アイテムモデルマスターを削除
指定された巨大アイテムモデルマスターを削除します。
削除はマスターデータが再有効化されるまで、現在アクティブなモデルに影響しません。
詳細
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| inventoryName | string | ✓ | ~ 128文字 | 巨大インベントリモデル名 巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| itemName | string | ✓ | ~ 128文字 | 巨大アイテムモデル名 巨大アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
Result
| 型 | 説明 | |
|---|---|---|
| item | BigItemModelMaster | 削除した巨大アイテムモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inventory"
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 := inventory.Gs2InventoryRestClient{
Session: &session,
}
result, err := client.DeleteBigItemModelMaster(
&inventory.DeleteBigItemModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
InventoryName: pointy.String("item"),
ItemName: pointy.String("item-master-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\DeleteBigItemModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2InventoryRestClient(
$session
);
try {
$result = $client->deleteBigItemModelMaster(
(new DeleteBigItemModelMasterRequest())
->withNamespaceName("namespace-0001")
->withInventoryName("item")
->withItemName("item-master-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.inventory.rest.Gs2InventoryRestClient;
import io.gs2.inventory.request.DeleteBigItemModelMasterRequest;
import io.gs2.inventory.result.DeleteBigItemModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);
try {
DeleteBigItemModelMasterResult result = client.deleteBigItemModelMaster(
new DeleteBigItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
BigItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InventoryRestClient(session);
AsyncResult<Gs2.Gs2Inventory.Result.DeleteBigItemModelMasterResult> asyncResult = null;
yield return client.DeleteBigItemModelMaster(
new Gs2.Gs2Inventory.Request.DeleteBigItemModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithInventoryName("item")
.WithItemName("item-master-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 Gs2Inventory from '@/gs2/inventory';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inventory.Gs2InventoryRestClient(session);
try {
const result = await client.deleteBigItemModelMaster(
new Gs2Inventory.DeleteBigItemModelMasterRequest()
.withNamespaceName("namespace-0001")
.withInventoryName("item")
.withItemName("item-master-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_big_item_model_master(
inventory.DeleteBigItemModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_inventory_name('item')
.with_item_name('item-master-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('inventory')
api_result = client.delete_big_item_model_master({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('inventory')
api_result_handler = client.delete_big_item_model_master_async({
namespaceName="namespace-0001",
inventoryName="item",
itemName="item-master-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['errorMessage'])
end
result = api_result.result
item = result.item;