GS2-Distributor SDK API Reference
Model
Namespace
Namespace
A Namespace allows multiple independent instances of the same service within a single project by separating data spaces and usage contexts. Each GS2 service is managed on a per-namespace basis. Even when using the same service, if the namespace differs, the data is treated as a completely independent data space.
Therefore, you must create a namespace before you can start using each service.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceId | string | ✓ | ~ 1024 chars | Namespace Grn | ||
| name | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| description | string | ~ 1024 chars | Description | |||
| transactionSetting | TransactionSetting | Transaction Settings Configuration for controlling how distributed transactions are executed when processing resource distribution. Supports auto-run, atomic commit, and async processing options. | ||||
| assumeUserId | string | ~ 1024 chars | GS2-Identifier User GRN | |||
| autoRunStampSheetNotification | NotificationSetting | ✓ | Push notification when transaction auto-execution is complete(Old specification) Configuration for sending push notifications via GS2-Gateway when a transaction completes auto-execution on the server side. This is the legacy specification; use autoRunTransactionNotification for the new specification. | |||
| autoRunTransactionNotification | NotificationSetting | ✓ | Push notification when transaction auto-execution is complete Configuration for sending push notifications via GS2-Gateway when a distributed transaction completes auto-execution on the server side. Notifies the client of the transaction result so it can update the local state accordingly. | |||
| logSetting | LogSetting | Log Output Settings Configuration for outputting log data of distributor operations to GS2-Log. By specifying a GS2-Log namespace, API request and response logs for resource distribution, transaction execution, and transaction processing can be collected. | ||||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||
| updatedAt | long | * | Now | Datetime of last update Unix time, milliseconds * Set automatically by the server | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
TransactionSetting
Transaction Settings
Transaction Settings control how transactions are executed, their consistency, asynchronous processing, and conflict avoidance mechanisms. Combining features like AutoRun, AtomicCommit, asynchronous execution using GS2-Distributor, batch application of script results, and asynchronous Acquire Actions via GS2-JobQueue enables robust transaction management tailored to game logic.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| enableAutoRun | bool | false | Whether to automatically execute issued transactions on the server side | |||
| enableAtomicCommit | bool | {enableAutoRun} == true | false | Whether to commit the execution of transactions atomically * Applicable only if enableAutoRun is true | ||
| transactionUseDistributor | bool | {enableAtomicCommit} == true | false | Whether to execute transactions asynchronously * Applicable only if enableAtomicCommit is true | ||
| commitScriptResultInUseDistributor | bool | {transactionUseDistributor} == true | false | Whether to execute the commit processing of the script result asynchronously * Applicable only if transactionUseDistributor is true | ||
| acquireActionUseJobQueue | bool | {enableAtomicCommit} == true | false | Whether to use GS2-JobQueue to execute the acquire action * Applicable only if enableAtomicCommit is true | ||
| distributorNamespaceId | string | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024 chars | GS2-Distributor Namespace GRN used to execute transactions | ||
| queueNamespaceId | string | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024 chars | GS2-JobQueue Namespace GRN used to execute transactions |
NotificationSetting
Push Notification Settings
This is a setting for sending push notifications when an event occurs in a GS2 microservice. The push notification here refers to the processing via the WebSocket interface provided by GS2-Gateway, and is different from the push notification of a smartphone. For example, when a matchmaking is completed or a friend request is received, the GS2-Gateway can send a push notification via the WebSocket interface, and the game client can detect the change of the state.
GS2-Gateway’s push notifications can be used to forward notifications to mobile push notification services when the destination device is offline. By properly utilizing mobile push notifications, you can implement a flow in which players are notified even if they exit the game during matchmaking and later return to it.
Details
| Type | Condition | Required | Default | Value Limits | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| gatewayNamespaceId | string | “grn:gs2:{region}:{ownerId}:gateway:default” | ~ 1024 chars | GS2-Gateway namespace to use for push notifications Specify the GS2-Gateway namespace ID in GRN format starting with “grn:gs2:”. | ||||||||
| enableTransferMobileNotification | bool? | false | Whether to forward the notification as a mobile push notification When this notification is sent and the destination device is offline, specify whether to forward it as a mobile push notification. | |||||||||
| sound | string | {enableTransferMobileNotification} == true | ~ 1024 chars | Sound file name to be used for mobile push notifications The sound file name specified here is used when sending mobile push notifications, and you can send notifications with a special sound. * Applicable only if enableTransferMobileNotification is true | ||||||||
| enable | String Enum enum { “Enabled”, “Disabled” } | “Enabled” | Whether to enable push notifications
|
LogSetting
Log Output Settings
Manages log output setting. This type holds the identifier of the log namespace used to output log data. The log namespace ID specifies the GS2-Log namespace to aggregate and store the log data. Through this setting, API request and response log data under this namespace will be output to the target GS2-Log. GS2-Log provides logs in real time, which can be used for system monitoring, analysis, debugging, etc.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| loggingNamespaceId | string | ✓ | ~ 1024 chars | GS2-Log namespace GRN
to output logs Must be specified in GRN format starting with “grn:gs2:”. |
GitHubCheckoutSetting
Setup to check out master data from GitHub
Details
| Type | Condition | Required | Default | Value Limits | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| apiKeyId | string | ✓ | ~ 1024 chars | GitHub API Key GRN | ||||||||||
| repositoryName | string | ✓ | ~ 1024 chars | Repository Name | ||||||||||
| sourcePath | string | ✓ | ~ 1024 chars | Master data (JSON) file path | ||||||||||
| referenceType | String Enum enum { “commit_hash”, “branch”, “tag” } | ✓ | Source of code
| |||||||||||
| commitHash | string | {referenceType} == “commit_hash” | ✓* | ~ 1024 chars | Commit hash * Required if referenceType is “commit_hash” | |||||||||
| branchName | string | {referenceType} == “branch” | ✓* | ~ 1024 chars | Branch Name * Required if referenceType is “branch” | |||||||||
| tagName | string | {referenceType} == “tag” | ✓* | ~ 1024 chars | Tag Name * Required if referenceType is “tag” |
StampSheetResult
Transaction execution results (Legacy)
Records the execution results of a transaction processed via server-side auto-execution. Contains the request payloads and response results for each phase: verify actions (precondition checks), consume actions (that deduct resources), and the acquire action (that grants resources). Also tracks HTTP status codes for error detection and retry logic.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stampSheetResultId | string | * | ~ 1024 chars | Transaction Result GRN * Set automatically by the server | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| transactionId | string | ✓ | 36 ~ 36 chars | Transaction ID A UUID that uniquely identifies this transaction. Used to correlate the transaction with its execution results and any chained subsequent transactions. | ||
| verifyTaskRequests | List<VerifyAction> | 0 ~ 100 items | List of verify action request payload | |||
| taskRequests | List<ConsumeAction> | 0 ~ 100 items | List of Consume Action request payload | |||
| sheetRequest | AcquireAction | ✓ | Acquire Action request payload | |||
| verifyTaskResultCodes | List<int> | [] | 0 ~ 100 items | Verify Action execution status code | ||
| verifyTaskResults | List<string> | [] | 0 ~ 100 items | Verify Action execution results | ||
| taskResultCodes | List<int> | [] | 0 ~ 100 items | Consume Action execution status code | ||
| taskResults | List<string> | [] | 0 ~ 100 items | Consume Action execution results | ||
| sheetResultCode | int | 0 ~ 999 | Acquire Action execution status code | |||
| sheetResult | string | ~ 1048576 chars | Acquire Action execution results | |||
| nextTransactionId | string | 36 ~ 36 chars | Transaction ID of the newly issued transaction by executing the transaction When the acquire action result contains a new transaction ID, it is extracted and stored here. This enables transaction chaining where one transaction’s completion triggers another transaction. | |||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
TransactionResult
Transaction execution results
Records the execution results of a distributed transaction processed via server-side auto-execution. Contains structured results for each phase: verify actions (precondition checks), consume actions (resource deductions), and acquire actions (resource grants). Each action result includes the request, HTTP status code, and response payload. Errors are detected by checking status codes (non-2xx), and retries are triggered for conflict (409) or server errors (5xx).
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| transactionResultId | string | * | ~ 1024 chars | Transaction Result GRN * Set automatically by the server | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| transactionId | string | ✓ | 36 ~ 36 chars | Transaction ID A UUID that uniquely identifies this distributed transaction. Used to look up the execution results and correlate with the originating API request. | ||
| verifyResults | List<VerifyActionResult> | 0 ~ 100 items | List of verify action execution results | |||
| consumeResults | List<ConsumeActionResult> | 0 ~ 100 items | List of Consume Action execution results | |||
| acquireResults | List<AcquireActionResult> | 0 ~ 100 items | List of acquire action execution results | |||
| hasError | bool | false | Whether an error occurred during transaction execution Set to true if any action (verify, consume, or acquire) returned a non-2xx status code. When true, the client should inspect individual action results to determine the failure cause. | |||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
DistributorModel
Distributor Model
Distributor Model is an entity that defines the policy applied when acquiring resources beyond the inventory capacity. By processing acquisitions through GS2-Distributor, overflow resources can be forwarded as GS2-Inbox messages.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| distributorModelId | string | * | ~ 1024 chars | Distributor Model GRN * Set automatically by the server | ||
| name | string | ✓ | ~ 128 chars | Distributor Model name Distributor Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| metadata | string | ~ 2048 chars | Metadata Arbitrary values can be set in the metadata. Since they do not affect GS2’s behavior, they can be used to store information used in the game. | |||
| inboxNamespaceId | string | ~ 1024 chars | GS2-Inbox namespace GRN
to transfer overflow resources When a resource acquisition exceeds the player’s inventory capacity, the overflow resources are forwarded as a message to the specified GS2-Inbox namespace. The player can then claim the resources from their inbox at a later time. | |||
| whiteListTargetIds | List<string> | [] | 0 ~ 1000 items | Whitelist of target resources GRN that can be processed through GS2-Distributor Specify the GRN prefix of the target resources that can be processed for acquisition using this Distributor Model. |
BatchRequestPayload
API Batch Request
Represents a single API request within a batch execution. Multiple batch request payloads can be sent together to execute several GS2 API calls in a single round trip, reducing network overhead and latency.
Details
| Type | Condition | Required | Default | Value Limits | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| requestId | string | ✓ | ~ 128 chars | Request ID A client-assigned identifier for this request within the batch. Used to correlate each request with its corresponding result in the batch response. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| service | String Enum enum { “account”, “adReward”, “auth”, “buff”, “chat”, “datastore”, “deploy”, “dictionary”, “distributor”, “enchant”, “enhance”, “exchange”, “experience”, “formation”, “friend”, “gateway”, “grade”, “guard”, “guild”, “identifier”, “idle”, “inbox”, “inventory”, “jobQueue”, “key”, “limit”, “lock”, “log”, “loginReward”, “lottery”, “matchmaking”, “megaField”, “mission”, “money”, “money2”, “news”, “quest”, “ranking”, “ranking2”, “realtime”, “schedule”, “script”, “seasonRating”, “serialKey”, “showcase”, “skillTree”, “stamina”, “stateMachine”, “version” } | ✓ | Service The GS2 microservice name to call (e.g., “inventory”, “experience”, “money”). Determines which service endpoint receives this API request.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| methodName | string | ✓ | ~ 128 chars | Method Name The API method name to invoke on the target service (e.g., “describeNamespaces”, “getInventory”). Must match a valid API method for the specified service. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parameter | string | ✓ | ~ 10240 chars | Parameter The JSON-serialized request parameters for the API method. Must conform to the request schema of the specified service method. |
BatchResultPayload
API Batch Result
Represents the result of a single API request within a batch execution. Each result is correlated with its original request by the request ID and contains the HTTP status code and JSON response payload.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| requestId | string | ✓ | ~ 128 chars | Request ID The client-assigned identifier matching the corresponding batch request. Used to correlate this result with its original request. | ||
| statusCode | int | ✓ | 100 ~ 1000 | Status Code The HTTP status code returned by the GS2 API for this batch request. 2xx indicates success, 4xx indicates a client error, and 5xx indicates a server error. | ||
| resultPayload | string | ✓ | ~ 10240 chars | Response The JSON response body returned by the GS2 API for this batch request. Contains the API method’s response data or error details. |
AcquireAction
Acquire Action
Represents a resource acquisition operation within a distributed transaction. Corresponds to a acquire action that grants resources (e.g., items, currency, experience) to the player. Contains the GS2 API action identifier and the JSON-serialized request parameters.
Details
ConsumeAction
Consume Action
Represents a resource consumption operation within a distributed transaction. Corresponds to a consume action that deducts resources (e.g., items, currency, stamina) from the player. Consume actions are executed before the acquire action to ensure the player meets the required cost.
Details
VerifyAction
Verify Action
Represents a precondition verification operation within a distributed transaction. Executed before consume and acquire actions to validate that conditions are met (e.g., checking inventory capacity, verifying quest completion status). If any verify action fails, the entire transaction is aborted.
Details
AcquireActionResult
Acquire Action execution result
Records the result of a single acquire action execution. Contains the action identifier, original request, HTTP status code indicating success or failure, and the JSON response payload from the GS2 API.
Details
ConsumeActionResult
Consume Action execution result
Records the result of a single consume action execution. Contains the action identifier, original request, HTTP status code indicating success or failure, and the JSON response payload from the GS2 API.
Details
VerifyActionResult
Verify Action execution result
Records the result of a single verify action execution. Contains the action identifier, original request, HTTP status code indicating success or failure, and the JSON response payload from the GS2 API.
Details
Config
Configuration
Set values to be applied to transaction variables
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| key | string | ✓ | ~ 64 chars | Name | ||
| value | string | ~ 51200 chars | Value |
DistributeResource
Distribute Resource
Represents a single resource distribution operation consisting of a acquire action and its request parameters. Used to specify which GS2 API action to execute and with what parameters when distributing resources to a player.
Details
CurrentDistributorMaster
Currently active Distributor Model master data
This master data describes the definitions of Distributor Models currently active within the namespace. GS2 uses JSON format files for managing master data. By uploading these files, the master data settings are updated on the server.
To create JSON files, GS2 provides a master data editor within the management console. Additionally, you can create tools better suited for game operations and export JSON files in the appropriate format.
Note
Please refer to Master Data Reference of GS2-Distributor for the JSON file format.Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceId | string | * | ~ 1024 chars | Namespace GRN * Set automatically by the server | ||
| settings | string | ✓ | ~ 5242880 bytes (5MB) | Master Data |
DistributorModelMaster
Distributor Model Master
Distributor Model Master is data used to edit and manage Distributor Model within the game. It is temporarily stored in the Management Console’s Master Data Editor. By performing import and update processes, it is reflected as Distributor Model actually referenced by the game.
Distributor Model is an entity that defines the policy applied when acquiring resources beyond the inventory capacity. By processing acquisitions through GS2-Distributor, overflow resources can be forwarded as GS2-Inbox messages.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| distributorModelId | string | * | ~ 1024 chars | Distributor Model Master GRN * Set automatically by the server | ||
| name | string | ✓ | ~ 128 chars | Distributor Model name Distributor Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| description | string | ~ 1024 chars | Description | |||
| metadata | string | ~ 2048 chars | Metadata Arbitrary values can be set in the metadata. Since they do not affect GS2’s behavior, they can be used to store information used in the game. | |||
| inboxNamespaceId | string | ~ 1024 chars | GS2-Inbox namespace GRN
to transfer overflow resources When a resource acquisition exceeds the player’s inventory capacity, the overflow resources are forwarded as a message to the specified GS2-Inbox namespace. The player can then claim the resources from their inbox at a later time. | |||
| whiteListTargetIds | List<string> | [] | 0 ~ 1000 items | Whitelist of target resources GRN that can be processed through GS2-Distributor Specify the GRN prefix of the target resources that can be processed for acquisition using this Distributor Model. | ||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||
| updatedAt | long | * | Now | Datetime of last update Unix time, milliseconds * Set automatically by the server | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
Methods
describeNamespaces
Get a list of Namespaces
Retrieves a list of namespaces that have been created on a per-service basis within the project. You can use the optional page token to start acquiring data from a specific location in the list. You can also limit the number of namespaces to be acquired.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namePrefix | string | ~ 64 chars | Filter by Namespace name prefix | |||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve |
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/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&distributor.DescribeNamespacesRequest {
NamePrefix: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DescribeNamespacesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->describeNamespaces(
(new DescribeNamespacesRequest())
->withNamePrefix(null)
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DescribeNamespacesRequest;
import io.gs2.distributor.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
DescribeNamespacesResult result = client.describeNamespaces(
new DescribeNamespacesRequest()
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
List<Namespace> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Distributor.Request.DescribeNamespacesRequest()
.WithNamePrefix(null)
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2Distributor.DescribeNamespacesRequest()
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.describe_namespaces(
distributor.DescribeNamespacesRequest()
.with_name_prefix(None)
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.describe_namespaces({
namePrefix=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('distributor')
api_result_handler = client.describe_namespaces_async({
namePrefix=nil,
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;createNamespace
Create a new Namespace
You must specify detailed information including the name, description, and various settings of the namespace.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| description | string | ~ 1024 chars | Description | |||
| transactionSetting | TransactionSetting | Transaction Settings Configuration for controlling how distributed transactions are executed when processing resource distribution. Supports auto-run, atomic commit, and async processing options. | ||||
| assumeUserId | string | ~ 1024 chars | GS2-Identifier User GRN | |||
| autoRunStampSheetNotification | NotificationSetting | ✓ | Push notification when transaction auto-execution is complete(Old specification) Configuration for sending push notifications via GS2-Gateway when a transaction completes auto-execution on the server side. This is the legacy specification; use autoRunTransactionNotification for the new specification. | |||
| autoRunTransactionNotification | NotificationSetting | ✓ | Push notification when transaction auto-execution is complete Configuration for sending push notifications via GS2-Gateway when a distributed transaction completes auto-execution on the server side. Notifies the client of the transaction result so it can update the local state accordingly. | |||
| logSetting | LogSetting | Log Output Settings Configuration for outputting log data of distributor operations to GS2-Log. By specifying a GS2-Log namespace, API request and response logs for resource distribution, transaction execution, and transaction processing can be collected. |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | Namespace created |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&distributor.CreateNamespaceRequest {
Name: pointy.String("namespace-0001"),
Description: nil,
TransactionSetting: nil,
AssumeUserId: pointy.String("grn:gs2::YourOwnerId:identifier:user:user-0001"),
AutoRunStampSheetNotification: nil,
AutoRunTransactionNotification: nil,
LogSetting: &distributor.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\CreateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->createNamespace(
(new CreateNamespaceRequest())
->withName("namespace-0001")
->withDescription(null)
->withTransactionSetting(null)
->withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
->withAutoRunStampSheetNotification(null)
->withAutoRunTransactionNotification(null)
->withLogSetting((new \Gs2\Distributor\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.CreateNamespaceRequest;
import io.gs2.distributor.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace-0001")
.withDescription(null)
.withTransactionSetting(null)
.withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
.withAutoRunStampSheetNotification(null)
.withAutoRunTransactionNotification(null)
.withLogSetting(new io.gs2.distributor.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Distributor.Request.CreateNamespaceRequest()
.WithName("namespace-0001")
.WithDescription(null)
.WithTransactionSetting(null)
.WithAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
.WithAutoRunStampSheetNotification(null)
.WithAutoRunTransactionNotification(null)
.WithLogSetting(new Gs2.Gs2Distributor.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.createNamespace(
new Gs2Distributor.CreateNamespaceRequest()
.withName("namespace-0001")
.withDescription(null)
.withTransactionSetting(null)
.withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
.withAutoRunStampSheetNotification(null)
.withAutoRunTransactionNotification(null)
.withLogSetting(new Gs2Distributor.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.create_namespace(
distributor.CreateNamespaceRequest()
.with_name('namespace-0001')
.with_description(None)
.with_transaction_setting(None)
.with_assume_user_id('grn:gs2::YourOwnerId:identifier:user:user-0001')
.with_auto_run_stamp_sheet_notification(None)
.with_auto_run_transaction_notification(None)
.with_log_setting(
distributor.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.create_namespace({
name="namespace-0001",
description=nil,
transactionSetting=nil,
assumeUserId="grn:gs2::YourOwnerId:identifier:user:user-0001",
autoRunStampSheetNotification=nil,
autoRunTransactionNotification=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.create_namespace_async({
name="namespace-0001",
description=nil,
transactionSetting=nil,
assumeUserId="grn:gs2::YourOwnerId:identifier:user:user-0001",
autoRunStampSheetNotification=nil,
autoRunTransactionNotification=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getNamespaceStatus
Get Namespace status
Get the current status of the specified namespace. This includes whether the Namespace is active, pending, or in some other state.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| status | string |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&distributor.GetNamespaceStatusRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
status := result.Statususe Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetNamespaceStatusRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->getNamespaceStatus(
(new GetNamespaceStatusRequest())
->withNamespaceName("namespace-0001")
);
$status = $result->getStatus();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetNamespaceStatusRequest;
import io.gs2.distributor.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetNamespaceStatusResult result = client.getNamespaceStatus(
new GetNamespaceStatusRequest()
.withNamespaceName("namespace-0001")
);
String status = result.getStatus();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Distributor.Request.GetNamespaceStatusRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2Distributor.GetNamespaceStatusRequest()
.withNamespaceName("namespace-0001")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_namespace_status(
distributor.GetNamespaceStatusRequest()
.with_namespace_name('namespace-0001')
)
status = result.status
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.get_namespace_status({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
status = result.status;client = gs2('distributor')
api_result_handler = client.get_namespace_status_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
status = result.status;getNamespace
Get namespace
Get detailed information about the specified namespace. This includes the name, description, and other settings of the namespace.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | Namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&distributor.GetNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->getNamespace(
(new GetNamespaceRequest())
->withNamespaceName("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetNamespaceRequest;
import io.gs2.distributor.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetNamespaceResult result = client.getNamespace(
new GetNamespaceRequest()
.withNamespaceName("namespace-0001")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Distributor.Request.GetNamespaceRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getNamespace(
new Gs2Distributor.GetNamespaceRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_namespace(
distributor.GetNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.get_namespace({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.get_namespace_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;updateNamespace
Update Namespace
Update the settings of the specified namespace. You can change the description of the Namespace and specific settings.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| description | string | ~ 1024 chars | Description | |||
| transactionSetting | TransactionSetting | Transaction Settings Configuration for controlling how distributed transactions are executed when processing resource distribution. Supports auto-run, atomic commit, and async processing options. | ||||
| assumeUserId | string | ~ 1024 chars | GS2-Identifier User GRN | |||
| autoRunStampSheetNotification | NotificationSetting | ✓ | Push notification when transaction auto-execution is complete(Old specification) Configuration for sending push notifications via GS2-Gateway when a transaction completes auto-execution on the server side. This is the legacy specification; use autoRunTransactionNotification for the new specification. | |||
| autoRunTransactionNotification | NotificationSetting | ✓ | Push notification when transaction auto-execution is complete Configuration for sending push notifications via GS2-Gateway when a distributed transaction completes auto-execution on the server side. Notifies the client of the transaction result so it can update the local state accordingly. | |||
| logSetting | LogSetting | Log Output Settings Configuration for outputting log data of distributor operations to GS2-Log. By specifying a GS2-Log namespace, API request and response logs for resource distribution, transaction execution, and transaction processing can be collected. |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | Namespace updated |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&distributor.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
Description: pointy.String("description1"),
TransactionSetting: nil,
AssumeUserId: pointy.String("grn:gs2::YourOwnerId:identifier:user:user-0001"),
AutoRunStampSheetNotification: nil,
AutoRunTransactionNotification: nil,
LogSetting: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\UpdateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->updateNamespace(
(new UpdateNamespaceRequest())
->withNamespaceName("namespace-0001")
->withDescription("description1")
->withTransactionSetting(null)
->withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
->withAutoRunStampSheetNotification(null)
->withAutoRunTransactionNotification(null)
->withLogSetting(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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.UpdateNamespaceRequest;
import io.gs2.distributor.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace-0001")
.withDescription("description1")
.withTransactionSetting(null)
.withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
.withAutoRunStampSheetNotification(null)
.withAutoRunTransactionNotification(null)
.withLogSetting(null)
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Distributor.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace-0001")
.WithDescription("description1")
.WithTransactionSetting(null)
.WithAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
.WithAutoRunStampSheetNotification(null)
.WithAutoRunTransactionNotification(null)
.WithLogSetting(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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2Distributor.UpdateNamespaceRequest()
.withNamespaceName("namespace-0001")
.withDescription("description1")
.withTransactionSetting(null)
.withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
.withAutoRunStampSheetNotification(null)
.withAutoRunTransactionNotification(null)
.withLogSetting(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.update_namespace(
distributor.UpdateNamespaceRequest()
.with_namespace_name('namespace-0001')
.with_description('description1')
.with_transaction_setting(None)
.with_assume_user_id('grn:gs2::YourOwnerId:identifier:user:user-0001')
.with_auto_run_stamp_sheet_notification(None)
.with_auto_run_transaction_notification(None)
.with_log_setting(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.update_namespace({
namespaceName="namespace-0001",
description="description1",
transactionSetting=nil,
assumeUserId="grn:gs2::YourOwnerId:identifier:user:user-0001",
autoRunStampSheetNotification=nil,
autoRunTransactionNotification=nil,
logSetting=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.update_namespace_async({
namespaceName="namespace-0001",
description="description1",
transactionSetting=nil,
assumeUserId="grn:gs2::YourOwnerId:identifier:user:user-0001",
autoRunStampSheetNotification=nil,
autoRunTransactionNotification=nil,
logSetting=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;deleteNamespace
Delete Namespace
Delete the specified namespace. This operation is irreversible and all data associated with the deleted Namespace will be lost.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | The deleted Namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&distributor.DeleteNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DeleteNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->deleteNamespace(
(new DeleteNamespaceRequest())
->withNamespaceName("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DeleteNamespaceRequest;
import io.gs2.distributor.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
DeleteNamespaceResult result = client.deleteNamespace(
new DeleteNamespaceRequest()
.withNamespaceName("namespace-0001")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Distributor.Request.DeleteNamespaceRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2Distributor.DeleteNamespaceRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.delete_namespace(
distributor.DeleteNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.delete_namespace({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.delete_namespace_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getServiceVersion
Get the microservice version
Details
Request
Request parameters: None
Result
| Type | Description | |
|---|---|---|
| item | string | Version |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetServiceVersion(
&distributor.GetServiceVersionRequest {
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetServiceVersionRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->getServiceVersion(
(new GetServiceVersionRequest())
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetServiceVersionRequest;
import io.gs2.distributor.result.GetServiceVersionResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetServiceVersionResult result = client.getServiceVersion(
new GetServiceVersionRequest()
);
String item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
new Gs2.Gs2Distributor.Request.GetServiceVersionRequest(),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getServiceVersion(
new Gs2Distributor.GetServiceVersionRequest()
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_service_version(
distributor.GetServiceVersionRequest()
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.get_service_version({
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.get_service_version_async({
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;distribute
Distribution of possessions
Distributes resources to a user based on the action specified in the distribute resource. Supported services include Inventory, Stamina, Experience, Inbox, Money, and others. If the distribution causes the user’s holdings to exceed capacity, the overflow is automatically forwarded to the inbox namespace configured in the Distributor Model.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| distributorName | string | ✓ | ~ 128 chars | Distributor Model name Distributor Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| distributeResource | DistributeResource | ✓ | Resources to be added | |||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| distributeResource | DistributeResource | Processed DistributeResource |
| inboxNamespaceId | string | GRN of the namespace of the gift box to be forwarded when the holdings are over capacity. |
| result | string | Response content |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.Distribute(
&distributor.DistributeRequest {
NamespaceName: pointy.String("namespace-0001"),
DistributorName: pointy.String("distributor-0001"),
UserId: pointy.String("user-0001"),
DistributeResource: &distributor.DistributeResource{
Action: pointy.String("Gs2Money:DepositWallet"),
Request: pointy.String("{}"),
},
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
distributeResource := result.DistributeResource
inboxNamespaceId := result.InboxNamespaceId
result := result.Resultuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DistributeRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->distribute(
(new DistributeRequest())
->withNamespaceName("namespace-0001")
->withDistributorName("distributor-0001")
->withUserId("user-0001")
->withDistributeResource((new DistributeResource())
->withAction("Gs2Money:DepositWallet")
->withRequest("{}")
)
->withTimeOffsetToken(null)
);
$distributeResource = $result->getDistributeResource();
$inboxNamespaceId = $result->getInboxNamespaceId();
$result = $result->getResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DistributeRequest;
import io.gs2.distributor.result.DistributeResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
DistributeResult result = client.distribute(
new DistributeRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-0001")
.withUserId("user-0001")
.withDistributeResource(new DistributeResource()
.withAction("Gs2Money:DepositWallet")
.withRequest("{}")
)
.withTimeOffsetToken(null)
);
DistributeResource distributeResource = result.getDistributeResource();
String inboxNamespaceId = result.getInboxNamespaceId();
String result = result.getResult();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.DistributeResult> asyncResult = null;
yield return client.Distribute(
new Gs2.Gs2Distributor.Request.DistributeRequest()
.WithNamespaceName("namespace-0001")
.WithDistributorName("distributor-0001")
.WithUserId("user-0001")
.WithDistributeResource(new Gs2.Gs2Distributor.Model.DistributeResource()
.WithAction("Gs2Money:DepositWallet")
.WithRequest("{}")
)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var distributeResource = result.DistributeResource;
var inboxNamespaceId = result.InboxNamespaceId;
var result = result.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.distribute(
new Gs2Distributor.DistributeRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-0001")
.withUserId("user-0001")
.withDistributeResource(new Gs2Distributor.model.DistributeResource()
.withAction("Gs2Money:DepositWallet")
.withRequest("{}")
)
.withTimeOffsetToken(null)
);
const distributeResource = result.getDistributeResource();
const inboxNamespaceId = result.getInboxNamespaceId();
const result = result.getResult();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.distribute(
distributor.DistributeRequest()
.with_namespace_name('namespace-0001')
.with_distributor_name('distributor-0001')
.with_user_id('user-0001')
.with_distribute_resource(distributor.DistributeResource()
.with_action('Gs2Money:DepositWallet')
.with_request('{}')
)
.with_time_offset_token(None)
)
distribute_resource = result.distribute_resource
inbox_namespace_id = result.inbox_namespace_id
result = result.result
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.distribute({
namespaceName="namespace-0001",
distributorName="distributor-0001",
userId="user-0001",
distributeResource={
action="Gs2Money:DepositWallet",
request="{}",
},
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
distributeResource = result.distributeResource;
inboxNamespaceId = result.inboxNamespaceId;
result = result.result;client = gs2('distributor')
api_result_handler = client.distribute_async({
namespaceName="namespace-0001",
distributorName="distributor-0001",
userId="user-0001",
distributeResource={
action="Gs2Money:DepositWallet",
request="{}",
},
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
distributeResource = result.distributeResource;
inboxNamespaceId = result.inboxNamespaceId;
result = result.result;distributeWithoutOverflowProcess
Distribute possessions (no bailout in case of overflow)
Distributes resources to a user without overflow handling. Unlike the standard distribute operation, if the distribution causes the user’s holdings to exceed capacity, the excess is simply discarded and not forwarded to the inbox. This variant does not require a namespace specification.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| distributeResource | DistributeResource | ✓ | Resources to be added | |||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| distributeResource | DistributeResource | Processed DistributeResource |
| result | string | Response content |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.DistributeWithoutOverflowProcess(
&distributor.DistributeWithoutOverflowProcessRequest {
UserId: pointy.String("user-0001"),
DistributeResource: &distributor.DistributeResource{
Action: pointy.String("Gs2Money:DepositWallet"),
Request: pointy.String("{}"),
},
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
distributeResource := result.DistributeResource
result := result.Resultuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DistributeWithoutOverflowProcessRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->distributeWithoutOverflowProcess(
(new DistributeWithoutOverflowProcessRequest())
->withUserId("user-0001")
->withDistributeResource((new DistributeResource())
->withAction("Gs2Money:DepositWallet")
->withRequest("{}")
)
->withTimeOffsetToken(null)
);
$distributeResource = $result->getDistributeResource();
$result = $result->getResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DistributeWithoutOverflowProcessRequest;
import io.gs2.distributor.result.DistributeWithoutOverflowProcessResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
DistributeWithoutOverflowProcessResult result = client.distributeWithoutOverflowProcess(
new DistributeWithoutOverflowProcessRequest()
.withUserId("user-0001")
.withDistributeResource(new DistributeResource()
.withAction("Gs2Money:DepositWallet")
.withRequest("{}")
)
.withTimeOffsetToken(null)
);
DistributeResource distributeResource = result.getDistributeResource();
String result = result.getResult();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.DistributeWithoutOverflowProcessResult> asyncResult = null;
yield return client.DistributeWithoutOverflowProcess(
new Gs2.Gs2Distributor.Request.DistributeWithoutOverflowProcessRequest()
.WithUserId("user-0001")
.WithDistributeResource(new Gs2.Gs2Distributor.Model.DistributeResource()
.WithAction("Gs2Money:DepositWallet")
.WithRequest("{}")
)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var distributeResource = result.DistributeResource;
var result = result.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.distributeWithoutOverflowProcess(
new Gs2Distributor.DistributeWithoutOverflowProcessRequest()
.withUserId("user-0001")
.withDistributeResource(new Gs2Distributor.model.DistributeResource()
.withAction("Gs2Money:DepositWallet")
.withRequest("{}")
)
.withTimeOffsetToken(null)
);
const distributeResource = result.getDistributeResource();
const result = result.getResult();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.distribute_without_overflow_process(
distributor.DistributeWithoutOverflowProcessRequest()
.with_user_id('user-0001')
.with_distribute_resource(distributor.DistributeResource()
.with_action('Gs2Money:DepositWallet')
.with_request('{}')
)
.with_time_offset_token(None)
)
distribute_resource = result.distribute_resource
result = result.result
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.distribute_without_overflow_process({
userId="user-0001",
distributeResource={
action="Gs2Money:DepositWallet",
request="{}",
},
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
distributeResource = result.distributeResource;
result = result.result;client = gs2('distributor')
api_result_handler = client.distribute_without_overflow_process_async({
userId="user-0001",
distributeResource={
action="Gs2Money:DepositWallet",
request="{}",
},
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
distributeResource = result.distributeResource;
result = result.result;runVerifyTask
Execute verify action of transaction
Executes a single verify task within a transaction to check preconditions. The returned context stack reflects the verification result and is passed to subsequent tasks in the transaction.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| verifyTask | string | ✓ | ~ 5242880 chars | Verify Action | ||
| keyId | string | ✓ | ~ 1024 chars | Encryption Key GRN |
Result
| Type | Description | |
|---|---|---|
| contextStack | string | Request of context reflecting task execution results |
| statusCode | int | Status code |
| result | string | Response content |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.RunVerifyTask(
&distributor.RunVerifyTaskRequest {
NamespaceName: pointy.String("namespace-0001"),
VerifyTask: pointy.String("stampTask"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
contextStack := result.ContextStack
statusCode := result.StatusCode
result := result.Resultuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunVerifyTaskRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->runVerifyTask(
(new RunVerifyTaskRequest())
->withNamespaceName("namespace-0001")
->withVerifyTask("stampTask")
->withKeyId("key-0001")
);
$contextStack = $result->getContextStack();
$statusCode = $result->getStatusCode();
$result = $result->getResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.RunVerifyTaskRequest;
import io.gs2.distributor.result.RunVerifyTaskResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
RunVerifyTaskResult result = client.runVerifyTask(
new RunVerifyTaskRequest()
.withNamespaceName("namespace-0001")
.withVerifyTask("stampTask")
.withKeyId("key-0001")
);
String contextStack = result.getContextStack();
int statusCode = result.getStatusCode();
String result = result.getResult();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.RunVerifyTaskResult> asyncResult = null;
yield return client.RunVerifyTask(
new Gs2.Gs2Distributor.Request.RunVerifyTaskRequest()
.WithNamespaceName("namespace-0001")
.WithVerifyTask("stampTask")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var contextStack = result.ContextStack;
var statusCode = result.StatusCode;
var result = result.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.runVerifyTask(
new Gs2Distributor.RunVerifyTaskRequest()
.withNamespaceName("namespace-0001")
.withVerifyTask("stampTask")
.withKeyId("key-0001")
);
const contextStack = result.getContextStack();
const statusCode = result.getStatusCode();
const result = result.getResult();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.run_verify_task(
distributor.RunVerifyTaskRequest()
.with_namespace_name('namespace-0001')
.with_verify_task('stampTask')
.with_key_id('key-0001')
)
context_stack = result.context_stack
status_code = result.status_code
result = result.result
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.run_verify_task({
namespaceName="namespace-0001",
verifyTask="stampTask",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
contextStack = result.contextStack;
statusCode = result.statusCode;
result = result.result;client = gs2('distributor')
api_result_handler = client.run_verify_task_async({
namespaceName="namespace-0001",
verifyTask="stampTask",
keyId="key-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
contextStack = result.contextStack;
statusCode = result.statusCode;
result = result.result;runStampSheetExpress
Execute transaction
Executes all three phases of a transaction in sequence: verify actions, consume actions, and acquire action. This is a convenience API that combines RunVerifyTask, RunStampTask, and RunStampSheet into a single call. The results of all phases are returned together, including individual status codes and response content for each verify task, consume action, and the transaction.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| stampSheet | string | ✓ | ~ 5242880 chars | Transaction | ||
| keyId | string | ✓ | ~ 1024 chars | Encryption Key GRN |
Result
| Type | Description | |
|---|---|---|
| verifyTaskResultCodes | List<int> | Verify Action execution status code |
| verifyTaskResults | List<string> | Verify Action execution results |
| taskResultCodes | List<int> | Consume Action execution status code |
| taskResults | List<string> | Consume Action execution results |
| sheetResultCode | int | Acquire Action execution status code |
| sheetResult | string | Acquire Action execution result response content |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.RunStampSheetExpress(
&distributor.RunStampSheetExpressRequest {
NamespaceName: pointy.String("namespace-0001"),
StampSheet: pointy.String("stampSheet"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
verifyTaskResultCodes := result.VerifyTaskResultCodes
verifyTaskResults := result.VerifyTaskResults
taskResultCodes := result.TaskResultCodes
taskResults := result.TaskResults
sheetResultCode := result.SheetResultCode
sheetResult := result.SheetResultuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunStampSheetExpressRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->runStampSheetExpress(
(new RunStampSheetExpressRequest())
->withNamespaceName("namespace-0001")
->withStampSheet("stampSheet")
->withKeyId("key-0001")
);
$verifyTaskResultCodes = $result->getVerifyTaskResultCodes();
$verifyTaskResults = $result->getVerifyTaskResults();
$taskResultCodes = $result->getTaskResultCodes();
$taskResults = $result->getTaskResults();
$sheetResultCode = $result->getSheetResultCode();
$sheetResult = $result->getSheetResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.RunStampSheetExpressRequest;
import io.gs2.distributor.result.RunStampSheetExpressResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
RunStampSheetExpressResult result = client.runStampSheetExpress(
new RunStampSheetExpressRequest()
.withNamespaceName("namespace-0001")
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
List<int> verifyTaskResultCodes = result.getVerifyTaskResultCodes();
List<String> verifyTaskResults = result.getVerifyTaskResults();
List<int> taskResultCodes = result.getTaskResultCodes();
List<String> taskResults = result.getTaskResults();
int sheetResultCode = result.getSheetResultCode();
String sheetResult = result.getSheetResult();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.RunStampSheetExpressResult> asyncResult = null;
yield return client.RunStampSheetExpress(
new Gs2.Gs2Distributor.Request.RunStampSheetExpressRequest()
.WithNamespaceName("namespace-0001")
.WithStampSheet("stampSheet")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var verifyTaskResultCodes = result.VerifyTaskResultCodes;
var verifyTaskResults = result.VerifyTaskResults;
var taskResultCodes = result.TaskResultCodes;
var taskResults = result.TaskResults;
var sheetResultCode = result.SheetResultCode;
var sheetResult = result.SheetResult;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.runStampSheetExpress(
new Gs2Distributor.RunStampSheetExpressRequest()
.withNamespaceName("namespace-0001")
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
const verifyTaskResultCodes = result.getVerifyTaskResultCodes();
const verifyTaskResults = result.getVerifyTaskResults();
const taskResultCodes = result.getTaskResultCodes();
const taskResults = result.getTaskResults();
const sheetResultCode = result.getSheetResultCode();
const sheetResult = result.getSheetResult();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.run_stamp_sheet_express(
distributor.RunStampSheetExpressRequest()
.with_namespace_name('namespace-0001')
.with_stamp_sheet('stampSheet')
.with_key_id('key-0001')
)
verify_task_result_codes = result.verify_task_result_codes
verify_task_results = result.verify_task_results
task_result_codes = result.task_result_codes
task_results = result.task_results
sheet_result_code = result.sheet_result_code
sheet_result = result.sheet_result
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.run_stamp_sheet_express({
namespaceName="namespace-0001",
stampSheet="stampSheet",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
verifyTaskResultCodes = result.verifyTaskResultCodes;
verifyTaskResults = result.verifyTaskResults;
taskResultCodes = result.taskResultCodes;
taskResults = result.taskResults;
sheetResultCode = result.sheetResultCode;
sheetResult = result.sheetResult;client = gs2('distributor')
api_result_handler = client.run_stamp_sheet_express_async({
namespaceName="namespace-0001",
stampSheet="stampSheet",
keyId="key-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
verifyTaskResultCodes = result.verifyTaskResultCodes;
verifyTaskResults = result.verifyTaskResults;
taskResultCodes = result.taskResultCodes;
taskResults = result.taskResults;
sheetResultCode = result.sheetResultCode;
sheetResult = result.sheetResult;runVerifyTaskWithoutNamespace
Execute verify action of transaction without specifying the GS2-Distributor namespace
Executes a verify task without specifying a GS2-Distributor namespace. By omitting the namespace specification, the following side effects occur:
- Execution logs are not recorded
- Resource overflow processing is not performed This is useful when a lightweight verify execution is needed without the overhead of namespace-level features.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| verifyTask | string | ✓ | ~ 5242880 chars | Verify Action | ||
| keyId | string | ✓ | ~ 1024 chars | Encryption Key GRN |
Result
| Type | Description | |
|---|---|---|
| contextStack | string | Request of context reflecting task execution results |
| statusCode | int | Status code |
| result | string | Response content |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.RunVerifyTaskWithoutNamespace(
&distributor.RunVerifyTaskWithoutNamespaceRequest {
VerifyTask: pointy.String("stampTask"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
contextStack := result.ContextStack
statusCode := result.StatusCode
result := result.Resultuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunVerifyTaskWithoutNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->runVerifyTaskWithoutNamespace(
(new RunVerifyTaskWithoutNamespaceRequest())
->withVerifyTask("stampTask")
->withKeyId("key-0001")
);
$contextStack = $result->getContextStack();
$statusCode = $result->getStatusCode();
$result = $result->getResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.RunVerifyTaskWithoutNamespaceRequest;
import io.gs2.distributor.result.RunVerifyTaskWithoutNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
RunVerifyTaskWithoutNamespaceResult result = client.runVerifyTaskWithoutNamespace(
new RunVerifyTaskWithoutNamespaceRequest()
.withVerifyTask("stampTask")
.withKeyId("key-0001")
);
String contextStack = result.getContextStack();
int statusCode = result.getStatusCode();
String result = result.getResult();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.RunVerifyTaskWithoutNamespaceResult> asyncResult = null;
yield return client.RunVerifyTaskWithoutNamespace(
new Gs2.Gs2Distributor.Request.RunVerifyTaskWithoutNamespaceRequest()
.WithVerifyTask("stampTask")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var contextStack = result.ContextStack;
var statusCode = result.StatusCode;
var result = result.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.runVerifyTaskWithoutNamespace(
new Gs2Distributor.RunVerifyTaskWithoutNamespaceRequest()
.withVerifyTask("stampTask")
.withKeyId("key-0001")
);
const contextStack = result.getContextStack();
const statusCode = result.getStatusCode();
const result = result.getResult();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.run_verify_task_without_namespace(
distributor.RunVerifyTaskWithoutNamespaceRequest()
.with_verify_task('stampTask')
.with_key_id('key-0001')
)
context_stack = result.context_stack
status_code = result.status_code
result = result.result
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.run_verify_task_without_namespace({
verifyTask="stampTask",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
contextStack = result.contextStack;
statusCode = result.statusCode;
result = result.result;client = gs2('distributor')
api_result_handler = client.run_verify_task_without_namespace_async({
verifyTask="stampTask",
keyId="key-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
contextStack = result.contextStack;
statusCode = result.statusCode;
result = result.result;runStampTaskWithoutNamespace
Execute consume action of transaction without specifying the GS2-Distributor namespace
Executes a consume action without specifying a GS2-Distributor namespace. By omitting the namespace specification, the following side effects occur:
- Execution logs are not recorded
- Resource overflow processing is not performed This is useful when a lightweight consume execution is needed without the overhead of namespace-level features.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stampTask | string | ✓ | ~ 5242880 chars | Consume Action | ||
| keyId | string | ✓ | ~ 1024 chars | Encryption Key GRN |
Result
| Type | Description | |
|---|---|---|
| contextStack | string | Request of context reflecting task execution results |
| statusCode | int | Status code |
| result | string | Response content |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.RunStampTaskWithoutNamespace(
&distributor.RunStampTaskWithoutNamespaceRequest {
StampTask: pointy.String("stampTask"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
contextStack := result.ContextStack
statusCode := result.StatusCode
result := result.Resultuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunStampTaskWithoutNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->runStampTaskWithoutNamespace(
(new RunStampTaskWithoutNamespaceRequest())
->withStampTask("stampTask")
->withKeyId("key-0001")
);
$contextStack = $result->getContextStack();
$statusCode = $result->getStatusCode();
$result = $result->getResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.RunStampTaskWithoutNamespaceRequest;
import io.gs2.distributor.result.RunStampTaskWithoutNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
RunStampTaskWithoutNamespaceResult result = client.runStampTaskWithoutNamespace(
new RunStampTaskWithoutNamespaceRequest()
.withStampTask("stampTask")
.withKeyId("key-0001")
);
String contextStack = result.getContextStack();
int statusCode = result.getStatusCode();
String result = result.getResult();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.RunStampTaskWithoutNamespaceResult> asyncResult = null;
yield return client.RunStampTaskWithoutNamespace(
new Gs2.Gs2Distributor.Request.RunStampTaskWithoutNamespaceRequest()
.WithStampTask("stampTask")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var contextStack = result.ContextStack;
var statusCode = result.StatusCode;
var result = result.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.runStampTaskWithoutNamespace(
new Gs2Distributor.RunStampTaskWithoutNamespaceRequest()
.withStampTask("stampTask")
.withKeyId("key-0001")
);
const contextStack = result.getContextStack();
const statusCode = result.getStatusCode();
const result = result.getResult();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.run_stamp_task_without_namespace(
distributor.RunStampTaskWithoutNamespaceRequest()
.with_stamp_task('stampTask')
.with_key_id('key-0001')
)
context_stack = result.context_stack
status_code = result.status_code
result = result.result
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.run_stamp_task_without_namespace({
stampTask="stampTask",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
contextStack = result.contextStack;
statusCode = result.statusCode;
result = result.result;client = gs2('distributor')
api_result_handler = client.run_stamp_task_without_namespace_async({
stampTask="stampTask",
keyId="key-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
contextStack = result.contextStack;
statusCode = result.statusCode;
result = result.result;runStampSheetWithoutNamespace
Execute acquire action of transaction without specifying the GS2-Distributor namespace
Executes a acquire action without specifying a GS2-Distributor namespace. By omitting the namespace specification, the following side effects occur:
- Execution logs are not recorded
- Resource overflow processing is not performed (excess resources are discarded) This is useful when a lightweight acquire execution is needed without the overhead of namespace-level features.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stampSheet | string | ✓ | ~ 5242880 chars | Transaction | ||
| keyId | string | ✓ | ~ 1024 chars | Encryption Key GRN |
Result
| Type | Description | |
|---|---|---|
| statusCode | int | Status code |
| result | string | Response content |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.RunStampSheetWithoutNamespace(
&distributor.RunStampSheetWithoutNamespaceRequest {
StampSheet: pointy.String("stampSheet"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
statusCode := result.StatusCode
result := result.Resultuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunStampSheetWithoutNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->runStampSheetWithoutNamespace(
(new RunStampSheetWithoutNamespaceRequest())
->withStampSheet("stampSheet")
->withKeyId("key-0001")
);
$statusCode = $result->getStatusCode();
$result = $result->getResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.RunStampSheetWithoutNamespaceRequest;
import io.gs2.distributor.result.RunStampSheetWithoutNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
RunStampSheetWithoutNamespaceResult result = client.runStampSheetWithoutNamespace(
new RunStampSheetWithoutNamespaceRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
int statusCode = result.getStatusCode();
String result = result.getResult();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.RunStampSheetWithoutNamespaceResult> asyncResult = null;
yield return client.RunStampSheetWithoutNamespace(
new Gs2.Gs2Distributor.Request.RunStampSheetWithoutNamespaceRequest()
.WithStampSheet("stampSheet")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var statusCode = result.StatusCode;
var result = result.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.runStampSheetWithoutNamespace(
new Gs2Distributor.RunStampSheetWithoutNamespaceRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
const statusCode = result.getStatusCode();
const result = result.getResult();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.run_stamp_sheet_without_namespace(
distributor.RunStampSheetWithoutNamespaceRequest()
.with_stamp_sheet('stampSheet')
.with_key_id('key-0001')
)
status_code = result.status_code
result = result.result
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.run_stamp_sheet_without_namespace({
stampSheet="stampSheet",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
statusCode = result.statusCode;
result = result.result;client = gs2('distributor')
api_result_handler = client.run_stamp_sheet_without_namespace_async({
stampSheet="stampSheet",
keyId="key-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
statusCode = result.statusCode;
result = result.result;runStampSheetExpressWithoutNamespace
Execute transactions without specifying the GS2-Distributor namespace
Executes all three phases of a transaction (verify, consume, acquire) in sequence without specifying a GS2-Distributor namespace. By omitting the namespace specification, the following side effects occur:
- Execution logs are not recorded
- Resource overflow processing is not performed (excess resources are discarded) This is useful when a lightweight full transaction execution is needed without the overhead of namespace-level features.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stampSheet | string | ✓ | ~ 5242880 chars | Transaction | ||
| keyId | string | ✓ | ~ 1024 chars | Encryption Key GRN |
Result
| Type | Description | |
|---|---|---|
| verifyTaskResultCodes | List<int> | Verify Action execution status code |
| verifyTaskResults | List<string> | Verify Action execution results |
| taskResultCodes | List<int> | Consume Action execution status code |
| taskResults | List<string> | Consume Action execution results |
| sheetResultCode | int | Acquire Action execution status code |
| sheetResult | string | Acquire Action execution result response content |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.RunStampSheetExpressWithoutNamespace(
&distributor.RunStampSheetExpressWithoutNamespaceRequest {
StampSheet: pointy.String("stampSheet"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
verifyTaskResultCodes := result.VerifyTaskResultCodes
verifyTaskResults := result.VerifyTaskResults
taskResultCodes := result.TaskResultCodes
taskResults := result.TaskResults
sheetResultCode := result.SheetResultCode
sheetResult := result.SheetResultuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunStampSheetExpressWithoutNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->runStampSheetExpressWithoutNamespace(
(new RunStampSheetExpressWithoutNamespaceRequest())
->withStampSheet("stampSheet")
->withKeyId("key-0001")
);
$verifyTaskResultCodes = $result->getVerifyTaskResultCodes();
$verifyTaskResults = $result->getVerifyTaskResults();
$taskResultCodes = $result->getTaskResultCodes();
$taskResults = $result->getTaskResults();
$sheetResultCode = $result->getSheetResultCode();
$sheetResult = $result->getSheetResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.RunStampSheetExpressWithoutNamespaceRequest;
import io.gs2.distributor.result.RunStampSheetExpressWithoutNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
RunStampSheetExpressWithoutNamespaceResult result = client.runStampSheetExpressWithoutNamespace(
new RunStampSheetExpressWithoutNamespaceRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
List<int> verifyTaskResultCodes = result.getVerifyTaskResultCodes();
List<String> verifyTaskResults = result.getVerifyTaskResults();
List<int> taskResultCodes = result.getTaskResultCodes();
List<String> taskResults = result.getTaskResults();
int sheetResultCode = result.getSheetResultCode();
String sheetResult = result.getSheetResult();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.RunStampSheetExpressWithoutNamespaceResult> asyncResult = null;
yield return client.RunStampSheetExpressWithoutNamespace(
new Gs2.Gs2Distributor.Request.RunStampSheetExpressWithoutNamespaceRequest()
.WithStampSheet("stampSheet")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var verifyTaskResultCodes = result.VerifyTaskResultCodes;
var verifyTaskResults = result.VerifyTaskResults;
var taskResultCodes = result.TaskResultCodes;
var taskResults = result.TaskResults;
var sheetResultCode = result.SheetResultCode;
var sheetResult = result.SheetResult;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.runStampSheetExpressWithoutNamespace(
new Gs2Distributor.RunStampSheetExpressWithoutNamespaceRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
const verifyTaskResultCodes = result.getVerifyTaskResultCodes();
const verifyTaskResults = result.getVerifyTaskResults();
const taskResultCodes = result.getTaskResultCodes();
const taskResults = result.getTaskResults();
const sheetResultCode = result.getSheetResultCode();
const sheetResult = result.getSheetResult();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.run_stamp_sheet_express_without_namespace(
distributor.RunStampSheetExpressWithoutNamespaceRequest()
.with_stamp_sheet('stampSheet')
.with_key_id('key-0001')
)
verify_task_result_codes = result.verify_task_result_codes
verify_task_results = result.verify_task_results
task_result_codes = result.task_result_codes
task_results = result.task_results
sheet_result_code = result.sheet_result_code
sheet_result = result.sheet_result
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.run_stamp_sheet_express_without_namespace({
stampSheet="stampSheet",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
verifyTaskResultCodes = result.verifyTaskResultCodes;
verifyTaskResults = result.verifyTaskResults;
taskResultCodes = result.taskResultCodes;
taskResults = result.taskResults;
sheetResultCode = result.sheetResultCode;
sheetResult = result.sheetResult;client = gs2('distributor')
api_result_handler = client.run_stamp_sheet_express_without_namespace_async({
stampSheet="stampSheet",
keyId="key-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
verifyTaskResultCodes = result.verifyTaskResultCodes;
verifyTaskResults = result.verifyTaskResults;
taskResultCodes = result.taskResultCodes;
taskResults = result.taskResults;
sheetResultCode = result.sheetResultCode;
sheetResult = result.sheetResult;setTransactionDefaultConfig
Set the default value of Config to be specified for the Transaction Issuance API
Sets default Config values that are automatically applied to subsequent transaction API calls. The default values are embedded in the returned ContextStack; by including this ContextStack in subsequent requests, the Config values are automatically applied. The default values are valid for 18 hours from the time they are set. After that, the values are ignored and must be set again. This is useful for setting commonly used Config values (such as slot names or rate model names) once without having to specify them in every transaction.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| config | List<Config> | ✓ | 1 ~ 1000 items | Transaction placeholder applied settings values |
Result
| Type | Description | |
|---|---|---|
| newContextStack | string | Context stack reflecting the results of the task |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.SetTransactionDefaultConfig(
&distributor.SetTransactionDefaultConfigRequest {
AccessToken: pointy.String("accessToken-0001"),
Config: []distributor.Config{
distributor.Config{
Key: pointy.String("key-0001"),
Value: pointy.String("value-0001"),
},
distributor.Config{
Key: pointy.String("key-0002"),
Value: pointy.String("value-0002"),
},
},
}
)
if err != nil {
panic("error occurred")
}
newContextStack := result.NewContextStackuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\SetTransactionDefaultConfigRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->setTransactionDefaultConfig(
(new SetTransactionDefaultConfigRequest())
->withAccessToken("accessToken-0001")
->withConfig([
(new Config())
->withKey("key-0001")
->withValue("value-0001"),
(new Config())
->withKey("key-0002")
->withValue("value-0002"),
])
);
$newContextStack = $result->getNewContextStack();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.SetTransactionDefaultConfigRequest;
import io.gs2.distributor.result.SetTransactionDefaultConfigResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
SetTransactionDefaultConfigResult result = client.setTransactionDefaultConfig(
new SetTransactionDefaultConfigRequest()
.withAccessToken("accessToken-0001")
.withConfig(Arrays.asList(
new Config()
.withKey("key-0001")
.withValue("value-0001"),
new Config()
.withKey("key-0002")
.withValue("value-0002")
))
);
String newContextStack = result.getNewContextStack();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.SetTransactionDefaultConfigResult> asyncResult = null;
yield return client.SetTransactionDefaultConfig(
new Gs2.Gs2Distributor.Request.SetTransactionDefaultConfigRequest()
.WithAccessToken("accessToken-0001")
.WithConfig(new Gs2.Gs2Distributor.Model.Config[] {
new Gs2.Gs2Distributor.Model.Config()
.WithKey("key-0001")
.WithValue("value-0001"),
new Gs2.Gs2Distributor.Model.Config()
.WithKey("key-0002")
.WithValue("value-0002"),
}),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var newContextStack = result.NewContextStack;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.setTransactionDefaultConfig(
new Gs2Distributor.SetTransactionDefaultConfigRequest()
.withAccessToken("accessToken-0001")
.withConfig([
new Gs2Distributor.model.Config()
.withKey("key-0001")
.withValue("value-0001"),
new Gs2Distributor.model.Config()
.withKey("key-0002")
.withValue("value-0002"),
])
);
const newContextStack = result.getNewContextStack();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.set_transaction_default_config(
distributor.SetTransactionDefaultConfigRequest()
.with_access_token('accessToken-0001')
.with_config([
distributor.Config()
.with_key('key-0001')
.with_value('value-0001'),
distributor.Config()
.with_key('key-0002')
.with_value('value-0002'),
])
)
new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.set_transaction_default_config({
accessToken="accessToken-0001",
config={
{
key="key-0001",
value="value-0001",
},
{
key="key-0002",
value="value-0002",
}
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
newContextStack = result.newContextStack;client = gs2('distributor')
api_result_handler = client.set_transaction_default_config_async({
accessToken="accessToken-0001",
config={
{
key="key-0001",
value="value-0001",
},
{
key="key-0002",
value="value-0002",
}
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
newContextStack = result.newContextStack;setTransactionDefaultConfigByUserId
Set the default value of Config to be specified for the Transaction Issuance API by specifying a user ID
Sets default Config values that are automatically applied to subsequent transaction API calls for the specified user. The default values are embedded in the returned ContextStack; by including this ContextStack in subsequent requests, the Config values are automatically applied. The default values are valid for 18 hours from the time they are set. After that, the values are ignored and must be set again. This is useful for setting commonly used Config values (such as slot names or rate model names) once without having to specify them in every transaction.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| config | List<Config> | ✓ | 1 ~ 1000 items | Transaction placeholder applied settings values | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| newContextStack | string | Context stack reflecting the results of the task |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.SetTransactionDefaultConfigByUserId(
&distributor.SetTransactionDefaultConfigByUserIdRequest {
UserId: pointy.String("user-0001"),
Config: []distributor.Config{
distributor.Config{
Key: pointy.String("key-0001"),
Value: pointy.String("value-0001"),
},
distributor.Config{
Key: pointy.String("key-0002"),
Value: pointy.String("value-0002"),
},
},
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
newContextStack := result.NewContextStackuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\SetTransactionDefaultConfigByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->setTransactionDefaultConfigByUserId(
(new SetTransactionDefaultConfigByUserIdRequest())
->withUserId("user-0001")
->withConfig([
(new Config())
->withKey("key-0001")
->withValue("value-0001"),
(new Config())
->withKey("key-0002")
->withValue("value-0002"),
])
->withTimeOffsetToken(null)
);
$newContextStack = $result->getNewContextStack();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.SetTransactionDefaultConfigByUserIdRequest;
import io.gs2.distributor.result.SetTransactionDefaultConfigByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
SetTransactionDefaultConfigByUserIdResult result = client.setTransactionDefaultConfigByUserId(
new SetTransactionDefaultConfigByUserIdRequest()
.withUserId("user-0001")
.withConfig(Arrays.asList(
new Config()
.withKey("key-0001")
.withValue("value-0001"),
new Config()
.withKey("key-0002")
.withValue("value-0002")
))
.withTimeOffsetToken(null)
);
String newContextStack = result.getNewContextStack();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.SetTransactionDefaultConfigByUserIdResult> asyncResult = null;
yield return client.SetTransactionDefaultConfigByUserId(
new Gs2.Gs2Distributor.Request.SetTransactionDefaultConfigByUserIdRequest()
.WithUserId("user-0001")
.WithConfig(new Gs2.Gs2Distributor.Model.Config[] {
new Gs2.Gs2Distributor.Model.Config()
.WithKey("key-0001")
.WithValue("value-0001"),
new Gs2.Gs2Distributor.Model.Config()
.WithKey("key-0002")
.WithValue("value-0002"),
})
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var newContextStack = result.NewContextStack;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.setTransactionDefaultConfigByUserId(
new Gs2Distributor.SetTransactionDefaultConfigByUserIdRequest()
.withUserId("user-0001")
.withConfig([
new Gs2Distributor.model.Config()
.withKey("key-0001")
.withValue("value-0001"),
new Gs2Distributor.model.Config()
.withKey("key-0002")
.withValue("value-0002"),
])
.withTimeOffsetToken(null)
);
const newContextStack = result.getNewContextStack();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.set_transaction_default_config_by_user_id(
distributor.SetTransactionDefaultConfigByUserIdRequest()
.with_user_id('user-0001')
.with_config([
distributor.Config()
.with_key('key-0001')
.with_value('value-0001'),
distributor.Config()
.with_key('key-0002')
.with_value('value-0002'),
])
.with_time_offset_token(None)
)
new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.set_transaction_default_config_by_user_id({
userId="user-0001",
config={
{
key="key-0001",
value="value-0001",
},
{
key="key-0002",
value="value-0002",
}
},
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
newContextStack = result.newContextStack;client = gs2('distributor')
api_result_handler = client.set_transaction_default_config_by_user_id_async({
userId="user-0001",
config={
{
key="key-0001",
value="value-0001",
},
{
key="key-0002",
value="value-0002",
}
},
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
newContextStack = result.newContextStack;freezeMasterData
Freeze master data at the current time
Freezes the master data at the current timestamp for the currently logged-in user. The freeze timestamp is recorded in the returned ContextStack; by including this ContextStack in subsequent requests, the master data as of the freeze time is used instead of the latest version. This ensures consistent master data during a series of related operations, preventing mid-operation changes from affecting the user.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token |
Result
| Type | Description | |
|---|---|---|
| newContextStack | string | Context recording the time at which master data is fixed |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.FreezeMasterData(
&distributor.FreezeMasterDataRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
}
)
if err != nil {
panic("error occurred")
}
newContextStack := result.NewContextStackuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\FreezeMasterDataRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->freezeMasterData(
(new FreezeMasterDataRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
);
$newContextStack = $result->getNewContextStack();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.FreezeMasterDataRequest;
import io.gs2.distributor.result.FreezeMasterDataResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
FreezeMasterDataResult result = client.freezeMasterData(
new FreezeMasterDataRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
);
String newContextStack = result.getNewContextStack();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.FreezeMasterDataResult> asyncResult = null;
yield return client.FreezeMasterData(
new Gs2.Gs2Distributor.Request.FreezeMasterDataRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var newContextStack = result.NewContextStack;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.freezeMasterData(
new Gs2Distributor.FreezeMasterDataRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
);
const newContextStack = result.getNewContextStack();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.freeze_master_data(
distributor.FreezeMasterDataRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
)
new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.freeze_master_data({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
newContextStack = result.newContextStack;client = gs2('distributor')
api_result_handler = client.freeze_master_data_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
newContextStack = result.newContextStack;freezeMasterDataByUserId
Freeze master data at the current time by specifying a user ID
Freezes the master data at the current timestamp for the specified user. The freeze timestamp is recorded in the returned ContextStack; by including this ContextStack in subsequent requests, the master data as of the freeze time is used instead of the latest version. This ensures consistent master data during a series of related operations, preventing mid-operation changes from affecting the user.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| newContextStack | string | Context recording the time at which master data is fixed |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.FreezeMasterDataByUserId(
&distributor.FreezeMasterDataByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
newContextStack := result.NewContextStackuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\FreezeMasterDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->freezeMasterDataByUserId(
(new FreezeMasterDataByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$newContextStack = $result->getNewContextStack();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.FreezeMasterDataByUserIdRequest;
import io.gs2.distributor.result.FreezeMasterDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
FreezeMasterDataByUserIdResult result = client.freezeMasterDataByUserId(
new FreezeMasterDataByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
String newContextStack = result.getNewContextStack();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.FreezeMasterDataByUserIdResult> asyncResult = null;
yield return client.FreezeMasterDataByUserId(
new Gs2.Gs2Distributor.Request.FreezeMasterDataByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var newContextStack = result.NewContextStack;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.freezeMasterDataByUserId(
new Gs2Distributor.FreezeMasterDataByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const newContextStack = result.getNewContextStack();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.freeze_master_data_by_user_id(
distributor.FreezeMasterDataByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_time_offset_token(None)
)
new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.freeze_master_data_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
newContextStack = result.newContextStack;client = gs2('distributor')
api_result_handler = client.freeze_master_data_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
newContextStack = result.newContextStack;signFreezeMasterDataTimestamp
Sign a timestamp for freezing master data
Creates a cryptographic signature for a specified timestamp using the provided encryption key. The returned body and signature can be used with FreezeMasterDataBySignedTimestamp to freeze master data at the specified time. This allows server-side control over the freeze timestamp, preventing clients from specifying arbitrary timestamps.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| timestamp | long | Now | Timestamp to freeze master data | |||
| keyId | string | ✓ | ~ 1024 chars | GS2-Key GRN of the cryptographic key used for signature calculation |
Result
| Type | Description | |
|---|---|---|
| body | string | Body |
| signature | string | Signature |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.SignFreezeMasterDataTimestamp(
&distributor.SignFreezeMasterDataTimestampRequest {
NamespaceName: pointy.String("namespace-0001"),
Timestamp: pointy.Int64(10000),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
body := result.Body
signature := result.Signatureuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\SignFreezeMasterDataTimestampRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->signFreezeMasterDataTimestamp(
(new SignFreezeMasterDataTimestampRequest())
->withNamespaceName("namespace-0001")
->withTimestamp(10000)
->withKeyId("key-0001")
);
$body = $result->getBody();
$signature = $result->getSignature();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.SignFreezeMasterDataTimestampRequest;
import io.gs2.distributor.result.SignFreezeMasterDataTimestampResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
SignFreezeMasterDataTimestampResult result = client.signFreezeMasterDataTimestamp(
new SignFreezeMasterDataTimestampRequest()
.withNamespaceName("namespace-0001")
.withTimestamp(10000L)
.withKeyId("key-0001")
);
String body = result.getBody();
String signature = result.getSignature();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.SignFreezeMasterDataTimestampResult> asyncResult = null;
yield return client.SignFreezeMasterDataTimestamp(
new Gs2.Gs2Distributor.Request.SignFreezeMasterDataTimestampRequest()
.WithNamespaceName("namespace-0001")
.WithTimestamp(10000L)
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var body = result.Body;
var signature = result.Signature;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.signFreezeMasterDataTimestamp(
new Gs2Distributor.SignFreezeMasterDataTimestampRequest()
.withNamespaceName("namespace-0001")
.withTimestamp(10000)
.withKeyId("key-0001")
);
const body = result.getBody();
const signature = result.getSignature();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.sign_freeze_master_data_timestamp(
distributor.SignFreezeMasterDataTimestampRequest()
.with_namespace_name('namespace-0001')
.with_timestamp(10000)
.with_key_id('key-0001')
)
body = result.body
signature = result.signature
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.sign_freeze_master_data_timestamp({
namespaceName="namespace-0001",
timestamp=10000,
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
body = result.body;
signature = result.signature;client = gs2('distributor')
api_result_handler = client.sign_freeze_master_data_timestamp_async({
namespaceName="namespace-0001",
timestamp=10000,
keyId="key-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
body = result.body;
signature = result.signature;freezeMasterDataBySignedTimestamp
Freeze master data at the specified signed timestamp
Freezes the master data at a timestamp that was previously signed by SignFreezeMasterDataTimestamp. The signature is verified using the provided encryption key to ensure the timestamp has not been tampered with. The freeze timestamp is recorded in the returned ContextStack for use in subsequent requests. This is used when the server needs to control the exact freeze time to prevent client-side manipulation.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| body | string | ✓ | ~ 1024 chars | Body | ||
| signature | string | ✓ | ~ 256 chars | Signature | ||
| keyId | string | ✓ | ~ 1024 chars | GS2-Key GRN of the cryptographic key used for signature calculation |
Result
| Type | Description | |
|---|---|---|
| newContextStack | string | Context recording the time at which master data is fixed |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.FreezeMasterDataBySignedTimestamp(
&distributor.FreezeMasterDataBySignedTimestampRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
Body: pointy.String("body"),
Signature: pointy.String("signature"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
newContextStack := result.NewContextStackuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\FreezeMasterDataBySignedTimestampRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->freezeMasterDataBySignedTimestamp(
(new FreezeMasterDataBySignedTimestampRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withBody("body")
->withSignature("signature")
->withKeyId("key-0001")
);
$newContextStack = $result->getNewContextStack();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.FreezeMasterDataBySignedTimestampRequest;
import io.gs2.distributor.result.FreezeMasterDataBySignedTimestampResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
FreezeMasterDataBySignedTimestampResult result = client.freezeMasterDataBySignedTimestamp(
new FreezeMasterDataBySignedTimestampRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withBody("body")
.withSignature("signature")
.withKeyId("key-0001")
);
String newContextStack = result.getNewContextStack();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.FreezeMasterDataBySignedTimestampResult> asyncResult = null;
yield return client.FreezeMasterDataBySignedTimestamp(
new Gs2.Gs2Distributor.Request.FreezeMasterDataBySignedTimestampRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithBody("body")
.WithSignature("signature")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var newContextStack = result.NewContextStack;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.freezeMasterDataBySignedTimestamp(
new Gs2Distributor.FreezeMasterDataBySignedTimestampRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withBody("body")
.withSignature("signature")
.withKeyId("key-0001")
);
const newContextStack = result.getNewContextStack();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.freeze_master_data_by_signed_timestamp(
distributor.FreezeMasterDataBySignedTimestampRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_body('body')
.with_signature('signature')
.with_key_id('key-0001')
)
new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.freeze_master_data_by_signed_timestamp({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
body="body",
signature="signature",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
newContextStack = result.newContextStack;client = gs2('distributor')
api_result_handler = client.freeze_master_data_by_signed_timestamp_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
body="body",
signature="signature",
keyId="key-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
newContextStack = result.newContextStack;freezeMasterDataByTimestamp
Freeze master data at the specified timestamp
Freezes the master data at a directly specified timestamp without signature verification. The freeze timestamp is recorded in the returned ContextStack for use in subsequent requests. Unlike FreezeMasterDataBySignedTimestamp, the timestamp is not cryptographically verified, so this should only be used in trusted contexts.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| timestamp | long | ✓ | Timestamp to freeze master data |
Result
| Type | Description | |
|---|---|---|
| newContextStack | string | Context recording the time at which master data is fixed |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.FreezeMasterDataByTimestamp(
&distributor.FreezeMasterDataByTimestampRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
Timestamp: pointy.Int64(10000),
}
)
if err != nil {
panic("error occurred")
}
newContextStack := result.NewContextStackuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\FreezeMasterDataByTimestampRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->freezeMasterDataByTimestamp(
(new FreezeMasterDataByTimestampRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTimestamp(10000)
);
$newContextStack = $result->getNewContextStack();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.FreezeMasterDataByTimestampRequest;
import io.gs2.distributor.result.FreezeMasterDataByTimestampResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
FreezeMasterDataByTimestampResult result = client.freezeMasterDataByTimestamp(
new FreezeMasterDataByTimestampRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTimestamp(10000L)
);
String newContextStack = result.getNewContextStack();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.FreezeMasterDataByTimestampResult> asyncResult = null;
yield return client.FreezeMasterDataByTimestamp(
new Gs2.Gs2Distributor.Request.FreezeMasterDataByTimestampRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTimestamp(10000L),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var newContextStack = result.NewContextStack;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.freezeMasterDataByTimestamp(
new Gs2Distributor.FreezeMasterDataByTimestampRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTimestamp(10000)
);
const newContextStack = result.getNewContextStack();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.freeze_master_data_by_timestamp(
distributor.FreezeMasterDataByTimestampRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_timestamp(10000)
)
new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.freeze_master_data_by_timestamp({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
timestamp=10000,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
newContextStack = result.newContextStack;client = gs2('distributor')
api_result_handler = client.freeze_master_data_by_timestamp_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
timestamp=10000,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
newContextStack = result.newContextStack;batchExecuteApi
Execute multiple APIs in bulk
Executes multiple API calls in a single batch request, reducing the number of round-trips required. Up to 100 API calls can be included in a single batch. Each request in the batch is processed independently, and the results are returned in the same order as the requests. This is useful for reducing latency when multiple independent API calls need to be made.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| requestPayloads | List<BatchRequestPayload> | ✓ | 1 ~ 100 items | Batch request |
Result
| Type | Description | |
|---|---|---|
| results | List<BatchResultPayload> | Batch result |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.BatchExecuteApi(
&distributor.BatchExecuteApiRequest {
RequestPayloads: []distributor.BatchRequestPayload{
distributor.BatchRequestPayload{
Service: pointy.String("inventory"),
Method: pointy.String("describeSimpleItems"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}"),
},
distributor.BatchRequestPayload{
Service: pointy.String("exchange"),
Method: pointy.String("describeRateModels"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\"}"),
},
},
}
)
if err != nil {
panic("error occurred")
}
results := result.Resultsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\BatchExecuteApiRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->batchExecuteApi(
(new BatchExecuteApiRequest())
->withRequestPayloads([
(new BatchRequestPayload())
->withService("inventory")
->withMethod("describeSimpleItems")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}"),
(new BatchRequestPayload())
->withService("exchange")
->withMethod("describeRateModels")
->withRequest("{\"namespaceName\": \"namespace-0001\"}"),
])
);
$results = $result->getResults();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.BatchExecuteApiRequest;
import io.gs2.distributor.result.BatchExecuteApiResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
BatchExecuteApiResult result = client.batchExecuteApi(
new BatchExecuteApiRequest()
.withRequestPayloads(Arrays.asList(
new BatchRequestPayload()
.withService("inventory")
.withMethod("describeSimpleItems")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}"),
new BatchRequestPayload()
.withService("exchange")
.withMethod("describeRateModels")
.withRequest("{\"namespaceName\": \"namespace-0001\"}")
))
);
List<BatchResultPayload> results = result.getResults();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.BatchExecuteApiResult> asyncResult = null;
yield return client.BatchExecuteApi(
new Gs2.Gs2Distributor.Request.BatchExecuteApiRequest()
.WithRequestPayloads(new Gs2.Gs2Distributor.Model.BatchRequestPayload[] {
new Gs2.Gs2Distributor.Model.BatchRequestPayload()
.WithService("inventory")
.WithMethod("describeSimpleItems")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}"),
new Gs2.Gs2Distributor.Model.BatchRequestPayload()
.WithService("exchange")
.WithMethod("describeRateModels")
.WithRequest("{\"namespaceName\": \"namespace-0001\"}"),
}),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var results = result.Results;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.batchExecuteApi(
new Gs2Distributor.BatchExecuteApiRequest()
.withRequestPayloads([
new Gs2Distributor.model.BatchRequestPayload()
.withService("inventory")
.withMethod("describeSimpleItems")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}"),
new Gs2Distributor.model.BatchRequestPayload()
.withService("exchange")
.withMethod("describeRateModels")
.withRequest("{\"namespaceName\": \"namespace-0001\"}"),
])
);
const results = result.getResults();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.batch_execute_api(
distributor.BatchExecuteApiRequest()
.with_request_payloads([
distributor.BatchRequestPayload()
.with_service('inventory')
.with_method('describeSimpleItems')
.with_request('{"namespaceName": "namespace-0001", "inventoryName": "inventory-0001", "accessToken": "accessToken-0001"}'),
distributor.BatchRequestPayload()
.with_service('exchange')
.with_method('describeRateModels')
.with_request('{"namespaceName": "namespace-0001"}'),
])
)
results = result.results
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.batch_execute_api({
requestPayloads={
{
service="inventory",
method="describeSimpleItems",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}",
},
{
service="exchange",
method="describeRateModels",
request="{\"namespaceName\": \"namespace-0001\"}",
}
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
results = result.results;client = gs2('distributor')
api_result_handler = client.batch_execute_api_async({
requestPayloads={
{
service="inventory",
method="describeSimpleItems",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}",
},
{
service="exchange",
method="describeRateModels",
request="{\"namespaceName\": \"namespace-0001\"}",
}
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
results = result.results;ifExpressionByUserId
Validate the condition and switch the contents of the Consume Action
Evaluates a verify action as a condition, and executes either the trueActions or falseActions list of consume actions based on the result. This enables conditional branching within a transaction, allowing different consume actions to be executed depending on the verification outcome. When multiplyValueSpecifyingQuantity is enabled, the values used for verification are also multiplied by the specified quantity.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| condition | VerifyAction | ✓ | Condition | |||
| trueActions | List<ConsumeAction> | 0 ~ 10 items | List of Consume Actions to be executed when the condition is true | |||
| falseActions | List<ConsumeAction> | 0 ~ 10 items | List of Consume Actions to be executed when the condition is false | |||
| multiplyValueSpecifyingQuantity | bool | true | Whether to multiply the value used for verification when specifying the quantity | |||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | TransactionResult | Transaction execution results |
| expressionResult | bool? | Result of condition evaluation |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.IfExpressionByUserId(
&distributor.IfExpressionByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
Condition: &distributor.VerifyAction{
Action: pointy.String("Gs2Inventory:VerifyItemSetByUserId"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
},
TrueActions: []distributor.ConsumeAction{
distributor.ConsumeAction{
Action: pointy.String("Gs2Inventory:ConsumeItemSetByUserId"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"consumeCount\": 1}"),
},
},
FalseActions: []distributor.ConsumeAction{
distributor.ConsumeAction{
Action: pointy.String("Gs2Inventory:ConsumeSimpleItemsByUserId"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"consumeCounts\": [{\"itemName\": \"item-0001\", \"count\": 1}]}"),
},
},
MultiplyValueSpecifyingQuantity: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
expressionResult := result.ExpressionResultuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\IfExpressionByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->ifExpressionByUserId(
(new IfExpressionByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withCondition((new VerifyAction())
->withAction("Gs2Inventory:VerifyItemSetByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}")
)
->withTrueActions([
(new ConsumeAction())
->withAction("Gs2Inventory:ConsumeItemSetByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"consumeCount\": 1}"),
])
->withFalseActions([
(new ConsumeAction())
->withAction("Gs2Inventory:ConsumeSimpleItemsByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"consumeCounts\": [{\"itemName\": \"item-0001\", \"count\": 1}]}"),
])
->withMultiplyValueSpecifyingQuantity(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$expressionResult = $result->getExpressionResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.IfExpressionByUserIdRequest;
import io.gs2.distributor.result.IfExpressionByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
IfExpressionByUserIdResult result = client.ifExpressionByUserId(
new IfExpressionByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withCondition(new VerifyAction()
.withAction("Gs2Inventory:VerifyItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}")
)
.withTrueActions(Arrays.asList(
new ConsumeAction()
.withAction("Gs2Inventory:ConsumeItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"consumeCount\": 1}")
))
.withFalseActions(Arrays.asList(
new ConsumeAction()
.withAction("Gs2Inventory:ConsumeSimpleItemsByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"consumeCounts\": [{\"itemName\": \"item-0001\", \"count\": 1}]}")
))
.withMultiplyValueSpecifyingQuantity(null)
.withTimeOffsetToken(null)
);
TransactionResult item = result.getItem();
boolean expressionResult = result.getExpressionResult();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.IfExpressionByUserIdResult> asyncResult = null;
yield return client.IfExpressionByUserId(
new Gs2.Gs2Distributor.Request.IfExpressionByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithCondition(new Gs2.Core.Model.VerifyAction()
.WithAction("Gs2Inventory:VerifyItemSetByUserId")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}")
)
.WithTrueActions(new Gs2.Core.Model.ConsumeAction[] {
new Gs2.Core.Model.ConsumeAction()
.WithAction("Gs2Inventory:ConsumeItemSetByUserId")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"consumeCount\": 1}"),
})
.WithFalseActions(new Gs2.Core.Model.ConsumeAction[] {
new Gs2.Core.Model.ConsumeAction()
.WithAction("Gs2Inventory:ConsumeSimpleItemsByUserId")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"consumeCounts\": [{\"itemName\": \"item-0001\", \"count\": 1}]}"),
})
.WithMultiplyValueSpecifyingQuantity(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var expressionResult = result.ExpressionResult;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.ifExpressionByUserId(
new Gs2Distributor.IfExpressionByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withCondition(new Gs2Distributor.model.VerifyAction()
.withAction("Gs2Inventory:VerifyItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}")
)
.withTrueActions([
new Gs2Distributor.model.ConsumeAction()
.withAction("Gs2Inventory:ConsumeItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"consumeCount\": 1}"),
])
.withFalseActions([
new Gs2Distributor.model.ConsumeAction()
.withAction("Gs2Inventory:ConsumeSimpleItemsByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"consumeCounts\": [{\"itemName\": \"item-0001\", \"count\": 1}]}"),
])
.withMultiplyValueSpecifyingQuantity(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
const expressionResult = result.getExpressionResult();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.if_expression_by_user_id(
distributor.IfExpressionByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_condition(distributor.VerifyAction()
.with_action('Gs2Inventory:VerifyItemSetByUserId')
.with_request('{"namespaceName": "namespace-0001", "userId": "user-0001", "inventoryName": "inventory-0001", "itemName": "item-0001", "verifyType": "greaterEqual", "count": 1}')
)
.with_true_actions([
distributor.ConsumeAction()
.with_action('Gs2Inventory:ConsumeItemSetByUserId')
.with_request('{"namespaceName": "namespace-0001", "userId": "user-0001", "inventoryName": "inventory-0001", "itemName": "item-0001", "consumeCount": 1}'),
])
.with_false_actions([
distributor.ConsumeAction()
.with_action('Gs2Inventory:ConsumeSimpleItemsByUserId')
.with_request('{"namespaceName": "namespace-0001", "userId": "user-0001", "inventoryName": "inventory-0001", "consumeCounts": [{"itemName": "item-0001", "count": 1}]}'),
])
.with_multiply_value_specifying_quantity(None)
.with_time_offset_token(None)
)
item = result.item
expression_result = result.expression_result
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.if_expression_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
condition={
action="Gs2Inventory:VerifyItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
},
trueActions={
{
action="Gs2Inventory:ConsumeItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"consumeCount\": 1}",
}
},
falseActions={
{
action="Gs2Inventory:ConsumeSimpleItemsByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"consumeCounts\": [{\"itemName\": \"item-0001\", \"count\": 1}]}",
}
},
multiplyValueSpecifyingQuantity=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
expressionResult = result.expressionResult;client = gs2('distributor')
api_result_handler = client.if_expression_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
condition={
action="Gs2Inventory:VerifyItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
},
trueActions={
{
action="Gs2Inventory:ConsumeItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"consumeCount\": 1}",
}
},
falseActions={
{
action="Gs2Inventory:ConsumeSimpleItemsByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"consumeCounts\": [{\"itemName\": \"item-0001\", \"count\": 1}]}",
}
},
multiplyValueSpecifyingQuantity=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
expressionResult = result.expressionResult;andExpressionByUserId
Perform multiple verification actions and determine if all are true
Executes multiple verify actions and succeeds only if all of them evaluate to true (AND logic). If any verify action fails, the entire expression fails. This is useful for combining multiple preconditions that must all be satisfied before proceeding with a transaction.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| actions | List<VerifyAction> | 0 ~ 10 items | List of Verify Actions | |||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description |
|---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.AndExpressionByUserId(
&distributor.AndExpressionByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
Actions: []distributor.VerifyAction{
distributor.VerifyAction{
Action: pointy.String("Gs2Inventory:VerifyItemSetByUserId"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
},
distributor.VerifyAction{
Action: pointy.String("Gs2Inventory:ConsumeItemSetByUserId"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
},
},
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\AndExpressionByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->andExpressionByUserId(
(new AndExpressionByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withActions([
(new VerifyAction())
->withAction("Gs2Inventory:VerifyItemSetByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
(new VerifyAction())
->withAction("Gs2Inventory:ConsumeItemSetByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
])
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.AndExpressionByUserIdRequest;
import io.gs2.distributor.result.AndExpressionByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
AndExpressionByUserIdResult result = client.andExpressionByUserId(
new AndExpressionByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withActions(Arrays.asList(
new VerifyAction()
.withAction("Gs2Inventory:VerifyItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
new VerifyAction()
.withAction("Gs2Inventory:ConsumeItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}")
))
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.AndExpressionByUserIdResult> asyncResult = null;
yield return client.AndExpressionByUserId(
new Gs2.Gs2Distributor.Request.AndExpressionByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithActions(new Gs2.Core.Model.VerifyAction[] {
new Gs2.Core.Model.VerifyAction()
.WithAction("Gs2Inventory:VerifyItemSetByUserId")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
new Gs2.Core.Model.VerifyAction()
.WithAction("Gs2Inventory:ConsumeItemSetByUserId")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
})
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.andExpressionByUserId(
new Gs2Distributor.AndExpressionByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withActions([
new Gs2Distributor.model.VerifyAction()
.withAction("Gs2Inventory:VerifyItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
new Gs2Distributor.model.VerifyAction()
.withAction("Gs2Inventory:ConsumeItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
])
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.and_expression_by_user_id(
distributor.AndExpressionByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_actions([
distributor.VerifyAction()
.with_action('Gs2Inventory:VerifyItemSetByUserId')
.with_request('{"namespaceName": "namespace-0001", "userId": "user-0001", "inventoryName": "inventory-0001", "itemName": "item-0001", "verifyType": "greaterEqual", "count": 1}'),
distributor.VerifyAction()
.with_action('Gs2Inventory:ConsumeItemSetByUserId')
.with_request('{"namespaceName": "namespace-0001", "userId": "user-0001", "inventoryName": "inventory-0001", "itemName": "item-0002", "verifyType": "greaterEqual", "count": 1}'),
])
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.and_expression_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
actions={
{
action="Gs2Inventory:VerifyItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
},
{
action="Gs2Inventory:ConsumeItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
}
},
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultclient = gs2('distributor')
api_result_handler = client.and_expression_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
actions={
{
action="Gs2Inventory:VerifyItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
},
{
action="Gs2Inventory:ConsumeItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
}
},
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultorExpressionByUserId
Perform multiple verification actions and determine if any are true
Executes multiple verify actions and succeeds if at least one of them evaluates to true (OR logic). The expression fails only if all verify actions fail. This is useful for defining alternative conditions where satisfying any one of them is sufficient to proceed.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| actions | List<VerifyAction> | 0 ~ 10 items | List of Verify Actions | |||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description |
|---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.OrExpressionByUserId(
&distributor.OrExpressionByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
Actions: []distributor.VerifyAction{
distributor.VerifyAction{
Action: pointy.String("Gs2Inventory:VerifyItemSetByUserId"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
},
distributor.VerifyAction{
Action: pointy.String("Gs2Inventory:ConsumeItemSetByUserId"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
},
},
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\OrExpressionByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->orExpressionByUserId(
(new OrExpressionByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withActions([
(new VerifyAction())
->withAction("Gs2Inventory:VerifyItemSetByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
(new VerifyAction())
->withAction("Gs2Inventory:ConsumeItemSetByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
])
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.OrExpressionByUserIdRequest;
import io.gs2.distributor.result.OrExpressionByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
OrExpressionByUserIdResult result = client.orExpressionByUserId(
new OrExpressionByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withActions(Arrays.asList(
new VerifyAction()
.withAction("Gs2Inventory:VerifyItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
new VerifyAction()
.withAction("Gs2Inventory:ConsumeItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}")
))
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.OrExpressionByUserIdResult> asyncResult = null;
yield return client.OrExpressionByUserId(
new Gs2.Gs2Distributor.Request.OrExpressionByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithActions(new Gs2.Core.Model.VerifyAction[] {
new Gs2.Core.Model.VerifyAction()
.WithAction("Gs2Inventory:VerifyItemSetByUserId")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
new Gs2.Core.Model.VerifyAction()
.WithAction("Gs2Inventory:ConsumeItemSetByUserId")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
})
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.orExpressionByUserId(
new Gs2Distributor.OrExpressionByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withActions([
new Gs2Distributor.model.VerifyAction()
.withAction("Gs2Inventory:VerifyItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
new Gs2Distributor.model.VerifyAction()
.withAction("Gs2Inventory:ConsumeItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
])
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.or_expression_by_user_id(
distributor.OrExpressionByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_actions([
distributor.VerifyAction()
.with_action('Gs2Inventory:VerifyItemSetByUserId')
.with_request('{"namespaceName": "namespace-0001", "userId": "user-0001", "inventoryName": "inventory-0001", "itemName": "item-0001", "verifyType": "greaterEqual", "count": 1}'),
distributor.VerifyAction()
.with_action('Gs2Inventory:ConsumeItemSetByUserId')
.with_request('{"namespaceName": "namespace-0001", "userId": "user-0001", "inventoryName": "inventory-0001", "itemName": "item-0002", "verifyType": "greaterEqual", "count": 1}'),
])
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.or_expression_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
actions={
{
action="Gs2Inventory:VerifyItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
},
{
action="Gs2Inventory:ConsumeItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
}
},
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultclient = gs2('distributor')
api_result_handler = client.or_expression_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
actions={
{
action="Gs2Inventory:VerifyItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
},
{
action="Gs2Inventory:ConsumeItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
}
},
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultgetStampSheetResult
Get transaction execution results
Retrieves the execution results of a specific transaction for the currently logged-in user. The result contains the status codes and response content for each phase (verify, consume, acquire) of the transaction.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| transactionId | string | ✓ | 36 ~ 36 chars | Transaction ID A UUID that uniquely identifies this transaction. Used to correlate the transaction with its execution results and any chained subsequent transactions. |
Result
| Type | Description | |
|---|---|---|
| item | StampSheetResult | Transaction execution results |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetStampSheetResult(
&distributor.GetStampSheetResultRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TransactionId: pointy.String("cc1985c3-54f0-4fc3-b295-dc30214284ec"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetStampSheetResultRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->getStampSheetResult(
(new GetStampSheetResultRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
);
$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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetStampSheetResultRequest;
import io.gs2.distributor.result.GetStampSheetResultResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetStampSheetResultResult result = client.getStampSheetResult(
new GetStampSheetResultRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
);
StampSheetResult item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetStampSheetResultResult> asyncResult = null;
yield return client.GetStampSheetResult(
new Gs2.Gs2Distributor.Request.GetStampSheetResultRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec"),
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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getStampSheetResult(
new Gs2Distributor.GetStampSheetResultRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_stamp_sheet_result(
distributor.GetStampSheetResultRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_transaction_id('cc1985c3-54f0-4fc3-b295-dc30214284ec')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.get_stamp_sheet_result({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.get_stamp_sheet_result_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getStampSheetResultByUserId
Get transaction execution results by specifying a user ID
Retrieves the execution results of a specific transaction for the specified user. The result contains the status codes and response content for each phase (verify, consume, acquire) of the transaction.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| transactionId | string | ✓ | 36 ~ 36 chars | Transaction ID A UUID that uniquely identifies this transaction. Used to correlate the transaction with its execution results and any chained subsequent transactions. | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | StampSheetResult | Transaction execution results |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetStampSheetResultByUserId(
&distributor.GetStampSheetResultByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TransactionId: pointy.String("cc1985c3-54f0-4fc3-b295-dc30214284ec"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetStampSheetResultByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->getStampSheetResultByUserId(
(new GetStampSheetResultByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetStampSheetResultByUserIdRequest;
import io.gs2.distributor.result.GetStampSheetResultByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetStampSheetResultByUserIdResult result = client.getStampSheetResultByUserId(
new GetStampSheetResultByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
.withTimeOffsetToken(null)
);
StampSheetResult item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetStampSheetResultByUserIdResult> asyncResult = null;
yield return client.GetStampSheetResultByUserId(
new Gs2.Gs2Distributor.Request.GetStampSheetResultByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getStampSheetResultByUserId(
new Gs2Distributor.GetStampSheetResultByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_stamp_sheet_result_by_user_id(
distributor.GetStampSheetResultByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_transaction_id('cc1985c3-54f0-4fc3-b295-dc30214284ec')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.get_stamp_sheet_result_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.get_stamp_sheet_result_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;runTransaction
Execute transaction
Executes a transaction consisting of verify actions, consume actions, and acquire actions. The transaction is processed in order: verify -> consume -> acquire. The execution result including status codes and response content for each phase is recorded and can be retrieved later.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| transaction | string | ✓ | ~ 5242880 chars | Transaction | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | TransactionResult | Transaction execution results |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.RunTransaction(
&distributor.RunTransactionRequest {
OwnerId: nil,
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
Transaction: pointy.String("transaction..."),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunTransactionRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->runTransaction(
(new RunTransactionRequest())
->withOwnerId(null)
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTransaction("transaction...")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.RunTransactionRequest;
import io.gs2.distributor.result.RunTransactionResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
RunTransactionResult result = client.runTransaction(
new RunTransactionRequest()
.withOwnerId(null)
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTransaction("transaction...")
.withTimeOffsetToken(null)
);
TransactionResult item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.RunTransactionResult> asyncResult = null;
yield return client.RunTransaction(
new Gs2.Gs2Distributor.Request.RunTransactionRequest()
.WithOwnerId(null)
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTransaction("transaction...")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.runTransaction(
new Gs2Distributor.RunTransactionRequest()
.withOwnerId(null)
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTransaction("transaction...")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.run_transaction(
distributor.RunTransactionRequest()
.with_owner_id(None)
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_transaction('transaction...')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.run_transaction({
ownerId=nil,
namespaceName="namespace-0001",
userId="user-0001",
transaction="transaction...",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.run_transaction_async({
ownerId=nil,
namespaceName="namespace-0001",
userId="user-0001",
transaction="transaction...",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getTransactionResult
Get transaction execution results
Retrieves the execution results of a specific transaction for the currently logged-in user. The result contains the status codes and response content for each phase (verify, consume, acquire) of the transaction.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| transactionId | string | ✓ | 36 ~ 36 chars | Transaction ID A UUID that uniquely identifies this distributed transaction. Used to look up the execution results and correlate with the originating API request. |
Result
| Type | Description | |
|---|---|---|
| item | TransactionResult | Transaction execution results |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetTransactionResult(
&distributor.GetTransactionResultRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TransactionId: pointy.String("cc1985c3-54f0-4fc3-b295-dc30214284ec"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetTransactionResultRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->getTransactionResult(
(new GetTransactionResultRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
);
$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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetTransactionResultRequest;
import io.gs2.distributor.result.GetTransactionResultResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetTransactionResultResult result = client.getTransactionResult(
new GetTransactionResultRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
);
TransactionResult item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetTransactionResultResult> asyncResult = null;
yield return client.GetTransactionResult(
new Gs2.Gs2Distributor.Request.GetTransactionResultRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec"),
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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getTransactionResult(
new Gs2Distributor.GetTransactionResultRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_transaction_result(
distributor.GetTransactionResultRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_transaction_id('cc1985c3-54f0-4fc3-b295-dc30214284ec')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.get_transaction_result({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.get_transaction_result_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getTransactionResultByUserId
Get transaction execution results by specifying a user ID
Retrieves the execution results of a specific transaction for the specified user. The result contains the status codes and response content for each phase (verify, consume, acquire) of the transaction.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| transactionId | string | ✓ | 36 ~ 36 chars | Transaction ID A UUID that uniquely identifies this distributed transaction. Used to look up the execution results and correlate with the originating API request. | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | TransactionResult | Transaction execution results |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetTransactionResultByUserId(
&distributor.GetTransactionResultByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TransactionId: pointy.String("cc1985c3-54f0-4fc3-b295-dc30214284ec"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetTransactionResultByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->getTransactionResultByUserId(
(new GetTransactionResultByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetTransactionResultByUserIdRequest;
import io.gs2.distributor.result.GetTransactionResultByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetTransactionResultByUserIdResult result = client.getTransactionResultByUserId(
new GetTransactionResultByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
.withTimeOffsetToken(null)
);
TransactionResult item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetTransactionResultByUserIdResult> asyncResult = null;
yield return client.GetTransactionResultByUserId(
new Gs2.Gs2Distributor.Request.GetTransactionResultByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getTransactionResultByUserId(
new Gs2Distributor.GetTransactionResultByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_transaction_result_by_user_id(
distributor.GetTransactionResultByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_transaction_id('cc1985c3-54f0-4fc3-b295-dc30214284ec')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.get_transaction_result_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.get_transaction_result_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;describeDistributorModels
Get a list of Distributor Models
Retrieves all currently active (published) Distributor Models in the specified namespace. Distributor Models define the resource distribution rules, including the inbox namespace for overflow handling and the whitelist of target service actions. Only models that have been activated via the current master data are returned; editable master data is not included.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| items | List<DistributorModel> | List of Distributor Models |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.DescribeDistributorModels(
&distributor.DescribeDistributorModelsRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Itemsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DescribeDistributorModelsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->describeDistributorModels(
(new DescribeDistributorModelsRequest())
->withNamespaceName("namespace-0001")
);
$items = $result->getItems();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DescribeDistributorModelsRequest;
import io.gs2.distributor.result.DescribeDistributorModelsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
DescribeDistributorModelsResult result = client.describeDistributorModels(
new DescribeDistributorModelsRequest()
.withNamespaceName("namespace-0001")
);
List<DistributorModel> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.DescribeDistributorModelsResult> asyncResult = null;
yield return client.DescribeDistributorModels(
new Gs2.Gs2Distributor.Request.DescribeDistributorModelsRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.describeDistributorModels(
new Gs2Distributor.DescribeDistributorModelsRequest()
.withNamespaceName("namespace-0001")
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.describe_distributor_models(
distributor.DescribeDistributorModelsRequest()
.with_namespace_name('namespace-0001')
)
items = result.items
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.describe_distributor_models({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;client = gs2('distributor')
api_result_handler = client.describe_distributor_models_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;getDistributorModel
Get Distributor Model
Retrieves the detailed information of a specific active Distributor Model by name. The returned information includes the model’s name, metadata, inbox namespace for overflow handling, and whitelist of target service actions.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| distributorName | string | ✓ | ~ 128 chars | Distributor Model name Distributor Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| item | DistributorModel | Distributor Model |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetDistributorModel(
&distributor.GetDistributorModelRequest {
NamespaceName: pointy.String("namespace-0001"),
DistributorName: pointy.String("distributor-model-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetDistributorModelRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->getDistributorModel(
(new GetDistributorModelRequest())
->withNamespaceName("namespace-0001")
->withDistributorName("distributor-model-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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetDistributorModelRequest;
import io.gs2.distributor.result.GetDistributorModelResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetDistributorModelResult result = client.getDistributorModel(
new GetDistributorModelRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
);
DistributorModel item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetDistributorModelResult> asyncResult = null;
yield return client.GetDistributorModel(
new Gs2.Gs2Distributor.Request.GetDistributorModelRequest()
.WithNamespaceName("namespace-0001")
.WithDistributorName("distributor-model-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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getDistributorModel(
new Gs2Distributor.GetDistributorModelRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_distributor_model(
distributor.GetDistributorModelRequest()
.with_namespace_name('namespace-0001')
.with_distributor_name('distributor-model-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.get_distributor_model({
namespaceName="namespace-0001",
distributorName="distributor-model-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.get_distributor_model_async({
namespaceName="namespace-0001",
distributorName="distributor-model-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;exportMaster
Export Distributor Model Master in a master data format that can be activated
Exports the current Distributor Model Master data in a format that can be used for activation. The exported data can be used to back up the current master configuration, or to import it into another namespace.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| item | CurrentDistributorMaster | Distributor Model master data that can be activated |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.ExportMaster(
&distributor.ExportMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\ExportMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->exportMaster(
(new ExportMasterRequest())
->withNamespaceName("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.ExportMasterRequest;
import io.gs2.distributor.result.ExportMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
ExportMasterResult result = client.exportMaster(
new ExportMasterRequest()
.withNamespaceName("namespace-0001")
);
CurrentDistributorMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.ExportMasterResult> asyncResult = null;
yield return client.ExportMaster(
new Gs2.Gs2Distributor.Request.ExportMasterRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.exportMaster(
new Gs2Distributor.ExportMasterRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.export_master(
distributor.ExportMasterRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.export_master({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.export_master_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getCurrentDistributorMaster
Get currently active Distributor Model master data
Retrieves the master data of the Distributor Models that are currently active (published) in the specified namespace. This represents the configuration that is actually being used in production, as opposed to the editable master data.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| item | CurrentDistributorMaster | Currently active Distributor Model master data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetCurrentDistributorMaster(
&distributor.GetCurrentDistributorMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetCurrentDistributorMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->getCurrentDistributorMaster(
(new GetCurrentDistributorMasterRequest())
->withNamespaceName("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetCurrentDistributorMasterRequest;
import io.gs2.distributor.result.GetCurrentDistributorMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetCurrentDistributorMasterResult result = client.getCurrentDistributorMaster(
new GetCurrentDistributorMasterRequest()
.withNamespaceName("namespace-0001")
);
CurrentDistributorMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetCurrentDistributorMasterResult> asyncResult = null;
yield return client.GetCurrentDistributorMaster(
new Gs2.Gs2Distributor.Request.GetCurrentDistributorMasterRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getCurrentDistributorMaster(
new Gs2Distributor.GetCurrentDistributorMasterRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_current_distributor_master(
distributor.GetCurrentDistributorMasterRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.get_current_distributor_master({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.get_current_distributor_master_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;preUpdateCurrentDistributorMaster
Update currently active Distributor Model master data (3-phase version)
When uploading master data larger than 1MB, the update is performed in 3 phases.
- Execute this API to obtain a token and URL for uploading.
- Upload the master data to the obtained URL.
- Execute UpdateCurrentModelMaster by passing the token obtained from the the upload to reflect the master data.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| uploadToken | string | Token used to reflect results after upload |
| uploadUrl | string | URL used to upload |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.PreUpdateCurrentDistributorMaster(
&distributor.PreUpdateCurrentDistributorMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\PreUpdateCurrentDistributorMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->preUpdateCurrentDistributorMaster(
(new PreUpdateCurrentDistributorMasterRequest())
->withNamespaceName("namespace-0001")
);
$uploadToken = $result->getUploadToken();
$uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.PreUpdateCurrentDistributorMasterRequest;
import io.gs2.distributor.result.PreUpdateCurrentDistributorMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
PreUpdateCurrentDistributorMasterResult result = client.preUpdateCurrentDistributorMaster(
new PreUpdateCurrentDistributorMasterRequest()
.withNamespaceName("namespace-0001")
);
String uploadToken = result.getUploadToken();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.PreUpdateCurrentDistributorMasterResult> asyncResult = null;
yield return client.PreUpdateCurrentDistributorMaster(
new Gs2.Gs2Distributor.Request.PreUpdateCurrentDistributorMasterRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.preUpdateCurrentDistributorMaster(
new Gs2Distributor.PreUpdateCurrentDistributorMasterRequest()
.withNamespaceName("namespace-0001")
);
const uploadToken = result.getUploadToken();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.pre_update_current_distributor_master(
distributor.PreUpdateCurrentDistributorMasterRequest()
.with_namespace_name('namespace-0001')
)
upload_token = result.upload_token
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.pre_update_current_distributor_master({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;client = gs2('distributor')
api_result_handler = client.pre_update_current_distributor_master_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;updateCurrentDistributorMaster
Update currently active Distributor Model master data
Updates and activates (publishes) the master data of the Distributor Models in the specified namespace. Supports two modes: ‘direct’ mode for inline master data, and ‘preUpload’ mode for master data that was uploaded in advance. For master data larger than 1MB, use the 3-phase update flow: PreUpdate -> Upload -> Update (preUpload mode). The uploaded master data is validated before being applied.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||||||||
| mode | String Enum enum { “direct”, “preUpload” } | “direct” | Update mode
| |||||||||
| settings | string | {mode} == “direct” | ✓* | ~ 5242880 chars | Master Data * Required if mode is “direct” | |||||||
| uploadToken | string | {mode} == “preUpload” | ✓* | ~ 1024 chars | Token obtained by pre-upload Used to apply the uploaded master data. * Required if mode is “preUpload” |
Result
| Type | Description | |
|---|---|---|
| item | CurrentDistributorMaster | Updated master data of the currently active Distributor Models |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.UpdateCurrentDistributorMaster(
&distributor.UpdateCurrentDistributorMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
Mode: pointy.String("direct"),
Settings: pointy.String("{\n \"version\": \"2019-03-01\",\n \"distributorModels\": [\n {\n \"name\": \"basic\",\n \"metadata\": \"BASIC\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n },\n {\n \"name\": \"special\",\n \"metadata\": \"SPECIAL\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n \"whiteListTargetIds\": [\n \"test\"\n ]\n }\n ]\n}"),
UploadToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\UpdateCurrentDistributorMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->updateCurrentDistributorMaster(
(new UpdateCurrentDistributorMasterRequest())
->withNamespaceName("namespace-0001")
->withMode("direct")
->withSettings("{\n \"version\": \"2019-03-01\",\n \"distributorModels\": [\n {\n \"name\": \"basic\",\n \"metadata\": \"BASIC\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n },\n {\n \"name\": \"special\",\n \"metadata\": \"SPECIAL\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n \"whiteListTargetIds\": [\n \"test\"\n ]\n }\n ]\n}")
->withUploadToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.UpdateCurrentDistributorMasterRequest;
import io.gs2.distributor.result.UpdateCurrentDistributorMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
UpdateCurrentDistributorMasterResult result = client.updateCurrentDistributorMaster(
new UpdateCurrentDistributorMasterRequest()
.withNamespaceName("namespace-0001")
.withMode("direct")
.withSettings("{\n \"version\": \"2019-03-01\",\n \"distributorModels\": [\n {\n \"name\": \"basic\",\n \"metadata\": \"BASIC\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n },\n {\n \"name\": \"special\",\n \"metadata\": \"SPECIAL\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n \"whiteListTargetIds\": [\n \"test\"\n ]\n }\n ]\n}")
.withUploadToken(null)
);
CurrentDistributorMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.UpdateCurrentDistributorMasterResult> asyncResult = null;
yield return client.UpdateCurrentDistributorMaster(
new Gs2.Gs2Distributor.Request.UpdateCurrentDistributorMasterRequest()
.WithNamespaceName("namespace-0001")
.WithMode("direct")
.WithSettings("{\n \"version\": \"2019-03-01\",\n \"distributorModels\": [\n {\n \"name\": \"basic\",\n \"metadata\": \"BASIC\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n },\n {\n \"name\": \"special\",\n \"metadata\": \"SPECIAL\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n \"whiteListTargetIds\": [\n \"test\"\n ]\n }\n ]\n}")
.WithUploadToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.updateCurrentDistributorMaster(
new Gs2Distributor.UpdateCurrentDistributorMasterRequest()
.withNamespaceName("namespace-0001")
.withMode("direct")
.withSettings("{\n \"version\": \"2019-03-01\",\n \"distributorModels\": [\n {\n \"name\": \"basic\",\n \"metadata\": \"BASIC\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n },\n {\n \"name\": \"special\",\n \"metadata\": \"SPECIAL\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n \"whiteListTargetIds\": [\n \"test\"\n ]\n }\n ]\n}")
.withUploadToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.update_current_distributor_master(
distributor.UpdateCurrentDistributorMasterRequest()
.with_namespace_name('namespace-0001')
.with_mode('direct')
.with_settings('{\n "version": "2019-03-01",\n "distributorModels": [\n {\n "name": "basic",\n "metadata": "BASIC",\n "inboxNamespaceId": "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001"\n },\n {\n "name": "special",\n "metadata": "SPECIAL",\n "inboxNamespaceId": "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001",\n "whiteListTargetIds": [\n "test"\n ]\n }\n ]\n}')
.with_upload_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.update_current_distributor_master({
namespaceName="namespace-0001",
mode="direct",
settings="{\n \"version\": \"2019-03-01\",\n \"distributorModels\": [\n {\n \"name\": \"basic\",\n \"metadata\": \"BASIC\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n },\n {\n \"name\": \"special\",\n \"metadata\": \"SPECIAL\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n \"whiteListTargetIds\": [\n \"test\"\n ]\n }\n ]\n}",
uploadToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.update_current_distributor_master_async({
namespaceName="namespace-0001",
mode="direct",
settings="{\n \"version\": \"2019-03-01\",\n \"distributorModels\": [\n {\n \"name\": \"basic\",\n \"metadata\": \"BASIC\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n },\n {\n \"name\": \"special\",\n \"metadata\": \"SPECIAL\",\n \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n \"whiteListTargetIds\": [\n \"test\"\n ]\n }\n ]\n}",
uploadToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;updateCurrentDistributorMasterFromGitHub
Update currently active Distributor Model master data from GitHub
Updates and activates (publishes) the master data by fetching it directly from a GitHub repository. The checkout settings specify the repository, branch/tag, and file path to use. This is useful for managing master data in version control and deploying it directly.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| checkoutSetting | GitHubCheckoutSetting | ✓ | Setup to check out master data from GitHub |
Result
| Type | Description | |
|---|---|---|
| item | CurrentDistributorMaster | Updated master data of the currently active Distributor Models |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.UpdateCurrentDistributorMasterFromGitHub(
&distributor.UpdateCurrentDistributorMasterFromGitHubRequest {
NamespaceName: pointy.String("namespace-0001"),
CheckoutSetting: &distributor.GitHubCheckoutSetting{
ApiKeyId: pointy.String("apiKeyId-0001"),
RepositoryName: pointy.String("gs2io/master-data"),
SourcePath: pointy.String("path/to/file.json"),
ReferenceType: pointy.String("branch"),
BranchName: pointy.String("develop"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\UpdateCurrentDistributorMasterFromGitHubRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->updateCurrentDistributorMasterFromGitHub(
(new UpdateCurrentDistributorMasterFromGitHubRequest())
->withNamespaceName("namespace-0001")
->withCheckoutSetting((new GitHubCheckoutSetting())
->withApiKeyId("apiKeyId-0001")
->withRepositoryName("gs2io/master-data")
->withSourcePath("path/to/file.json")
->withReferenceType("branch")
->withBranchName("develop")
)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.UpdateCurrentDistributorMasterFromGitHubRequest;
import io.gs2.distributor.result.UpdateCurrentDistributorMasterFromGitHubResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
UpdateCurrentDistributorMasterFromGitHubResult result = client.updateCurrentDistributorMasterFromGitHub(
new UpdateCurrentDistributorMasterFromGitHubRequest()
.withNamespaceName("namespace-0001")
.withCheckoutSetting(new GitHubCheckoutSetting()
.withApiKeyId("apiKeyId-0001")
.withRepositoryName("gs2io/master-data")
.withSourcePath("path/to/file.json")
.withReferenceType("branch")
.withBranchName("develop")
)
);
CurrentDistributorMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.UpdateCurrentDistributorMasterFromGitHubResult> asyncResult = null;
yield return client.UpdateCurrentDistributorMasterFromGitHub(
new Gs2.Gs2Distributor.Request.UpdateCurrentDistributorMasterFromGitHubRequest()
.WithNamespaceName("namespace-0001")
.WithCheckoutSetting(new Gs2.Gs2Distributor.Model.GitHubCheckoutSetting()
.WithApiKeyId("apiKeyId-0001")
.WithRepositoryName("gs2io/master-data")
.WithSourcePath("path/to/file.json")
.WithReferenceType("branch")
.WithBranchName("develop")
),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.updateCurrentDistributorMasterFromGitHub(
new Gs2Distributor.UpdateCurrentDistributorMasterFromGitHubRequest()
.withNamespaceName("namespace-0001")
.withCheckoutSetting(new Gs2Distributor.model.GitHubCheckoutSetting()
.withApiKeyId("apiKeyId-0001")
.withRepositoryName("gs2io/master-data")
.withSourcePath("path/to/file.json")
.withReferenceType("branch")
.withBranchName("develop")
)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.update_current_distributor_master_from_git_hub(
distributor.UpdateCurrentDistributorMasterFromGitHubRequest()
.with_namespace_name('namespace-0001')
.with_checkout_setting(distributor.GitHubCheckoutSetting()
.with_api_key_id('apiKeyId-0001')
.with_repository_name('gs2io/master-data')
.with_source_path('path/to/file.json')
.with_reference_type('branch')
.with_branch_name('develop')
)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.update_current_distributor_master_from_git_hub({
namespaceName="namespace-0001",
checkoutSetting={
api_key_id="apiKeyId-0001",
repository_name="gs2io/master-data",
source_path="path/to/file.json",
reference_type="branch",
branch_name="develop",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.update_current_distributor_master_from_git_hub_async({
namespaceName="namespace-0001",
checkoutSetting={
api_key_id="apiKeyId-0001",
repository_name="gs2io/master-data",
source_path="path/to/file.json",
reference_type="branch",
branch_name="develop",
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;describeDistributorModelMasters
Get a list of Distributor Model Masters
Retrieves a paginated list of editable Distributor Model Masters with optional name prefix filtering. Distributor Model Masters are the editable definitions for resource distribution rules. Changes to masters do not take effect until the master data is activated via the CurrentDistributorMaster API.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| namePrefix | string | ~ 64 chars | Filter by Distributor Model Master name prefix | |||
| 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<DistributorModelMaster> | List of Distributor Model Masters |
| 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/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.DescribeDistributorModelMasters(
&distributor.DescribeDistributorModelMastersRequest {
NamespaceName: pointy.String("namespace-0001"),
NamePrefix: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DescribeDistributorModelMastersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->describeDistributorModelMasters(
(new DescribeDistributorModelMastersRequest())
->withNamespaceName("namespace-0001")
->withNamePrefix(null)
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DescribeDistributorModelMastersRequest;
import io.gs2.distributor.result.DescribeDistributorModelMastersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
DescribeDistributorModelMastersResult result = client.describeDistributorModelMasters(
new DescribeDistributorModelMastersRequest()
.withNamespaceName("namespace-0001")
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
List<DistributorModelMaster> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.DescribeDistributorModelMastersResult> asyncResult = null;
yield return client.DescribeDistributorModelMasters(
new Gs2.Gs2Distributor.Request.DescribeDistributorModelMastersRequest()
.WithNamespaceName("namespace-0001")
.WithNamePrefix(null)
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.describeDistributorModelMasters(
new Gs2Distributor.DescribeDistributorModelMastersRequest()
.withNamespaceName("namespace-0001")
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.describe_distributor_model_masters(
distributor.DescribeDistributorModelMastersRequest()
.with_namespace_name('namespace-0001')
.with_name_prefix(None)
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.describe_distributor_model_masters({
namespaceName="namespace-0001",
namePrefix=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('distributor')
api_result_handler = client.describe_distributor_model_masters_async({
namespaceName="namespace-0001",
namePrefix=nil,
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;createDistributorModelMaster
Create a new Distributor Model Master
Creates a new editable Distributor Model Master definition with a name, description, metadata, inbox namespace for overflow handling, and whitelist of target service actions. The inbox namespace specifies where resources are forwarded when the user’s holdings exceed capacity. The whitelist restricts which service actions are allowed to be distributed through this model. Changes do not take effect until the master data is activated via the CurrentDistributorMaster API.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| name | string | ✓ | ~ 128 chars | Distributor Model name Distributor Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| description | string | ~ 1024 chars | Description | |||
| metadata | string | ~ 2048 chars | Metadata Arbitrary values can be set in the metadata. Since they do not affect GS2’s behavior, they can be used to store information used in the game. | |||
| inboxNamespaceId | string | ~ 1024 chars | GS2-Inbox namespace GRN to transfer overflow resources | |||
| whiteListTargetIds | List<string> | [] | 0 ~ 1000 items | Whitelist of target resources GRN that can be processed through GS2-Distributor Specify the GRN prefix of the target resources that can be processed for acquisition using this Distributor Model. |
Result
| Type | Description | |
|---|---|---|
| item | DistributorModelMaster | Created Distributor Model Master |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.CreateDistributorModelMaster(
&distributor.CreateDistributorModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
Name: pointy.String("distributor-model-0001"),
Description: nil,
Metadata: nil,
InboxNamespaceId: nil,
WhiteListTargetIds: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\CreateDistributorModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->createDistributorModelMaster(
(new CreateDistributorModelMasterRequest())
->withNamespaceName("namespace-0001")
->withName("distributor-model-0001")
->withDescription(null)
->withMetadata(null)
->withInboxNamespaceId(null)
->withWhiteListTargetIds(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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.CreateDistributorModelMasterRequest;
import io.gs2.distributor.result.CreateDistributorModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
CreateDistributorModelMasterResult result = client.createDistributorModelMaster(
new CreateDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withName("distributor-model-0001")
.withDescription(null)
.withMetadata(null)
.withInboxNamespaceId(null)
.withWhiteListTargetIds(null)
);
DistributorModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.CreateDistributorModelMasterResult> asyncResult = null;
yield return client.CreateDistributorModelMaster(
new Gs2.Gs2Distributor.Request.CreateDistributorModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithName("distributor-model-0001")
.WithDescription(null)
.WithMetadata(null)
.WithInboxNamespaceId(null)
.WithWhiteListTargetIds(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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.createDistributorModelMaster(
new Gs2Distributor.CreateDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withName("distributor-model-0001")
.withDescription(null)
.withMetadata(null)
.withInboxNamespaceId(null)
.withWhiteListTargetIds(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.create_distributor_model_master(
distributor.CreateDistributorModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_name('distributor-model-0001')
.with_description(None)
.with_metadata(None)
.with_inbox_namespace_id(None)
.with_white_list_target_ids(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.create_distributor_model_master({
namespaceName="namespace-0001",
name="distributor-model-0001",
description=nil,
metadata=nil,
inboxNamespaceId=nil,
whiteListTargetIds=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.create_distributor_model_master_async({
namespaceName="namespace-0001",
name="distributor-model-0001",
description=nil,
metadata=nil,
inboxNamespaceId=nil,
whiteListTargetIds=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getDistributorModelMaster
Get Distributor Model Master
Retrieves the detailed information of a specific editable Distributor Model Master by name. This is used for viewing and editing the master definition before activation.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| distributorName | string | ✓ | ~ 128 chars | Distributor Model name Distributor Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| item | DistributorModelMaster | Distributor Model Master |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.GetDistributorModelMaster(
&distributor.GetDistributorModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
DistributorName: pointy.String("distributor-model-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetDistributorModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->getDistributorModelMaster(
(new GetDistributorModelMasterRequest())
->withNamespaceName("namespace-0001")
->withDistributorName("distributor-model-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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetDistributorModelMasterRequest;
import io.gs2.distributor.result.GetDistributorModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
GetDistributorModelMasterResult result = client.getDistributorModelMaster(
new GetDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
);
DistributorModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.GetDistributorModelMasterResult> asyncResult = null;
yield return client.GetDistributorModelMaster(
new Gs2.Gs2Distributor.Request.GetDistributorModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithDistributorName("distributor-model-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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.getDistributorModelMaster(
new Gs2Distributor.GetDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.get_distributor_model_master(
distributor.GetDistributorModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_distributor_name('distributor-model-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.get_distributor_model_master({
namespaceName="namespace-0001",
distributorName="distributor-model-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.get_distributor_model_master_async({
namespaceName="namespace-0001",
distributorName="distributor-model-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;updateDistributorModelMaster
Update Distributor Model Master
Updates the description, metadata, inbox namespace, and whitelist of an existing Distributor Model Master. The distributor model name cannot be changed after creation. Changes do not take effect until the master data is re-activated via the CurrentDistributorMaster API.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| distributorName | string | ✓ | ~ 128 chars | Distributor Model name Distributor Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| description | string | ~ 1024 chars | Description | |||
| metadata | string | ~ 2048 chars | Metadata Arbitrary values can be set in the metadata. Since they do not affect GS2’s behavior, they can be used to store information used in the game. | |||
| inboxNamespaceId | string | ~ 1024 chars | GS2-Inbox namespace GRN to transfer overflow resources | |||
| whiteListTargetIds | List<string> | [] | 0 ~ 1000 items | Whitelist of target resources GRN that can be processed through GS2-Distributor Specify the GRN prefix of the target resources that can be processed for acquisition using this Distributor Model. |
Result
| Type | Description | |
|---|---|---|
| item | DistributorModelMaster | Distributor Model Master updated |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.UpdateDistributorModelMaster(
&distributor.UpdateDistributorModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
DistributorName: pointy.String("distributor-model-0001"),
Description: pointy.String("description1"),
Metadata: pointy.String("{\"hoge\": \"fuga\"}"),
InboxNamespaceId: pointy.String("inbox-0001"),
WhiteListTargetIds: []*string{
pointy.String("grn:AAA"),
pointy.String("grn:BBB"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\UpdateDistributorModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->updateDistributorModelMaster(
(new UpdateDistributorModelMasterRequest())
->withNamespaceName("namespace-0001")
->withDistributorName("distributor-model-0001")
->withDescription("description1")
->withMetadata("{\"hoge\": \"fuga\"}")
->withInboxNamespaceId("inbox-0001")
->withWhiteListTargetIds([
"grn:AAA",
"grn:BBB",
])
);
$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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.UpdateDistributorModelMasterRequest;
import io.gs2.distributor.result.UpdateDistributorModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
UpdateDistributorModelMasterResult result = client.updateDistributorModelMaster(
new UpdateDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
.withDescription("description1")
.withMetadata("{\"hoge\": \"fuga\"}")
.withInboxNamespaceId("inbox-0001")
.withWhiteListTargetIds(Arrays.asList(
"grn:AAA",
"grn:BBB"
))
);
DistributorModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.UpdateDistributorModelMasterResult> asyncResult = null;
yield return client.UpdateDistributorModelMaster(
new Gs2.Gs2Distributor.Request.UpdateDistributorModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithDistributorName("distributor-model-0001")
.WithDescription("description1")
.WithMetadata("{\"hoge\": \"fuga\"}")
.WithInboxNamespaceId("inbox-0001")
.WithWhiteListTargetIds(new string[] {
"grn:AAA",
"grn:BBB",
}),
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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.updateDistributorModelMaster(
new Gs2Distributor.UpdateDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
.withDescription("description1")
.withMetadata("{\"hoge\": \"fuga\"}")
.withInboxNamespaceId("inbox-0001")
.withWhiteListTargetIds([
"grn:AAA",
"grn:BBB",
])
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.update_distributor_model_master(
distributor.UpdateDistributorModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_distributor_name('distributor-model-0001')
.with_description('description1')
.with_metadata('{"hoge": "fuga"}')
.with_inbox_namespace_id('inbox-0001')
.with_white_list_target_ids([
'grn:AAA',
'grn:BBB',
])
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.update_distributor_model_master({
namespaceName="namespace-0001",
distributorName="distributor-model-0001",
description="description1",
metadata="{\"hoge\": \"fuga\"}",
inboxNamespaceId="inbox-0001",
whiteListTargetIds={
"grn:AAA",
"grn:BBB"
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.update_distributor_model_master_async({
namespaceName="namespace-0001",
distributorName="distributor-model-0001",
description="description1",
metadata="{\"hoge\": \"fuga\"}",
inboxNamespaceId="inbox-0001",
whiteListTargetIds={
"grn:AAA",
"grn:BBB"
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;deleteDistributorModelMaster
Delete Distributor Model Master
Deletes an editable Distributor Model Master definition. This only affects the master data; the currently active (published) model is not affected until the master data is re-activated.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| distributorName | string | ✓ | ~ 128 chars | Distributor Model name Distributor Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| item | DistributorModelMaster | Distributor Model Master deleted |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
Session: &session,
}
result, err := client.DeleteDistributorModelMaster(
&distributor.DeleteDistributorModelMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
DistributorName: pointy.String("distributor-model-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DeleteDistributorModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DistributorRestClient(
$session
);
try {
$result = $client->deleteDistributorModelMaster(
(new DeleteDistributorModelMasterRequest())
->withNamespaceName("namespace-0001")
->withDistributorName("distributor-model-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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DeleteDistributorModelMasterRequest;
import io.gs2.distributor.result.DeleteDistributorModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(session);
try {
DeleteDistributorModelMasterResult result = client.deleteDistributorModelMaster(
new DeleteDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
);
DistributorModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DistributorRestClient(session);
AsyncResult<Gs2.Gs2Distributor.Result.DeleteDistributorModelMasterResult> asyncResult = null;
yield return client.DeleteDistributorModelMaster(
new Gs2.Gs2Distributor.Request.DeleteDistributorModelMasterRequest()
.WithNamespaceName("namespace-0001")
.WithDistributorName("distributor-model-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 Gs2Distributor from '@/gs2/distributor';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Distributor.Gs2DistributorRestClient(session);
try {
const result = await client.deleteDistributorModelMaster(
new Gs2Distributor.DeleteDistributorModelMasterRequest()
.withNamespaceName("namespace-0001")
.withDistributorName("distributor-model-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import distributor
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = distributor.Gs2DistributorRestClient(session)
try:
result = client.delete_distributor_model_master(
distributor.DeleteDistributorModelMasterRequest()
.with_namespace_name('namespace-0001')
.with_distributor_name('distributor-model-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('distributor')
api_result = client.delete_distributor_model_master({
namespaceName="namespace-0001",
distributorName="distributor-model-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('distributor')
api_result_handler = client.delete_distributor_model_master_async({
namespaceName="namespace-0001",
distributorName="distributor-model-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;