API Reference of GS2-Inventory SDK
Model
Namespace
Namespace
Namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project. Basically, GS2 services have a layer called namespace, and different namespaces are treated as completely different data spaces, even for the same service.
Therefore, it is necessary to create a namespace before starting to use each service.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceId | string | ✓ | ~ 1024 chars | Namespace GRN | ||
name | string | ✓ | ~ 32 chars | Namespace name | ||
description | string | ~ 1024 chars | description of Namespace | |||
acquireScript | ScriptSetting | Script to be executed when an item is obtained | ||||
overflowScript | ScriptSetting | Script to be executed when the maximum acquisition limit is reached and the script cannot be obtained. | ||||
consumeScript | ScriptSetting | Script to run when consuming items | ||||
logSetting | LogSetting | Log output settings | ||||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
InventoryModelMaster
Inventory Model Master
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.
The inventory capacity can be expanded. It can be set to reward stamp sheets, so any method of expansion is acceptable as long as the stamp sheets can be used to grant rewards.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
inventoryModelId | string | ✓ | ~ 1024 chars | Inventory Model Master GRN | ||
name | string | ✓ | ~ 128 chars | Inventory Model Name | ||
metadata | string | ~ 128 chars | metadata | |||
description | string | ~ 1024 chars | description of Namespace | |||
initialCapacity | int | ✓ | ~ 2147483646 | Initial Capacity | ||
maxCapacity | int | ✓ | ~ 2147483646 | Maximum Capacity | ||
protectReferencedItem | bool | ✓ | false | Item Sets with registered references cannot be deleted | ||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
InventoryModel
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.
The inventory capacity can be expanded. It can be set to reward stamp sheets, so any method of expansion is acceptable as long as the stamp sheets can be used to grant rewards.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
inventoryModelId | string | ✓ | ~ 1024 chars | Inventory model GRN | ||
name | string | ✓ | ~ 128 chars | Inventory Model Name | ||
metadata | string | ~ 128 chars | metadata | |||
initialCapacity | int | ✓ | ~ 2147483646 | Initial Capacity | ||
maxCapacity | int | ✓ | ~ 2147483646 | Maximum Capacity | ||
protectReferencedItem | bool? | false | Item Sets with registered references cannot be deleted | |||
itemModels | List<ItemModel> | ✓ | List of item models that can be stored in inventory |
ItemModelMaster
Item Model Master
Items can be owned more than once for one capacity of inventory, such as potion x 99
.
Multiple items owned in a single 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.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
itemModelId | string | ✓ | ~ 1024 chars | Item Model Master GRN | ||
inventoryName | string | ✓ | ~ 128 chars | inventory model name | ||
name | string | ✓ | ~ 128 chars | Item Model Name | ||
description | string | ~ 1024 chars | description of Namespace | |||
metadata | string | ~ 128 chars | metadata | |||
stackingLimit | long | ✓ | 1 ~ 9223372036854775805 | Maximum stackable quantity | ||
allowMultipleStacks | bool | ✓ | Allow items to be stored in multiple slots when the maximum stackable quantity is exceeded | |||
sortValue | int | ✓ | ~ 2147483646 | Display order | ||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
ItemModel
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.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
itemModelId | string | ✓ | ~ 1024 chars | Item Model GRN | ||
name | string | ✓ | ~ 128 chars | Item Model Name | ||
metadata | string | ~ 128 chars | metadata | |||
stackingLimit | long | ✓ | 1 ~ 9223372036854775805 | Maximum stackable quantity | ||
allowMultipleStacks | bool | ✓ | Allow items to be stored in multiple slots when the maximum stackable quantity is exceeded? | |||
sortValue | int | ✓ | ~ 2147483646 | Display order |
SimpleInventoryModelMaster
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.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
inventoryModelId | string | ✓ | ~ 1024 chars | Simple Inventory Model Master GRN | ||
name | string | ✓ | ~ 128 chars | Simple Inventory Model Name | ||
metadata | string | ~ 128 chars | metadata | |||
description | string | ~ 1024 chars | description of Namespace | |||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
SimpleInventoryModel
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.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
inventoryModelId | string | ✓ | ~ 1024 chars | Inventory model GRN | ||
name | string | ✓ | ~ 128 chars | Simple Inventory Model Name | ||
metadata | string | ~ 128 chars | metadata | |||
simpleItemModels | List<SimpleItemModel> | ✓ | List of simple item models that can be stored in inventory |
SimpleItemModelMaster
Simple ItemModel Master
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.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
itemModelId | string | ✓ | ~ 1024 chars | Simple Item Model Master GRN | ||
name | string | ✓ | ~ 128 chars | Simple Item Model Name | ||
description | string | ~ 1024 chars | description of Namespace | |||
metadata | string | ~ 128 chars | metadata | |||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
SimpleItemModel
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.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
itemModelId | string | ✓ | ~ 1024 chars | Simple Item Model GRN | ||
name | string | ✓ | ~ 128 chars | Simple Item Model Name | ||
metadata | string | ~ 128 chars | metadata |
BigInventoryModelMaster
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.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
inventoryModelId | string | ✓ | ~ 1024 chars | Big Inventory Model Master GRN | ||
name | string | ✓ | ~ 128 chars | Big Inventory Model Name | ||
metadata | string | ~ 128 chars | metadata | |||
description | string | ~ 1024 chars | description of Namespace | |||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
BigInventoryModel
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.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
inventoryModelId | string | ✓ | ~ 1024 chars | Inventory model GRN | ||
name | string | ✓ | ~ 128 chars | Big Inventory Model Name | ||
metadata | string | ~ 128 chars | metadata | |||
bigItemModels | List<BigItemModel> | ✓ | List of big item models that can be stored in inventory |
BigItemModelMaster
Big ItemModel Master
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.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
itemModelId | string | ✓ | ~ 1024 chars | Big Item Model Master GRN | ||
name | string | ✓ | ~ 128 chars | Big Item Model Name | ||
description | string | ~ 1024 chars | description of Namespace | |||
metadata | string | ~ 128 chars | metadata | |||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
BigItemModel
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.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
itemModelId | string | ✓ | ~ 1024 chars | Big Item Model GRN | ||
name | string | ✓ | ~ 128 chars | Big Item Model Name | ||
metadata | string | ~ 128 chars | metadata |
CurrentItemModelMaster
Currently available master data
GS2 uses JSON format files for master data management. By uploading the file, you can actually reflect the settings on the server.
We provide a master data editor on the management console as a way to create JSON files, but you can also create JSON files using the The service can also be used by creating a tool more appropriate for game management and exporting a JSON file in the appropriate format.
Please refer to the documentation for the format of the JSON file.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceId | string | ✓ | ~ 1024 chars | Namespace GRN | ||
settings | string | ✓ | ~ 5242880 chars | Master data |
Inventory
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.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
inventoryId | string | ✓ | ~ 1024 chars | Inventory GRN | ||
inventoryName | string | ✓ | ~ 128 chars | Inventory Model Name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
currentInventoryCapacityUsage | int | ✓ | 0 | ~ 2147483646 | Capacity usage | |
currentInventoryMaxCapacity | int | ✓ | 1 ~ 2147483646 | Maximum capacity | ||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
ItemSet
Items are the property of the game player
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
itemSetId | string | ✓ | ~ 1024 chars | Quantity of items held per expiration date GRN | ||
name | string | ✓ | UUID | ~ 36 chars | Name identifying the item set | |
inventoryName | string | ✓ | ~ 128 chars | Inventory Model Name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
itemName | string | ✓ | ~ 128 chars | Item Model Name | ||
count | long | ✓ | 1 ~ 9223372036854775805 | Quantity in possession | ||
referenceOf | List<string> | [] | List of references for this possession | |||
sortValue | int | ✓ | ~ 2147483646 | Display order | ||
expiresAt | long | ✓ | 0 | Effective date | ||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update |
ReferenceOf
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
referenceOfId | string | ✓ | ~ 1024 chars | Reference GRN | ||
name | string | ✓ | ~ 128 chars | Name identifying the item set |
SimpleInventory
Simple Inventory
Inventory is like a bag that stores items owned by game players.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
inventoryId | string | ✓ | ~ 1024 chars | Simple Inventory GRN | ||
inventoryName | string | ✓ | ~ 128 chars | Simple Inventory Model Name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
simpleItems | List<SimpleItem> | List of simple item | ||||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
SimpleItem
Items are the property of the game player
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
itemId | string | ✓ | ~ 1024 chars | Quantity of items GRN | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
itemName | string | ✓ | ~ 128 chars | Simple Item Model Name | ||
count | long | ✓ | 1 ~ 9223372036854775805 | Quantity in possession | ||
revision | long | 0 | ~ 9223372036854775805 | Revision |
BigInventory
Big Inventory
Inventory is like a bag that stores items owned by game players.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
inventoryId | string | ✓ | ~ 1024 chars | BigInventory GRN | ||
inventoryName | string | ✓ | ~ 128 chars | Big Inventory Model Name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
bigItems | List<BigItem> | List of big item | ||||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update |
BigItem
Items are the property of the game player
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
itemId | string | ✓ | ~ 1024 chars | Quantity of items GRN | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
itemName | string | ✓ | ~ 128 chars | Big Item Model Name | ||
count | string | ✓ | ~ 1024 chars | Quantity in possession | ||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
GitHubCheckoutSetting
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
apiKeyId | string | ✓ | ~ 1024 chars | GitHub API key GRN | ||
repositoryName | string | ✓ | ~ 1024 chars | Repository Name | ||
sourcePath | string | ✓ | ~ 1024 chars | Source code file path | ||
referenceType | enum [‘commit_hash’, ‘branch’, ’tag’] | ✓ | ~ 128 chars | Source of code | ||
commitHash | string | {referenceType} == “commit_hash” | ✓ | ~ 1024 chars | Commit hash | |
branchName | string | {referenceType} == “branch” | ✓ | ~ 1024 chars | Branch Name | |
tagName | string | {referenceType} == “tag” | ✓ | ~ 1024 chars | Tag Name |
ScriptSetting
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
triggerScriptId | string | ~ 1024 chars | Script GRN | |||
doneTriggerTargetType | enum [’none’, ‘gs2_script’, ‘aws’] | ✓ | “none” | ~ 128 chars | Notification of Completion | |
doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024 chars | Script GRN | ||
doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024 chars | Namespace GRN |
LogSetting
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
loggingNamespaceId | string | ✓ | ~ 1024 chars | Namespace GRN |
AcquireCount
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
itemName | string | ✓ | ~ 128 chars | Simple Item Model Name | ||
count | long | ✓ | 1 ~ 9223372036854775805 | Quantity to be obtained |
ConsumeCount
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
itemName | string | ✓ | ~ 128 chars | Simple Item Model Name | ||
count | long | ✓ | 1 ~ 9223372036854775805 | Quantity to be consumed |
Methods
describeNamespaces
Get list of namespaces
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | List<Namespace> | List of Namespace |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
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.Gs2Inventory.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Inventory.Request.DescribeNamespacesRequest()
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as 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(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_namespaces(
inventory.DescribeNamespacesRequest()
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('inventory')
api_result = client.describe_namespaces({
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
createNamespace
Create a new namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
name | string | ✓ | ~ 32 chars | Namespace name | ||
description | string | ~ 1024 chars | description of Namespace | |||
acquireScript | ScriptSetting | Script to be executed when an item is obtained | ||||
overflowScript | ScriptSetting | Script to be executed when the maximum acquisition limit is reached and the script cannot be obtained. | ||||
consumeScript | ScriptSetting | Script to run when consuming items | ||||
logSetting | LogSetting | Log output settings |
Result
Type | Description | |
---|---|---|
item | Namespace | Namespace created |
Implementation Example
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.Gs2Inventory.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Inventory.Request.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(null)
.withAcquireScript(null)
.withOverflowScript(null)
.withConsumeScript(null)
.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
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.create_namespace(
inventory.CreateNamespaceRequest()
.with_name(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:
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
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getNamespaceStatus
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
status | string |
Implementation Example
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.Gs2Inventory.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Inventory.Request.GetNamespaceStatusRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as 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
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_namespace_status(
inventory.GetNamespaceStatusRequest()
.with_namespace_name(self.hash1)
)
status = result.status
except core.Gs2Exception as e:
exit(1)
client = gs2('inventory')
api_result = client.get_namespace_status({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
status = result.status;
getNamespace
Get namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | Namespace | Namespace |
Implementation Example
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.Gs2Inventory.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Inventory.Request.GetNamespaceRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_namespace(
inventory.GetNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inventory')
api_result = client.get_namespace({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateNamespace
Update namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | ||
description | string | ~ 1024 chars | description of Namespace | |||
acquireScript | ScriptSetting | Script to be executed when an item is obtained | ||||
overflowScript | ScriptSetting | Script to be executed when the maximum acquisition limit is reached and the script cannot be obtained. | ||||
consumeScript | ScriptSetting | Script to run when consuming items | ||||
logSetting | LogSetting | Log output settings |
Result
Type | Description | |
---|---|---|
item | Namespace | Updated namespace |
Implementation Example
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.Gs2Inventory.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Inventory.Request.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
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.update_namespace(
inventory.UpdateNamespaceRequest()
.with_namespace_name(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:
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
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
deleteNamespace
Delete namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | Namespace | Deleted namespace |
Implementation Example
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.Gs2Inventory.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Inventory.Request.DeleteNamespaceRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_namespace(
inventory.DeleteNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inventory')
api_result = client.delete_namespace({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
describeInventoryModelMasters
Get list of inventory model masters
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | ||
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | List<InventoryModelMaster> | List of Inventory Model Master |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
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.Gs2Inventory.Result.DescribeInventoryModelMastersResult> asyncResult = null;
yield return client.DescribeInventoryModelMasters(
new Gs2.Gs2Inventory.Request.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(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_inventory_model_masters(
inventory.DescribeInventoryModelMastersRequest()
.with_namespace_name(self.hash1)
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('inventory')
api_result = client.describe_inventory_model_masters({
namespaceName='namespace1',
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
createInventoryModelMaster
Create a new inventory model master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | ||
name | string | ✓ | ~ 128 chars | Inventory Model Name | ||
description | string | ~ 1024 chars | description of Namespace | |||
metadata | string | ~ 128 chars | metadata | |||
initialCapacity | int | ✓ | ~ 2147483646 | Initial Capacity | ||
maxCapacity | int | ✓ | ~ 2147483646 | Maximum Capacity | ||
protectReferencedItem | bool | ✓ | false | Item Sets with registered references cannot be deleted |
Result
Type | Description | |
---|---|---|
item | InventoryModelMaster | Inventory model master created |
Implementation Example
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.Gs2Inventory.Result.CreateInventoryModelMasterResult> asyncResult = null;
yield return client.CreateInventoryModelMaster(
new Gs2.Gs2Inventory.Request.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(null)
.withMetadata(null)
.withInitialCapacity(50)
.withMaxCapacity(100)
.withProtectReferencedItem(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.create_inventory_model_master(
inventory.CreateInventoryModelMasterRequest()
.with_namespace_name(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:
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
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getInventoryModelMaster
Get inventory model master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | ||
inventoryName | string | ✓ | ~ 128 chars | Inventory Model Name |
Result
Type | Description | |
---|---|---|
item | InventoryModelMaster | Inventory Model Master |
Implementation Example
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.Gs2Inventory.Result.GetInventoryModelMasterResult> asyncResult = null;
yield return client.GetInventoryModelMaster(
new Gs2.Gs2Inventory.Request.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
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_inventory_model_master(
inventory.GetInventoryModelMasterRequest()
.with_namespace_name(self.hash1)
.with_inventory_name('item')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inventory')
api_result = client.get_inventory_model_master({
namespaceName='namespace1',
inventoryName='item',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateInventoryModelMaster
Update inventory model master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | ||
inventoryName | string | ✓ | ~ 128 chars | Inventory Model Name | ||
description | string | ~ 1024 chars | description of Namespace | |||
metadata | string | ~ 128 chars | metadata | |||
initialCapacity | int | ✓ | ~ 2147483646 | Initial Capacity | ||
maxCapacity | int | ✓ | ~ 2147483646 | Maximum Capacity | ||
protectReferencedItem | bool | ✓ | false | Item Sets with registered references cannot be deleted |
Result
Type | Description | |
---|---|---|
item | InventoryModelMaster | Updated inventory model master |
Implementation Example
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.Gs2Inventory.Result.UpdateInventoryModelMasterResult> asyncResult = null;
yield return client.UpdateInventoryModelMaster(
new Gs2.Gs2Inventory.Request.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(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.update_inventory_model_master(
inventory.UpdateInventoryModelMasterRequest()
.with_namespace_name(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:
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
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
deleteInventoryModelMaster
Delete inventory model master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | ||
inventoryName | string | ✓ | ~ 128 chars | Inventory Model Name |
Result
Type | Description | |
---|---|---|
item | InventoryModelMaster | Deleted inventory model master |
Implementation Example
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.Gs2Inventory.Result.DeleteInventoryModelMasterResult> asyncResult = null;
yield return client.DeleteInventoryModelMaster(
new Gs2.Gs2Inventory.Request.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
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.delete_inventory_model_master(
inventory.DeleteInventoryModelMasterRequest()
.with_namespace_name(self.hash1)
.with_inventory_name('item')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inventory')
api_result = client.delete_inventory_model_master({
namespaceName='namespace1',
inventoryName='item',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
describeInventoryModels
Get list of inventory models
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
items | List<InventoryModel> | List of Inventory Models |
Implementation Example
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.Gs2Inventory.Result.DescribeInventoryModelsResult> asyncResult = null;
yield return client.DescribeInventoryModels(
new Gs2.Gs2Inventory.Request.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
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_inventory_models(
inventory.DescribeInventoryModelsRequest()
.with_namespace_name(self.hash1)
)
items = result.items
except core.Gs2Exception as e:
exit(1)
client = gs2('inventory')
api_result = client.describe_inventory_models({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
getInventoryModel
Get Inventory Model
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | ||
inventoryName | string | ✓ | ~ 128 chars | Inventory Model Name |
Result
Type | Description | |
---|---|---|
item | InventoryModel | Inventory Model |
Implementation Example
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.Gs2Inventory.Result.GetInventoryModelResult> asyncResult = null;
yield return client.GetInventoryModel(
new Gs2.Gs2Inventory.Request.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
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_inventory_model(
inventory.GetInventoryModelRequest()
.with_namespace_name(self.hash1)
.with_inventory_name('item')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inventory')
api_result = client.get_inventory_model({
namespaceName='namespace1',
inventoryName='item',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
describeItemModelMasters
Get list of item model masters
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | ||
inventoryName | string | ✓ | ~ 128 chars | Inventory Model Name | ||
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | List<ItemModelMaster> | List of Item Model Master |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
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.Gs2Inventory.Result.DescribeItemModelMastersResult> asyncResult = null;
yield return client.DescribeItemModelMasters(
new Gs2.Gs2Inventory.Request.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(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.describe_item_model_masters(
inventory.DescribeItemModelMastersRequest()
.with_namespace_name(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:
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
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
createItemModelMaster
Create a new item model master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | ||
inventoryName | string | ✓ | ~ 128 chars | inventory model name | ||
name | string | ✓ | ~ 128 chars | Item Model Name | ||
description | string | ~ 1024 chars | description of Namespace | |||
metadata | string | ~ 128 chars | metadata | |||
stackingLimit | long | ✓ | 1 ~ 9223372036854775805 | Maximum stackable quantity | ||
allowMultipleStacks | bool | ✓ | Allow items to be stored in multiple slots when the maximum stackable quantity is exceeded | |||
sortValue | int | ✓ | ~ 2147483646 | Display order |
Result
Type | Description | |
---|---|---|
item | ItemModelMaster | Item model master created |
Implementation Example
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.Gs2Inventory.Result.CreateItemModelMasterResult> asyncResult = null;
yield return client.CreateItemModelMaster(
new Gs2.Gs2Inventory.Request.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(null)
.withMetadata(null)
.withStackingLimit(99)
.withAllowMultipleStacks(false)
.withSortValue(10)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inventory
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.create_item_model_master(
inventory.CreateItemModelMasterRequest()
.with_namespace_name(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:
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
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getItemModelMaster
Get item model master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | ||
inventoryName | string | ✓ | ~ 128 chars | Inventory Model Name | ||
itemName | string | ✓ | ~ 128 chars | Item Model Name |
Result
Type | Description | |
---|---|---|
item | ItemModelMaster | Item Model Master |
Implementation Example
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.Gs2Inventory.Result.GetItemModelMasterResult> asyncResult = null;
yield return client.GetItemModelMaster(
new Gs2.Gs2Inventory.Request.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
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inventory.Gs2InventoryRestClient(session)
try:
result = client.get_item_model_master(
inventory.GetItemModelMasterRequest()
.with_namespace_name(self.hash1)
.with_inventory_name('item')
.with_item_name('item-master-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inventory')
api_result = client.get_item_model_master({
namespaceName='namespace1',
inventoryName='item',
itemName='item-master-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateItemModelMaster
Update Item Model Master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | ||
inventoryName | string | ✓ | ~ 128 chars | Inventory Model Name | ||
itemName | string | ✓ | ~ 128 chars | Item Model Name | ||
description | string | ~ 1024 chars | description of Namespace | |||
metadata | string | ~ 128 chars | metadata | |||
stackingLimit | long | ✓ | 1 ~ 9223372036854775805 | Maximum stackable quantity | ||
allowMultipleStacks | bool | ✓ | Allow items to be stored in multiple slots when the maximum stackable quantity is exceeded | |||
sortValue | int | ✓ | ~ 2147483646 | Display order |
Result
Type | Description | |
---|---|---|
item | ItemModelMaster | Updated Item Model Master |
Implementation Example
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.ApNort