API Reference of GS2-Inventory SDK for Game Engine

Model

EzInventoryModel

Inventory Model

Inventory is like a bag that stores items owned by game players. Inventory can have a set capacity and cannot be owned beyond its capacity.

TypeRequireDefaultLimitationDescription
namestring~ 128 charsInventory Model Name
metadatastring~ 128 charsmetadata
initialCapacityint~ 2147483646Initial Capacity
maxCapacityint~ 2147483646Maximum Capacity

EzItemModel

Item Model

Multiple items can be owned for one capacity of inventory, such as potions x 99. Multiple items owned in one capacity are stacked items. The maximum number of items that can be stacked can be specified for each item.

When the maximum stackable quantity is reached, you can set for each item whether you can reserve a new inventory capacity and own it, or whether it will no longer be available.

TypeRequireDefaultLimitationDescription
namestring~ 128 charsItem Model Name
metadatastring~ 128 charsmetadata
stackingLimitlong1 ~ 9223372036854775805Maximum stackable quantity
allowMultipleStacksboolAllow items to be stored in multiple slots when the maximum stackable quantity is exceeded?
sortValueint~ 2147483646Display order

EzInventory

Inventory

Inventory is like a bag that stores items owned by game players. The bag has a capacity, and the capacity can be expanded by each player.

TypeRequireDefaultLimitationDescription
inventoryIdstring~ 1024 charsInventory GRN
inventoryNamestring~ 128 charsInventory Model Name
currentInventoryCapacityUsageint0~ 2147483646Capacity usage
currentInventoryMaxCapacityint1 ~ 2147483646Maximum capacity

EzItemSet

Item Set

Item set represents the possessions stored in the game player’s inventory. Item set has an item model and the quantity possessed.

TypeRequireDefaultLimitationDescription
itemSetIdstring~ 1024 charsQuantity of items held per expiration date GRN
namestringUUID~ 36 charsName identifying the item set
inventoryNamestring~ 128 charsInventory Model Name
itemNamestring~ 128 charsItem Model Name
countlong1 ~ 9223372036854775805Quantity in possession
sortValueint~ 2147483646Display order
expiresAtlong0Effective date (Unix time unit:milliseconds)
referenceOfList<string>[]~ 24 itemsList of references for this possession

EzSimpleInventoryModel

Simple Inventory Model

In a normal InventoryModel, you could limit the amount of items that could be stored in your inventory. Simple Inventory, however, has no such functionality and simply stores the number of items in the inventory.

However, the Simple Inventory provides an API that can increase or decrease the number of items in a single process.

TypeRequireDefaultLimitationDescription
namestring~ 128 charsSimple Inventory Model Name
metadatastring~ 128 charsmetadata

EzSimpleItemModel

Simple ItemModel

In the normal ItemModel, it is possible to set the maximum number of items that can be stacked, and if the number exceeds a certain number, it can be implemented to divide the items into multiple stacks. However, SimpleItem does not have such a function and simply stores the number of items in the possession of the item.

TypeRequireDefaultLimitationDescription
namestring~ 128 charsSimple Item Model Name
metadatastring~ 128 charsmetadata

EzSimpleItem

Simple Item

Simple Item represents a possession stored in the game player’s inventory. Simple Item has a model name and the quantity possessed.

TypeRequireDefaultLimitationDescription
itemIdstring~ 1024 charsQuantity of items GRN
itemNamestring~ 128 charsSimple Item Model Name
countlong1 ~ 9223372036854775805Quantity in possession

EzBigInventoryModel

Big Inventory model

In the normal InventoryModel and SimpleInventoryModel, the number of items that can be stored in the inventory is limited to the range of 64bit integer values. In inflationary games, you may need a wider range of values.

In the Big Inventory Model, the number of items that can be stored in the inventory can have an integer value of 1024 digits.

TypeRequireDefaultLimitationDescription
namestring~ 128 charsBig Inventory Model Name
metadatastring~ 128 charsmetadata

EzBigItemModel

Big ItemModel

In the normal ItemModel, it is possible to set the maximum number of items that can be stacked, and if the number exceeds a certain number, it can be implemented to divide the items into multiple stacks. However, BigItem does not have such a function and simply stores the number of items in the possession of the item.

TypeRequireDefaultLimitationDescription
namestring~ 128 charsBig Item Model Name
metadatastring~ 128 charsmetadata

EzBigItem

Big item

Big item represent possessions stored in the game player’s huge inventory. Big item model name and the quantity of possessions can be held beyond the int64 range.

TypeRequireDefaultLimitationDescription
itemIdstring~ 1024 charsQuantity of items GRN
itemNamestring~ 128 charsBig Item Model Name
countstring
BigInteger (Unity)
~ 1024 charsQuantity in possession

EzBigInventoryModel

Big Inventory model

In the normal InventoryModel and SimpleInventoryModel, the number of items that can be stored in the inventory is limited to the range of 64bit integer values. In inflationary games, you may need a wider range of values.

In the Big Inventory Model, the number of items that can be stored in the inventory can have an integer value of 1024 digits.

TypeRequireDefaultLimitationDescription
namestring~ 128 charsBig Inventory Model Name
metadatastring~ 128 charsmetadata

EzBigItemModel

Big ItemModel

In the normal ItemModel, it is possible to set the maximum number of items that can be stacked, and if the number exceeds a certain number, it can be implemented to divide the items into multiple stacks. However, BigItem does not have such a function and simply stores the number of items in the possession of the item.

TypeRequireDefaultLimitationDescription
namestring~ 128 charsBig Item Model Name
metadatastring~ 128 charsmetadata

EzBigItem

Big item

Big item represent possessions stored in the game player’s huge inventory. Big item model name and the quantity of possessions can be held beyond the int64 range.

TypeRequireDefaultLimitationDescription
itemIdstring~ 1024 charsQuantity of items GRN
itemNamestring~ 128 charsBig Item Model Name
countstring
BigInteger (Unity)
~ 1024 charsQuantity in possession

EzConsumeCount

Consumption quantity of simple items

TypeRequireDefaultLimitationDescription
itemNamestring~ 128 charsSimple Item Model Name
countlong1 ~ 9223372036854775805Quantity to be consumed

EzAcquireCount

Quantity of simple items obtained

TypeRequireDefaultLimitationDescription
itemNamestring~ 128 charsSimple Item Model Name
countlong1 ~ 9223372036854775805Quantity to be obtained

Methods

getInventoryModel

Get inventory model by specifying inventory name

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsInventory Model Name

Result

TypeDescription
itemEzInventoryModelInventory Model

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).InventoryModel(
        inventoryName: "item"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).InventoryModel(
        inventoryName: "item"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->InventoryModel(
        "item" // inventoryName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).InventoryModel(
        inventoryName: "item"
    );
    
    // Start event handling
    var callbackId = domain.Subscribe(
        value => {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    domain.Unsubscribe(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).InventoryModel(
        inventoryName: "item"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->InventoryModel(
        "item" // inventoryName
    );
    
    // Start event handling
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Inventory::Model::FInventoryModel> value) {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    Domain->Unsubscribe(CallbackId);

listInventoryModels

Get list of inventory models

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name

Result

TypeDescription
itemsList<EzInventoryModel>List of Inventory Models

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    );
    var items = await domain.InventoryModelsAsync(
    ).ToListAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    );
    var it = domain.InventoryModels(
    );
    List<EzInventoryModel> items = new List<EzInventoryModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    );
    const auto It = Domain->InventoryModels(
    );
    TArray<Gs2::UE5::Inventory::Model::FEzInventoryModelPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    );
    
    // Start event handling
    var callbackId = domain.SubscribeInventoryModels(
        () => {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    domain.UnsubscribeInventoryModels(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    );
    var it = domain.InventoryModels(
    );
    List<EzInventoryModel> items = new List<EzInventoryModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    );
    
    // Start event handling
    const auto CallbackId = Domain->SubscribeInventoryModels(
        []() {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    Domain->UnsubscribeInventoryModels(CallbackId);

getItemModel

Get item model by specifying inventory name and item name

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsInventory Model Name
itemNamestring~ 128 charsItem Model Name

Result

TypeDescription
itemEzItemModel

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).InventoryModel(
        inventoryName: "item"
    ).ItemModel(
        itemName: "item-master-0001"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).InventoryModel(
        inventoryName: "item"
    ).ItemModel(
        itemName: "item-master-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->InventoryModel(
        "item" // inventoryName
    )->ItemModel(
        "item-master-0001" // itemName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).InventoryModel(
        inventoryName: "item"
    ).ItemModel(
        itemName: "item-master-0001"
    );
    
    // Start event handling
    var callbackId = domain.Subscribe(
        value => {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    domain.Unsubscribe(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).InventoryModel(
        inventoryName: "item"
    ).ItemModel(
        itemName: "item-master-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->InventoryModel(
        "item" // inventoryName
    )->ItemModel(
        "item-master-0001" // itemName
    );
    
    // Start event handling
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Inventory::Model::FItemModel> value) {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    Domain->Unsubscribe(CallbackId);

listItemModels

Get list of item models by specifying the inventory name

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsInventory Model Name

Result

TypeDescription
itemsList<EzItemModel>List of Item Model

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).InventoryModel(
        inventoryName: "item"
    );
    var items = await domain.ItemModelsAsync(
    ).ToListAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).InventoryModel(
        inventoryName: "item"
    );
    var it = domain.ItemModels(
    );
    List<EzItemModel> items = new List<EzItemModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->InventoryModel(
        "item" // inventoryName
    );
    const auto It = Domain->ItemModels(
    );
    TArray<Gs2::UE5::Inventory::Model::FEzItemModelPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).InventoryModel(
        inventoryName: "item"
    );
    
    // Start event handling
    var callbackId = domain.SubscribeItemModels(
        () => {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    domain.UnsubscribeItemModels(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).InventoryModel(
        inventoryName: "item"
    );
    var it = domain.ItemModels(
    );
    List<EzItemModel> items = new List<EzItemModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->InventoryModel(
        "item" // inventoryName
    );
    
    // Start event handling
    const auto CallbackId = Domain->SubscribeItemModels(
        []() {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    Domain->UnsubscribeItemModels(CallbackId);

getInventory

Get inventory information by specifying the inventory name

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsInventory Model Name
accessTokenstring~ 128 charsUser Id

Result

TypeDescription
itemEzInventoryInventory

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "inventory-0001"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "inventory-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Inventory(
        "inventory-0001" // inventoryName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "inventory-0001"
    );
    
    // Start event handling
    var callbackId = domain.Subscribe(
        value => {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    domain.Unsubscribe(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "inventory-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Inventory(
        "inventory-0001" // inventoryName
    );
    
    // Start event handling
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Inventory::Model::FInventory> value) {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    Domain->Unsubscribe(CallbackId);

listInventories

Get Inventory List

Retrieves list of the inventory associated with a game player.

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
accessTokenstring~ 128 charsUser Id
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data acquired

Result

TypeDescription
itemsList<EzInventory>List of Inventories
nextPageTokenstringPage token to retrieve the rest of the listing

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var items = await domain.InventoriesAsync(
    ).ToListAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var it = domain.Inventories(
    );
    List<EzInventory> items = new List<EzInventory>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    );
    const auto It = Domain->Inventories(
    );
    TArray<Gs2::UE5::Inventory::Model::FEzInventoryPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    
    // Start event handling
    var callbackId = domain.SubscribeInventories(
        () => {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    domain.UnsubscribeInventories(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var it = domain.Inventories(
    );
    List<EzInventory> items = new List<EzInventory>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    );
    
    // Start event handling
    const auto CallbackId = Domain->SubscribeInventories(
        []() {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    Domain->UnsubscribeInventories(CallbackId);

consume

Consume Item

Use this if you wish to consume items from within the game.

This API is not used to increase or decrease items in conjunction with the GS2 system. This is because if the consideration is needed to purchase an item or to participate in a quest, you can set the consideration on GS2-Showcase or GS2-Quest, and then use the This is because items and other resources are automatically consumed as compensation when purchasing products or participating in quests.

Therefore, this API should be used when items are consumed for elements that do not involve GS2.

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsInventory Model Name
itemNamestring~ 128 charsItem Model Name
accessTokenstring~ 128 charsUser Id
consumeCountlong1 ~ 9223372036854775805Amount to consume
itemSetNamestring~ 36 charsName identifying the item set

Result

TypeDescription
itemsList<EzItemSet>List of item possession quantities per post-consumption expiration date
itemModelEzItemModelItem Model
inventoryEzInventoryInventory

Error

Special exceptions are defined in this API. GS2-SDK for GameEngine provides specialized exceptions derived from general exceptions to facilitate handling of errors that may need to be handled in games. Please refer to the documentation here for more information on common error types and handling methods.

TypeBase TypeDescription
ConflictExceptionConflictExceptionItem manipulation process conflicted. Retry required.
InsufficientExceptionBadRequestExceptionInsufficient quantity of items in your possession.

Implementation Example

try {
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "inventory-0001"
    ).ItemSet(
        itemName: "item-0001",
        itemSetName: null
    );
    var result = await domain.ConsumeAsync(
        consumeCount: 1L
    );
    var item = await result.ModelAsync();
} catch(Gs2.Gs2Inventory.Exception.Conflict e) {
    // Item manipulation process conflicted. Retry required.
} catch(Gs2.Gs2Inventory.Exception.Insufficient e) {
    // Insufficient quantity of items in your possession.
}
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "inventory-0001"
    ).ItemSet(
        itemName: "item-0001",
        itemSetName: null
    );
    var future = domain.ConsumeFuture(
        consumeCount: 1L
    );
    yield return future;
    if (future.Error != null)
    {
        if (future.Error is Gs2.Gs2Inventory.Exception.ConflictException)
        {
            // Item manipulation process conflicted. Retry required.
        }
        if (future.Error is Gs2.Gs2Inventory.Exception.InsufficientException)
        {
            // Insufficient quantity of items in your possession.
        }
        onError.Invoke(future.Error, null);
        yield break;
    }
    var future2 = future.Result.ModelFuture();
    yield return future2;
    if (future2.Error != null)
    {
        onError.Invoke(future2.Error, null);
        yield break;
    }
    var result = future2.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Inventory(
        "inventory-0001" // inventoryName
    )->ItemSet(
        "item-0001", // itemName
        nullptr // itemSetName
    );
    const auto Future = Domain->Consume(
        1L // consumeCount
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        auto e = Future->GetTask().Error();
        if (e->IsChildOf(Gs2::Inventory::Error::FConflictError::Class))
        {
            // Item manipulation process conflicted. Retry required.
        }
        if (e->IsChildOf(Gs2::Inventory::Error::FInsufficientError::Class))
        {
            // Insufficient quantity of items in your possession.
        }
        return false;
    }

    // obtain changed values / result values
    const auto Future2 = Future->GetTask().Result()->Model();
    Future2->StartSynchronousTask();
    if (Future2->GetTask().IsError())
    {
        return Future2->GetTask().Error();
    }
    const auto Result = Future2->GetTask().Result();

getItem

Retrieve items by specifying the inventory name and item name

Items may be divided into multiple stacks and responded to. Also, items with different expiration dates will always be in different stacks.

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsInventory Model Name
itemNamestring~ 128 charsItem Model Name
accessTokenstring~ 128 charsUser Id

Result

TypeDescription
itemsList<EzItemSet>List of Quantity of items held per expiration date
itemModelEzItemModelItem Model
inventoryEzInventoryinventory

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "item"
    ).ItemSet(
        itemName: "item-0001",
        itemSetName: "itemSet-0001"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "item"
    ).ItemSet(
        itemName: "item-0001",
        itemSetName: "itemSet-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Inventory(
        "item" // inventoryName
    )->ItemSet(
        "item-0001", // itemName
        "itemSet-0001" // itemSetName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "item"
    ).ItemSet(
        itemName: "item-0001",
        itemSetName: "itemSet-0001"
    );
    
    // Start event handling
    var callbackId = domain.Subscribe(
        value => {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    domain.Unsubscribe(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "item"
    ).ItemSet(
        itemName: "item-0001",
        itemSetName: "itemSet-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Inventory(
        "item" // inventoryName
    )->ItemSet(
        "item-0001", // itemName
        "itemSet-0001" // itemSetName
    );
    
    // Start event handling
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Inventory::Model::FItemSet> value) {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    Domain->Unsubscribe(CallbackId);

getItemWithSignature

Retrieve signed items by specifying the inventory name and item name

This API allows you to prove that you own the item at the moment you call the API

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsInventory Model Name
itemNamestring~ 128 charsItem Model Name
accessTokenstring~ 128 charsUser Id
itemSetNamestring~ 36 charsName identifying the item set
keyIdstring“grn:gs2:{region}:{ownerId}:key:default:key:default”~ 1024 charsencryption key GRN

Result

TypeDescription
itemsList<EzItemSet>List of Quantity of items held per expiration date
itemModelEzItemModelItem Model
inventoryEzInventoryInventory
bodystringItem Set Information for Signature Subject
signaturestringSignature

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "inventory-0001"
    ).ItemSet(
        itemName: "item-0001",
        itemSetName: null
    );
    var result = await domain.GetItemWithSignatureAsync(
        keyId: "key-0001"
    );
    var item = await result.ModelAsync();
    var body = result.Body;
    var signature = result.Signature;
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "inventory-0001"
    ).ItemSet(
        itemName: "item-0001",
        itemSetName: null
    );
    var future = domain.GetItemWithSignatureFuture(
        keyId: "key-0001"
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    var future2 = future.Result.ModelFuture();
    yield return future2;
    if (future2.Error != null)
    {
        onError.Invoke(future2.Error, null);
        yield break;
    }
    var result = future2.Result;
    var body = future.Result.Body;
    var signature = future.Result.Signature;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Inventory(
        "inventory-0001" // inventoryName
    )->ItemSet(
        "item-0001", // itemName
        nullptr // itemSetName
    );
    const auto Future = Domain->GetItemWithSignature(
        "key-0001" // keyId
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }

    // obtain changed values / result values
    const auto Future2 = Future->GetTask().Result()->Model();
    Future2->StartSynchronousTask();
    if (Future2->GetTask().IsError())
    {
        return Future2->GetTask().Error();
    }
    const auto Result = Future2->GetTask().Result();
    const auto Body = Result->Body;
    const auto Signature = Result->Signature;

listItems

Retrieves list of items owned in the specified inventory

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsInventory Model Name
accessTokenstring~ 128 charsUser Id
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data acquired

Result

TypeDescription
itemsList<EzItemSet>List of Quantity of items held per expiration date
nextPageTokenstringPage token to retrieve the rest of the listing

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "item"
    );
    var items = await domain.ItemSetsAsync(
    ).ToListAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "item"
    );
    var it = domain.ItemSets(
    );
    List<EzItemSet> items = new List<EzItemSet>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Inventory(
        "item" // inventoryName
    );
    const auto It = Domain->ItemSets(
    );
    TArray<Gs2::UE5::Inventory::Model::FEzItemSetPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "item"
    );
    
    // Start event handling
    var callbackId = domain.SubscribeItemSets(
        () => {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    domain.UnsubscribeItemSets(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Inventory(
        inventoryName: "item"
    );
    var it = domain.ItemSets(
    );
    List<EzItemSet> items = new List<EzItemSet>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Inventory(
        "item" // inventoryName
    );
    
    // Start event handling
    const auto CallbackId = Domain->SubscribeItemSets(
        []() {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    Domain->UnsubscribeItemSets(CallbackId);

getSimpleInventoryModel

Get simple inventory model by specifying inventory name

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsSimple Inventory Model Name

Result

TypeDescription
itemEzSimpleInventoryModelSimple Inventory Model

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).SimpleInventoryModel(
        inventoryName: "item"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).SimpleInventoryModel(
        inventoryName: "item"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->SimpleInventoryModel(
        "item" // inventoryName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).SimpleInventoryModel(
        inventoryName: "item"
    );
    
    // Start event handling
    var callbackId = domain.Subscribe(
        value => {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    domain.Unsubscribe(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).SimpleInventoryModel(
        inventoryName: "item"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->SimpleInventoryModel(
        "item" // inventoryName
    );
    
    // Start event handling
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Inventory::Model::FSimpleInventoryModel> value) {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    Domain->Unsubscribe(CallbackId);

listSimpleInventoryModels

Get list of simple inventory models

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name

Result

TypeDescription
itemsList<EzSimpleInventoryModel>List of Simple Inventory Models

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    );
    var items = await domain.SimpleInventoryModelsAsync(
    ).ToListAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    );
    var it = domain.SimpleInventoryModels(
    );
    List<EzSimpleInventoryModel> items = new List<EzSimpleInventoryModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    );
    const auto It = Domain->SimpleInventoryModels(
    );
    TArray<Gs2::UE5::Inventory::Model::FEzSimpleInventoryModelPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    );
    
    // Start event handling
    var callbackId = domain.SubscribeSimpleInventoryModels(
        () => {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    domain.UnsubscribeSimpleInventoryModels(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    );
    var it = domain.SimpleInventoryModels(
    );
    List<EzSimpleInventoryModel> items = new List<EzSimpleInventoryModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    );
    
    // Start event handling
    const auto CallbackId = Domain->SubscribeSimpleInventoryModels(
        []() {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    Domain->UnsubscribeSimpleInventoryModels(CallbackId);

getSimpleItemModel

Get simple item model by specifying inventory name and item name

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsSimple Inventory Model Name
itemNamestring~ 128 charsSimple Item Model Name

Result

TypeDescription
itemEzSimpleItemModel

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).SimpleInventoryModel(
        inventoryName: "item"
    ).SimpleItemModel(
        itemName: "item-master-0001"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).SimpleInventoryModel(
        inventoryName: "item"
    ).SimpleItemModel(
        itemName: "item-master-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->SimpleInventoryModel(
        "item" // inventoryName
    )->SimpleItemModel(
        "item-master-0001" // itemName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).SimpleInventoryModel(
        inventoryName: "item"
    ).SimpleItemModel(
        itemName: "item-master-0001"
    );
    
    // Start event handling
    var callbackId = domain.Subscribe(
        value => {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    domain.Unsubscribe(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).SimpleInventoryModel(
        inventoryName: "item"
    ).SimpleItemModel(
        itemName: "item-master-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->SimpleInventoryModel(
        "item" // inventoryName
    )->SimpleItemModel(
        "item-master-0001" // itemName
    );
    
    // Start event handling
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Inventory::Model::FSimpleItemModel> value) {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    Domain->Unsubscribe(CallbackId);

listSimpleItemModels

Get list of simple item models by specifying the inventory name

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsSimple Inventory Model Name

Result

TypeDescription
itemsList<EzSimpleItemModel>List of Simple Item Model

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).SimpleInventoryModel(
        inventoryName: "item"
    );
    var items = await domain.SimpleItemModelsAsync(
    ).ToListAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).SimpleInventoryModel(
        inventoryName: "item"
    );
    var it = domain.SimpleItemModels(
    );
    List<EzSimpleItemModel> items = new List<EzSimpleItemModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->SimpleInventoryModel(
        "item" // inventoryName
    );
    const auto It = Domain->SimpleItemModels(
    );
    TArray<Gs2::UE5::Inventory::Model::FEzSimpleItemModelPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).SimpleInventoryModel(
        inventoryName: "item"
    );
    
    // Start event handling
    var callbackId = domain.SubscribeSimpleItemModels(
        () => {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    domain.UnsubscribeSimpleItemModels(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).SimpleInventoryModel(
        inventoryName: "item"
    );
    var it = domain.SimpleItemModels(
    );
    List<EzSimpleItemModel> items = new List<EzSimpleItemModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->SimpleInventoryModel(
        "item" // inventoryName
    );
    
    // Start event handling
    const auto CallbackId = Domain->SubscribeSimpleItemModels(
        []() {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    Domain->UnsubscribeSimpleItemModels(CallbackId);

consumeSimpleItems

Consume Item

Use this if you wish to consume items from within the game.

This API is not used to increase or decrease items in conjunction with the GS2 system. This is because if the consideration is needed to purchase an item or to participate in a quest, you can set the consideration on GS2-Showcase or GS2-Quest, and then use the This is because items and other resources are automatically consumed as compensation when purchasing products or participating in quests.

Therefore, this API should be used when items are consumed for elements that do not involve GS2.

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsSimple Inventory Model Name
accessTokenstring~ 128 charsUser Id
consumeCountsList<EzConsumeCount>1 ~ 100 itemsList of quantity of simple items to be consumed

Result

TypeDescription
itemsList<EzSimpleItem>List of simple items possession quantities per post-consumption

Error

Special exceptions are defined in this API. GS2-SDK for GameEngine provides specialized exceptions derived from general exceptions to facilitate handling of errors that may need to be handled in games. Please refer to the documentation here for more information on common error types and handling methods.

TypeBase TypeDescription
ConflictExceptionConflictExceptionItem manipulation process conflicted. Retry required.
InsufficientExceptionBadRequestExceptionInsufficient quantity of items in your possession.

Implementation Example

try {
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).SimpleInventory(
        inventoryName: "inventory-0001"
    );
    var result = await domain.ConsumeSimpleItemsAsync(
        consumeCounts: new List<Gs2.Unity.Gs2Inventory.Model.EzConsumeCount> {
            new Gs2.Unity.Gs2Inventory.Model.EzConsumeCount() {
                ItemName = "item-0001",
                Count = 5,
            },
            new Gs2.Unity.Gs2Inventory.Model.EzConsumeCount() {
                ItemName = "item-0002",
                Count = 3,
            },
        }
    );
    var item = await result.ModelAsync();
} catch(Gs2.Gs2Inventory.Exception.Conflict e) {
    // Item manipulation process conflicted. Retry required.
} catch(Gs2.Gs2Inventory.Exception.Insufficient e) {
    // Insufficient quantity of items in your possession.
}
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).SimpleInventory(
        inventoryName: "inventory-0001"
    );
    var future = domain.ConsumeSimpleItemsFuture(
        consumeCounts: new List<Gs2.Unity.Gs2Inventory.Model.EzConsumeCount> {
            new Gs2.Unity.Gs2Inventory.Model.EzConsumeCount() {
                ItemName = "item-0001",
                Count = 5,
            },
            new Gs2.Unity.Gs2Inventory.Model.EzConsumeCount() {
                ItemName = "item-0002",
                Count = 3,
            },
        }
    );
    yield return future;
    if (future.Error != null)
    {
        if (future.Error is Gs2.Gs2Inventory.Exception.ConflictException)
        {
            // Item manipulation process conflicted. Retry required.
        }
        if (future.Error is Gs2.Gs2Inventory.Exception.InsufficientException)
        {
            // Insufficient quantity of items in your possession.
        }
        onError.Invoke(future.Error, null);
        yield break;
    }
    var future2 = future.Result.ModelFuture();
    yield return future2;
    if (future2.Error != null)
    {
        onError.Invoke(future2.Error, null);
        yield break;
    }
    var result = future2.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->SimpleInventory(
        "inventory-0001" // inventoryName
    );
    const auto Future = Domain->ConsumeSimpleItems(
        []
        {
            auto v = MakeShared<TArray<TSharedPtr<Gs2::UE5::Inventory::Model::FEzConsumeCount>>>();
            v->Add(
                MakeShared<Gs2::UE5::Inventory::Model::FEzConsumeCount>()
                ->WithItemName(TOptional<FString>("item-0001"))
                ->WithCount(TOptional<int32>(5))
            );
            v->Add(
                MakeShared<Gs2::UE5::Inventory::Model::FEzConsumeCount>()
                ->WithItemName(TOptional<FString>("item-0002"))
                ->WithCount(TOptional<int32>(3))
            );
            return v;
        }() // consumeCounts
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        auto e = Future->GetTask().Error();
        if (e->IsChildOf(Gs2::Inventory::Error::FConflictError::Class))
        {
            // Item manipulation process conflicted. Retry required.
        }
        if (e->IsChildOf(Gs2::Inventory::Error::FInsufficientError::Class))
        {
            // Insufficient quantity of items in your possession.
        }
        return false;
    }

    // obtain changed values / result values
    const auto Future2 = Future->GetTask().Result()->Model();
    Future2->StartSynchronousTask();
    if (Future2->GetTask().IsError())
    {
        return Future2->GetTask().Error();
    }
    const auto Result = Future2->GetTask().Result();

getSimpleItem

Retrieve items by specifying the inventory name and item name

Items may be divided into multiple stacks and responded to. Also, items with different expiration dates will always be in different stacks.

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsSimple Inventory Model Name
itemNamestring~ 128 charsSimple Item Model Name
accessTokenstring~ 128 charsUser Id

Result

TypeDescription
itemEzSimpleItemQuantity of simple items
itemModelEzSimpleItemModelSimple Item Model

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).SimpleInventory(
        inventoryName: "item"
    ).SimpleItem(
        itemName: "item-0001"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).SimpleInventory(
        inventoryName: "item"
    ).SimpleItem(
        itemName: "item-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->SimpleInventory(
        "item" // inventoryName
    )->SimpleItem(
        "item-0001" // itemName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).SimpleInventory(
        inventoryName: "item"
    ).SimpleItem(
        itemName: "item-0001"
    );
    
    // Start event handling
    var callbackId = domain.Subscribe(
        value => {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    domain.Unsubscribe(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).SimpleInventory(
        inventoryName: "item"
    ).SimpleItem(
        itemName: "item-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->SimpleInventory(
        "item" // inventoryName
    )->SimpleItem(
        "item-0001" // itemName
    );
    
    // Start event handling
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Inventory::Model::FSimpleItem> value) {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    Domain->Unsubscribe(CallbackId);

getSimpleItemWithSignature

Retrieve signed items by specifying the inventory name and item name

This API allows you to prove that you own the item at the moment you call the API

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsSimple Inventory Model Name
itemNamestring~ 128 charsSimple Item Model Name
accessTokenstring~ 128 charsUser Id
keyIdstring“grn:gs2:{region}:{ownerId}:key:default:key:default”~ 1024 charsencryption key GRN

Result

TypeDescription
itemEzSimpleItemQuantity of simple items
simpleItemModelEzSimpleItemModelSimple Item Model
bodystringSimple Item Set Information for Signature Subject
signaturestringSignature

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).SimpleInventory(
        inventoryName: "inventory-0001"
    ).SimpleItem(
        itemName: "item-0001"
    );
    var result = await domain.GetSimpleItemWithSignatureAsync(
        keyId: "key-0001"
    );
    var item = await result.ModelAsync();
    var body = result.Body;
    var signature = result.Signature;
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).SimpleInventory(
        inventoryName: "inventory-0001"
    ).SimpleItem(
        itemName: "item-0001"
    );
    var future = domain.GetSimpleItemWithSignatureFuture(
        keyId: "key-0001"
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    var future2 = future.Result.ModelFuture();
    yield return future2;
    if (future2.Error != null)
    {
        onError.Invoke(future2.Error, null);
        yield break;
    }
    var result = future2.Result;
    var body = future.Result.Body;
    var signature = future.Result.Signature;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->SimpleInventory(
        "inventory-0001" // inventoryName
    )->SimpleItem(
        "item-0001" // itemName
    );
    const auto Future = Domain->GetSimpleItemWithSignature(
        "key-0001" // keyId
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }

    // obtain changed values / result values
    const auto Future2 = Future->GetTask().Result()->Model();
    Future2->StartSynchronousTask();
    if (Future2->GetTask().IsError())
    {
        return Future2->GetTask().Error();
    }
    const auto Result = Future2->GetTask().Result();
    const auto Body = Result->Body;
    const auto Signature = Result->Signature;

listSimpleItems

Retrieves list of items owned in the specified inventory

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsSimple Inventory Model Name
accessTokenstring~ 128 charsUser Id
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data acquired

Result

TypeDescription
itemsList<EzSimpleItem>List of Quantity of simple items
nextPageTokenstringPage token to retrieve the rest of the listing

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).SimpleInventory(
        inventoryName: "item"
    );
    var items = await domain.SimpleItemsAsync(
    ).ToListAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).SimpleInventory(
        inventoryName: "item"
    );
    var it = domain.SimpleItems(
    );
    List<EzSimpleItem> items = new List<EzSimpleItem>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->SimpleInventory(
        "item" // inventoryName
    );
    const auto It = Domain->SimpleItems(
    );
    TArray<Gs2::UE5::Inventory::Model::FEzSimpleItemPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).SimpleInventory(
        inventoryName: "item"
    );
    
    // Start event handling
    var callbackId = domain.SubscribeSimpleItems(
        () => {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    domain.UnsubscribeSimpleItems(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).SimpleInventory(
        inventoryName: "item"
    );
    var it = domain.SimpleItems(
    );
    List<EzSimpleItem> items = new List<EzSimpleItem>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->SimpleInventory(
        "item" // inventoryName
    );
    
    // Start event handling
    const auto CallbackId = Domain->SubscribeSimpleItems(
        []() {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    Domain->UnsubscribeSimpleItems(CallbackId);

getBigInventoryModel

Get big inventory model by specifying inventory name

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsBig Inventory Model Name

Result

TypeDescription
itemEzBigInventoryModelBig Inventory Model

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).BigInventoryModel(
        inventoryName: "item"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).BigInventoryModel(
        inventoryName: "item"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->BigInventoryModel(
        "item" // inventoryName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).BigInventoryModel(
        inventoryName: "item"
    );
    
    // Start event handling
    var callbackId = domain.Subscribe(
        value => {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    domain.Unsubscribe(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).BigInventoryModel(
        inventoryName: "item"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->BigInventoryModel(
        "item" // inventoryName
    );
    
    // Start event handling
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Inventory::Model::FBigInventoryModel> value) {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    Domain->Unsubscribe(CallbackId);

listBigInventoryModels

Get list of big inventory models

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name

Result

TypeDescription
itemsList<EzBigInventoryModel>List of Big Inventory Models

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    );
    var items = await domain.BigInventoryModelsAsync(
    ).ToListAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    );
    var it = domain.BigInventoryModels(
    );
    List<EzBigInventoryModel> items = new List<EzBigInventoryModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    );
    const auto It = Domain->BigInventoryModels(
    );
    TArray<Gs2::UE5::Inventory::Model::FEzBigInventoryModelPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    );
    
    // Start event handling
    var callbackId = domain.SubscribeBigInventoryModels(
        () => {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    domain.UnsubscribeBigInventoryModels(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    );
    var it = domain.BigInventoryModels(
    );
    List<EzBigInventoryModel> items = new List<EzBigInventoryModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    );
    
    // Start event handling
    const auto CallbackId = Domain->SubscribeBigInventoryModels(
        []() {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    Domain->UnsubscribeBigInventoryModels(CallbackId);

getBigItemModel

Get big item model by specifying inventory name and item name

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsBig Inventory Model Name
itemNamestring~ 128 charsBig Item Model Name

Result

TypeDescription
itemEzBigItemModel

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).BigInventoryModel(
        inventoryName: "item"
    ).BigItemModel(
        itemName: "item-master-0001"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).BigInventoryModel(
        inventoryName: "item"
    ).BigItemModel(
        itemName: "item-master-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->BigInventoryModel(
        "item" // inventoryName
    )->BigItemModel(
        "item-master-0001" // itemName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).BigInventoryModel(
        inventoryName: "item"
    ).BigItemModel(
        itemName: "item-master-0001"
    );
    
    // Start event handling
    var callbackId = domain.Subscribe(
        value => {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    domain.Unsubscribe(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).BigInventoryModel(
        inventoryName: "item"
    ).BigItemModel(
        itemName: "item-master-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->BigInventoryModel(
        "item" // inventoryName
    )->BigItemModel(
        "item-master-0001" // itemName
    );
    
    // Start event handling
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Inventory::Model::FBigItemModel> value) {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    Domain->Unsubscribe(CallbackId);

listBigItemModels

Get list of big item models by specifying the inventory name

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsBig Inventory Model Name

Result

TypeDescription
itemsList<EzBigItemModel>List of Big Item Model

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).BigInventoryModel(
        inventoryName: "item"
    );
    var items = await domain.BigItemModelsAsync(
    ).ToListAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).BigInventoryModel(
        inventoryName: "item"
    );
    var it = domain.BigItemModels(
    );
    List<EzBigItemModel> items = new List<EzBigItemModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->BigInventoryModel(
        "item" // inventoryName
    );
    const auto It = Domain->BigItemModels(
    );
    TArray<Gs2::UE5::Inventory::Model::FEzBigItemModelPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).BigInventoryModel(
        inventoryName: "item"
    );
    
    // Start event handling
    var callbackId = domain.SubscribeBigItemModels(
        () => {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    domain.UnsubscribeBigItemModels(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).BigInventoryModel(
        inventoryName: "item"
    );
    var it = domain.BigItemModels(
    );
    List<EzBigItemModel> items = new List<EzBigItemModel>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->BigInventoryModel(
        "item" // inventoryName
    );
    
    // Start event handling
    const auto CallbackId = Domain->SubscribeBigItemModels(
        []() {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    Domain->UnsubscribeBigItemModels(CallbackId);

consumeBigItem

Consume Item

Use this if you wish to consume items from within the game.

This API is not used to increase or decrease items in conjunction with the GS2 system. This is because if the consideration is needed to purchase an item or to participate in a quest, you can set the consideration on GS2-Showcase or GS2-Quest, and then use the This is because items and other resources are automatically consumed as compensation when purchasing products or participating in quests.

Therefore, this API should be used when items are consumed for elements that do not involve GS2.

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsBig Inventory Model Name
itemNamestring~ 128 charsBig Item Model Name
accessTokenstring~ 128 charsUser Id
consumeCountstring~ 1024 charsQuantity of big items to be consumed

Result

TypeDescription
itemEzBigItemQuantity of big items held per post-consumption expiration date

Error

Special exceptions are defined in this API. GS2-SDK for GameEngine provides specialized exceptions derived from general exceptions to facilitate handling of errors that may need to be handled in games. Please refer to the documentation here for more information on common error types and handling methods.

TypeBase TypeDescription
ConflictExceptionConflictExceptionItem manipulation process conflicted. Retry required.
InsufficientExceptionBadRequestExceptionInsufficient quantity of items in your possession.

Implementation Example

try {
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).BigInventory(
        inventoryName: "inventory-0001"
    ).BigItem(
        itemName: "item-0001"
    );
    var result = await domain.ConsumeBigItemAsync(
        consumeCount: "1234567890123456789012345678901234567890"
    );
    var item = await result.ModelAsync();
} catch(Gs2.Gs2Inventory.Exception.Conflict e) {
    // Item manipulation process conflicted. Retry required.
} catch(Gs2.Gs2Inventory.Exception.Insufficient e) {
    // Insufficient quantity of items in your possession.
}
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).BigInventory(
        inventoryName: "inventory-0001"
    ).BigItem(
        itemName: "item-0001"
    );
    var future = domain.ConsumeBigItemFuture(
        consumeCount: "1234567890123456789012345678901234567890"
    );
    yield return future;
    if (future.Error != null)
    {
        if (future.Error is Gs2.Gs2Inventory.Exception.ConflictException)
        {
            // Item manipulation process conflicted. Retry required.
        }
        if (future.Error is Gs2.Gs2Inventory.Exception.InsufficientException)
        {
            // Insufficient quantity of items in your possession.
        }
        onError.Invoke(future.Error, null);
        yield break;
    }
    var future2 = future.Result.ModelFuture();
    yield return future2;
    if (future2.Error != null)
    {
        onError.Invoke(future2.Error, null);
        yield break;
    }
    var result = future2.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->BigInventory(
        "inventory-0001" // inventoryName
    )->BigItem(
        "item-0001" // itemName
    );
    const auto Future = Domain->ConsumeBigItem(
        "1234567890123456789012345678901234567890" // consumeCount
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        auto e = Future->GetTask().Error();
        if (e->IsChildOf(Gs2::Inventory::Error::FConflictError::Class))
        {
            // Item manipulation process conflicted. Retry required.
        }
        if (e->IsChildOf(Gs2::Inventory::Error::FInsufficientError::Class))
        {
            // Insufficient quantity of items in your possession.
        }
        return false;
    }

    // obtain changed values / result values
    const auto Future2 = Future->GetTask().Result()->Model();
    Future2->StartSynchronousTask();
    if (Future2->GetTask().IsError())
    {
        return Future2->GetTask().Error();
    }
    const auto Result = Future2->GetTask().Result();

getBigItem

Retrieve items by specifying the inventory name and item name

Items may be divided into multiple stacks and responded to. Also, items with different expiration dates will always be in different stacks.

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsBig Inventory Model Name
itemNamestring~ 128 charsBig Item Model Name
accessTokenstring~ 128 charsUser Id

Result

TypeDescription
itemEzBigItemQuantity of big items
itemModelEzBigItemModelBig Item Model

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).BigInventory(
        inventoryName: "item"
    ).BigItem(
        itemName: "item-0001"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).BigInventory(
        inventoryName: "item"
    ).BigItem(
        itemName: "item-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->BigInventory(
        "item" // inventoryName
    )->BigItem(
        "item-0001" // itemName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).BigInventory(
        inventoryName: "item"
    ).BigItem(
        itemName: "item-0001"
    );
    
    // Start event handling
    var callbackId = domain.Subscribe(
        value => {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    domain.Unsubscribe(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).BigInventory(
        inventoryName: "item"
    ).BigItem(
        itemName: "item-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->BigInventory(
        "item" // inventoryName
    )->BigItem(
        "item-0001" // itemName
    );
    
    // Start event handling
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Inventory::Model::FBigItem> value) {
            // Called when the value changes
            // The "value" is passed the value after the change.
        }
    );

    // Stop event handling
    Domain->Unsubscribe(CallbackId);

listBigItems

Retrieves list of items owned in the specified inventory

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
inventoryNamestring~ 128 charsBig Inventory Model Name
accessTokenstring~ 128 charsUser Id
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data acquired

Result

TypeDescription
itemsList<EzBigItem>List of Quantity of big items
nextPageTokenstringPage token to retrieve the rest of the listing

Implementation Example

    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).BigInventory(
        inventoryName: "item"
    );
    var items = await domain.BigItemsAsync(
    ).ToListAsync();
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).BigInventory(
        inventoryName: "item"
    );
    var it = domain.BigItems(
    );
    List<EzBigItem> items = new List<EzBigItem>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->BigInventory(
        "item" // inventoryName
    );
    const auto It = Domain->BigItems(
    );
    TArray<Gs2::UE5::Inventory::Model::FEzBigItemPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
Value change event handling
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).BigInventory(
        inventoryName: "item"
    );
    
    // Start event handling
    var callbackId = domain.SubscribeBigItems(
        () => {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    domain.UnsubscribeBigItems(callbackId);
    var domain = gs2.Inventory.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).BigInventory(
        inventoryName: "item"
    );
    var it = domain.BigItems(
    );
    List<EzBigItem> items = new List<EzBigItem>();
    while (it.HasNext())
    {
        yield return it.Next();
        if (it.Error != null)
        {
            onError.Invoke(it.Error, null);
            break;
        }
        if (it.Current != null)
        {
            items.Add(it.Current);
        }
        else
        {
            break;
        }
    }
    const auto Domain = Gs2->Inventory->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->BigInventory(
        "item" // inventoryName
    );
    
    // Start event handling
    const auto CallbackId = Domain->SubscribeBigItems(
        []() {
            // Called when an element of the list changes.
        }
    );

    // Stop event handling
    Domain->UnsubscribeBigItems(CallbackId);