NAV
go python java php typescript csharp GS2-Script

GS2-Inventory

GS2-SDK のリファレンス

モデル

Namespace

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

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

説明
namespaceId string ネームスペースGRN
name string ネームスペース名
description string 説明文
acquireScript ScriptSetting アイテム入手したときに実行するスクリプト
overflowScript ScriptSetting 入手上限に当たって入手できなかったときに実行するスクリプト
consumeScript ScriptSetting アイテム消費するときに実行するスクリプト
logSetting LogSetting ログの出力設定
createdAt long 作成日時
updatedAt long 最終更新日時

InventoryModelMaster

インベントリはゲームプレイヤーが所有しているアイテムを格納する鞄のようなものです。 インベントリには容量が設定でき、容量を超えては所有できません。

インベントリの容量は拡張することができます。 スタンプシートの報酬に設定ができますので、スタンプシートで報酬を付与できる手段であれば、拡張の方法は問いません。

説明
inventoryModelId string インベントリモデルマスターGRN
name string インベントリの種類名
metadata string メタデータ
description string 説明文
initialCapacity int インベントリの初期サイズ
maxCapacity int インベントリの最大サイズ
protectReferencedItem bool 参照元が登録されているアイテムセットは削除できなくする
createdAt long 作成日時
updatedAt long 最終更新日時

InventoryModel

インベントリはゲームプレイヤーが所有しているアイテムを格納する鞄のようなものです。 インベントリには容量が設定でき、容量を超えては所有できません。

インベントリの容量は拡張することができます。 スタンプシートの報酬に設定ができますので、スタンプシートで報酬を付与できる手段であれば、拡張の方法は問いません。

説明
inventoryModelId string インベントリモデルGRN
name string インベントリの種類名
metadata string メタデータ
initialCapacity int 初期サイズ
maxCapacity int 最大サイズ
protectReferencedItem bool 参照元が登録されているアイテムセットは削除できなくする
itemModels ItemModel[] インベントリに格納可能なアイテムモデル一覧

ItemModelMaster

アイテムの種類を定義するエンティティです。

アイテムは ポーション×99 のようにインベントリの1容量に対して複数所有できます。 1容量で複数所有している状態を アイテムをスタック する。と呼び、アイテムごとにスタックできる最大数量を指定できます。

スタックできる最大数量に達したとき、新しくインベントリの容量を確保して所有することができるか、入手することが出来なくなるかをアイテムごとに設定できます。

説明
itemModelId string アイテムモデルマスターGRN
inventoryName string アイテムの種類名
name string アイテムモデルの種類名
description string 説明文
metadata string メタデータ
stackingLimit long スタック可能な最大数量
allowMultipleStacks bool スタック可能な最大数量を超えた時複数枠にアイテムを保管することを許すか
sortValue int 表示順番
createdAt long 作成日時
updatedAt long 最終更新日時

ItemModel

アイテムの種類を定義するエンティティです。

アイテムは ポーション×99 のようにインベントリの1容量に対して複数所有できます。 1容量で複数所有している状態を アイテムをスタック する。と呼び、アイテムごとにスタックできる最大数量を指定できます。

スタックできる最大数量に達したとき、新しくインベントリの容量を確保して所有することができるか、入手することが出来なくなるかをアイテムごとに設定できます。

説明
itemModelId string アイテムモデルGRN
name string アイテムモデルの種類名
metadata string メタデータ
stackingLimit long スタック可能な最大数量
allowMultipleStacks bool スタック可能な最大数量を超えた時複数枠にアイテムを保管することを許すか
sortValue int 表示順番

CurrentItemModelMaster

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

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

JSONファイルの形式についてはドキュメントを参照ください。

説明
namespaceId string ネームスペースGRN
settings string マスターデータ

Inventory

インベントリはゲームプレイヤーが所有しているアイテムを格納する鞄のようなものです。

説明
inventoryId string インベントリGRN
inventoryName string インベントリモデル名
userId string ユーザーID
currentInventoryCapacityUsage int キャパシティ使用量
currentInventoryMaxCapacity int 最大キャパシティ
createdAt long 作成日時
updatedAt long 最終更新日時

ItemSet

アイテムはゲームプレイヤーの所有物です。

説明
itemSetId string 有効期限ごとのアイテム所持数量GRN
name string アイテムセットを識別する名前
inventoryName string インベントリの名前
userId string ユーザーID
itemName string アイテムマスターの名前
count long 所持数量
referenceOf string[] この所持品の参照元リスト
sortValue int 表示順番
expiresAt long 有効期限
createdAt long 作成日時
updatedAt long 最終更新日時

GitHubCheckoutSetting

説明
apiKeyId string GitHub のAPIキーGRN
repositoryName string リポジトリ名
sourcePath string ソースコードのファイルパス
referenceType string コードの取得元
commitHash string コミットハッシュ
branchName string ブランチ名
tagName string タグ名

ScriptSetting

説明
triggerScriptId string スクリプトGRN
doneTriggerTargetType string 完了通知の通知先
doneTriggerScriptId string スクリプトGRN
doneTriggerQueueNamespaceId string ネームスペースGRN

LogSetting

説明
loggingNamespaceId string ネームスペースGRN

メソッド

describeNamespaces

describeNamespaces

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 {
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeNamespaces(
        (new DescribeNamespacesRequest())
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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()
            .withPageToken(null)
            .withLimit(null)
    );
    List<Namespace> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.DescribeNamespacesRequest;
using Gs2.Gs2Inventory.Result.DescribeNamespacesResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeNamespaces(
    new DescribeNamespacesRequest()
        .withPageToken(null)
        .withLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as 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()
            .withPageToken(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.describe_namespaces(
        new inventory.DescribeNamespacesRequest()
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.describe_namespaces({
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

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

Request

必須 デフォルト 値の制限 説明
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Namespace[] ネームスペースのリスト
nextPageToken string リストの続きを取得するためのページトークン

createNamespace

createNamespace

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("namespace1"),
        Description: nil,
        AcquireScript: nil,
        OverflowScript: nil,
        ConsumeScript: nil,
        LogSetting: &inventory.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName(self::namespace1)
            ->withDescription(null)
            ->withAcquireScript(null)
            ->withOverflowScript(null)
            ->withConsumeScript(null)
            ->withLogSetting((new \Gs2\Inventory\Model\LogSetting())
                ->withLoggingNamespaceId('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
            .withDescription(null)
            .withAcquireScript(null)
            .withOverflowScript(null)
            .withConsumeScript(null)
            .withLogSetting(new io.gs2.inventory.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.CreateNamespaceRequest;
using Gs2.Gs2Inventory.Result.CreateNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createNamespace(
    new CreateNamespaceRequest()
        .withName("namespace1")
        .withDescription(null)
        .withAcquireScript(null)
        .withOverflowScript(null)
        .withConsumeScript(null)
        .withLogSetting(new Gs2.Gs2Inventory.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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('namespace1')
            .withDescription(undefined)
            .withAcquireScript(undefined)
            .withOverflowScript(undefined)
            .withConsumeScript(undefined)
            .withLogSetting(new Gs2Inventory.Model.LogSetting()
                .withLoggingNamespaceId('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.create_namespace(
        new inventory.CreateNamespaceRequest()
            .with_name(self.hash1)
            .with_description(None)
            .with_acquire_script(None)
            .with_overflow_script(None)
            .with_consume_script(None)
            .with_log_setting(
                inventory.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.create_namespace({
    name='namespace1',
    description=nil,
    acquireScript=nil,
    overflowScript=nil,
    consumeScript=nil,
    logSetting={
        loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
    },
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ネームスペースを新規作成

Request

必須 デフォルト 値の制限 説明
name string ~ 32文字 ネームスペース名
description string ~ 1024文字 説明文
acquireScript ScriptSetting アイテム入手したときに実行するスクリプト
overflowScript ScriptSetting 入手上限に当たって入手できなかったときに実行するスクリプト
consumeScript ScriptSetting アイテム消費するときに実行するスクリプト
logSetting LogSetting ログの出力設定

Result

説明
item Namespace 作成したネームスペース

getNamespaceStatus

getNamespaceStatus

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("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
status := result.Status
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getNamespaceStatus(
        (new GetNamespaceStatusRequest())
            ->withNamespaceName(self::namespace1)
    );
    $status = $result->getStatus();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
    );
    String status = result.getStatus();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Inventory.Result.GetNamespaceStatusResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getNamespaceStatus(
    new GetNamespaceStatusRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as 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('namespace1')
    );
    const status = result.getStatus();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.get_namespace_status(
        new inventory.GetNamespaceStatusRequest()
            .with_namespace_name(self.hash1)
    )
    status = result.status
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.get_namespace_status({
    namespaceName='namespace1',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
status = result.status;

ネームスペースの状態を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名

Result

説明
status string

getNamespace

getNamespace

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("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getNamespace(
        (new GetNamespaceRequest())
            ->withNamespaceName(self::namespace1)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.GetNamespaceRequest;
using Gs2.Gs2Inventory.Result.GetNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getNamespace(
    new GetNamespaceRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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('namespace1')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.get_namespace(
        new inventory.GetNamespaceRequest()
            .with_namespace_name(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.get_namespace({
    namespaceName='namespace1',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ネームスペースを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名

Result

説明
item Namespace ネームスペース

updateNamespace

updateNamespace

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("namespace1"),
        Description: pointy.String("description1"),
        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"),
        },
        LogSetting: &inventory.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateNamespace(
        (new UpdateNamespaceRequest())
            ->withNamespaceName(self::namespace1)
            ->withDescription('description1')
            ->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'))
            ->withLogSetting((new \Gs2\Inventory\Model\LogSetting())
                ->withLoggingNamespaceId('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
            .withDescription("description1")
            .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"))
            .withLogSetting(new io.gs2.inventory.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.UpdateNamespaceRequest;
using Gs2.Gs2Inventory.Result.UpdateNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateNamespace(
    new UpdateNamespaceRequest()
        .withNamespaceName("namespace1")
        .withDescription("description1")
        .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"))
        .withLogSetting(new Gs2.Gs2Inventory.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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('namespace1')
            .withDescription('description1')
            .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'))
            .withLogSetting(new Gs2Inventory.Model.LogSetting()
                .withLoggingNamespaceId('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.update_namespace(
        new inventory.UpdateNamespaceRequest()
            .with_namespace_name(self.hash1)
            .with_description('description1')
            .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_log_setting(
                inventory.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.update_namespace({
    namespaceName='namespace1',
    description='description1',
    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',
    },
    logSetting={
        loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
    },
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ネームスペースを更新

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
description string ~ 1024文字 説明文
acquireScript ScriptSetting アイテム入手したときに実行するスクリプト
overflowScript ScriptSetting 入手上限に当たって入手できなかったときに実行するスクリプト
consumeScript ScriptSetting アイテム消費するときに実行するスクリプト
logSetting LogSetting ログの出力設定

Result

説明
item Namespace 更新したネームスペース

deleteNamespace

deleteNamespace

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("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteNamespace(
        (new DeleteNamespaceRequest())
            ->withNamespaceName(self::namespace1)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.DeleteNamespaceRequest;
using Gs2.Gs2Inventory.Result.DeleteNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteNamespace(
    new DeleteNamespaceRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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('namespace1')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.delete_namespace(
        new inventory.DeleteNamespaceRequest()
            .with_namespace_name(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.delete_namespace({
    namespaceName='namespace1',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ネームスペースを削除

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名

Result

説明
item Namespace 削除したネームスペース

describeInventoryModelMasters

describeInventoryModelMasters

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("namespace1"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeInventoryModelMasters(
        (new DescribeInventoryModelMastersRequest())
            ->withNamespaceName(self::namespace1)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
            .withPageToken(null)
            .withLimit(null)
    );
    List<InventoryModelMaster> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.DescribeInventoryModelMastersRequest;
using Gs2.Gs2Inventory.Result.DescribeInventoryModelMastersResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeInventoryModelMasters(
    new DescribeInventoryModelMastersRequest()
        .withNamespaceName("namespace1")
        .withPageToken(null)
        .withLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as 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('namespace1')
            .withPageToken(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.describe_inventory_model_masters(
        new inventory.DescribeInventoryModelMastersRequest()
            .with_namespace_name(self.hash1)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.describe_inventory_model_masters({
    namespaceName='namespace1',
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

インベントリモデルマスターの一覧を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items InventoryModelMaster[] インベントリモデルマスターのリスト
nextPageToken string リストの続きを取得するためのページトークン

createInventoryModelMaster

createInventoryModelMaster

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("namespace1"),
        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.Item
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\CreateInventoryModelMasterRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createInventoryModelMaster(
        (new CreateInventoryModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.CreateInventoryModelMasterRequest;
using Gs2.Gs2Inventory.Result.CreateInventoryModelMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createInventoryModelMaster(
    new CreateInventoryModelMasterRequest()
        .withNamespaceName("namespace1")
        .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('namespace1')
            .withName('item')
            .withDescription(undefined)
            .withMetadata(undefined)
            .withInitialCapacity(50)
            .withMaxCapacity(100)
            .withProtectReferencedItem(undefined)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.create_inventory_model_master(
        new inventory.CreateInventoryModelMasterRequest()
            .with_namespace_name(self.hash1)
            .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:
    os.exit(1);

client = gs2('inventory')

api_result = client.create_inventory_model_master({
    namespaceName='namespace1',
    name='item',
    description=nil,
    metadata=nil,
    initialCapacity=50,
    maxCapacity=100,
    protectReferencedItem=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

インベントリモデルマスターを新規作成

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
name string ~ 128文字 インベントリの種類名
description string ~ 1024文字 説明文
metadata string ~ 128文字 メタデータ
initialCapacity int ~ 9223372036854775807 インベントリの初期サイズ
maxCapacity int ~ 9223372036854775807 インベントリの最大サイズ
protectReferencedItem bool false 参照元が登録されているアイテムセットは削除できなくする

Result

説明
item InventoryModelMaster 作成したインベントリモデルマスター

getInventoryModelMaster

getInventoryModelMaster

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("namespace1"),
        InventoryName: pointy.String("item"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getInventoryModelMaster(
        (new GetInventoryModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .withInventoryName("item")
    );
    InventoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.GetInventoryModelMasterRequest;
using Gs2.Gs2Inventory.Result.GetInventoryModelMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getInventoryModelMaster(
    new GetInventoryModelMasterRequest()
        .withNamespaceName("namespace1")
        .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('namespace1')
            .withInventoryName('item')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.get_inventory_model_master(
        new inventory.GetInventoryModelMasterRequest()
            .with_namespace_name(self.hash1)
            .with_inventory_name('item')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.get_inventory_model_master({
    namespaceName='namespace1',
    inventoryName='item',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

インベントリモデルマスターを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリの種類名

Result

説明
item InventoryModelMaster インベントリモデルマスター

updateInventoryModelMaster

updateInventoryModelMaster

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("namespace1"),
        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.Item
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\UpdateInventoryModelMasterRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateInventoryModelMaster(
        (new UpdateInventoryModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.UpdateInventoryModelMasterRequest;
using Gs2.Gs2Inventory.Result.UpdateInventoryModelMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateInventoryModelMaster(
    new UpdateInventoryModelMasterRequest()
        .withNamespaceName("namespace1")
        .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('namespace1')
            .withInventoryName('item')
            .withDescription('description1')
            .withMetadata('ITEM_INVENTORY_MASTER')
            .withInitialCapacity(150)
            .withMaxCapacity(250)
            .withProtectReferencedItem(undefined)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.update_inventory_model_master(
        new inventory.UpdateInventoryModelMasterRequest()
            .with_namespace_name(self.hash1)
            .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:
    os.exit(1);

client = gs2('inventory')

api_result = client.update_inventory_model_master({
    namespaceName='namespace1',
    inventoryName='item',
    description='description1',
    metadata='ITEM_INVENTORY_MASTER',
    initialCapacity=150,
    maxCapacity=250,
    protectReferencedItem=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

インベントリモデルマスターを更新

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリの種類名
description string ~ 1024文字 説明文
metadata string ~ 128文字 メタデータ
initialCapacity int ~ 9223372036854775807 インベントリの初期サイズ
maxCapacity int ~ 9223372036854775807 インベントリの最大サイズ
protectReferencedItem bool false 参照元が登録されているアイテムセットは削除できなくする

Result

説明
item InventoryModelMaster 更新したインベントリモデルマスター

deleteInventoryModelMaster

deleteInventoryModelMaster

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("namespace1"),
        InventoryName: pointy.String("item"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteInventoryModelMaster(
        (new DeleteInventoryModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .withInventoryName("item")
    );
    InventoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.DeleteInventoryModelMasterRequest;
using Gs2.Gs2Inventory.Result.DeleteInventoryModelMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteInventoryModelMaster(
    new DeleteInventoryModelMasterRequest()
        .withNamespaceName("namespace1")
        .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('namespace1')
            .withInventoryName('item')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.delete_inventory_model_master(
        new inventory.DeleteInventoryModelMasterRequest()
            .with_namespace_name(self.hash1)
            .with_inventory_name('item')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.delete_inventory_model_master({
    namespaceName='namespace1',
    inventoryName='item',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

インベントリモデルマスターを削除

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリの種類名

Result

説明
item InventoryModelMaster 削除したインベントリモデルマスター

describeInventoryModels

describeInventoryModels

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("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeInventoryModels(
        (new DescribeInventoryModelsRequest())
            ->withNamespaceName(self::namespace1)
    );
    $items = $result->getItems();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
    );
    List<InventoryModel> items = result.getItems();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.DescribeInventoryModelsRequest;
using Gs2.Gs2Inventory.Result.DescribeInventoryModelsResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeInventoryModels(
    new DescribeInventoryModelsRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
import Gs2Core from '@/gs2/core';
import * as 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('namespace1')
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.describe_inventory_models(
        new inventory.DescribeInventoryModelsRequest()
            .with_namespace_name(self.hash1)
    )
    items = result.items
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.describe_inventory_models({
    namespaceName='namespace1',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;

インベントリモデルの一覧を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名

Result

説明
items InventoryModel[] インベントリモデルのリスト

getInventoryModel

getInventoryModel

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("namespace1"),
        InventoryName: pointy.String("item"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getInventoryModel(
        (new GetInventoryModelRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .withInventoryName("item")
    );
    InventoryModel item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.GetInventoryModelRequest;
using Gs2.Gs2Inventory.Result.GetInventoryModelResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getInventoryModel(
    new GetInventoryModelRequest()
        .withNamespaceName("namespace1")
        .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('namespace1')
            .withInventoryName('item')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.get_inventory_model(
        new inventory.GetInventoryModelRequest()
            .with_namespace_name(self.hash1)
            .with_inventory_name('item')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.get_inventory_model({
    namespaceName='namespace1',
    inventoryName='item',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

インベントリモデルを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリの種類名

Result

説明
item InventoryModel インベントリモデル

describeItemModelMasters

describeItemModelMasters

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("namespace1"),
        InventoryName: pointy.String("item"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeItemModelMasters(
        (new DescribeItemModelMastersRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .withInventoryName("item")
            .withPageToken(null)
            .withLimit(null)
    );
    List<ItemModelMaster> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.DescribeItemModelMastersRequest;
using Gs2.Gs2Inventory.Result.DescribeItemModelMastersResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeItemModelMasters(
    new DescribeItemModelMastersRequest()
        .withNamespaceName("namespace1")
        .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('namespace1')
            .withInventoryName('item')
            .withPageToken(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.describe_item_model_masters(
        new inventory.DescribeItemModelMastersRequest()
            .with_namespace_name(self.hash1)
            .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:
    os.exit(1);

client = gs2('inventory')

api_result = client.describe_item_model_masters({
    namespaceName='namespace1',
    inventoryName='item',
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

アイテムモデルマスターの一覧を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 アイテムの種類名
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items ItemModelMaster[] アイテムモデルマスターのリスト
nextPageToken string リストの続きを取得するためのページトークン

createItemModelMaster

createItemModelMaster

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("namespace1"),
        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.Item
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\CreateItemModelMasterRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createItemModelMaster(
        (new CreateItemModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.CreateItemModelMasterRequest;
using Gs2.Gs2Inventory.Result.CreateItemModelMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createItemModelMaster(
    new CreateItemModelMasterRequest()
        .withNamespaceName("namespace1")
        .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('namespace1')
            .withInventoryName('item')
            .withName('item-master-0001')
            .withDescription(undefined)
            .withMetadata(undefined)
            .withStackingLimit(99)
            .withAllowMultipleStacks(false)
            .withSortValue(10)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.create_item_model_master(
        new inventory.CreateItemModelMasterRequest()
            .with_namespace_name(self.hash1)
            .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:
    os.exit(1);

client = gs2('inventory')

api_result = client.create_item_model_master({
    namespaceName='namespace1',
    inventoryName='item',
    name='item-master-0001',
    description=nil,
    metadata=nil,
    stackingLimit=99,
    allowMultipleStacks=false,
    sortValue=10,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

アイテムモデルマスターを新規作成

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 アイテムの種類名
name string ~ 128文字 アイテムモデルの種類名
description string ~ 1024文字 説明文
metadata string ~ 128文字 メタデータ
stackingLimit long 1 ~ 9223372036854775807 スタック可能な最大数量
allowMultipleStacks bool スタック可能な最大数量を超えた時複数枠にアイテムを保管することを許すか
sortValue int ~ 9223372036854775807 表示順番

Result

説明
item ItemModelMaster 作成したアイテムモデルマスター

getItemModelMaster

getItemModelMaster

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("namespace1"),
        InventoryName: pointy.String("item"),
        ItemName: pointy.String("item-master-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getItemModelMaster(
        (new GetItemModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .withInventoryName("item")
            .withItemName("item-master-0001")
    );
    ItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.GetItemModelMasterRequest;
using Gs2.Gs2Inventory.Result.GetItemModelMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getItemModelMaster(
    new GetItemModelMasterRequest()
        .withNamespaceName("namespace1")
        .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('namespace1')
            .withInventoryName('item')
            .withItemName('item-master-0001')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.get_item_model_master(
        new inventory.GetItemModelMasterRequest()
            .with_namespace_name(self.hash1)
            .with_inventory_name('item')
            .with_item_name('item-master-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.get_item_model_master({
    namespaceName='namespace1',
    inventoryName='item',
    itemName='item-master-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

アイテムモデルマスターを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリの種類名
itemName string ~ 128文字 アイテムモデルの種類名

Result

説明
item ItemModelMaster アイテムモデルマスター

updateItemModelMaster

updateItemModelMaster

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("namespace1"),
        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.Item
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\UpdateItemModelMasterRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateItemModelMaster(
        (new UpdateItemModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.UpdateItemModelMasterRequest;
using Gs2.Gs2Inventory.Result.UpdateItemModelMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateItemModelMaster(
    new UpdateItemModelMasterRequest()
        .withNamespaceName("namespace1")
        .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('namespace1')
            .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

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.update_item_model_master(
        new inventory.UpdateItemModelMasterRequest()
            .with_namespace_name(self.hash1)
            .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:
    os.exit(1);

client = gs2('inventory')

api_result = client.update_item_model_master({
    namespaceName='namespace1',
    inventoryName='item',
    itemName='item-master-0001',
    description='description1',
    metadata='ITEM_MASTER_0001',
    stackingLimit=49,
    allowMultipleStacks=true,
    sortValue=30,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

アイテムモデルマスターを更新

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリの種類名
itemName string ~ 128文字 アイテムモデルの種類名
description string ~ 1024文字 説明文
metadata string ~ 128文字 メタデータ
stackingLimit long 1 ~ 9223372036854775807 スタック可能な最大数量
allowMultipleStacks bool スタック可能な最大数量を超えた時複数枠にアイテムを保管することを許すか
sortValue int ~ 9223372036854775807 表示順番

Result

説明
item ItemModelMaster 更新したアイテムモデルマスター

deleteItemModelMaster

deleteItemModelMaster

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("namespace1"),
        InventoryName: pointy.String("item"),
        ItemName: pointy.String("item-master-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteItemModelMaster(
        (new DeleteItemModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .withInventoryName("item")
            .withItemName("item-master-0001")
    );
    ItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.DeleteItemModelMasterRequest;
using Gs2.Gs2Inventory.Result.DeleteItemModelMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteItemModelMaster(
    new DeleteItemModelMasterRequest()
        .withNamespaceName("namespace1")
        .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('namespace1')
            .withInventoryName('item')
            .withItemName('item-master-0001')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.delete_item_model_master(
        new inventory.DeleteItemModelMasterRequest()
            .with_namespace_name(self.hash1)
            .with_inventory_name('item')
            .with_item_name('item-master-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.delete_item_model_master({
    namespaceName='namespace1',
    inventoryName='item',
    itemName='item-master-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

アイテムモデルマスターを削除

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリの種類名
itemName string ~ 128文字 アイテムモデルの種類名

Result

説明
item ItemModelMaster 削除したアイテムモデルマスター

describeItemModels

describeItemModels

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("namespace1"),
        InventoryName: pointy.String("item"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeItemModels(
        (new DescribeItemModelsRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .withInventoryName("item")
    );
    List<ItemModel> items = result.getItems();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.DescribeItemModelsRequest;
using Gs2.Gs2Inventory.Result.DescribeItemModelsResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeItemModels(
    new DescribeItemModelsRequest()
        .withNamespaceName("namespace1")
        .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('namespace1')
            .withInventoryName('item')
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.describe_item_models(
        new inventory.DescribeItemModelsRequest()
            .with_namespace_name(self.hash1)
            .with_inventory_name('item')
    )
    items = result.items
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.describe_item_models({
    namespaceName='namespace1',
    inventoryName='item',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;

Noneの一覧を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリの種類名

Result

説明
items ItemModel[] アイテムモデルのリスト

getItemModel

getItemModel

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("namespace1"),
        InventoryName: pointy.String("item"),
        ItemName: pointy.String("item-master-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getItemModel(
        (new GetItemModelRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .withInventoryName("item")
            .withItemName("item-master-0001")
    );
    ItemModel item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.GetItemModelRequest;
using Gs2.Gs2Inventory.Result.GetItemModelResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getItemModel(
    new GetItemModelRequest()
        .withNamespaceName("namespace1")
        .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('namespace1')
            .withInventoryName('item')
            .withItemName('item-master-0001')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.get_item_model(
        new inventory.GetItemModelRequest()
            .with_namespace_name(self.hash1)
            .with_inventory_name('item')
            .with_item_name('item-master-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.get_item_model({
    namespaceName='namespace1',
    inventoryName='item',
    itemName='item-master-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

Noneを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリの種類名
itemName string ~ 128文字 アイテムモデルの種類名

Result

説明
item ItemModel

exportMaster

exportMaster

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("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->exportMaster(
        (new ExportMasterRequest())
            ->withNamespaceName(self::namespace1)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
    );
    CurrentItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.ExportMasterRequest;
using Gs2.Gs2Inventory.Result.ExportMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.exportMaster(
    new ExportMasterRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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('namespace1')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.export_master(
        new inventory.ExportMasterRequest()
            .with_namespace_name(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.export_master({
    namespaceName='namespace1',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

現在有効な所持品マスターのマスターデータをエクスポートします

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名

Result

説明
item CurrentItemModelMaster 現在有効な所持品マスター

getCurrentItemModelMaster

getCurrentItemModelMaster

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("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getCurrentItemModelMaster(
        (new GetCurrentItemModelMasterRequest())
            ->withNamespaceName(self::namespace1)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
    );
    CurrentItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.GetCurrentItemModelMasterRequest;
using Gs2.Gs2Inventory.Result.GetCurrentItemModelMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getCurrentItemModelMaster(
    new GetCurrentItemModelMasterRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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('namespace1')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.get_current_item_model_master(
        new inventory.GetCurrentItemModelMasterRequest()
            .with_namespace_name(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.get_current_item_model_master({
    namespaceName='namespace1',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

現在有効な所持品マスターを取得します

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名

Result

説明
item CurrentItemModelMaster 現在有効な所持品マスター

updateCurrentItemModelMaster

updateCurrentItemModelMaster

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("namespace1"),
        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
                }
              ]
            }
          ]
        }`),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateCurrentItemModelMaster(
        (new UpdateCurrentItemModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->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
                    }
                  ]
                }
              ]
            }")
    );
    $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("namespace1")
            .withSettings("{\n  \"version\": \"2019-02-05\",\n  \"inventoryModels\": [\n    {\n      \"name\": \"item\",\n      \"metadata\": \"INVENTORY_ITEM\",\n      \"initialCapacity\": 100,\n      \"maxCapacity\": 999,\n      \"itemModels\": [\n        {\n          \"name\": \"item-0001\",\n          \"metadata\": \"ITEM_0001\",\n          \"stackingLimit\": 99,\n          \"allowMultipleStacks\": false,\n          \"sortValue\": 1\n        },\n        {\n          \"name\": \"item-0002\",\n          \"metadata\": \"ITEM_0002\",\n          \"stackingLimit\": 49,\n          \"allowMultipleStacks\": true,\n          \"sortValue\": 2\n        },\n        {\n          \"name\": \"item-0003\",\n          \"metadata\": \"ITEM_0003\",\n          \"stackingLimit\": 9,\n          \"allowMultipleStacks\": false,\n          \"sortValue\": 3\n        }\n      ]\n    },\n    {\n      \"name\": \"character\",\n      \"metadata\": \"INVENTORY_CHARACTER\",\n      \"initialCapacity\": 50,\n      \"maxCapacity\": 99,\n      \"itemModels\": [\n        {\n          \"name\": \"character-0001\",\n          \"metadata\": \"CHARACTER_0001\",\n          \"stackingLimit\": 99,\n          \"allowMultipleStacks\": false,\n          \"sortValue\": 1\n        },\n        {\n          \"name\": \"character-0002\",\n          \"metadata\": \"CHARACTER_0002\",\n          \"stackingLimit\": 49,\n          \"allowMultipleStacks\": true,\n          \"sortValue\": 2\n        },\n        {\n          \"name\": \"character-0003\",\n          \"metadata\": \"CHARACTER_0003\",\n          \"stackingLimit\": 9,\n          \"allowMultipleStacks\": false,\n          \"sortValue\": 3\n        }\n      ]\n    }\n  ]\n}")
    );
    CurrentItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.UpdateCurrentItemModelMasterRequest;
using Gs2.Gs2Inventory.Result.UpdateCurrentItemModelMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateCurrentItemModelMaster(
    new UpdateCurrentItemModelMasterRequest()
        .withNamespaceName("namespace1")
        .withSettings("{\n  \"version\": \"2019-02-05\",\n  \"inventoryModels\": [\n    {\n      \"name\": \"item\",\n      \"metadata\": \"INVENTORY_ITEM\",\n      \"initialCapacity\": 100,\n      \"maxCapacity\": 999,\n      \"itemModels\": [\n        {\n          \"name\": \"item-0001\",\n          \"metadata\": \"ITEM_0001\",\n          \"stackingLimit\": 99,\n          \"allowMultipleStacks\": false,\n          \"sortValue\": 1\n        },\n        {\n          \"name\": \"item-0002\",\n          \"metadata\": \"ITEM_0002\",\n          \"stackingLimit\": 49,\n          \"allowMultipleStacks\": true,\n          \"sortValue\": 2\n        },\n        {\n          \"name\": \"item-0003\",\n          \"metadata\": \"ITEM_0003\",\n          \"stackingLimit\": 9,\n          \"allowMultipleStacks\": false,\n          \"sortValue\": 3\n        }\n      ]\n    },\n    {\n      \"name\": \"character\",\n      \"metadata\": \"INVENTORY_CHARACTER\",\n      \"initialCapacity\": 50,\n      \"maxCapacity\": 99,\n      \"itemModels\": [\n        {\n          \"name\": \"character-0001\",\n          \"metadata\": \"CHARACTER_0001\",\n          \"stackingLimit\": 99,\n          \"allowMultipleStacks\": false,\n          \"sortValue\": 1\n        },\n        {\n          \"name\": \"character-0002\",\n          \"metadata\": \"CHARACTER_0002\",\n          \"stackingLimit\": 49,\n          \"allowMultipleStacks\": true,\n          \"sortValue\": 2\n        },\n        {\n          \"name\": \"character-0003\",\n          \"metadata\": \"CHARACTER_0003\",\n          \"stackingLimit\": 9,\n          \"allowMultipleStacks\": false,\n          \"sortValue\": 3\n        }\n      ]\n    }\n  ]\n}"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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('namespace1')
            .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
                    }
                  ]
                }
              ]
            }`)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.update_current_item_model_master(
        new inventory.UpdateCurrentItemModelMasterRequest()
            .with_namespace_name(self.hash1)
            .with_settings('{\n  "version": "2019-02-05",\n  "inventoryModels": [\n    {\n      "name": "item",\n      "metadata": "INVENTORY_ITEM",\n      "initialCapacity": 100,\n      "maxCapacity": 999,\n      "itemModels": [\n        {\n          "name": "item-0001",\n          "metadata": "ITEM_0001",\n          "stackingLimit": 99,\n          "allowMultipleStacks": false,\n          "sortValue": 1\n        },\n        {\n          "name": "item-0002",\n          "metadata": "ITEM_0002",\n          "stackingLimit": 49,\n          "allowMultipleStacks": true,\n          "sortValue": 2\n        },\n        {\n          "name": "item-0003",\n          "metadata": "ITEM_0003",\n          "stackingLimit": 9,\n          "allowMultipleStacks": false,\n          "sortValue": 3\n        }\n      ]\n    },\n    {\n      "name": "character",\n      "metadata": "INVENTORY_CHARACTER",\n      "initialCapacity": 50,\n      "maxCapacity": 99,\n      "itemModels": [\n        {\n          "name": "character-0001",\n          "metadata": "CHARACTER_0001",\n          "stackingLimit": 99,\n          "allowMultipleStacks": false,\n          "sortValue": 1\n        },\n        {\n          "name": "character-0002",\n          "metadata": "CHARACTER_0002",\n          "stackingLimit": 49,\n          "allowMultipleStacks": true,\n          "sortValue": 2\n        },\n        {\n          "name": "character-0003",\n          "metadata": "CHARACTER_0003",\n          "stackingLimit": 9,\n          "allowMultipleStacks": false,\n          "sortValue": 3\n        }\n      ]\n    }\n  ]\n}')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.update_current_item_model_master({
    namespaceName='namespace1',
    settings='{\n  "version": "2019-02-05",\n  "inventoryModels": [\n    {\n      "name": "item",\n      "metadata": "INVENTORY_ITEM",\n      "initialCapacity": 100,\n      "maxCapacity": 999,\n      "itemModels": [\n        {\n          "name": "item-0001",\n          "metadata": "ITEM_0001",\n          "stackingLimit": 99,\n          "allowMultipleStacks": false,\n          "sortValue": 1\n        },\n        {\n          "name": "item-0002",\n          "metadata": "ITEM_0002",\n          "stackingLimit": 49,\n          "allowMultipleStacks": true,\n          "sortValue": 2\n        },\n        {\n          "name": "item-0003",\n          "metadata": "ITEM_0003",\n          "stackingLimit": 9,\n          "allowMultipleStacks": false,\n          "sortValue": 3\n        }\n      ]\n    },\n    {\n      "name": "character",\n      "metadata": "INVENTORY_CHARACTER",\n      "initialCapacity": 50,\n      "maxCapacity": 99,\n      "itemModels": [\n        {\n          "name": "character-0001",\n          "metadata": "CHARACTER_0001",\n          "stackingLimit": 99,\n          "allowMultipleStacks": false,\n          "sortValue": 1\n        },\n        {\n          "name": "character-0002",\n          "metadata": "CHARACTER_0002",\n          "stackingLimit": 49,\n          "allowMultipleStacks": true,\n          "sortValue": 2\n        },\n        {\n          "name": "character-0003",\n          "metadata": "CHARACTER_0003",\n          "stackingLimit": 9,\n          "allowMultipleStacks": false,\n          "sortValue": 3\n        }\n      ]\n    }\n  ]\n}',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

現在有効な所持品マスターを更新します

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
settings string ~ 5242880文字 マスターデータ

Result

説明
item CurrentItemModelMaster 更新した現在有効な所持品マスター

updateCurrentItemModelMasterFromGitHub

updateCurrentItemModelMasterFromGitHub

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("namespace1"),
        CheckoutSetting: {'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'},
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateCurrentItemModelMasterFromGitHub(
        (new UpdateCurrentItemModelMasterFromGitHubRequest())
            ->withNamespaceName(self::namespace1)
            ->withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': '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("namespace1")
            .withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    );
    CurrentItemModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.UpdateCurrentItemModelMasterFromGitHubRequest;
using Gs2.Gs2Inventory.Result.UpdateCurrentItemModelMasterFromGitHubResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateCurrentItemModelMasterFromGitHub(
    new UpdateCurrentItemModelMasterFromGitHubRequest()
        .withNamespaceName("namespace1")
        .withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': '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('namespace1')
            .withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.update_current_item_model_master_from_git_hub(
        new inventory.UpdateCurrentItemModelMasterFromGitHubRequest()
            .with_namespace_name(self.hash1)
            .with_checkout_setting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.update_current_item_model_master_from_git_hub({
    namespaceName='namespace1',
    checkoutSetting={'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'},
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

現在有効な所持品マスターを更新します

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
checkoutSetting GitHubCheckoutSetting GitHubからマスターデータをチェックアウトしてくる設定

Result

説明
item CurrentItemModelMaster 更新した現在有効な所持品マスター

describeInventories

describeInventories

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("namespace1"),
        AccessToken: pointy.String("$access_token_0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeInventories(
        (new DescribeInventoriesRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->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("namespace1")
            .withAccessToken("$access_token_0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Inventory> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.DescribeInventoriesRequest;
using Gs2.Gs2Inventory.Result.DescribeInventoriesResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeInventories(
    new DescribeInventoriesRequest()
        .withNamespaceName("namespace1")
        .withAccessToken("$access_token_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('namespace1')
            .withAccessToken('$access_token_0001')
            .withPageToken(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.describe_inventories(
        new inventory.DescribeInventoriesRequest()
            .with_namespace_name(self.hash1)
            .with_access_token(self.access_token_0001)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.describe_inventories({
    namespaceName='namespace1',
    accessToken='$access_token_0001',
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

インベントリの一覧を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Inventory[] インベントリのリスト
nextPageToken string リストの続きを取得するためのページトークン

describeInventoriesByUserId

describeInventoriesByUserId

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("namespace1"),
        UserId: pointy.String("user-0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeInventoriesByUserId(
        (new DescribeInventoriesByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId('user-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.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("namespace1")
            .withUserId("user-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Inventory> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.DescribeInventoriesByUserIdRequest;
using Gs2.Gs2Inventory.Result.DescribeInventoriesByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeInventoriesByUserId(
    new DescribeInventoriesByUserIdRequest()
        .withNamespaceName("namespace1")
        .withUserId("user-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.describeInventoriesByUserId(
        new Gs2Inventory.DescribeInventoriesByUserIdRequest()
            .withNamespaceName('namespace1')
            .withUserId('user-0001')
            .withPageToken(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.describe_inventories_by_user_id(
        new inventory.DescribeInventoriesByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.describe_inventories_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

インベントリの一覧を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
userId string ~ 128文字 ユーザーID
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Inventory[] インベントリのリスト
nextPageToken string リストの続きを取得するためのページトークン

getInventory

getInventory

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("namespace1"),
        InventoryName: pointy.String("inventory-0001"),
        AccessToken: pointy.String("$access_token_0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getInventory(
        (new GetInventoryRequest())
            ->withNamespaceName(self::namespace1)
            ->withInventoryName('inventory-0001')
            ->withAccessToken(self::$accessToken0001)
    );
    $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("namespace1")
            .withInventoryName("inventory-0001")
            .withAccessToken("$access_token_0001")
    );
    Inventory item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.GetInventoryRequest;
using Gs2.Gs2Inventory.Result.GetInventoryResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getInventory(
    new GetInventoryRequest()
        .withNamespaceName("namespace1")
        .withInventoryName("inventory-0001")
        .withAccessToken("$access_token_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('namespace1')
            .withInventoryName('inventory-0001')
            .withAccessToken('$access_token_0001')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.get_inventory(
        new inventory.GetInventoryRequest()
            .with_namespace_name(self.hash1)
            .with_inventory_name('inventory-0001')
            .with_access_token(self.access_token_0001)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.get_inventory({
    namespaceName='namespace1',
    inventoryName='inventory-0001',
    accessToken='$access_token_0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

インベントリを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリモデル名
accessToken string ~ 128文字 ユーザーID

Result

説明
item Inventory インベントリ

getInventoryByUserId

getInventoryByUserId

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("namespace1"),
        InventoryName: pointy.String("inventory-0001"),
        UserId: pointy.String("user-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getInventoryByUserId(
        (new GetInventoryByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withInventoryName('inventory-0001')
            ->withUserId('user-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.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("namespace1")
            .withInventoryName("inventory-0001")
            .withUserId("user-0001")
    );
    Inventory item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.GetInventoryByUserIdRequest;
using Gs2.Gs2Inventory.Result.GetInventoryByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getInventoryByUserId(
    new GetInventoryByUserIdRequest()
        .withNamespaceName("namespace1")
        .withInventoryName("inventory-0001")
        .withUserId("user-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.getInventoryByUserId(
        new Gs2Inventory.GetInventoryByUserIdRequest()
            .withNamespaceName('namespace1')
            .withInventoryName('inventory-0001')
            .withUserId('user-0001')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.get_inventory_by_user_id(
        new inventory.GetInventoryByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_inventory_name('inventory-0001')
            .with_user_id('user-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.get_inventory_by_user_id({
    namespaceName='namespace1',
    inventoryName='inventory-0001',
    userId='user-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

インベントリを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリモデル名
userId string ~ 128文字 ユーザーID

Result

説明
item Inventory インベントリ

addCapacityByUserId

addCapacityByUserId

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("namespace1"),
        InventoryName: pointy.String("inventory-0001"),
        UserId: pointy.String("user-0001"),
        AddCapacityValue: pointy.Int32(1),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->addCapacityByUserId(
        (new AddCapacityByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withInventoryName('inventory-0001')
            ->withUserId('user-0001')
            ->withAddCapacityValue(1)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
            .withInventoryName("inventory-0001")
            .withUserId("user-0001")
            .withAddCapacityValue(1)
    );
    Inventory item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.AddCapacityByUserIdRequest;
using Gs2.Gs2Inventory.Result.AddCapacityByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.addCapacityByUserId(
    new AddCapacityByUserIdRequest()
        .withNamespaceName("namespace1")
        .withInventoryName("inventory-0001")
        .withUserId("user-0001")
        .withAddCapacityValue(1),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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('namespace1')
            .withInventoryName('inventory-0001')
            .withUserId('user-0001')
            .withAddCapacityValue(1)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.add_capacity_by_user_id(
        new inventory.AddCapacityByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_inventory_name('inventory-0001')
            .with_user_id('user-0001')
            .with_add_capacity_value(1)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.add_capacity_by_user_id({
    namespaceName='namespace1',
    inventoryName='inventory-0001',
    userId='user-0001',
    addCapacityValue=1,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

キャパシティサイズを加算

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリモデル名
userId string ~ 128文字 ユーザーID
addCapacityValue int 1 ~ 9223372036854775807 加算するキャパシティサイズ

Result

説明
item Inventory キャパシティ加算後のインベントリ

setCapacityByUserId

setCapacityByUserId

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("namespace1"),
        InventoryName: pointy.String("inventory-0001"),
        UserId: pointy.String("user-0001"),
        NewCapacityValue: pointy.Int32(10),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->setCapacityByUserId(
        (new SetCapacityByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withInventoryName('inventory-0001')
            ->withUserId('user-0001')
            ->withNewCapacityValue(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.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("namespace1")
            .withInventoryName("inventory-0001")
            .withUserId("user-0001")
            .withNewCapacityValue(10)
    );
    Inventory item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.SetCapacityByUserIdRequest;
using Gs2.Gs2Inventory.Result.SetCapacityByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.setCapacityByUserId(
    new SetCapacityByUserIdRequest()
        .withNamespaceName("namespace1")
        .withInventoryName("inventory-0001")
        .withUserId("user-0001")
        .withNewCapacityValue(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.setCapacityByUserId(
        new Gs2Inventory.SetCapacityByUserIdRequest()
            .withNamespaceName('namespace1')
            .withInventoryName('inventory-0001')
            .withUserId('user-0001')
            .withNewCapacityValue(10)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.set_capacity_by_user_id(
        new inventory.SetCapacityByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_inventory_name('inventory-0001')
            .with_user_id('user-0001')
            .with_new_capacity_value(10)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.set_capacity_by_user_id({
    namespaceName='namespace1',
    inventoryName='inventory-0001',
    userId='user-0001',
    newCapacityValue=10,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

キャパシティサイズを設定

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリモデル名
userId string ~ 128文字 ユーザーID
newCapacityValue int 1 ~ 9223372036854775807 現在のインベントリの最大キャパシティ

Result

説明
item Inventory 更新後のインベントリ

deleteInventoryByUserId

deleteInventoryByUserId

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("namespace1"),
        InventoryName: pointy.String("inventory-0001"),
        UserId: pointy.String("user-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteInventoryByUserId(
        (new DeleteInventoryByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withInventoryName('inventory-0001')
            ->withUserId('user-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.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("namespace1")
            .withInventoryName("inventory-0001")
            .withUserId("user-0001")
    );
    Inventory item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.DeleteInventoryByUserIdRequest;
using Gs2.Gs2Inventory.Result.DeleteInventoryByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteInventoryByUserId(
    new DeleteInventoryByUserIdRequest()
        .withNamespaceName("namespace1")
        .withInventoryName("inventory-0001")
        .withUserId("user-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.deleteInventoryByUserId(
        new Gs2Inventory.DeleteInventoryByUserIdRequest()
            .withNamespaceName('namespace1')
            .withInventoryName('inventory-0001')
            .withUserId('user-0001')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.delete_inventory_by_user_id(
        new inventory.DeleteInventoryByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_inventory_name('inventory-0001')
            .with_user_id('user-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.delete_inventory_by_user_id({
    namespaceName='namespace1',
    inventoryName='inventory-0001',
    userId='user-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

インベントリを削除

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリモデル名
userId string ~ 128文字 ユーザーID

Result

説明
item Inventory インベントリ

addCapacityByStampSheet

addCapacityByStampSheet

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.AddCapacityByStampSheet(
    &inventory.AddCapacityByStampSheetRequest {
        StampSheet: pointy.String("$stampSheet"),
        KeyId: pointy.String("$key1.keyId"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\AddCapacityByStampSheetRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->addCapacityByStampSheet(
        (new AddCapacityByStampSheetRequest())
            ->withStampSheet(self::$stampSheet)
            ->withKeyId(self::$key1.keyId)
    );
    $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.AddCapacityByStampSheetRequest;
import io.gs2.inventory.result.AddCapacityByStampSheetResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);

try {
    AddCapacityByStampSheetResult result = client.addCapacityByStampSheet(
        new AddCapacityByStampSheetRequest()
            .withStampSheet("$stampSheet")
            .withKeyId("$key1.keyId")
    );
    Inventory item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.AddCapacityByStampSheetRequest;
using Gs2.Gs2Inventory.Result.AddCapacityByStampSheetResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.addCapacityByStampSheet(
    new AddCapacityByStampSheetRequest()
        .withStampSheet("$stampSheet")
        .withKeyId("$key1.keyId"),
    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.addCapacityByStampSheet(
        new Gs2Inventory.AddCapacityByStampSheetRequest()
            .withStampSheet('$stampSheet')
            .withKeyId('$key1.keyId')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.add_capacity_by_stamp_sheet(
        new inventory.AddCapacityByStampSheetRequest()
            .with_stamp_sheet(self.stamp_sheet)
            .with_key_id(self.key1.key_id)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.add_capacity_by_stamp_sheet({
    stampSheet='$stampSheet',
    keyId='$key1.keyId',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

スタンプシートでキャパシティサイズを加算

Request

必須 デフォルト 値の制限 説明
stampSheet string ~ 5242880文字 スタンプシート
keyId string ~ 1024文字 暗号鍵GRN

Result

説明
item Inventory キャパシティ加算後のインベントリ

setCapacityByStampSheet

setCapacityByStampSheet

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.SetCapacityByStampSheet(
    &inventory.SetCapacityByStampSheetRequest {
        StampSheet: pointy.String("$stampSheet"),
        KeyId: pointy.String("$key1.keyId"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inventory\Gs2InventoryRestClient;
use Gs2\Inventory\Request\SetCapacityByStampSheetRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->setCapacityByStampSheet(
        (new SetCapacityByStampSheetRequest())
            ->withStampSheet(self::$stampSheet)
            ->withKeyId(self::$key1.keyId)
    );
    $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.SetCapacityByStampSheetRequest;
import io.gs2.inventory.result.SetCapacityByStampSheetResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2InventoryRestClient client = new Gs2InventoryRestClient(session);

try {
    SetCapacityByStampSheetResult result = client.setCapacityByStampSheet(
        new SetCapacityByStampSheetRequest()
            .withStampSheet("$stampSheet")
            .withKeyId("$key1.keyId")
    );
    Inventory item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.SetCapacityByStampSheetRequest;
using Gs2.Gs2Inventory.Result.SetCapacityByStampSheetResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.setCapacityByStampSheet(
    new SetCapacityByStampSheetRequest()
        .withStampSheet("$stampSheet")
        .withKeyId("$key1.keyId"),
    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.setCapacityByStampSheet(
        new Gs2Inventory.SetCapacityByStampSheetRequest()
            .withStampSheet('$stampSheet')
            .withKeyId('$key1.keyId')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.set_capacity_by_stamp_sheet(
        new inventory.SetCapacityByStampSheetRequest()
            .with_stamp_sheet(self.stamp_sheet)
            .with_key_id(self.key1.key_id)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.set_capacity_by_stamp_sheet({
    stampSheet='$stampSheet',
    keyId='$key1.keyId',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

スタンプシートでキャパシティサイズを設定

Request

必須 デフォルト 値の制限 説明
stampSheet string ~ 5242880文字 スタンプシート
keyId string ~ 1024文字 暗号鍵GRN

Result

説明
item Inventory 更新後のインベントリ

describeItemSets

describeItemSets

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("namespace1"),
        InventoryName: pointy.String("item"),
        AccessToken: pointy.String("$access_token_0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeItemSets(
        (new DescribeItemSetsRequest())
            ->withNamespaceName(self::namespace1)
            ->withInventoryName('item')
            ->withAccessToken(self::$accessToken0001)
            ->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("namespace1")
            .withInventoryName("item")
            .withAccessToken("$access_token_0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<ItemSet> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.DescribeItemSetsRequest;
using Gs2.Gs2Inventory.Result.DescribeItemSetsResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeItemSets(
    new DescribeItemSetsRequest()
        .withNamespaceName("namespace1")
        .withInventoryName("item")
        .withAccessToken("$access_token_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('namespace1')
            .withInventoryName('item')
            .withAccessToken('$access_token_0001')
            .withPageToken(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.describe_item_sets(
        new inventory.DescribeItemSetsRequest()
            .with_namespace_name(self.hash1)
            .with_inventory_name('item')
            .with_access_token(self.access_token_0001)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.describe_item_sets({
    namespaceName='namespace1',
    inventoryName='item',
    accessToken='$access_token_0001',
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

有効期限ごとのアイテム所持数量の一覧を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリの名前
accessToken string ~ 128文字 ユーザーID
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items ItemSet[] 有効期限ごとのアイテム所持数量のリスト
nextPageToken string リストの続きを取得するためのページトークン

describeItemSetsByUserId

describeItemSetsByUserId

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: nil,
        InventoryName: pointy.String("inventory-0001"),
        UserId: pointy.String("user-0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeItemSetsByUserId(
        (new DescribeItemSetsByUserIdRequest())
            ->withNamespaceName(null)
            ->withInventoryName('inventory-0001')
            ->withUserId('user-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.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(null)
            .withInventoryName("inventory-0001")
            .withUserId("user-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<ItemSet> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.DescribeItemSetsByUserIdRequest;
using Gs2.Gs2Inventory.Result.DescribeItemSetsByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeItemSetsByUserId(
    new DescribeItemSetsByUserIdRequest()
        .withNamespaceName(null)
        .withInventoryName("inventory-0001")
        .withUserId("user-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.describeItemSetsByUserId(
        new Gs2Inventory.DescribeItemSetsByUserIdRequest()
            .withNamespaceName(undefined)
            .withInventoryName('inventory-0001')
            .withUserId('user-0001')
            .withPageToken(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import inventory

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.describe_item_sets_by_user_id(
        new inventory.DescribeItemSetsByUserIdRequest()
            .with_namespace_name(None)
            .with_inventory_name('inventory-0001')
            .with_user_id('user-0001')
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.describe_item_sets_by_user_id({
    namespaceName=nil,
    inventoryName='inventory-0001',
    userId='user-0001',
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

有効期限ごとのアイテム所持数量の一覧を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリの名前
userId string ~ 128文字 ユーザーID
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items ItemSet[] 有効期限ごとのアイテム所持数量のリスト
nextPageToken string リストの続きを取得するためのページトークン

getItemSet

getItemSet

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("namespace1"),
        InventoryName: pointy.String("item"),
        AccessToken: pointy.String("$access_token_0001"),
        ItemName: pointy.String("item-0001"),
        ItemSetName: pointy.String("$itemSet1.name"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
itemModel := result.ItemModel
inventory := result.Inventory
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\GetItemSetRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getItemSet(
        (new GetItemSetRequest())
            ->withNamespaceName(self::namespace1)
            ->withInventoryName('item')
            ->withAccessToken(self::$accessToken0001)
            ->withItemName('item-0001')
            ->withItemSetName(self::$itemSet1.name)
    );
    $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("namespace1")
            .withInventoryName("item")
            .withAccessToken("$access_token_0001")
            .withItemName("item-0001")
            .withItemSetName("$itemSet1.name")
    );
    List<ItemSet> items = result.getItems();
    ItemModel itemModel = result.getItemModel();
    Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.GetItemSetRequest;
using Gs2.Gs2Inventory.Result.GetItemSetResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getItemSet(
    new GetItemSetRequest()
        .withNamespaceName("namespace1")
        .withInventoryName("item")
        .withAccessToken("$access_token_0001")
        .withItemName("item-0001")
        .withItemSetName("$itemSet1.name"),
    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('namespace1')
            .withInventoryName('item')
            .withAccessToken('$access_token_0001')
            .withItemName('item-0001')
            .withItemSetName('$itemSet1.name')
    );
    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

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.get_item_set(
        new inventory.GetItemSetRequest()
            .with_namespace_name(self.hash1)
            .with_inventory_name('item')
            .with_access_token(self.access_token_0001)
            .with_item_name('item-0001')
            .with_item_set_name(self.item_set1.name)
    )
    items = result.items
    item_model = result.item_model
    inventory = result.inventory
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.get_item_set({
    namespaceName='namespace1',
    inventoryName='item',
    accessToken='$access_token_0001',
    itemName='item-0001',
    itemSetName='$itemSet1.name',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;

有効期限ごとのアイテム所持数量を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリの名前
accessToken string ~ 128文字 ユーザーID
itemName string ~ 128文字 アイテムマスターの名前
itemSetName string UUID ~ 36文字 アイテムセットを識別する名前

Result

説明
items ItemSet[] 有効期限毎の{model_name}
itemModel ItemModel アイテムモデル
inventory Inventory インベントリ

getItemSetByUserId

getItemSetByUserId

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: nil,
        InventoryName: pointy.String("inventory-0001"),
        UserId: pointy.String("user-0001"),
        ItemName: pointy.String("item-0001"),
        ItemSetName: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
itemModel := result.ItemModel
inventory := result.Inventory
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\GetItemSetByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getItemSetByUserId(
        (new GetItemSetByUserIdRequest())
            ->withNamespaceName(null)
            ->withInventoryName('inventory-0001')
            ->withUserId('user-0001')
            ->withItemName('item-0001')
            ->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.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(null)
            .withInventoryName("inventory-0001")
            .withUserId("user-0001")
            .withItemName("item-0001")
            .withItemSetName(null)
    );
    List<ItemSet> items = result.getItems();
    ItemModel itemModel = result.getItemModel();
    Inventory inventory = result.getInventory();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.GetItemSetByUserIdRequest;
using Gs2.Gs2Inventory.Result.GetItemSetByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getItemSetByUserId(
    new GetItemSetByUserIdRequest()
        .withNamespaceName(null)
        .withInventoryName("inventory-0001")
        .withUserId("user-0001")
        .withItemName("item-0001")
        .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.getItemSetByUserId(
        new Gs2Inventory.GetItemSetByUserIdRequest()
            .withNamespaceName(undefined)
            .withInventoryName('inventory-0001')
            .withUserId('user-0001')
            .withItemName('item-0001')
            .withItemSetName(undefined)
    );
    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

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.get_item_set_by_user_id(
        new inventory.GetItemSetByUserIdRequest()
            .with_namespace_name(None)
            .with_inventory_name('inventory-0001')
            .with_user_id('user-0001')
            .with_item_name('item-0001')
            .with_item_set_name(None)
    )
    items = result.items
    item_model = result.item_model
    inventory = result.inventory
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.get_item_set_by_user_id({
    namespaceName=nil,
    inventoryName='inventory-0001',
    userId='user-0001',
    itemName='item-0001',
    itemSetName=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;

有効期限ごとのアイテム所持数量を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリの名前
userId string ~ 128文字 ユーザーID
itemName string ~ 128文字 アイテムマスターの名前
itemSetName string UUID ~ 36文字 アイテムセットを識別する名前

Result

説明
items ItemSet[] 有効期限毎の{model_name}
itemModel ItemModel アイテムモデル
inventory Inventory インベントリ

getItemWithSignature

getItemWithSignature

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: nil,
        InventoryName: pointy.String("inventory-0001"),
        AccessToken: pointy.String("$access_token_0001"),
        ItemName: pointy.String("item-0001"),
        ItemSetName: nil,
        KeyId: pointy.String("$key1.keyId"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
itemModel := result.ItemModel
inventory := result.Inventory
body := result.Body
signature := result.Signature
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\GetItemWithSignatureRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getItemWithSignature(
        (new GetItemWithSignatureRequest())
            ->withNamespaceName(null)
            ->withInventoryName('inventory-0001')
            ->withAccessToken(self::$accessToken0001)
            ->withItemName('item-0001')
            ->withItemSetName(null)
            ->withKeyId(self::$key1.keyId)
    );
    $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(null)
            .withInventoryName("inventory-0001")
            .withAccessToken("$access_token_0001")
            .withItemName("item-0001")
            .withItemSetName(null)
            .withKeyId("$key1.keyId")
    );
    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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.GetItemWithSignatureRequest;
using Gs2.Gs2Inventory.Result.GetItemWithSignatureResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getItemWithSignature(
    new GetItemWithSignatureRequest()
        .withNamespaceName(null)
        .withInventoryName("inventory-0001")
        .withAccessToken("$access_token_0001")
        .withItemName("item-0001")
        .withItemSetName(null)
        .withKeyId("$key1.keyId"),
    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(undefined)
            .withInventoryName('inventory-0001')
            .withAccessToken('$access_token_0001')
            .withItemName('item-0001')
            .withItemSetName(undefined)
            .withKeyId('$key1.keyId')
    );
    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

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new inventory.Gs2InventoryRestClient(session)

try:
    result = client.get_item_with_signature(
        new inventory.GetItemWithSignatureRequest()
            .with_namespace_name(None)
            .with_inventory_name('inventory-0001')
            .with_access_token(self.access_token_0001)
            .with_item_name('item-0001')
            .with_item_set_name(None)
            .with_key_id(self.key1.key_id)
    )
    items = result.items
    item_model = result.item_model
    inventory = result.inventory
    body = result.body
    signature = result.signature
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('inventory')

api_result = client.get_item_with_signature({
    namespaceName=nil,
    inventoryName='inventory-0001',
    accessToken='$access_token_0001',
    itemName='item-0001',
    itemSetName=nil,
    keyId='$key1.keyId',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
itemModel = result.itemModel;
inventory = result.inventory;
body = result.body;
signature = result.signature;

有効期限ごとのアイテム所持数量を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
inventoryName string ~ 128文字 インベントリの名前
accessToken string ~ 128文字 ユーザーID
itemName string ~ 128文字 アイテムマスターの名前
itemSetName string UUID ~ 36文字 アイテムセットを識別する名前
keyId string ~ 1024文字 暗号鍵GRN

Result

説明
items ItemSet[] 有効期限毎の{model_name}
itemModel ItemModel アイテムモデル
inventory Inventory インベントリ
body string 署名対象のアイテムセット情報
signature string 署名

getItemWithSignatureByUserId

getItemWithSignatureByUserId

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: nil,
        InventoryName: pointy.String("inventory-0001"),
        UserId: pointy.String("user-0001"),
        ItemName: pointy.String("item-0001"),
        ItemSetName: nil,
        KeyId: pointy.String("$key1.keyId"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
itemModel := result.ItemModel
inventory := result.Inventory
body := result.Body
signature := result.Signature
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\GetItemWithSignatureByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getItemWithSignatureByUserId(
        (new GetItemWithSignatureByUserIdRequest())
            ->withNamespaceName(null)
            ->withInventoryName('inventory-0001')
            ->withUserId('user-0001')
            ->withItemName('item-0001')
            ->withItemSetName(null)
            ->withKeyId(self::$key1.keyId)
    );
    $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(null)
            .withInventoryName("inventory-0001")
            .withUserId("user-0001")
            .withItemName("item-0001")
            .withItemSetName(null)
            .withKeyId("$key1.keyId")
    );
    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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Inventory.Gs2InventoryRestClient;
using Gs2.Gs2Inventory.Request.GetItemWithSignatureByUserIdRequest;
using Gs2.Gs2Inventory.Result.GetItemWithSignatureByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InventoryRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getItemWithSignatureByUserId(
    new GetItemWithSignatureByUserIdRequest()
        .withNamespaceName(null)
        .withInventoryName("inventory-0001")
        .withUserId("user-0001")
        .withItemName("item-0001")
        .withItemSetName(null)
        .withKeyId("$key1.keyId"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw