API Reference of GS2-Exchange SDK
Model
Namespace
Namespace
Namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project. Basically, GS2 services have a layer called namespace, and different namespaces are treated as completely different data spaces, even for the same service.
Therefore, it is necessary to create a namespace before starting to use each service.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceId | string | ✓ | ~ 1024 chars | Namespace GRN | ||
name | string | ✓ | ~ 128 chars | Namespace name | ||
description | string | ~ 1024 chars | Description | |||
enableDirectExchange | bool | ✓ | true | Allow direct exchange API calls. If not allowed, exchange can only be done via transaction. | ||
enableAwaitExchange | bool | ✓ | false | Use the exchange function with waiting time to receive the exchange results | ||
transactionSetting | TransactionSetting | ✓ | Transaction settings | |||
exchangeScript | ScriptSetting | Script to run when an attempt is made to perform an exchange | ||||
incrementalExchangeScript | ScriptSetting | Script to run when an attempt is made to perform an incremental exchange | ||||
logSetting | LogSetting | Log output settings | ||||
createdAt | long | ✓ | Now | Datetime of creation (Unix time unit:milliseconds) | ||
updatedAt | long | ✓ | Now | Datetime of last update (Unix time unit:milliseconds) | ||
revision | long | 0 | ~ 9223372036854775805 | Revision |
RateModel
Exchange Rate Model
The exchange rate is an entity that defines the rate used to exchange resources for resources.
In addition to the rate at which a resource can be exchanged immediately, a rate can also be set at which a resource can be exchanged after a certain amount of time in real time has elapsed. Exchange rates that require an elapse of time in real time can further define the resources required to perform an immediate exchange.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
rateModelId | string | ✓ | ~ 1024 chars | Exchange rate model GRN | ||
name | string | ✓ | ~ 128 chars | Exchange Rate Name | ||
metadata | string | ~ 2048 chars | metadata | |||
verifyActions | List<VerifyAction> | [] | ~ 10 items | List of Verify Action | ||
consumeActions | List<ConsumeAction> | [] | ~ 10 items | List of Consume Action | ||
timingType | enum { “immediate”, “await” } | ✓ | “immediate” | ~ 128 chars | Type of exchange | |
lockTime | int | {timingType} == “await” | ✓ | ~ 538214400 | Waiting time (minutes) from the execution of the exchange until the reward is actually received | |
acquireActions | List<AcquireAction> | [] | ~ 100 items | List of Acquire Action |
Enumeration type definition to specify as timingType
Enumerator String Definition | Description |
---|---|
immediate | Immediate |
await | Waiting for reality time to elapse |
RateModelMaster
Exchange Rate Model Master
An exchange rate is an entity that defines the rate used to exchange resources for resources.
In addition to rates that can be exchanged immediately, rates can also be set that can be exchanged after a certain amount of time in real time. Exchange rates that require an elapse of time in real time can further define the resources required to perform an immediate exchange.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
rateModelId | string | ✓ | ~ 1024 chars | Exchange Rate Master GRN | ||
name | string | ✓ | ~ 128 chars | Exchange rate name | ||
description | string | ~ 1024 chars | Description | |||
metadata | string | ~ 2048 chars | metadata | |||
verifyActions | List<VerifyAction> | [] | ~ 10 items | List of Verify Action | ||
consumeActions | List<ConsumeAction> | [] | ~ 10 items | List of Consumption Action | ||
timingType | enum { “immediate”, “await” } | ✓ | “immediate” | ~ 128 chars | Type of exchange | |
lockTime | int | {timingType} == “await” | ✓ | ~ 538214400 | Waiting time (minutes) from the execution of the exchange until the reward is actually received | |
acquireActions | List<AcquireAction> | [] | ~ 100 items | List of Acquire Action | ||
createdAt | long | ✓ | Now | Datetime of creation (Unix time unit:milliseconds) | ||
updatedAt | long | ✓ | Now | Datetime of last update (Unix time unit:milliseconds) | ||
revision | long | 0 | ~ 9223372036854775805 | Revision |
Enumeration type definition to specify as timingType
Enumerator String Definition | Description |
---|---|
immediate | Immediate |
await | Waiting for reality time to elapse |
IncrementalRateModel
Cost increase type exchange rate model
Normal exchange rates always provide exchanges at a constant rate. With incremental exchange rates, you can define a rate that increases in cost as the number of exchanges increases. For example, the first exchange can be exchanged at a rate of 1:1, but the second exchange can be exchanged at a rate of 2:1. By defining such a rate, you can increase the value of the resources obtained by the player as the game progresses.
The number of exchanges can be reset by the passage of real time. This is useful for resetting the number of exchanges on a daily or weekly basis.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
incrementalRateModelId | string | ✓ | ~ 1024 chars | Incremental Exchange rate model GRN | ||
name | string | ✓ | ~ 128 chars | Cost Increase Type Exchange Rate Name | ||
metadata | string | ~ 2048 chars | metadata | |||
consumeAction | ConsumeAction | ✓ | Consumption Action (Quantity/Value is overwritten so no setting is required) | |||
calculateType | enum { “linear”, “power”, “gs2_script” } | ✓ | ~ 128 chars | Calculation method for cost increase amount | ||
baseValue | long | {calculateType} == “linear” | ✓ | ~ 9223372036854775805 | Base Value | |
coefficientValue | long | {calculateType} in [“linear”, “power”] | ✓ | ~ 9223372036854775805 | Coefficient Value” | |
calculateScriptId | string | {calculateType} == “gs2_script” | ✓ | ~ 1024 chars | GRN of cost calculation script | |
exchangeCountId | string | ✓ | ~ 1024 chars | GRN of GS2-Limit model that manages the number of exchanges | ||
maximumExchangeCount | int | ✓ | 2147483646 | ~ 2147483646 | Maximum number of exchanges | |
acquireActions | List<AcquireAction> | [] | ~ 100 items | List of Acquire Action |
Enumeration type definition to specify as calculateType
Enumerator String Definition | Description |
---|---|
linear | Base Value + (Coefficient * Number of Exchanges) |
power | Coefficient * (Number of Exchanges + 1) ^ 2 |
gs2_script | Any logic with GS2-Script |
IncrementalRateModelMaster
Cost increase type exchange rate model master
Normal exchange rates always provide exchanges at a constant rate. With incremental exchange rates, you can define a rate that increases in cost as the number of exchanges increases. For example, the first exchange can be exchanged at a rate of 1:1, but the second exchange can be exchanged at a rate of 2:1. By defining such a rate, you can increase the value of the resources obtained by the player as the game progresses.
The number of exchanges can be reset by the passage of real time. This is useful for resetting the number of exchanges on a daily or weekly basis.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
incrementalRateModelId | string | ✓ | ~ 1024 chars | Exchange Rate Master GRN | ||
name | string | ✓ | ~ 128 chars | Exchange rate name | ||
description | string | ~ 1024 chars | Description | |||
metadata | string | ~ 2048 chars | metadata | |||
consumeAction | ConsumeAction | ✓ | Consumption Action (Quantity/Value is overwritten so no setting is required) | |||
calculateType | enum { “linear”, “power”, “gs2_script” } | ✓ | ~ 128 chars | Calculation method for cost increase amount | ||
baseValue | long | {calculateType} == “linear” | ✓ | ~ 9223372036854775805 | Base Value | |
coefficientValue | long | {calculateType} in [“linear”, “power”] | ✓ | ~ 9223372036854775805 | Coefficient Value” | |
calculateScriptId | string | {calculateType} == “gs2_script” | ✓ | ~ 1024 chars | GRN of cost calculation script | |
exchangeCountId | string | ✓ | ~ 1024 chars | GRN of GS2-Limit model that manages the number of exchanges | ||
maximumExchangeCount | int | ✓ | 2147483646 | ~ 2147483646 | Maximum number of exchanges | |
acquireActions | List<AcquireAction> | [] | ~ 100 items | List of Acquire Action | ||
createdAt | long | ✓ | Now | Datetime of creation (Unix time unit:milliseconds) | ||
updatedAt | long | ✓ | Now | Datetime of last update (Unix time unit:milliseconds) | ||
revision | long | 0 | ~ 9223372036854775805 | Revision |
Enumeration type definition to specify as calculateType
Enumerator String Definition | Description |
---|---|
linear | Base Value + (Coefficient * Number of Exchanges) |
power | Coefficient * (Number of Exchanges + 1) ^ 2 |
gs2_script | Any logic with GS2-Script |
CurrentRateMaster
Currently available master data
GS2 uses JSON format files for master data management. By uploading the file, you can actually reflect the settings on the server.
We provide a master data editor on the management console as a way to create JSON files, but you can also create JSON files using the The service can also be used by creating a tool more appropriate for game management and exporting a JSON file in the appropriate format.
Note
Please refer to Master Data Reference of GS2-Exchange for the JSON file format.Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceId | string | ✓ | ~ 1024 chars | Currently available exchange rate setting GRN | ||
settings | string | ✓ | ~ 5242880 chars | Master data |
Await
Standby for exchange
Waiting for exchange is an entity that represents the execution state of the exchange process, where the elapse of time in real time is a condition for exchange.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
awaitId | string | ✓ | ~ 1024 chars | Standby for exchange GRN | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
rateName | string | ✓ | ~ 128 chars | Exchange Rate Name | ||
name | string | ✓ | UUID | ~ 36 chars | Exchange standby name | |
count | int | ✓ | 1 | 1 ~ 10000 | Number of exchanges | |
skipSeconds | int | ✓ | 0 | ~ 2147483646 | Skip seconds | |
config | List<Config> | [] | ~ 32 items | Default value to apply when obtaining rewards | ||
acquirableAt | long | Time when rewards can be received (Unix time unit:milliseconds) | ||||
exchangedAt | long | ✓ | Now | Datetime of creation (Unix time unit:milliseconds) | ||
revision | long | 0 | ~ 9223372036854775805 | Revision |
LogCost
Cost calculation result using logarithm
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
base | double | ✓ | ~ 10 | Base | ||
adds | List<double> | ✓ | 1 ~ 10000 items | List of logs to be added | ||
subs | List<double> | ~ 10000 items | List of logs to be subtracted |
LogRate
Logarithmic acquisition correction
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
base | double | ✓ | ~ 10 | Base | ||
logs | List<double> | ✓ | 1 ~ 10000 items | List of logs |
AcquireAction
Acquire Action
ConsumeAction
Consume Action
VerifyAction
Verify Action
Config
Configration
Set values to be applied to transaction variables
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
key | string | ✓ | ~ 64 chars | Name | ||
value | string | ~ 51200 chars | Value |
VerifyActionResult
Verify action execution result
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
action | enum { } | ✓ | ~ 128 chars | Types of actions to be performed in the verify task | ||
verifyRequest | string | ✓ | ~ 1048576 chars | JSON of request | ||
statusCode | int | ~ 999 | Status code | |||
verifyResult | string | ~ 1048576 chars | Result payload |
Enumeration type definition to specify as action
Enumerator String Definition | Description |
---|
ConsumeActionResult
Consume action execution result
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
action | enum { } | ✓ | ~ 128 chars | Types of actions to be performed in the consume action | ||
consumeRequest | string | ✓ | ~ 1048576 chars | JSON of request | ||
statusCode | int | ~ 999 | Status code | |||
consumeResult | string | ~ 1048576 chars | Result payload |
Enumeration type definition to specify as action
Enumerator String Definition | Description |
---|
AcquireActionResult
Acquire action execution result
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
action | enum { } | ✓ | ~ 128 chars | Types of actions to be performed in the acquire action | ||
acquireRequest | string | ✓ | ~ 1048576 chars | JSON of request | ||
statusCode | int | ~ 999 | Status code | |||
acquireResult | string | ~ 1048576 chars | Result payload |
Enumeration type definition to specify as action
Enumerator String Definition | Description |
---|
TransactionResult
Transaction execution results
Transaction execution results executed using server-side transaction auto-execution functionality
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
transactionId | string | ✓ | 36 ~ 36 chars | Transaction ID | ||
verifyResults | List<VerifyActionResult> | ~ 10 items | List of verify action execution results | |||
consumeResults | List<ConsumeActionResult> | ~ 10 items | List of consume action execution results | |||
acquireResults | List<AcquireActionResult> | ~ 100 items | List of acquire action execution results |
GitHubCheckoutSetting
Setup to check out master data from GitHub
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
apiKeyId | string | ✓ | ~ 1024 chars | GitHub API key GRN | ||
repositoryName | string | ✓ | ~ 1024 chars | Repository Name | ||
sourcePath | string | ✓ | ~ 1024 chars | Source code file path | ||
referenceType | enum { “commit_hash”, “branch”, “tag” } | ✓ | ~ 128 chars | Source of code | ||
commitHash | string | {referenceType} == “commit_hash” | ✓ | ~ 1024 chars | Commit hash | |
branchName | string | {referenceType} == “branch” | ✓ | ~ 1024 chars | Branch Name | |
tagName | string | {referenceType} == “tag” | ✓ | ~ 1024 chars | Tag Name |
Enumeration type definition to specify as referenceType
Enumerator String Definition | Description |
---|---|
commit_hash | Commit hash |
branch | Branch |
tag | Tag |
ScriptSetting
Script settings
In GS2, you can associate custom scripts with microservice events and execute them. This model holds the settings for triggering script execution.
There are two main ways to execute a script: synchronous execution and asynchronous execution. Synchronous execution blocks processing until the script has finished executing. Instead, you can use the script execution result to stop the execution of the API or to tamper with the result of the API.
On the other hand, asynchronous execution does not block processing until the script has finished executing. Instead, you can use the script execution result to stop the execution of the API or to tamper with the result of the API. However, asynchronous execution does not block processing until the script has finished executing, so it is generally recommended to use asynchronous execution.
There are two types of asynchronous execution methods: GS2-Script and Amazon EventBridge. By using Amazon EventBridge, you can write processing in languages other than Lua.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
triggerScriptId | string | ~ 1024 chars | Script GRN | |||
doneTriggerTargetType | enum { “none”, “gs2_script”, “aws” } | ✓ | “none” | ~ 128 chars | Notification of Completion | |
doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024 chars | Script GRN | ||
doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024 chars | Namespace GRN |
Enumeration type definition to specify as doneTriggerTargetType
Enumerator String Definition | Description |
---|---|
none | None |
gs2_script | GS2-Script |
aws | Amazon EventBridge |
LogSetting
Log setting
This type manages log output settings. 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.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
loggingNamespaceId | string | ✓ | ~ 1024 chars | Namespace GRN |
TransactionSetting
Transaction settings
Type | Condition | Require | Default | Limitation | 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 | |
transactionUseDistributor | bool | {enableAtomicCommit} == true | ✓ | false | Whether to execute transactions asynchronously | |
acquireActionUseJobQueue | bool | {enableAtomicCommit} == true | ✓ | false | Whether to use GS2-JobQueue to execute the acquire action | |
distributorNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024 chars | GS2-Distributor namespace used for transaction execution | |
queueNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024 chars | Namespace in GS2-JobQueue used to run the transaction |
Methods
describeNamespaces
Get list of namespaces
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | List<Namespace> | List of Namespace |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&exchange.DescribeNamespacesRequest {
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DescribeNamespacesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeNamespaces(
(new DescribeNamespacesRequest())
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DescribeNamespacesRequest;
import io.gs2.exchange.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DescribeNamespacesResult result = client.describeNamespaces(
new DescribeNamespacesRequest()
.withPageToken(null)
.withLimit(null)
);
List<Namespace> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DescribeNamespacesRequest;
using Gs2.Gs2Exchange.Result.DescribeNamespacesResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Exchange.Request.DescribeNamespacesRequest()
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2Exchange.DescribeNamespacesRequest()
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.describe_namespaces(
exchange.DescribeNamespacesRequest()
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.describe_namespaces({
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('exchange')
api_result_handler = client.describe_namespaces_async({
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['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
createNamespace
Create a new namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
name | string | ✓ | ~ 128 chars | Namespace name | ||
description | string | ~ 1024 chars | Description | |||
enableAwaitExchange | bool | ✓ | false | Use the exchange function with waiting time to receive the exchange results | ||
enableDirectExchange | bool | ✓ | true | Allow direct exchange API calls. If not allowed, exchange can only be done via transaction. | ||
transactionSetting | TransactionSetting | ✓ | Transaction settings | |||
exchangeScript | ScriptSetting | Script to run when an attempt is made to perform an exchange | ||||
incrementalExchangeScript | ScriptSetting | Script to run when an attempt is made to perform an incremental exchange | ||||
logSetting | LogSetting | Log output settings | ||||
queueNamespaceId | string | ~ 1024 chars | Namespace in GS2-JobQueue used to run the transaction | |||
keyId | string | ~ 1024 chars | GS2-Key namespace used to issue transactions |
Result
Type | Description | |
---|---|---|
item | Namespace | Namespace created |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&exchange.CreateNamespaceRequest {
Name: pointy.String("namespace1"),
Description: nil,
EnableAwaitExchange: nil,
EnableDirectExchange: nil,
TransactionSetting: &exchange.TransactionSetting{
EnableAutoRun: pointy.Bool(false),
QueueNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"),
KeyId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001"),
},
ExchangeScript: nil,
IncrementalExchangeScript: nil,
LogSetting: &exchange.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CreateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createNamespace(
(new CreateNamespaceRequest())
->withName(self::namespace1)
->withDescription(null)
->withEnableAwaitExchange(null)
->withEnableDirectExchange(null)
->withTransactionSetting((new \Gs2\Exchange\Model\TransactionSetting())
->withEnableAutoRun(False)
->withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
->withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:\namespace1:key:key-0001"))
->withExchangeScript(null)
->withIncrementalExchangeScript(null)
->withLogSetting((new \Gs2\Exchange\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CreateNamespaceRequest;
import io.gs2.exchange.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withEnableAwaitExchange(null)
.withEnableDirectExchange(null)
.withTransactionSetting(new io.gs2.exchange.model.TransactionSetting()
.withEnableAutoRun(false)
.withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
.withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001"))
.withExchangeScript(null)
.withIncrementalExchangeScript(null)
.withLogSetting(new io.gs2.exchange.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CreateNamespaceRequest;
using Gs2.Gs2Exchange.Result.CreateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Exchange.Request.CreateNamespaceRequest()
.WithName("namespace1")
.WithDescription(null)
.WithEnableAwaitExchange(null)
.WithEnableDirectExchange(null)
.WithTransactionSetting(new Gs2.Gs2Exchange.Model.TransactionSetting()
.WithEnableAutoRun(false)
.WithQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
.WithKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001"))
.WithExchangeScript(null)
.WithIncrementalExchangeScript(null)
.WithLogSetting(new Gs2.Gs2Exchange.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.createNamespace(
new Gs2Exchange.CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withEnableAwaitExchange(null)
.withEnableDirectExchange(null)
.withTransactionSetting(new Gs2Exchange.model.TransactionSetting()
.withEnableAutoRun(false)
.withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
.withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001"))
.withExchangeScript(null)
.withIncrementalExchangeScript(null)
.withLogSetting(new Gs2Exchange.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.create_namespace(
exchange.CreateNamespaceRequest()
.with_name(self.hash1)
.with_description(None)
.with_enable_await_exchange(None)
.with_enable_direct_exchange(None)
.with_transaction_setting(
exchange.TransactionSetting()
.with_enable_auto_run(False)
.with_queue_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001')
.with_key_id('grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001'))
.with_exchange_script(None)
.with_incremental_exchange_script(None)
.with_log_setting(
exchange.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.create_namespace({
name="namespace1",
description=nil,
enableAwaitExchange=nil,
enableDirectExchange=nil,
transactionSetting={
enableAutoRun=false,
queueNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001",
keyId="grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001",
},
exchangeScript=nil,
incrementalExchangeScript=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.create_namespace_async({
name="namespace1",
description=nil,
enableAwaitExchange=nil,
enableDirectExchange=nil,
transactionSetting={
enableAutoRun=false,
queueNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001",
keyId="grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001",
},
exchangeScript=nil,
incrementalExchangeScript=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
},
})
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['message'])
end
result = api_result.result
item = result.item;
getNamespaceStatus
Get namespace status
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
status | string |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&exchange.GetNamespaceStatusRequest {
NamespaceName: pointy.String("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
status := result.Status
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\GetNamespaceStatusRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getNamespaceStatus(
(new GetNamespaceStatusRequest())
->withNamespaceName(self::namespace1)
);
$status = $result->getStatus();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.GetNamespaceStatusRequest;
import io.gs2.exchange.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetNamespaceStatusResult result = client.getNamespaceStatus(
new GetNamespaceStatusRequest()
.withNamespaceName("namespace1")
);
String status = result.getStatus();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Exchange.Result.GetNamespaceStatusResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Exchange.Request.GetNamespaceStatusRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2Exchange.GetNamespaceStatusRequest()
.withNamespaceName("namespace1")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.get_namespace_status(
exchange.GetNamespaceStatusRequest()
.with_namespace_name(self.hash1)
)
status = result.status
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_namespace_status({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
status = result.status;
client = gs2('exchange')
api_result_handler = client.get_namespace_status_async({
namespaceName="namespace1",
})
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['message'])
end
result = api_result.result
status = result.status;
getNamespace
Get namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | Namespace | Namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&exchange.GetNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\GetNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getNamespace(
(new GetNamespaceRequest())
->withNamespaceName(self::namespace1)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.GetNamespaceRequest;
import io.gs2.exchange.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetNamespaceResult result = client.getNamespace(
new GetNamespaceRequest()
.withNamespaceName("namespace1")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.GetNamespaceRequest;
using Gs2.Gs2Exchange.Result.GetNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Exchange.Request.GetNamespaceRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.getNamespace(
new Gs2Exchange.GetNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.get_namespace(
exchange.GetNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_namespace({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.get_namespace_async({
namespaceName="namespace1",
})
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['message'])
end
result = api_result.result
item = result.item;
updateNamespace
Update namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
description | string | ~ 1024 chars | Description | |||
enableAwaitExchange | bool | ✓ | false | Use the exchange function with waiting time to receive the exchange results | ||
enableDirectExchange | bool | ✓ | true | Allow direct exchange API calls. If not allowed, exchange can only be done via transaction. | ||
transactionSetting | TransactionSetting | ✓ | Transaction settings | |||
exchangeScript | ScriptSetting | Script to run when an attempt is made to perform an exchange | ||||
incrementalExchangeScript | ScriptSetting | Script to run when an attempt is made to perform an incremental exchange | ||||
logSetting | LogSetting | Log output settings | ||||
queueNamespaceId | string | ~ 1024 chars | Namespace in GS2-JobQueue used to run the transaction | |||
keyId | string | ~ 1024 chars | GS2-Key namespace used to issue transactions |
Result
Type | Description | |
---|---|---|
item | Namespace | Updated namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&exchange.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
Description: pointy.String("description1"),
EnableAwaitExchange: pointy.Bool(true),
EnableDirectExchange: nil,
TransactionSetting: &exchange.TransactionSetting{
EnableAutoRun: pointy.Bool(false),
QueueNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002"),
KeyId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002"),
},
ExchangeScript: nil,
IncrementalExchangeScript: nil,
LogSetting: &exchange.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\UpdateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateNamespace(
(new UpdateNamespaceRequest())
->withNamespaceName(self::namespace1)
->withDescription("description1")
->withEnableAwaitExchange(True)
->withEnableDirectExchange(null)
->withTransactionSetting((new \Gs2\Exchange\Model\TransactionSetting())
->withEnableAutoRun(False)
->withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
->withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:\namespace1:key:key-0002"))
->withExchangeScript(null)
->withIncrementalExchangeScript(null)
->withLogSetting((new \Gs2\Exchange\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.UpdateNamespaceRequest;
import io.gs2.exchange.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withEnableAwaitExchange(true)
.withEnableDirectExchange(null)
.withTransactionSetting(new io.gs2.exchange.model.TransactionSetting()
.withEnableAutoRun(false)
.withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
.withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002"))
.withExchangeScript(null)
.withIncrementalExchangeScript(null)
.withLogSetting(new io.gs2.exchange.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.UpdateNamespaceRequest;
using Gs2.Gs2Exchange.Result.UpdateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Exchange.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace1")
.WithDescription("description1")
.WithEnableAwaitExchange(true)
.WithEnableDirectExchange(null)
.WithTransactionSetting(new Gs2.Gs2Exchange.Model.TransactionSetting()
.WithEnableAutoRun(false)
.WithQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
.WithKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002"))
.WithExchangeScript(null)
.WithIncrementalExchangeScript(null)
.WithLogSetting(new Gs2.Gs2Exchange.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2Exchange.UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withEnableAwaitExchange(true)
.withEnableDirectExchange(null)
.withTransactionSetting(new Gs2Exchange.model.TransactionSetting()
.withEnableAutoRun(false)
.withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
.withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002"))
.withExchangeScript(null)
.withIncrementalExchangeScript(null)
.withLogSetting(new Gs2Exchange.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.update_namespace(
exchange.UpdateNamespaceRequest()
.with_namespace_name(self.hash1)
.with_description('description1')
.with_enable_await_exchange(True)
.with_enable_direct_exchange(None)
.with_transaction_setting(
exchange.TransactionSetting()
.with_enable_auto_run(False)
.with_queue_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002')
.with_key_id('grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002'))
.with_exchange_script(None)
.with_incremental_exchange_script(None)
.with_log_setting(
exchange.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.update_namespace({
namespaceName="namespace1",
description="description1",
enableAwaitExchange=true,
enableDirectExchange=nil,
transactionSetting={
enableAutoRun=false,
queueNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002",
keyId="grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002",
},
exchangeScript=nil,
incrementalExchangeScript=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.update_namespace_async({
namespaceName="namespace1",
description="description1",
enableAwaitExchange=true,
enableDirectExchange=nil,
transactionSetting={
enableAutoRun=false,
queueNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002",
keyId="grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002",
},
exchangeScript=nil,
incrementalExchangeScript=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
},
})
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['message'])
end
result = api_result.result
item = result.item;
deleteNamespace
Delete namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | Namespace | Deleted namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&exchange.DeleteNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DeleteNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteNamespace(
(new DeleteNamespaceRequest())
->withNamespaceName(self::namespace1)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DeleteNamespaceRequest;
import io.gs2.exchange.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DeleteNamespaceResult result = client.deleteNamespace(
new DeleteNamespaceRequest()
.withNamespaceName("namespace1")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DeleteNamespaceRequest;
using Gs2.Gs2Exchange.Result.DeleteNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Exchange.Request.DeleteNamespaceRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2Exchange.DeleteNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.delete_namespace(
exchange.DeleteNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.delete_namespace({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.delete_namespace_async({
namespaceName="namespace1",
})
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['message'])
end
result = api_result.result
item = result.item;
dumpUserDataByUserId
Get dump data of the data associated with the specified user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
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/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DumpUserDataByUserId(
&exchange.DumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->dumpUserDataByUserId(
(new DumpUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DumpUserDataByUserIdRequest;
import io.gs2.exchange.result.DumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DumpUserDataByUserIdResult result = client.dumpUserDataByUserId(
new DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DumpUserDataByUserIdRequest;
using Gs2.Gs2Exchange.Result.DumpUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
new Gs2.Gs2Exchange.Request.DumpUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.dumpUserDataByUserId(
new Gs2Exchange.DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.dump_user_data_by_user_id(
exchange.DumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.dump_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
client = gs2('exchange')
api_result_handler = client.dump_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
checkDumpUserDataByUserId
Check if the dump of the data associated with the specified user ID is complete
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
url | string | URL of output data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
&exchange.CheckDumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.Url
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CheckDumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->checkDumpUserDataByUserId(
(new CheckDumpUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$url = $result->getUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.exchange.result.CheckDumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CheckDumpUserDataByUserIdResult result = client.checkDumpUserDataByUserId(
new CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
String url = result.getUrl();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CheckDumpUserDataByUserIdRequest;
using Gs2.Gs2Exchange.Result.CheckDumpUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
new Gs2.Gs2Exchange.Request.CheckDumpUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.checkDumpUserDataByUserId(
new Gs2Exchange.CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.check_dump_user_data_by_user_id(
exchange.CheckDumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.check_dump_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
client = gs2('exchange')
api_result_handler = client.check_dump_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
cleanUserDataByUserId
Get clean data of the data associated with the specified user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
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/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CleanUserDataByUserId(
&exchange.CleanUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->cleanUserDataByUserId(
(new CleanUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CleanUserDataByUserIdRequest;
import io.gs2.exchange.result.CleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CleanUserDataByUserIdResult result = client.cleanUserDataByUserId(
new CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CleanUserDataByUserIdRequest;
using Gs2.Gs2Exchange.Result.CleanUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
new Gs2.Gs2Exchange.Request.CleanUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.cleanUserDataByUserId(
new Gs2Exchange.CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.clean_user_data_by_user_id(
exchange.CleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.clean_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
client = gs2('exchange')
api_result_handler = client.clean_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
checkCleanUserDataByUserId
Check if the clean of the data associated with the specified user ID is complete
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
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/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
&exchange.CheckCleanUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CheckCleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->checkCleanUserDataByUserId(
(new CheckCleanUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.exchange.result.CheckCleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CheckCleanUserDataByUserIdResult result = client.checkCleanUserDataByUserId(
new CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CheckCleanUserDataByUserIdRequest;
using Gs2.Gs2Exchange.Result.CheckCleanUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
new Gs2.Gs2Exchange.Request.CheckCleanUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.checkCleanUserDataByUserId(
new Gs2Exchange.CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.check_clean_user_data_by_user_id(
exchange.CheckCleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.check_clean_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
client = gs2('exchange')
api_result_handler = client.check_clean_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
prepareImportUserDataByUserId
Start importing data associated with the specified user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
uploadToken | string | Token used to reflect results after upload |
uploadUrl | string | URL used to upload user data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
&exchange.PrepareImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\PrepareImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->prepareImportUserDataByUserId(
(new PrepareImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$uploadToken = $result->getUploadToken();
$uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.exchange.result.PrepareImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
PrepareImportUserDataByUserIdResult result = client.prepareImportUserDataByUserId(
new PrepareImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
String uploadToken = result.getUploadToken();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.PrepareImportUserDataByUserIdRequest;
using Gs2.Gs2Exchange.Result.PrepareImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
new Gs2.Gs2Exchange.Request.PrepareImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.prepareImportUserDataByUserId(
new Gs2Exchange.PrepareImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const uploadToken = result.getUploadToken();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.prepare_import_user_data_by_user_id(
exchange.PrepareImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
upload_token = result.upload_token
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.prepare_import_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;
client = gs2('exchange')
api_result_handler = client.prepare_import_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;
importUserDataByUserId
Start importing data associated with the specified user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
uploadToken | string | ✓ | ~ 1024 chars | Token received in preparation for upload | ||
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/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.ImportUserDataByUserId(
&exchange.ImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\ImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->importUserDataByUserId(
(new ImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withUploadToken("upload-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.ImportUserDataByUserIdRequest;
import io.gs2.exchange.result.ImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
ImportUserDataByUserIdResult result = client.importUserDataByUserId(
new ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.ImportUserDataByUserIdRequest;
using Gs2.Gs2Exchange.Result.ImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
new Gs2.Gs2Exchange.Request.ImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithUploadToken("upload-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.importUserDataByUserId(
new Gs2Exchange.ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.import_user_data_by_user_id(
exchange.ImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_upload_token('upload-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.import_user_data_by_user_id({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
client = gs2('exchange')
api_result_handler = client.import_user_data_by_user_id_async({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
checkImportUserDataByUserId
Check if the import of the data associated with the specified user ID is complete
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
uploadToken | string | ✓ | ~ 1024 chars | Token received in preparation for upload | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
url | string | URL of log data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
&exchange.CheckImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.Url
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CheckImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->checkImportUserDataByUserId(
(new CheckImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withUploadToken("upload-0001")
->withTimeOffsetToken(null)
);
$url = $result->getUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CheckImportUserDataByUserIdRequest;
import io.gs2.exchange.result.CheckImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CheckImportUserDataByUserIdResult result = client.checkImportUserDataByUserId(
new CheckImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
String url = result.getUrl();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CheckImportUserDataByUserIdRequest;
using Gs2.Gs2Exchange.Result.CheckImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
new Gs2.Gs2Exchange.Request.CheckImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithUploadToken("upload-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.checkImportUserDataByUserId(
new Gs2Exchange.CheckImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.check_import_user_data_by_user_id(
exchange.CheckImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_upload_token('upload-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.check_import_user_data_by_user_id({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
client = gs2('exchange')
api_result_handler = client.check_import_user_data_by_user_id_async({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
describeRateModels
Get list of exchange rate models
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
items | List<RateModel> | List of exchange rate models |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DescribeRateModels(
&exchange.DescribeRateModelsRequest {
NamespaceName: pointy.String("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DescribeRateModelsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeRateModels(
(new DescribeRateModelsRequest())
->withNamespaceName(self::namespace1)
);
$items = $result->getItems();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DescribeRateModelsRequest;
import io.gs2.exchange.result.DescribeRateModelsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DescribeRateModelsResult result = client.describeRateModels(
new DescribeRateModelsRequest()
.withNamespaceName("namespace1")
);
List<RateModel> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DescribeRateModelsRequest;
using Gs2.Gs2Exchange.Result.DescribeRateModelsResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DescribeRateModelsResult> asyncResult = null;
yield return client.DescribeRateModels(
new Gs2.Gs2Exchange.Request.DescribeRateModelsRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.describeRateModels(
new Gs2Exchange.DescribeRateModelsRequest()
.withNamespaceName("namespace1")
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.describe_rate_models(
exchange.DescribeRateModelsRequest()
.with_namespace_name(self.hash1)
)
items = result.items
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.describe_rate_models({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
client = gs2('exchange')
api_result_handler = client.describe_rate_models_async({
namespaceName="namespace1",
})
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['message'])
end
result = api_result.result
items = result.items;
getRateModel
Get a exchange rate model
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
rateName | string | ✓ | ~ 128 chars | Exchange Rate Name |
Result
Type | Description | |
---|---|---|
item | RateModel | Exchange rate model |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.GetRateModel(
&exchange.GetRateModelRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("character-level"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\GetRateModelRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getRateModel(
(new GetRateModelRequest())
->withNamespaceName(self::namespace1)
->withRateName("character-level")
);
$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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.GetRateModelRequest;
import io.gs2.exchange.result.GetRateModelResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetRateModelResult result = client.getRateModel(
new GetRateModelRequest()
.withNamespaceName("namespace1")
.withRateName("character-level")
);
RateModel item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.GetRateModelRequest;
using Gs2.Gs2Exchange.Result.GetRateModelResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.GetRateModelResult> asyncResult = null;
yield return client.GetRateModel(
new Gs2.Gs2Exchange.Request.GetRateModelRequest()
.WithNamespaceName("namespace1")
.WithRateName("character-level"),
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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.getRateModel(
new Gs2Exchange.GetRateModelRequest()
.withNamespaceName("namespace1")
.withRateName("character-level")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.get_rate_model(
exchange.GetRateModelRequest()
.with_namespace_name(self.hash1)
.with_rate_name('character-level')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_rate_model({
namespaceName="namespace1",
rateName="character-level",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.get_rate_model_async({
namespaceName="namespace1",
rateName="character-level",
})
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['message'])
end
result = api_result.result
item = result.item;
describeRateModelMasters
Get list of exchange rate masters
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | List<RateModelMaster> | List of Exchange Rate Master |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DescribeRateModelMasters(
&exchange.DescribeRateModelMastersRequest {
NamespaceName: pointy.String("namespace1"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DescribeRateModelMastersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeRateModelMasters(
(new DescribeRateModelMastersRequest())
->withNamespaceName(self::namespace1)
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DescribeRateModelMastersRequest;
import io.gs2.exchange.result.DescribeRateModelMastersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DescribeRateModelMastersResult result = client.describeRateModelMasters(
new DescribeRateModelMastersRequest()
.withNamespaceName("namespace1")
.withPageToken(null)
.withLimit(null)
);
List<RateModelMaster> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DescribeRateModelMastersRequest;
using Gs2.Gs2Exchange.Result.DescribeRateModelMastersResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DescribeRateModelMastersResult> asyncResult = null;
yield return client.DescribeRateModelMasters(
new Gs2.Gs2Exchange.Request.DescribeRateModelMastersRequest()
.WithNamespaceName("namespace1")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.describeRateModelMasters(
new Gs2Exchange.DescribeRateModelMastersRequest()
.withNamespaceName("namespace1")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.describe_rate_model_masters(
exchange.DescribeRateModelMastersRequest()
.with_namespace_name(self.hash1)
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.describe_rate_model_masters({
namespaceName="namespace1",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('exchange')
api_result_handler = client.describe_rate_model_masters_async({
namespaceName="namespace1",
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['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
createRateModelMaster
Create a new exchange rate master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
name | string | ✓ | ~ 128 chars | Exchange rate name | ||
description | string | ~ 1024 chars | Description | |||
metadata | string | ~ 2048 chars | metadata | |||
timingType | enum { “immediate”, “await” } | ✓ | “immediate” | ~ 128 chars | Type of exchange | |
lockTime | int | {timingType} == “await” | ✓ | ~ 538214400 | Waiting time (minutes) from the execution of the exchange until the reward is actually received | |
acquireActions | List<AcquireAction> | [] | ~ 100 items | List of Acquire Action | ||
verifyActions | List<VerifyAction> | [] | ~ 10 items | List of Verify Action | ||
consumeActions | List<ConsumeAction> | [] | ~ 10 items | List of Consumption Action |
Enumeration type definition to specify as timingType
Enumerator String Definition | Description |
---|---|
immediate | Immediate |
await | Waiting for reality time to elapse |
Result
Type | Description | |
---|---|---|
item | RateModelMaster | Created Exchange Rate Master |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CreateRateModelMaster(
&exchange.CreateRateModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
Name: pointy.String("rate-0001"),
Description: nil,
Metadata: pointy.String("N2R"),
TimingType: nil,
LockTime: nil,
AcquireActions: []exchange.AcquireAction{
exchange.AcquireAction{
Action: pointy.String("Gs2Inventory:AcquireItemSetByUserId"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
},
},
VerifyActions: nil,
ConsumeActions: []exchange.ConsumeAction{
exchange.ConsumeAction{
Action: pointy.String("Gs2Inventory:ConsumeItemSetByUserId"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"),
},
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CreateRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createRateModelMaster(
(new CreateRateModelMasterRequest())
->withNamespaceName(self::namespace1)
->withName("rate-0001")
->withDescription(null)
->withMetadata("N2R")
->withTimingType(null)
->withLockTime(null)
->withAcquireActions([
(new \Gs2\Exchange\Model\AcquireAction())
->withAction("Gs2Inventory:AcquireItemSetByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
])
->withVerifyActions(null)
->withConsumeActions([
(new \Gs2\Exchange\Model\ConsumeAction())
->withAction("Gs2Inventory:ConsumeItemSetByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"),
])
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CreateRateModelMasterRequest;
import io.gs2.exchange.result.CreateRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CreateRateModelMasterResult result = client.createRateModelMaster(
new CreateRateModelMasterRequest()
.withNamespaceName("namespace1")
.withName("rate-0001")
.withDescription(null)
.withMetadata("N2R")
.withTimingType(null)
.withLockTime(null)
.withAcquireActions(Arrays.asList(
new io.gs2.exchange.model.AcquireAction()
.withAction("Gs2Inventory:AcquireItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}")
))
.withVerifyActions(null)
.withConsumeActions(Arrays.asList(
new io.gs2.exchange.model.ConsumeAction()
.withAction("Gs2Inventory:ConsumeItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}")
))
);
RateModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CreateRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.CreateRateModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CreateRateModelMasterResult> asyncResult = null;
yield return client.CreateRateModelMaster(
new Gs2.Gs2Exchange.Request.CreateRateModelMasterRequest()
.WithNamespaceName("namespace1")
.WithName("rate-0001")
.WithDescription(null)
.WithMetadata("N2R")
.WithTimingType(null)
.WithLockTime(null)
.WithAcquireActions(new Gs2.Core.Model.AcquireAction[] {
new Gs2.Core.Model.AcquireAction()
.WithAction("Gs2Inventory:AcquireItemSetByUserId")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
})
.WithVerifyActions(null)
.WithConsumeActions(new Gs2.Core.Model.ConsumeAction[] {
new Gs2.Core.Model.ConsumeAction()
.WithAction("Gs2Inventory:ConsumeItemSetByUserId")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"),
}),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.createRateModelMaster(
new Gs2Exchange.CreateRateModelMasterRequest()
.withNamespaceName("namespace1")
.withName("rate-0001")
.withDescription(null)
.withMetadata("N2R")
.withTimingType(null)
.withLockTime(null)
.withAcquireActions([
new Gs2Exchange.model.AcquireAction()
.withAction("Gs2Inventory:AcquireItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
])
.withVerifyActions(null)
.withConsumeActions([
new Gs2Exchange.model.ConsumeAction()
.withAction("Gs2Inventory:ConsumeItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"),
])
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.create_rate_model_master(
exchange.CreateRateModelMasterRequest()
.with_namespace_name(self.hash1)
.with_name('rate-0001')
.with_description(None)
.with_metadata('N2R')
.with_timing_type(None)
.with_lock_time(None)
.with_acquire_actions([
exchange.AcquireAction()
.with_action('Gs2Inventory:AcquireItemSetByUserId')
.with_request('{"namespaceName": "namespace-0001", "inventoryName": "item", "itemName": "item-0002", "userId": "#{userId}", "acquireCount": 1}'),
])
.with_verify_actions(None)
.with_consume_actions([
exchange.ConsumeAction()
.with_action('Gs2Inventory:ConsumeItemSetByUserId')
.with_request('{"namespaceName": "namespace-0001", "inventoryName": "item", "itemName": "item-0001", "userId": "#{userId}", "consumeCount": 10}'),
])
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.create_rate_model_master({
namespaceName="namespace1",
name="rate-0001",
description=nil,
metadata="N2R",
timingType=nil,
lockTime=nil,
acquireActions={
{
action="Gs2Inventory:AcquireItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}",
}
},
verifyActions=nil,
consumeActions={
{
action="Gs2Inventory:ConsumeItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}",
}
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.create_rate_model_master_async({
namespaceName="namespace1",
name="rate-0001",
description=nil,
metadata="N2R",
timingType=nil,
lockTime=nil,
acquireActions={
{
action="Gs2Inventory:AcquireItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}",
}
},
verifyActions=nil,
consumeActions={
{
action="Gs2Inventory:ConsumeItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}",
}
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getRateModelMaster
Obtain Exchange Rate Master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
rateName | string | ✓ | ~ 128 chars | Exchange rate name |
Result
Type | Description | |
---|---|---|
item | RateModelMaster | Exchange Rate Master |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.GetRateModelMaster(
&exchange.GetRateModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\GetRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getRateModelMaster(
(new GetRateModelMasterRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.GetRateModelMasterRequest;
import io.gs2.exchange.result.GetRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetRateModelMasterResult result = client.getRateModelMaster(
new GetRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
);
RateModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.GetRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.GetRateModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.GetRateModelMasterResult> asyncResult = null;
yield return client.GetRateModelMaster(
new Gs2.Gs2Exchange.Request.GetRateModelMasterRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.getRateModelMaster(
new Gs2Exchange.GetRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.get_rate_model_master(
exchange.GetRateModelMasterRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_rate_model_master({
namespaceName="namespace1",
rateName="rate-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.get_rate_model_master_async({
namespaceName="namespace1",
rateName="rate-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['message'])
end
result = api_result.result
item = result.item;
updateRateModelMaster
Update Exchange Rate Master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
rateName | string | ✓ | ~ 128 chars | Exchange rate name | ||
description | string | ~ 1024 chars | Description | |||
metadata | string | ~ 2048 chars | metadata | |||
timingType | enum { “immediate”, “await” } | ✓ | “immediate” | ~ 128 chars | Type of exchange | |
lockTime | int | {timingType} == “await” | ✓ | ~ 538214400 | Waiting time (minutes) from the execution of the exchange until the reward is actually received | |
acquireActions | List<AcquireAction> | [] | ~ 100 items | List of Acquire Action | ||
verifyActions | List<VerifyAction> | [] | ~ 10 items | List of Verify Action | ||
consumeActions | List<ConsumeAction> | [] | ~ 10 items | List of Consumption Action |
Enumeration type definition to specify as timingType
Enumerator String Definition | Description |
---|---|
immediate | Immediate |
await | Waiting for reality time to elapse |
Result
Type | Description | |
---|---|---|
item | RateModelMaster | Updated Exchange Rate Master |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.UpdateRateModelMaster(
&exchange.UpdateRateModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
Description: pointy.String("description1"),
Metadata: pointy.String("RATE_0001"),
TimingType: pointy.String("await"),
LockTime: pointy.Int32(180),
AcquireActions: []exchange.AcquireAction{
exchange.AcquireAction{
Action: pointy.String("Gs2Stamina:RecoverStaminaByUserId"),
Request: pointy.String("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
},
},
VerifyActions: nil,
ConsumeActions: []exchange.ConsumeAction{
exchange.ConsumeAction{
Action: pointy.String("Gs2Money:WithdrawByUserId"),
Request: pointy.String("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
},
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\UpdateRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateRateModelMaster(
(new UpdateRateModelMasterRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-0001")
->withDescription("description1")
->withMetadata("RATE_0001")
->withTimingType("await")
->withLockTime(180)
->withAcquireActions([
(new \Gs2\Exchange\Model\AcquireAction())
->withAction("Gs2Stamina:RecoverStaminaByUserId")
->withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
])
->withVerifyActions(null)
->withConsumeActions([
(new \Gs2\Exchange\Model\ConsumeAction())
->withAction("Gs2Money:WithdrawByUserId")
->withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
])
);
$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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.UpdateRateModelMasterRequest;
import io.gs2.exchange.result.UpdateRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
UpdateRateModelMasterResult result = client.updateRateModelMaster(
new UpdateRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withDescription("description1")
.withMetadata("RATE_0001")
.withTimingType("await")
.withLockTime(180)
.withAcquireActions(Arrays.asList(
new io.gs2.exchange.model.AcquireAction()
.withAction("Gs2Stamina:RecoverStaminaByUserId")
.withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}")
))
.withVerifyActions(null)
.withConsumeActions(Arrays.asList(
new io.gs2.exchange.model.ConsumeAction()
.withAction("Gs2Money:WithdrawByUserId")
.withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}")
))
);
RateModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.UpdateRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.UpdateRateModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.UpdateRateModelMasterResult> asyncResult = null;
yield return client.UpdateRateModelMaster(
new Gs2.Gs2Exchange.Request.UpdateRateModelMasterRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-0001")
.WithDescription("description1")
.WithMetadata("RATE_0001")
.WithTimingType("await")
.WithLockTime(180)
.WithAcquireActions(new Gs2.Core.Model.AcquireAction[] {
new Gs2.Core.Model.AcquireAction()
.WithAction("Gs2Stamina:RecoverStaminaByUserId")
.WithRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
})
.WithVerifyActions(null)
.WithConsumeActions(new Gs2.Core.Model.ConsumeAction[] {
new Gs2.Core.Model.ConsumeAction()
.WithAction("Gs2Money:WithdrawByUserId")
.WithRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
}),
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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.updateRateModelMaster(
new Gs2Exchange.UpdateRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withDescription("description1")
.withMetadata("RATE_0001")
.withTimingType("await")
.withLockTime(180)
.withAcquireActions([
new Gs2Exchange.model.AcquireAction()
.withAction("Gs2Stamina:RecoverStaminaByUserId")
.withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
])
.withVerifyActions(null)
.withConsumeActions([
new Gs2Exchange.model.ConsumeAction()
.withAction("Gs2Money:WithdrawByUserId")
.withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
])
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.update_rate_model_master(
exchange.UpdateRateModelMasterRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
.with_description('description1')
.with_metadata('RATE_0001')
.with_timing_type('await')
.with_lock_time(180)
.with_acquire_actions([
exchange.AcquireAction()
.with_action('Gs2Stamina:RecoverStaminaByUserId')
.with_request('{"moneyName": "money-0001", "userId": "user-0001", "slot": 0, "count": 200, "paidOnly": false}'),
])
.with_verify_actions(None)
.with_consume_actions([
exchange.ConsumeAction()
.with_action('Gs2Money:WithdrawByUserId')
.with_request('{"moneyName": "money-0001", "userId": "user-0001", "slot": 0, "count": 200, "paidOnly": false}'),
])
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.update_rate_model_master({
namespaceName="namespace1",
rateName="rate-0001",
description="description1",
metadata="RATE_0001",
timingType="await",
lockTime=180,
acquireActions={
{
action="Gs2Stamina:RecoverStaminaByUserId",
request="{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
}
},
verifyActions=nil,
consumeActions={
{
action="Gs2Money:WithdrawByUserId",
request="{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
}
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.update_rate_model_master_async({
namespaceName="namespace1",
rateName="rate-0001",
description="description1",
metadata="RATE_0001",
timingType="await",
lockTime=180,
acquireActions={
{
action="Gs2Stamina:RecoverStaminaByUserId",
request="{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
}
},
verifyActions=nil,
consumeActions={
{
action="Gs2Money:WithdrawByUserId",
request="{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
}
},
})
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['message'])
end
result = api_result.result
item = result.item;
deleteRateModelMaster
Delete Exchange Rate Master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
rateName | string | ✓ | ~ 128 chars | Exchange rate name |
Result
Type | Description | |
---|---|---|
item | RateModelMaster | Deleted Exchange Rate Master |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DeleteRateModelMaster(
&exchange.DeleteRateModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DeleteRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteRateModelMaster(
(new DeleteRateModelMasterRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DeleteRateModelMasterRequest;
import io.gs2.exchange.result.DeleteRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DeleteRateModelMasterResult result = client.deleteRateModelMaster(
new DeleteRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
);
RateModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DeleteRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.DeleteRateModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DeleteRateModelMasterResult> asyncResult = null;
yield return client.DeleteRateModelMaster(
new Gs2.Gs2Exchange.Request.DeleteRateModelMasterRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.deleteRateModelMaster(
new Gs2Exchange.DeleteRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.delete_rate_model_master(
exchange.DeleteRateModelMasterRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.delete_rate_model_master({
namespaceName="namespace1",
rateName="rate-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.delete_rate_model_master_async({
namespaceName="namespace1",
rateName="rate-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['message'])
end
result = api_result.result
item = result.item;
describeIncrementalRateModels
Get list of cost increase type exchange rate models
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
items | List<IncrementalRateModel> | List of cost increase type exchange rate models |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DescribeIncrementalRateModels(
&exchange.DescribeIncrementalRateModelsRequest {
NamespaceName: pointy.String("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DescribeIncrementalRateModelsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeIncrementalRateModels(
(new DescribeIncrementalRateModelsRequest())
->withNamespaceName(self::namespace1)
);
$items = $result->getItems();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DescribeIncrementalRateModelsRequest;
import io.gs2.exchange.result.DescribeIncrementalRateModelsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DescribeIncrementalRateModelsResult result = client.describeIncrementalRateModels(
new DescribeIncrementalRateModelsRequest()
.withNamespaceName("namespace1")
);
List<IncrementalRateModel> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DescribeIncrementalRateModelsRequest;
using Gs2.Gs2Exchange.Result.DescribeIncrementalRateModelsResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DescribeIncrementalRateModelsResult> asyncResult = null;
yield return client.DescribeIncrementalRateModels(
new Gs2.Gs2Exchange.Request.DescribeIncrementalRateModelsRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.describeIncrementalRateModels(
new Gs2Exchange.DescribeIncrementalRateModelsRequest()
.withNamespaceName("namespace1")
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.describe_incremental_rate_models(
exchange.DescribeIncrementalRateModelsRequest()
.with_namespace_name(self.hash1)
)
items = result.items
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.describe_incremental_rate_models({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
client = gs2('exchange')
api_result_handler = client.describe_incremental_rate_models_async({
namespaceName="namespace1",
})
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['message'])
end
result = api_result.result
items = result.items;
getIncrementalRateModel
Get a cost increase type exchange rate model
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
rateName | string | ✓ | ~ 128 chars | Cost Increase Type Exchange Rate Name |
Result
Type | Description | |
---|---|---|
item | IncrementalRateModel | Cost increase type cost increase type exchange rate model |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.GetIncrementalRateModel(
&exchange.GetIncrementalRateModelRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("character-level"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\GetIncrementalRateModelRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getIncrementalRateModel(
(new GetIncrementalRateModelRequest())
->withNamespaceName(self::namespace1)
->withRateName("character-level")
);
$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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.GetIncrementalRateModelRequest;
import io.gs2.exchange.result.GetIncrementalRateModelResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetIncrementalRateModelResult result = client.getIncrementalRateModel(
new GetIncrementalRateModelRequest()
.withNamespaceName("namespace1")
.withRateName("character-level")
);
IncrementalRateModel item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.GetIncrementalRateModelRequest;
using Gs2.Gs2Exchange.Result.GetIncrementalRateModelResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.GetIncrementalRateModelResult> asyncResult = null;
yield return client.GetIncrementalRateModel(
new Gs2.Gs2Exchange.Request.GetIncrementalRateModelRequest()
.WithNamespaceName("namespace1")
.WithRateName("character-level"),
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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.getIncrementalRateModel(
new Gs2Exchange.GetIncrementalRateModelRequest()
.withNamespaceName("namespace1")
.withRateName("character-level")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.get_incremental_rate_model(
exchange.GetIncrementalRateModelRequest()
.with_namespace_name(self.hash1)
.with_rate_name('character-level')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_incremental_rate_model({
namespaceName="namespace1",
rateName="character-level",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.get_incremental_rate_model_async({
namespaceName="namespace1",
rateName="character-level",
})
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['message'])
end
result = api_result.result
item = result.item;
describeIncrementalRateModelMasters
Get list of exchange rate masters
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | List<IncrementalRateModelMaster> | List of Cost Increase Type Exchange Rate Master |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DescribeIncrementalRateModelMasters(
&exchange.DescribeIncrementalRateModelMastersRequest {
NamespaceName: pointy.String("namespace1"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DescribeIncrementalRateModelMastersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeIncrementalRateModelMasters(
(new DescribeIncrementalRateModelMastersRequest())
->withNamespaceName(self::namespace1)
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DescribeIncrementalRateModelMastersRequest;
import io.gs2.exchange.result.DescribeIncrementalRateModelMastersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DescribeIncrementalRateModelMastersResult result = client.describeIncrementalRateModelMasters(
new DescribeIncrementalRateModelMastersRequest()
.withNamespaceName("namespace1")
.withPageToken(null)
.withLimit(null)
);
List<IncrementalRateModelMaster> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DescribeIncrementalRateModelMastersRequest;
using Gs2.Gs2Exchange.Result.DescribeIncrementalRateModelMastersResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DescribeIncrementalRateModelMastersResult> asyncResult = null;
yield return client.DescribeIncrementalRateModelMasters(
new Gs2.Gs2Exchange.Request.DescribeIncrementalRateModelMastersRequest()
.WithNamespaceName("namespace1")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.describeIncrementalRateModelMasters(
new Gs2Exchange.DescribeIncrementalRateModelMastersRequest()
.withNamespaceName("namespace1")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.describe_incremental_rate_model_masters(
exchange.DescribeIncrementalRateModelMastersRequest()
.with_namespace_name(self.hash1)
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.describe_incremental_rate_model_masters({
namespaceName="namespace1",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('exchange')
api_result_handler = client.describe_incremental_rate_model_masters_async({
namespaceName="namespace1",
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['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
createIncrementalRateModelMaster
Create a new exchange rate master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
name | string | ✓ | ~ 128 chars | Exchange rate name | ||
description | string | ~ 1024 chars | Description | |||
metadata | string | ~ 2048 chars | metadata | |||
consumeAction | ConsumeAction | ✓ | Consumption Action (Quantity/Value is overwritten so no setting is required) | |||
calculateType | enum { “linear”, “power”, “gs2_script” } | ✓ | ~ 128 chars | Calculation method for cost increase amount | ||
baseValue | long | {calculateType} == “linear” | ✓ | ~ 9223372036854775805 | Base Value | |
coefficientValue | long | {calculateType} in [“linear”, “power”] | ✓ | ~ 9223372036854775805 | Coefficient Value” | |
calculateScriptId | string | {calculateType} == “gs2_script” | ✓ | ~ 1024 chars | GRN of cost calculation script | |
exchangeCountId | string | ✓ | ~ 1024 chars | GRN of GS2-Limit model that manages the number of exchanges | ||
maximumExchangeCount | int | ✓ | 2147483646 | ~ 2147483646 | Maximum number of exchanges | |
acquireActions | List<AcquireAction> | [] | ~ 100 items | List of Acquire Action |
Enumeration type definition to specify as calculateType
Enumerator String Definition | Description |
---|---|
linear | Base Value + (Coefficient * Number of Exchanges) |
power | Coefficient * (Number of Exchanges + 1) ^ 2 |
gs2_script | Any logic with GS2-Script |
Result
Type | Description | |
---|---|---|
item | IncrementalRateModelMaster | Created Cost Increase Type Exchange Rate Master |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CreateIncrementalRateModelMaster(
&exchange.CreateIncrementalRateModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
Name: pointy.String("rate-0001"),
Description: nil,
Metadata: pointy.String("N2R"),
ConsumeAction: &exchange.ConsumeAction{
Action: pointy.String("Gs2Inventory:ConsumeItemSetByUserId"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"),
},
CalculateType: pointy.String("linear"),
BaseValue: pointy.Int64(100),
CoefficientValue: pointy.Int64(150),
CalculateScriptId: nil,
ExchangeCountId: pointy.String("grn:gs2:limit-0001"),
MaximumExchangeCount: nil,
AcquireActions: []exchange.AcquireAction{
exchange.AcquireAction{
Action: pointy.String("Gs2Inventory:AcquireItemSetByUserId"),
Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
},
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CreateIncrementalRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createIncrementalRateModelMaster(
(new CreateIncrementalRateModelMasterRequest())
->withNamespaceName(self::namespace1)
->withName("rate-0001")
->withDescription(null)
->withMetadata("N2R")
->withConsumeAction((new \Gs2\Exchange\Model\ConsumeAction())
->withAction("Gs2Inventory:ConsumeItemSetByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"))
->withCalculateType("linear")
->withBaseValue(100)
->withCoefficientValue(150)
->withCalculateScriptId(null)
->withExchangeCountId("grn:gs2:limit-0001")
->withMaximumExchangeCount(null)
->withAcquireActions([
(new \Gs2\Exchange\Model\AcquireAction())
->withAction("Gs2Inventory:AcquireItemSetByUserId")
->withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
])
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CreateIncrementalRateModelMasterRequest;
import io.gs2.exchange.result.CreateIncrementalRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CreateIncrementalRateModelMasterResult result = client.createIncrementalRateModelMaster(
new CreateIncrementalRateModelMasterRequest()
.withNamespaceName("namespace1")
.withName("rate-0001")
.withDescription(null)
.withMetadata("N2R")
.withConsumeAction(new io.gs2.exchange.model.ConsumeAction()
.withAction("Gs2Inventory:ConsumeItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"))
.withCalculateType("linear")
.withBaseValue(100L)
.withCoefficientValue(150L)
.withCalculateScriptId(null)
.withExchangeCountId("grn:gs2:limit-0001")
.withMaximumExchangeCount(null)
.withAcquireActions(Arrays.asList(
new io.gs2.exchange.model.AcquireAction()
.withAction("Gs2Inventory:AcquireItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}")
))
);
IncrementalRateModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CreateIncrementalRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.CreateIncrementalRateModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CreateIncrementalRateModelMasterResult> asyncResult = null;
yield return client.CreateIncrementalRateModelMaster(
new Gs2.Gs2Exchange.Request.CreateIncrementalRateModelMasterRequest()
.WithNamespaceName("namespace1")
.WithName("rate-0001")
.WithDescription(null)
.WithMetadata("N2R")
.WithConsumeAction(new Gs2.Core.Model.ConsumeAction()
.WithAction("Gs2Inventory:ConsumeItemSetByUserId")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"))
.WithCalculateType("linear")
.WithBaseValue(100L)
.WithCoefficientValue(150L)
.WithCalculateScriptId(null)
.WithExchangeCountId("grn:gs2:limit-0001")
.WithMaximumExchangeCount(null)
.WithAcquireActions(new Gs2.Core.Model.AcquireAction[] {
new Gs2.Core.Model.AcquireAction()
.WithAction("Gs2Inventory:AcquireItemSetByUserId")
.WithRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
}),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.createIncrementalRateModelMaster(
new Gs2Exchange.CreateIncrementalRateModelMasterRequest()
.withNamespaceName("namespace1")
.withName("rate-0001")
.withDescription(null)
.withMetadata("N2R")
.withConsumeAction(new Gs2Exchange.model.ConsumeAction()
.withAction("Gs2Inventory:ConsumeItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}"))
.withCalculateType("linear")
.withBaseValue(100)
.withCoefficientValue(150)
.withCalculateScriptId(null)
.withExchangeCountId("grn:gs2:limit-0001")
.withMaximumExchangeCount(null)
.withAcquireActions([
new Gs2Exchange.model.AcquireAction()
.withAction("Gs2Inventory:AcquireItemSetByUserId")
.withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
])
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.create_incremental_rate_model_master(
exchange.CreateIncrementalRateModelMasterRequest()
.with_namespace_name(self.hash1)
.with_name('rate-0001')
.with_description(None)
.with_metadata('N2R')
.with_consume_action(
exchange.ConsumeAction()
.with_action('Gs2Inventory:ConsumeItemSetByUserId')
.with_request('{"namespaceName": "namespace-0001", "inventoryName": "item", "itemName": "item-0001", "userId": "#{userId}", "consumeCount": 10}'))
.with_calculate_type('linear')
.with_base_value(100)
.with_coefficient_value(150)
.with_calculate_script_id(None)
.with_exchange_count_id('grn:gs2:limit-0001')
.with_maximum_exchange_count(None)
.with_acquire_actions([
exchange.AcquireAction()
.with_action('Gs2Inventory:AcquireItemSetByUserId')
.with_request('{"namespaceName": "namespace-0001", "inventoryName": "item", "itemName": "item-0002", "userId": "#{userId}", "acquireCount": 1}'),
])
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.create_incremental_rate_model_master({
namespaceName="namespace1",
name="rate-0001",
description=nil,
metadata="N2R",
consumeAction={
action="Gs2Inventory:ConsumeItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}",
},
calculateType="linear",
baseValue=100,
coefficientValue=150,
calculateScriptId=nil,
exchangeCountId="grn:gs2:limit-0001",
maximumExchangeCount=nil,
acquireActions={
{
action="Gs2Inventory:AcquireItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}",
}
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.create_incremental_rate_model_master_async({
namespaceName="namespace1",
name="rate-0001",
description=nil,
metadata="N2R",
consumeAction={
action="Gs2Inventory:ConsumeItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0001\", \"userId\": \"#{userId}\", \"consumeCount\": 10}",
},
calculateType="linear",
baseValue=100,
coefficientValue=150,
calculateScriptId=nil,
exchangeCountId="grn:gs2:limit-0001",
maximumExchangeCount=nil,
acquireActions={
{
action="Gs2Inventory:AcquireItemSetByUserId",
request="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}",
}
},
})
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['message'])
end
result = api_result.result
item = result.item;
getIncrementalRateModelMaster
Obtain Cost Increase Type Exchange Rate Master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
rateName | string | ✓ | ~ 128 chars | Exchange rate name |
Result
Type | Description | |
---|---|---|
item | IncrementalRateModelMaster | Cost Increase Type Exchange Rate Master |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.GetIncrementalRateModelMaster(
&exchange.GetIncrementalRateModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\GetIncrementalRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getIncrementalRateModelMaster(
(new GetIncrementalRateModelMasterRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.GetIncrementalRateModelMasterRequest;
import io.gs2.exchange.result.GetIncrementalRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetIncrementalRateModelMasterResult result = client.getIncrementalRateModelMaster(
new GetIncrementalRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
);
IncrementalRateModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.GetIncrementalRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.GetIncrementalRateModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.GetIncrementalRateModelMasterResult> asyncResult = null;
yield return client.GetIncrementalRateModelMaster(
new Gs2.Gs2Exchange.Request.GetIncrementalRateModelMasterRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.getIncrementalRateModelMaster(
new Gs2Exchange.GetIncrementalRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.get_incremental_rate_model_master(
exchange.GetIncrementalRateModelMasterRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_incremental_rate_model_master({
namespaceName="namespace1",
rateName="rate-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.get_incremental_rate_model_master_async({
namespaceName="namespace1",
rateName="rate-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['message'])
end
result = api_result.result
item = result.item;
updateIncrementalRateModelMaster
Update Cost Increase Type Exchange Rate Master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
rateName | string | ✓ | ~ 128 chars | Exchange rate name | ||
description | string | ~ 1024 chars | Description | |||
metadata | string | ~ 2048 chars | metadata | |||
consumeAction | ConsumeAction | ✓ | Consumption Action (Quantity/Value is overwritten so no setting is required) | |||
calculateType | enum { “linear”, “power”, “gs2_script” } | ✓ | ~ 128 chars | Calculation method for cost increase amount | ||
baseValue | long | {calculateType} == “linear” | ✓ | ~ 9223372036854775805 | Base Value | |
coefficientValue | long | {calculateType} in [“linear”, “power”] | ✓ | ~ 9223372036854775805 | Coefficient Value” | |
calculateScriptId | string | {calculateType} == “gs2_script” | ✓ | ~ 1024 chars | GRN of cost calculation script | |
exchangeCountId | string | ✓ | ~ 1024 chars | GRN of GS2-Limit model that manages the number of exchanges | ||
maximumExchangeCount | int | ✓ | 2147483646 | ~ 2147483646 | Maximum number of exchanges | |
acquireActions | List<AcquireAction> | [] | ~ 100 items | List of Acquire Action |
Enumeration type definition to specify as calculateType
Enumerator String Definition | Description |
---|---|
linear | Base Value + (Coefficient * Number of Exchanges) |
power | Coefficient * (Number of Exchanges + 1) ^ 2 |
gs2_script | Any logic with GS2-Script |
Result
Type | Description | |
---|---|---|
item | IncrementalRateModelMaster | Updated Cost Increase Type Exchange Rate Master |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.UpdateIncrementalRateModelMaster(
&exchange.UpdateIncrementalRateModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
Description: pointy.String("description1"),
Metadata: pointy.String("RATE_0001"),
ConsumeAction: &exchange.ConsumeAction{
Action: pointy.String("Gs2Money:WithdrawByUserId"),
Request: pointy.String("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
},
CalculateType: pointy.String("gs2_script"),
BaseValue: pointy.Int64(100),
CoefficientValue: pointy.Int64(150),
CalculateScriptId: pointy.String("grn:gs2:script-0001"),
ExchangeCountId: pointy.String("grn:gs2:limit-0001"),
MaximumExchangeCount: nil,
AcquireActions: []exchange.AcquireAction{
exchange.AcquireAction{
Action: pointy.String("Gs2Stamina:RecoverStaminaByUserId"),
Request: pointy.String("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
},
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\UpdateIncrementalRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateIncrementalRateModelMaster(
(new UpdateIncrementalRateModelMasterRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-0001")
->withDescription("description1")
->withMetadata("RATE_0001")
->withConsumeAction((new \Gs2\Exchange\Model\ConsumeAction())
->withAction("Gs2Money:WithdrawByUserId")
->withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"))
->withCalculateType("gs2_script")
->withBaseValue(100)
->withCoefficientValue(150)
->withCalculateScriptId("grn:gs2:script-0001")
->withExchangeCountId("grn:gs2:limit-0001")
->withMaximumExchangeCount(null)
->withAcquireActions([
(new \Gs2\Exchange\Model\AcquireAction())
->withAction("Gs2Stamina:RecoverStaminaByUserId")
->withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
])
);
$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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.UpdateIncrementalRateModelMasterRequest;
import io.gs2.exchange.result.UpdateIncrementalRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
UpdateIncrementalRateModelMasterResult result = client.updateIncrementalRateModelMaster(
new UpdateIncrementalRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withDescription("description1")
.withMetadata("RATE_0001")
.withConsumeAction(new io.gs2.exchange.model.ConsumeAction()
.withAction("Gs2Money:WithdrawByUserId")
.withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"))
.withCalculateType("gs2_script")
.withBaseValue(100L)
.withCoefficientValue(150L)
.withCalculateScriptId("grn:gs2:script-0001")
.withExchangeCountId("grn:gs2:limit-0001")
.withMaximumExchangeCount(null)
.withAcquireActions(Arrays.asList(
new io.gs2.exchange.model.AcquireAction()
.withAction("Gs2Stamina:RecoverStaminaByUserId")
.withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}")
))
);
IncrementalRateModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.UpdateIncrementalRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.UpdateIncrementalRateModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.UpdateIncrementalRateModelMasterResult> asyncResult = null;
yield return client.UpdateIncrementalRateModelMaster(
new Gs2.Gs2Exchange.Request.UpdateIncrementalRateModelMasterRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-0001")
.WithDescription("description1")
.WithMetadata("RATE_0001")
.WithConsumeAction(new Gs2.Core.Model.ConsumeAction()
.WithAction("Gs2Money:WithdrawByUserId")
.WithRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"))
.WithCalculateType("gs2_script")
.WithBaseValue(100L)
.WithCoefficientValue(150L)
.WithCalculateScriptId("grn:gs2:script-0001")
.WithExchangeCountId("grn:gs2:limit-0001")
.WithMaximumExchangeCount(null)
.WithAcquireActions(new Gs2.Core.Model.AcquireAction[] {
new Gs2.Core.Model.AcquireAction()
.WithAction("Gs2Stamina:RecoverStaminaByUserId")
.WithRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
}),
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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.updateIncrementalRateModelMaster(
new Gs2Exchange.UpdateIncrementalRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withDescription("description1")
.withMetadata("RATE_0001")
.withConsumeAction(new Gs2Exchange.model.ConsumeAction()
.withAction("Gs2Money:WithdrawByUserId")
.withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"))
.withCalculateType("gs2_script")
.withBaseValue(100)
.withCoefficientValue(150)
.withCalculateScriptId("grn:gs2:script-0001")
.withExchangeCountId("grn:gs2:limit-0001")
.withMaximumExchangeCount(null)
.withAcquireActions([
new Gs2Exchange.model.AcquireAction()
.withAction("Gs2Stamina:RecoverStaminaByUserId")
.withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
])
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.update_incremental_rate_model_master(
exchange.UpdateIncrementalRateModelMasterRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
.with_description('description1')
.with_metadata('RATE_0001')
.with_consume_action(
exchange.ConsumeAction()
.with_action('Gs2Money:WithdrawByUserId')
.with_request('{"moneyName": "money-0001", "userId": "user-0001", "slot": 0, "count": 200, "paidOnly": false}'))
.with_calculate_type('gs2_script')
.with_base_value(100)
.with_coefficient_value(150)
.with_calculate_script_id('grn:gs2:script-0001')
.with_exchange_count_id('grn:gs2:limit-0001')
.with_maximum_exchange_count(None)
.with_acquire_actions([
exchange.AcquireAction()
.with_action('Gs2Stamina:RecoverStaminaByUserId')
.with_request('{"moneyName": "money-0001", "userId": "user-0001", "slot": 0, "count": 200, "paidOnly": false}'),
])
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.update_incremental_rate_model_master({
namespaceName="namespace1",
rateName="rate-0001",
description="description1",
metadata="RATE_0001",
consumeAction={
action="Gs2Money:WithdrawByUserId",
request="{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
},
calculateType="gs2_script",
baseValue=100,
coefficientValue=150,
calculateScriptId="grn:gs2:script-0001",
exchangeCountId="grn:gs2:limit-0001",
maximumExchangeCount=nil,
acquireActions={
{
action="Gs2Stamina:RecoverStaminaByUserId",
request="{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
}
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.update_incremental_rate_model_master_async({
namespaceName="namespace1",
rateName="rate-0001",
description="description1",
metadata="RATE_0001",
consumeAction={
action="Gs2Money:WithdrawByUserId",
request="{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
},
calculateType="gs2_script",
baseValue=100,
coefficientValue=150,
calculateScriptId="grn:gs2:script-0001",
exchangeCountId="grn:gs2:limit-0001",
maximumExchangeCount=nil,
acquireActions={
{
action="Gs2Stamina:RecoverStaminaByUserId",
request="{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}",
}
},
})
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['message'])
end
result = api_result.result
item = result.item;
deleteIncrementalRateModelMaster
Delete Cost Increase Type Exchange Rate Master
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
rateName | string | ✓ | ~ 128 chars | Exchange rate name |
Result
Type | Description | |
---|---|---|
item | IncrementalRateModelMaster | Deleted Cost Increase Type Exchange Rate Master |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DeleteIncrementalRateModelMaster(
&exchange.DeleteIncrementalRateModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DeleteIncrementalRateModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteIncrementalRateModelMaster(
(new DeleteIncrementalRateModelMasterRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DeleteIncrementalRateModelMasterRequest;
import io.gs2.exchange.result.DeleteIncrementalRateModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DeleteIncrementalRateModelMasterResult result = client.deleteIncrementalRateModelMaster(
new DeleteIncrementalRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
);
IncrementalRateModelMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DeleteIncrementalRateModelMasterRequest;
using Gs2.Gs2Exchange.Result.DeleteIncrementalRateModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DeleteIncrementalRateModelMasterResult> asyncResult = null;
yield return client.DeleteIncrementalRateModelMaster(
new Gs2.Gs2Exchange.Request.DeleteIncrementalRateModelMasterRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.deleteIncrementalRateModelMaster(
new Gs2Exchange.DeleteIncrementalRateModelMasterRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.delete_incremental_rate_model_master(
exchange.DeleteIncrementalRateModelMasterRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.delete_incremental_rate_model_master({
namespaceName="namespace1",
rateName="rate-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.delete_incremental_rate_model_master_async({
namespaceName="namespace1",
rateName="rate-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['message'])
end
result = api_result.result
item = result.item;
exchange
Perform exchange
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
rateName | string | ✓ | ~ 128 chars | Exchange Rate Name | ||
accessToken | string | ✓ | ~ 128 chars | User Id | ||
count | int | ✓ | 1 ~ 1073741821 | Number of lots to be exchanged | ||
config | List<Config> | [] | ~ 32 items | Set values to be applied to transaction variables |
Result
Type | Description | |
---|---|---|
item | RateModel | Exchange rate model |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheets used to execute the exchange process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool? | Is transaction auto-execution enabled? |
atomicCommit | bool? | Transaction to commit atomically |
transaction | string | Issued transaction |
transactionResult | TransactionResult | Transaction execution result |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.Exchange(
&exchange.ExchangeRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
AccessToken: pointy.String("accessToken-0001"),
Count: pointy.Int32(1),
Config: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\ExchangeRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->exchange(
(new ExchangeRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-0001")
->withAccessToken(self::$accessToken0001)
->withCount(1)
->withConfig(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.ExchangeRequest;
import io.gs2.exchange.result.ExchangeResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
ExchangeResult result = client.exchange(
new ExchangeRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withAccessToken("accessToken-0001")
.withCount(1)
.withConfig(null)
);
RateModel item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.ExchangeRequest;
using Gs2.Gs2Exchange.Result.ExchangeResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.ExchangeResult> asyncResult = null;
yield return client.Exchange(
new Gs2.Gs2Exchange.Request.ExchangeRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-0001")
.WithAccessToken("accessToken-0001")
.WithCount(1)
.WithConfig(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.exchange(
new Gs2Exchange.ExchangeRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withAccessToken("accessToken-0001")
.withCount(1)
.withConfig(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.exchange(
exchange.ExchangeRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
.with_access_token(self.access_token_0001)
.with_count(1)
.with_config(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.exchange({
namespaceName="namespace1",
rateName="rate-0001",
accessToken="accessToken-0001",
count=1,
config=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.exchange_async({
namespaceName="namespace1",
rateName="rate-0001",
accessToken="accessToken-0001",
count=1,
config=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['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
exchangeByUserId
Perform exchange by specifying a user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
rateName | string | ✓ | ~ 128 chars | Exchange Rate Name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
count | int | ✓ | 1 ~ 1073741821 | Number of lots to be exchanged | ||
config | List<Config> | [] | ~ 32 items | Set values to be applied to transaction variables | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | RateModel | Exchange rate model |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheets used to execute the exchange process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool? | Is transaction auto-execution enabled? |
atomicCommit | bool? | Transaction to commit atomically |
transaction | string | Issued transaction |
transactionResult | TransactionResult | Transaction execution result |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.ExchangeByUserId(
&exchange.ExchangeByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
UserId: pointy.String("user-0001"),
Count: pointy.Int32(1),
Config: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\ExchangeByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->exchangeByUserId(
(new ExchangeByUserIdRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-0001")
->withUserId("user-0001")
->withCount(1)
->withConfig(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.ExchangeByUserIdRequest;
import io.gs2.exchange.result.ExchangeByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
ExchangeByUserIdResult result = client.exchangeByUserId(
new ExchangeByUserIdRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withUserId("user-0001")
.withCount(1)
.withConfig(null)
.withTimeOffsetToken(null)
);
RateModel item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.ExchangeByUserIdRequest;
using Gs2.Gs2Exchange.Result.ExchangeByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.ExchangeByUserIdResult> asyncResult = null;
yield return client.ExchangeByUserId(
new Gs2.Gs2Exchange.Request.ExchangeByUserIdRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-0001")
.WithUserId("user-0001")
.WithCount(1)
.WithConfig(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.exchangeByUserId(
new Gs2Exchange.ExchangeByUserIdRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withUserId("user-0001")
.withCount(1)
.withConfig(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.exchange_by_user_id(
exchange.ExchangeByUserIdRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
.with_user_id('user-0001')
.with_count(1)
.with_config(None)
.with_time_offset_token(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.exchange_by_user_id({
namespaceName="namespace1",
rateName="rate-0001",
userId="user-0001",
count=1,
config=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.exchange_by_user_id_async({
namespaceName="namespace1",
rateName="rate-0001",
userId="user-0001",
count=1,
config=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['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
exchangeByStampSheet
Execute exchange as a acquire action
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
stampSheet | string | ✓ | ~ 5242880 chars | Transaction | ||
keyId | string | ✓ | ~ 1024 chars | encryption key GRN |
Result
Type | Description | |
---|---|---|
item | RateModel | Exchange rate model |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheets used to execute the exchange process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool? | Is transaction auto-execution enabled? |
atomicCommit | bool? | Transaction to commit atomically |
transaction | string | Issued transaction |
transactionResult | TransactionResult | Transaction execution result |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.ExchangeByStampSheet(
&exchange.ExchangeByStampSheetRequest {
StampSheet: pointy.String("stampSheet"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\ExchangeByStampSheetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->exchangeByStampSheet(
(new ExchangeByStampSheetRequest())
->withStampSheet(self::stampSheet)
->withKeyId(self::key-0001)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.ExchangeByStampSheetRequest;
import io.gs2.exchange.result.ExchangeByStampSheetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
ExchangeByStampSheetResult result = client.exchangeByStampSheet(
new ExchangeByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
RateModel item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.ExchangeByStampSheetRequest;
using Gs2.Gs2Exchange.Result.ExchangeByStampSheetResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.ExchangeByStampSheetResult> asyncResult = null;
yield return client.ExchangeByStampSheet(
new Gs2.Gs2Exchange.Request.ExchangeByStampSheetRequest()
.WithStampSheet("stampSheet")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.exchangeByStampSheet(
new Gs2Exchange.ExchangeByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.exchange_by_stamp_sheet(
exchange.ExchangeByStampSheetRequest()
.with_stamp_sheet(self.stamp_sheet)
.with_key_id(self.key1.key_id)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.exchange_by_stamp_sheet({
stampSheet="stampSheet",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.exchange_by_stamp_sheet_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['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
incrementalExchange
Perform cost increase type exchange
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
rateName | string | ✓ | ~ 128 chars | Cost Increase Type Exchange Rate Name | ||
accessToken | string | ✓ | ~ 128 chars | User Id | ||
count | int | ✓ | 1 ~ 1073741821 | Number of lots to be exchanged | ||
config | List<Config> | [] | ~ 32 items | Set values to be applied to transaction variables |
Result
Type | Description | |
---|---|---|
item | IncrementalRateModel | Cost increase type exchange rate model |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheets used to execute the exchange process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool? | Is transaction auto-execution enabled? |
atomicCommit | bool? | Transaction to commit atomically |
transaction | string | Issued transaction |
transactionResult | TransactionResult | Transaction execution result |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.IncrementalExchange(
&exchange.IncrementalExchangeRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
AccessToken: pointy.String("accessToken-0001"),
Count: pointy.Int32(1),
Config: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\IncrementalExchangeRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->incrementalExchange(
(new IncrementalExchangeRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-0001")
->withAccessToken(self::$accessToken0001)
->withCount(1)
->withConfig(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.IncrementalExchangeRequest;
import io.gs2.exchange.result.IncrementalExchangeResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
IncrementalExchangeResult result = client.incrementalExchange(
new IncrementalExchangeRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withAccessToken("accessToken-0001")
.withCount(1)
.withConfig(null)
);
IncrementalRateModel item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.IncrementalExchangeRequest;
using Gs2.Gs2Exchange.Result.IncrementalExchangeResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.IncrementalExchangeResult> asyncResult = null;
yield return client.IncrementalExchange(
new Gs2.Gs2Exchange.Request.IncrementalExchangeRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-0001")
.WithAccessToken("accessToken-0001")
.WithCount(1)
.WithConfig(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.incrementalExchange(
new Gs2Exchange.IncrementalExchangeRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withAccessToken("accessToken-0001")
.withCount(1)
.withConfig(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.incremental_exchange(
exchange.IncrementalExchangeRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
.with_access_token(self.access_token_0001)
.with_count(1)
.with_config(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.incremental_exchange({
namespaceName="namespace1",
rateName="rate-0001",
accessToken="accessToken-0001",
count=1,
config=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.incremental_exchange_async({
namespaceName="namespace1",
rateName="rate-0001",
accessToken="accessToken-0001",
count=1,
config=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['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
incrementalExchangeByUserId
Perform cost increase type exchange by specifying a user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
rateName | string | ✓ | ~ 128 chars | Cost Increase Type Exchange Rate Name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
count | int | ✓ | 1 ~ 1073741821 | Number of lots to be exchanged | ||
config | List<Config> | [] | ~ 32 items | Set values to be applied to transaction variables | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | IncrementalRateModel | Cost increase type exchange rate model |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheets used to execute the exchange process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool? | Is transaction auto-execution enabled? |
atomicCommit | bool? | Transaction to commit atomically |
transaction | string | Issued transaction |
transactionResult | TransactionResult | Transaction execution result |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.IncrementalExchangeByUserId(
&exchange.IncrementalExchangeByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
RateName: pointy.String("rate-0001"),
UserId: pointy.String("user-0001"),
Count: pointy.Int32(1),
Config: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\IncrementalExchangeByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->incrementalExchangeByUserId(
(new IncrementalExchangeByUserIdRequest())
->withNamespaceName(self::namespace1)
->withRateName("rate-0001")
->withUserId("user-0001")
->withCount(1)
->withConfig(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.IncrementalExchangeByUserIdRequest;
import io.gs2.exchange.result.IncrementalExchangeByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
IncrementalExchangeByUserIdResult result = client.incrementalExchangeByUserId(
new IncrementalExchangeByUserIdRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withUserId("user-0001")
.withCount(1)
.withConfig(null)
.withTimeOffsetToken(null)
);
IncrementalRateModel item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.IncrementalExchangeByUserIdRequest;
using Gs2.Gs2Exchange.Result.IncrementalExchangeByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.IncrementalExchangeByUserIdResult> asyncResult = null;
yield return client.IncrementalExchangeByUserId(
new Gs2.Gs2Exchange.Request.IncrementalExchangeByUserIdRequest()
.WithNamespaceName("namespace1")
.WithRateName("rate-0001")
.WithUserId("user-0001")
.WithCount(1)
.WithConfig(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.incrementalExchangeByUserId(
new Gs2Exchange.IncrementalExchangeByUserIdRequest()
.withNamespaceName("namespace1")
.withRateName("rate-0001")
.withUserId("user-0001")
.withCount(1)
.withConfig(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.incremental_exchange_by_user_id(
exchange.IncrementalExchangeByUserIdRequest()
.with_namespace_name(self.hash1)
.with_rate_name('rate-0001')
.with_user_id('user-0001')
.with_count(1)
.with_config(None)
.with_time_offset_token(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.incremental_exchange_by_user_id({
namespaceName="namespace1",
rateName="rate-0001",
userId="user-0001",
count=1,
config=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.incremental_exchange_by_user_id_async({
namespaceName="namespace1",
rateName="rate-0001",
userId="user-0001",
count=1,
config=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['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
incrementalExchangeByStampSheet
Execute cost increase type exchange as a acquire action
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
stampSheet | string | ✓ | ~ 5242880 chars | Transaction | ||
keyId | string | ✓ | ~ 1024 chars | encryption key GRN |
Result
Type | Description | |
---|---|---|
item | IncrementalRateModel | Cost increase type exchange rate model |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheets used to execute the exchange process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool? | Is transaction auto-execution enabled? |
atomicCommit | bool? | Transaction to commit atomically |
transaction | string | Issued transaction |
transactionResult | TransactionResult | Transaction execution result |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.IncrementalExchangeByStampSheet(
&exchange.IncrementalExchangeByStampSheetRequest {
StampSheet: pointy.String("stampSheet"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\IncrementalExchangeByStampSheetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->incrementalExchangeByStampSheet(
(new IncrementalExchangeByStampSheetRequest())
->withStampSheet(self::stampSheet)
->withKeyId(self::key-0001)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.IncrementalExchangeByStampSheetRequest;
import io.gs2.exchange.result.IncrementalExchangeByStampSheetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
IncrementalExchangeByStampSheetResult result = client.incrementalExchangeByStampSheet(
new IncrementalExchangeByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
IncrementalRateModel item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.IncrementalExchangeByStampSheetRequest;
using Gs2.Gs2Exchange.Result.IncrementalExchangeByStampSheetResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.IncrementalExchangeByStampSheetResult> asyncResult = null;
yield return client.IncrementalExchangeByStampSheet(
new Gs2.Gs2Exchange.Request.IncrementalExchangeByStampSheetRequest()
.WithStampSheet("stampSheet")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.incrementalExchangeByStampSheet(
new Gs2Exchange.IncrementalExchangeByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.incremental_exchange_by_stamp_sheet(
exchange.IncrementalExchangeByStampSheetRequest()
.with_stamp_sheet(self.stamp_sheet)
.with_key_id(self.key1.key_id)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.incremental_exchange_by_stamp_sheet({
stampSheet="stampSheet",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.incremental_exchange_by_stamp_sheet_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['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
exportMaster
Export master data for currently available exchange rate settings
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | CurrentRateMaster | Currently available exchange rate settings |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.ExportMaster(
&exchange.ExportMasterRequest {
NamespaceName: pointy.String("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\ExportMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->exportMaster(
(new ExportMasterRequest())
->withNamespaceName(self::namespace1)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.ExportMasterRequest;
import io.gs2.exchange.result.ExportMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
ExportMasterResult result = client.exportMaster(
new ExportMasterRequest()
.withNamespaceName("namespace1")
);
CurrentRateMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.ExportMasterRequest;
using Gs2.Gs2Exchange.Result.ExportMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.ExportMasterResult> asyncResult = null;
yield return client.ExportMaster(
new Gs2.Gs2Exchange.Request.ExportMasterRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.exportMaster(
new Gs2Exchange.ExportMasterRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.export_master(
exchange.ExportMasterRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.export_master({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.export_master_async({
namespaceName="namespace1",
})
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['message'])
end
result = api_result.result
item = result.item;
getCurrentRateMaster
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | CurrentRateMaster | Currently available exchange rate settings |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.GetCurrentRateMaster(
&exchange.GetCurrentRateMasterRequest {
NamespaceName: pointy.String("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\GetCurrentRateMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getCurrentRateMaster(
(new GetCurrentRateMasterRequest())
->withNamespaceName(self::namespace1)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.GetCurrentRateMasterRequest;
import io.gs2.exchange.result.GetCurrentRateMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetCurrentRateMasterResult result = client.getCurrentRateMaster(
new GetCurrentRateMasterRequest()
.withNamespaceName("namespace1")
);
CurrentRateMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.GetCurrentRateMasterRequest;
using Gs2.Gs2Exchange.Result.GetCurrentRateMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.GetCurrentRateMasterResult> asyncResult = null;
yield return client.GetCurrentRateMaster(
new Gs2.Gs2Exchange.Request.GetCurrentRateMasterRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.getCurrentRateMaster(
new Gs2Exchange.GetCurrentRateMasterRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.get_current_rate_master(
exchange.GetCurrentRateMasterRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_current_rate_master({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.get_current_rate_master_async({
namespaceName="namespace1",
})
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['message'])
end
result = api_result.result
item = result.item;
updateCurrentRateMaster
Update currently available exchange rate settings
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
settings | string | ✓ | ~ 5242880 chars | Master data |
Result
Type | Description | |
---|---|---|
item | CurrentRateMaster | Updated currently available exchange rate settings |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.UpdateCurrentRateMaster(
&exchange.UpdateCurrentRateMasterRequest {
NamespaceName: pointy.String("namespace1"),
Settings: pointy.String("{\n \"version\": \"2019-08-19\",\n \"rateModels\": [\n {\n \"name\": \"material_n_to_r\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 10}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 1}\"\n }\n ]\n },\n {\n \"name\": \"material_r_to_n\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 1}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 10}\"\n }\n ]\n }\n ]\n}"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\UpdateCurrentRateMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateCurrentRateMaster(
(new UpdateCurrentRateMasterRequest())
->withNamespaceName(self::namespace1)
->withSettings("{\n \"version\": \"2019-08-19\",\n \"rateModels\": [\n {\n \"name\": \"material_n_to_r\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 10}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 1}\"\n }\n ]\n },\n {\n \"name\": \"material_r_to_n\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 1}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 10}\"\n }\n ]\n }\n ]\n}")
);
$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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.UpdateCurrentRateMasterRequest;
import io.gs2.exchange.result.UpdateCurrentRateMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
UpdateCurrentRateMasterResult result = client.updateCurrentRateMaster(
new UpdateCurrentRateMasterRequest()
.withNamespaceName("namespace1")
.withSettings("{\n \"version\": \"2019-08-19\",\n \"rateModels\": [\n {\n \"name\": \"material_n_to_r\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 10}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 1}\"\n }\n ]\n },\n {\n \"name\": \"material_r_to_n\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 1}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 10}\"\n }\n ]\n }\n ]\n}")
);
CurrentRateMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.UpdateCurrentRateMasterRequest;
using Gs2.Gs2Exchange.Result.UpdateCurrentRateMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.UpdateCurrentRateMasterResult> asyncResult = null;
yield return client.UpdateCurrentRateMaster(
new Gs2.Gs2Exchange.Request.UpdateCurrentRateMasterRequest()
.WithNamespaceName("namespace1")
.WithSettings("{\n \"version\": \"2019-08-19\",\n \"rateModels\": [\n {\n \"name\": \"material_n_to_r\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 10}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 1}\"\n }\n ]\n },\n {\n \"name\": \"material_r_to_n\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 1}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 10}\"\n }\n ]\n }\n ]\n}"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.updateCurrentRateMaster(
new Gs2Exchange.UpdateCurrentRateMasterRequest()
.withNamespaceName("namespace1")
.withSettings("{\n \"version\": \"2019-08-19\",\n \"rateModels\": [\n {\n \"name\": \"material_n_to_r\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 10}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 1}\"\n }\n ]\n },\n {\n \"name\": \"material_r_to_n\",\n \"metadata\": \"N2R\",\n \"timingType\": \"await\",\n \"enableSkip\": false,\n \"lockTime\": 50,\n \"consumeActions\": [\n {\n \"action\": \"Gs2Inventory:ConsumeItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0002\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"consumeCount\\\": 1}\"\n }\n ],\n \"acquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"{\\\"namespaceName\\\": \\\"category-0001\\\", \\\"inventoryName\\\": \\\"item\\\", \\\"itemName\\\": \\\"item-0001\\\", \\\"userId\\\": \\\"#{userId}\\\", \\\"acquireCount\\\": 10}\"\n }\n ]\n }\n ]\n}")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.update_current_rate_master(
exchange.UpdateCurrentRateMasterRequest()
.with_namespace_name(self.hash1)
.with_settings('{\n "version": "2019-08-19",\n "rateModels": [\n {\n "name": "material_n_to_r",\n "metadata": "N2R",\n "timingType": "await",\n "enableSkip": false,\n "lockTime": 50,\n "consumeActions": [\n {\n "action": "Gs2Inventory:ConsumeItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0001\\", \\"userId\\": \\"#{userId}\\", \\"consumeCount\\": 10}"\n }\n ],\n "acquireActions": [\n {\n "action": "Gs2Inventory:AcquireItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0002\\", \\"userId\\": \\"#{userId}\\", \\"acquireCount\\": 1}"\n }\n ]\n },\n {\n "name": "material_r_to_n",\n "metadata": "N2R",\n "timingType": "await",\n "enableSkip": false,\n "lockTime": 50,\n "consumeActions": [\n {\n "action": "Gs2Inventory:ConsumeItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0002\\", \\"userId\\": \\"#{userId}\\", \\"consumeCount\\": 1}"\n }\n ],\n "acquireActions": [\n {\n "action": "Gs2Inventory:AcquireItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0001\\", \\"userId\\": \\"#{userId}\\", \\"acquireCount\\": 10}"\n }\n ]\n }\n ]\n}')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.update_current_rate_master({
namespaceName="namespace1",
settings="{\n "version": "2019-08-19",\n "rateModels": [\n {\n "name": "material_n_to_r",\n "metadata": "N2R",\n "timingType": "await",\n "enableSkip": false,\n "lockTime": 50,\n "consumeActions": [\n {\n "action": "Gs2Inventory:ConsumeItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0001\\", \\"userId\\": \\"#{userId}\\", \\"consumeCount\\": 10}"\n }\n ],\n "acquireActions": [\n {\n "action": "Gs2Inventory:AcquireItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0002\\", \\"userId\\": \\"#{userId}\\", \\"acquireCount\\": 1}"\n }\n ]\n },\n {\n "name": "material_r_to_n",\n "metadata": "N2R",\n "timingType": "await",\n "enableSkip": false,\n "lockTime": 50,\n "consumeActions": [\n {\n "action": "Gs2Inventory:ConsumeItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0002\\", \\"userId\\": \\"#{userId}\\", \\"consumeCount\\": 1}"\n }\n ],\n "acquireActions": [\n {\n "action": "Gs2Inventory:AcquireItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0001\\", \\"userId\\": \\"#{userId}\\", \\"acquireCount\\": 10}"\n }\n ]\n }\n ]\n}",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.update_current_rate_master_async({
namespaceName="namespace1",
settings="{\n "version": "2019-08-19",\n "rateModels": [\n {\n "name": "material_n_to_r",\n "metadata": "N2R",\n "timingType": "await",\n "enableSkip": false,\n "lockTime": 50,\n "consumeActions": [\n {\n "action": "Gs2Inventory:ConsumeItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0001\\", \\"userId\\": \\"#{userId}\\", \\"consumeCount\\": 10}"\n }\n ],\n "acquireActions": [\n {\n "action": "Gs2Inventory:AcquireItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0002\\", \\"userId\\": \\"#{userId}\\", \\"acquireCount\\": 1}"\n }\n ]\n },\n {\n "name": "material_r_to_n",\n "metadata": "N2R",\n "timingType": "await",\n "enableSkip": false,\n "lockTime": 50,\n "consumeActions": [\n {\n "action": "Gs2Inventory:ConsumeItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0002\\", \\"userId\\": \\"#{userId}\\", \\"consumeCount\\": 1}"\n }\n ],\n "acquireActions": [\n {\n "action": "Gs2Inventory:AcquireItemSetByUserId",\n "request": "{\\"namespaceName\\": \\"category-0001\\", \\"inventoryName\\": \\"item\\", \\"itemName\\": \\"item-0001\\", \\"userId\\": \\"#{userId}\\", \\"acquireCount\\": 10}"\n }\n ]\n }\n ]\n}",
})
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['message'])
end
result = api_result.result
item = result.item;
updateCurrentRateMasterFromGitHub
Update currently available exchange rate settings
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
checkoutSetting | GitHubCheckoutSetting | ✓ | Setup to check out master data from GitHub |
Result
Type | Description | |
---|---|---|
item | CurrentRateMaster | Updated currently available exchange rate settings |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.UpdateCurrentRateMasterFromGitHub(
&exchange.UpdateCurrentRateMasterFromGitHubRequest {
NamespaceName: pointy.String("namespace1"),
CheckoutSetting: &exchange.GitHubCheckoutSetting{
ApiKeyId: pointy.String("$gitHubApiKey1.apiKeyId"),
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.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\UpdateCurrentRateMasterFromGitHubRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateCurrentRateMasterFromGitHub(
(new UpdateCurrentRateMasterFromGitHubRequest())
->withNamespaceName(self::namespace1)
->withCheckoutSetting((new GitHubCheckoutSetting())
->withApiKeyId(self::$gitHubApiKey1.apiKeyId)
->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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.UpdateCurrentRateMasterFromGitHubRequest;
import io.gs2.exchange.result.UpdateCurrentRateMasterFromGitHubResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
UpdateCurrentRateMasterFromGitHubResult result = client.updateCurrentRateMasterFromGitHub(
new UpdateCurrentRateMasterFromGitHubRequest()
.withNamespaceName("namespace1")
.withCheckoutSetting(new GitHubCheckoutSetting()
.withApiKeyId("$gitHubApiKey1.apiKeyId")
.withRepositoryName("gs2io/master-data")
.withSourcePath("path/to/file.json")
.withReferenceType("branch")
.withBranchName("develop")
)
);
CurrentRateMaster item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.UpdateCurrentRateMasterFromGitHubRequest;
using Gs2.Gs2Exchange.Result.UpdateCurrentRateMasterFromGitHubResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.UpdateCurrentRateMasterFromGitHubResult> asyncResult = null;
yield return client.UpdateCurrentRateMasterFromGitHub(
new Gs2.Gs2Exchange.Request.UpdateCurrentRateMasterFromGitHubRequest()
.WithNamespaceName("namespace1")
.WithCheckoutSetting(new Gs2.Gs2Exchange.Model.GitHubCheckoutSetting()
.WithApiKeyId("$gitHubApiKey1.apiKeyId")
.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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.updateCurrentRateMasterFromGitHub(
new Gs2Exchange.UpdateCurrentRateMasterFromGitHubRequest()
.withNamespaceName("namespace1")
.withCheckoutSetting(new Gs2Exchange.model.GitHubCheckoutSetting()
.withApiKeyId("$gitHubApiKey1.apiKeyId")
.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 exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.update_current_rate_master_from_git_hub(
exchange.UpdateCurrentRateMasterFromGitHubRequest()
.with_namespace_name(self.hash1)
.with_checkout_setting(exchange.GitHubCheckoutSetting()
.with_api_key_id(self.git_hub_api_key1.api_key_id)
.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('exchange')
api_result = client.update_current_rate_master_from_git_hub({
namespaceName="namespace1",
checkoutSetting={
api_key_id="$gitHubApiKey1.apiKeyId",
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['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.update_current_rate_master_from_git_hub_async({
namespaceName="namespace1",
checkoutSetting={
api_key_id="$gitHubApiKey1.apiKeyId",
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['message'])
end
result = api_result.result
item = result.item;
createAwaitByUserId
Create exchange standby by specifying user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
rateName | string | ✓ | ~ 128 chars | Exchange Rate Name | ||
count | int | ✓ | 1 | 1 ~ 10000 | Number of exchanges | |
config | List<Config> | [] | ~ 32 items | Default value to apply when obtaining rewards | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | Await | Standby for exchange |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CreateAwaitByUserId(
&exchange.CreateAwaitByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
RateName: pointy.String("material_n_to_r"),
Count: nil,
Config: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CreateAwaitByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createAwaitByUserId(
(new CreateAwaitByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withRateName("material_n_to_r")
->withCount(null)
->withConfig(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CreateAwaitByUserIdRequest;
import io.gs2.exchange.result.CreateAwaitByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CreateAwaitByUserIdResult result = client.createAwaitByUserId(
new CreateAwaitByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withRateName("material_n_to_r")
.withCount(null)
.withConfig(null)
.withTimeOffsetToken(null)
);
Await item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CreateAwaitByUserIdRequest;
using Gs2.Gs2Exchange.Result.CreateAwaitByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CreateAwaitByUserIdResult> asyncResult = null;
yield return client.CreateAwaitByUserId(
new Gs2.Gs2Exchange.Request.CreateAwaitByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithRateName("material_n_to_r")
.WithCount(null)
.WithConfig(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.createAwaitByUserId(
new Gs2Exchange.CreateAwaitByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withRateName("material_n_to_r")
.withCount(null)
.withConfig(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.create_await_by_user_id(
exchange.CreateAwaitByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_rate_name('material_n_to_r')
.with_count(None)
.with_config(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.create_await_by_user_id({
namespaceName="namespace1",
userId="user-0001",
rateName="material_n_to_r",
count=nil,
config=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.create_await_by_user_id_async({
namespaceName="namespace1",
userId="user-0001",
rateName="material_n_to_r",
count=nil,
config=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['message'])
end
result = api_result.result
item = result.item;
describeAwaits
Get list of exchange standby
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
accessToken | string | ✓ | ~ 128 chars | User Id | ||
rateName | string | ~ 128 chars | Exchange Rate Name | |||
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | List<Await> | List of Standby for exchange |
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/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DescribeAwaits(
&exchange.DescribeAwaitsRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("accessToken-0001"),
RateName: pointy.String("material_n_to_r"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DescribeAwaitsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeAwaits(
(new DescribeAwaitsRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withRateName("material_n_to_r")
->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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DescribeAwaitsRequest;
import io.gs2.exchange.result.DescribeAwaitsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DescribeAwaitsResult result = client.describeAwaits(
new DescribeAwaitsRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withRateName("material_n_to_r")
.withPageToken(null)
.withLimit(null)
);
List<Await> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DescribeAwaitsRequest;
using Gs2.Gs2Exchange.Result.DescribeAwaitsResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DescribeAwaitsResult> asyncResult = null;
yield return client.DescribeAwaits(
new Gs2.Gs2Exchange.Request.DescribeAwaitsRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("accessToken-0001")
.WithRateName("material_n_to_r")
.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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.describeAwaits(
new Gs2Exchange.DescribeAwaitsRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withRateName("material_n_to_r")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.describe_awaits(
exchange.DescribeAwaitsRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_rate_name('material_n_to_r')
.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('exchange')
api_result = client.describe_awaits({
namespaceName="namespace1",
accessToken="accessToken-0001",
rateName="material_n_to_r",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('exchange')
api_result_handler = client.describe_awaits_async({
namespaceName="namespace1",
accessToken="accessToken-0001",
rateName="material_n_to_r",
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['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
describeAwaitsByUserId
Obtain list of exchange waits by specifying a user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
rateName | string | ~ 128 chars | Exchange Rate Name | |||
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired | |
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
items | List<Await> | List of Standby for exchange |
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/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DescribeAwaitsByUserId(
&exchange.DescribeAwaitsByUserIdRequest {
NamespaceName: pointy.String("namespace2"),
UserId: pointy.String("user-0001"),
RateName: pointy.String("material_n_to_r"),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DescribeAwaitsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeAwaitsByUserId(
(new DescribeAwaitsByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withRateName("material_n_to_r")
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DescribeAwaitsByUserIdRequest;
import io.gs2.exchange.result.DescribeAwaitsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DescribeAwaitsByUserIdResult result = client.describeAwaitsByUserId(
new DescribeAwaitsByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withRateName("material_n_to_r")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<Await> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DescribeAwaitsByUserIdRequest;
using Gs2.Gs2Exchange.Result.DescribeAwaitsByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DescribeAwaitsByUserIdResult> asyncResult = null;
yield return client.DescribeAwaitsByUserId(
new Gs2.Gs2Exchange.Request.DescribeAwaitsByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithRateName("material_n_to_r")
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.describeAwaitsByUserId(
new Gs2Exchange.DescribeAwaitsByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withRateName("material_n_to_r")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.describe_awaits_by_user_id(
exchange.DescribeAwaitsByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
.with_rate_name('material_n_to_r')
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.describe_awaits_by_user_id({
namespaceName="namespace2",
userId="user-0001",
rateName="material_n_to_r",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('exchange')
api_result_handler = client.describe_awaits_by_user_id_async({
namespaceName="namespace2",
userId="user-0001",
rateName="material_n_to_r",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
getAwait
Get standby for exchange
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
accessToken | string | ✓ | ~ 128 chars | User Id | ||
awaitName | string | ✓ | UUID | ~ 36 chars | Exchange standby name |
Result
Type | Description | |
---|---|---|
item | Await | Standby for exchange |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.GetAwait(
&exchange.GetAwaitRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("accessToken-0001"),
AwaitName: pointy.String("await-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\GetAwaitRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getAwait(
(new GetAwaitRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withAwaitName(self::await-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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.GetAwaitRequest;
import io.gs2.exchange.result.GetAwaitResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetAwaitResult result = client.getAwait(
new GetAwaitRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withAwaitName("await-0001")
);
Await item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.GetAwaitRequest;
using Gs2.Gs2Exchange.Result.GetAwaitResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.GetAwaitResult> asyncResult = null;
yield return client.GetAwait(
new Gs2.Gs2Exchange.Request.GetAwaitRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("accessToken-0001")
.WithAwaitName("await-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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.getAwait(
new Gs2Exchange.GetAwaitRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withAwaitName("await-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.get_await(
exchange.GetAwaitRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_await_name(self.await1.name)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_await({
namespaceName="namespace1",
accessToken="accessToken-0001",
awaitName="await-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.get_await_async({
namespaceName="namespace1",
accessToken="accessToken-0001",
awaitName="await-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['message'])
end
result = api_result.result
item = result.item;
getAwaitByUserId
Get standby for exchange by specifying user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
awaitName | string | ✓ | UUID | ~ 36 chars | Exchange standby name | |
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | Await | Standby for exchange |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.GetAwaitByUserId(
&exchange.GetAwaitByUserIdRequest {
NamespaceName: pointy.String("namespace2"),
UserId: pointy.String("user-0001"),
AwaitName: pointy.String("await-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\GetAwaitByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getAwaitByUserId(
(new GetAwaitByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withAwaitName("await-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.GetAwaitByUserIdRequest;
import io.gs2.exchange.result.GetAwaitByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
GetAwaitByUserIdResult result = client.getAwaitByUserId(
new GetAwaitByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withTimeOffsetToken(null)
);
Await item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.GetAwaitByUserIdRequest;
using Gs2.Gs2Exchange.Result.GetAwaitByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.GetAwaitByUserIdResult> asyncResult = null;
yield return client.GetAwaitByUserId(
new Gs2.Gs2Exchange.Request.GetAwaitByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithAwaitName("await-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.getAwaitByUserId(
new Gs2Exchange.GetAwaitByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.get_await_by_user_id(
exchange.GetAwaitByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
.with_await_name('await-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.get_await_by_user_id({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.get_await_by_user_id_async({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-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['message'])
end
result = api_result.result
item = result.item;
acquire
Get rewarded for waiting for exchange
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
accessToken | string | ✓ | ~ 128 chars | User Id | ||
awaitName | string | ✓ | UUID | ~ 36 chars | Exchange standby name | |
config | List<Config> | [] | ~ 32 items | Set values to be applied to transaction variables |
Result
Type | Description | |
---|---|---|
item | Await | Standby for exchange |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheet used to execute the reward acquisition process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool? | Is transaction auto-execution enabled? |
atomicCommit | bool? | Transaction to commit atomically |
transaction | string | Issued transaction |
transactionResult | TransactionResult | Transaction execution result |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.Acquire(
&exchange.AcquireRequest {
NamespaceName: pointy.String("namespace2"),
AccessToken: pointy.String("accessToken-0001"),
AwaitName: pointy.String("await-0001"),
Config: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\AcquireRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->acquire(
(new AcquireRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->withAwaitName("await-0001")
->withConfig(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.AcquireRequest;
import io.gs2.exchange.result.AcquireResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
AcquireResult result = client.acquire(
new AcquireRequest()
.withNamespaceName("namespace2")
.withAccessToken("accessToken-0001")
.withAwaitName("await-0001")
.withConfig(null)
);
Await item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.AcquireRequest;
using Gs2.Gs2Exchange.Result.AcquireResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.AcquireResult> asyncResult = null;
yield return client.Acquire(
new Gs2.Gs2Exchange.Request.AcquireRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("accessToken-0001")
.WithAwaitName("await-0001")
.WithConfig(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.acquire(
new Gs2Exchange.AcquireRequest()
.withNamespaceName("namespace2")
.withAccessToken("accessToken-0001")
.withAwaitName("await-0001")
.withConfig(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.acquire(
exchange.AcquireRequest()
.with_namespace_name(self.hash2)
.with_access_token(self.access_token_0001)
.with_await_name('await-0001')
.with_config(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.acquire({
namespaceName="namespace2",
accessToken="accessToken-0001",
awaitName="await-0001",
config=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.acquire_async({
namespaceName="namespace2",
accessToken="accessToken-0001",
awaitName="await-0001",
config=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['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
acquireByUserId
Get rewarded for waiting for exchange
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
awaitName | string | ✓ | UUID | ~ 36 chars | Exchange standby name | |
config | List<Config> | [] | ~ 32 items | Set values to be applied to transaction variables | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | Await | Standby for exchange |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheet used to execute the reward acquisition process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool? | Is transaction auto-execution enabled? |
atomicCommit | bool? | Transaction to commit atomically |
transaction | string | Issued transaction |
transactionResult | TransactionResult | Transaction execution result |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.AcquireByUserId(
&exchange.AcquireByUserIdRequest {
NamespaceName: pointy.String("namespace2"),
UserId: pointy.String("user-0001"),
AwaitName: pointy.String("await-0001"),
Config: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\AcquireByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->acquireByUserId(
(new AcquireByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withAwaitName("await-0001")
->withConfig(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.AcquireByUserIdRequest;
import io.gs2.exchange.result.AcquireByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
AcquireByUserIdResult result = client.acquireByUserId(
new AcquireByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withConfig(null)
.withTimeOffsetToken(null)
);
Await item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.AcquireByUserIdRequest;
using Gs2.Gs2Exchange.Result.AcquireByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.AcquireByUserIdResult> asyncResult = null;
yield return client.AcquireByUserId(
new Gs2.Gs2Exchange.Request.AcquireByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithAwaitName("await-0001")
.WithConfig(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.acquireByUserId(
new Gs2Exchange.AcquireByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withConfig(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.acquire_by_user_id(
exchange.AcquireByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
.with_await_name('await-0001')
.with_config(None)
.with_time_offset_token(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.acquire_by_user_id({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
config=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.acquire_by_user_id_async({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
config=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['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
acquireForceByUserId
Get rewarded for waiting for exchange without waiting for the waiting time
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
awaitName | string | ✓ | UUID | ~ 36 chars | Exchange standby name | |
config | List<Config> | [] | ~ 32 items | Set values to be applied to transaction variables | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | Await | Standby for exchange |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheet used to execute the reward acquisition process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool? | Is transaction auto-execution enabled? |
atomicCommit | bool? | Transaction to commit atomically |
transaction | string | Issued transaction |
transactionResult | TransactionResult | Transaction execution result |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.AcquireForceByUserId(
&exchange.AcquireForceByUserIdRequest {
NamespaceName: pointy.String("namespace2"),
UserId: pointy.String("user-0001"),
AwaitName: pointy.String("await-0001"),
Config: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\AcquireForceByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->acquireForceByUserId(
(new AcquireForceByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withAwaitName("await-0001")
->withConfig(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.AcquireForceByUserIdRequest;
import io.gs2.exchange.result.AcquireForceByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
AcquireForceByUserIdResult result = client.acquireForceByUserId(
new AcquireForceByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withConfig(null)
.withTimeOffsetToken(null)
);
Await item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.AcquireForceByUserIdRequest;
using Gs2.Gs2Exchange.Result.AcquireForceByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.AcquireForceByUserIdResult> asyncResult = null;
yield return client.AcquireForceByUserId(
new Gs2.Gs2Exchange.Request.AcquireForceByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithAwaitName("await-0001")
.WithConfig(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.acquireForceByUserId(
new Gs2Exchange.AcquireForceByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withConfig(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.acquire_force_by_user_id(
exchange.AcquireForceByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
.with_await_name('await-0001')
.with_config(None)
.with_time_offset_token(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.acquire_force_by_user_id({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
config=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.acquire_force_by_user_id_async({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
config=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['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
skipByUserId
Skip exchange standby by specifying user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
awaitName | string | ✓ | UUID | ~ 36 chars | Exchange standby name | |
skipType | enum { “complete”, “minutes”, “totalRate”, “remainRate” } | ✓ | “complete” | ~ 128 chars | Skip type | |
minutes | int | {skipType} == “minutes” | ~ 2147483646 | Minutes to skip | ||
rate | float | {skipType} == “totalRate” or {skipType} == “remainRate” | ~ 1 | Percentage of time to skip | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Enumeration type definition to specify as skipType
Enumerator String Definition | Description |
---|---|
complete | Complete skip |
minutes | Skip by specifying time(minutes) |
totalRate | Skip by specifying the percentage of total waiting time |
remainRate | Skip by specifying the percentage of remaining waiting time |
Result
Type | Description | |
---|---|---|
item | Await | Standby for exchange |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.SkipByUserId(
&exchange.SkipByUserIdRequest {
NamespaceName: pointy.String("namespace2"),
UserId: pointy.String("user-0001"),
AwaitName: pointy.String("await-0001"),
SkipType: nil,
Minutes: nil,
Rate: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\SkipByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->skipByUserId(
(new SkipByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withAwaitName("await-0001")
->withSkipType(null)
->withMinutes(null)
->withRate(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.SkipByUserIdRequest;
import io.gs2.exchange.result.SkipByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
SkipByUserIdResult result = client.skipByUserId(
new SkipByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withSkipType(null)
.withMinutes(null)
.withRate(null)
.withTimeOffsetToken(null)
);
Await item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.SkipByUserIdRequest;
using Gs2.Gs2Exchange.Result.SkipByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.SkipByUserIdResult> asyncResult = null;
yield return client.SkipByUserId(
new Gs2.Gs2Exchange.Request.SkipByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithAwaitName("await-0001")
.WithSkipType(null)
.WithMinutes(null)
.WithRate(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.skipByUserId(
new Gs2Exchange.SkipByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withSkipType(null)
.withMinutes(null)
.withRate(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.skip_by_user_id(
exchange.SkipByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
.with_await_name('await-0001')
.with_skip_type(None)
.with_minutes(None)
.with_rate(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.skip_by_user_id({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
skipType=nil,
minutes=nil,
rate=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.skip_by_user_id_async({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
skipType=nil,
minutes=nil,
rate=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['message'])
end
result = api_result.result
item = result.item;
deleteAwait
Delete exchange standby
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
accessToken | string | ✓ | ~ 128 chars | User Id | ||
awaitName | string | ✓ | UUID | ~ 36 chars | Exchange standby name |
Result
Type | Description | |
---|---|---|
item | Await | Standby for exchange |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DeleteAwait(
&exchange.DeleteAwaitRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("accessToken-0001"),
AwaitName: pointy.String("await-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DeleteAwaitRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteAwait(
(new DeleteAwaitRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withAwaitName(self::await-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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DeleteAwaitRequest;
import io.gs2.exchange.result.DeleteAwaitResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DeleteAwaitResult result = client.deleteAwait(
new DeleteAwaitRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withAwaitName("await-0001")
);
Await item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DeleteAwaitRequest;
using Gs2.Gs2Exchange.Result.DeleteAwaitResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DeleteAwaitResult> asyncResult = null;
yield return client.DeleteAwait(
new Gs2.Gs2Exchange.Request.DeleteAwaitRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("accessToken-0001")
.WithAwaitName("await-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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.deleteAwait(
new Gs2Exchange.DeleteAwaitRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withAwaitName("await-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.delete_await(
exchange.DeleteAwaitRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_await_name(self.await1.name)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.delete_await({
namespaceName="namespace1",
accessToken="accessToken-0001",
awaitName="await-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.delete_await_async({
namespaceName="namespace1",
accessToken="accessToken-0001",
awaitName="await-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['message'])
end
result = api_result.result
item = result.item;
deleteAwaitByUserId
Delete exchange standby
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
awaitName | string | ✓ | UUID | ~ 36 chars | Exchange standby name | |
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | Await | Standby for exchange |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DeleteAwaitByUserId(
&exchange.DeleteAwaitByUserIdRequest {
NamespaceName: pointy.String("namespace2"),
UserId: pointy.String("user-0001"),
AwaitName: pointy.String("await-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DeleteAwaitByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteAwaitByUserId(
(new DeleteAwaitByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withAwaitName("await-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DeleteAwaitByUserIdRequest;
import io.gs2.exchange.result.DeleteAwaitByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DeleteAwaitByUserIdResult result = client.deleteAwaitByUserId(
new DeleteAwaitByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withTimeOffsetToken(null)
);
Await item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DeleteAwaitByUserIdRequest;
using Gs2.Gs2Exchange.Result.DeleteAwaitByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DeleteAwaitByUserIdResult> asyncResult = null;
yield return client.DeleteAwaitByUserId(
new Gs2.Gs2Exchange.Request.DeleteAwaitByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithAwaitName("await-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.deleteAwaitByUserId(
new Gs2Exchange.DeleteAwaitByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withAwaitName("await-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.delete_await_by_user_id(
exchange.DeleteAwaitByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
.with_await_name('await-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.delete_await_by_user_id({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.delete_await_by_user_id_async({
namespaceName="namespace2",
userId="user-0001",
awaitName="await-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['message'])
end
result = api_result.result
item = result.item;
createAwaitByStampSheet
Execute creation of exchange standby as acquire action
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
stampSheet | string | ✓ | ~ 5242880 chars | Transaction | ||
keyId | string | ✓ | ~ 1024 chars | encryption key GRN |
Result
Type | Description | |
---|---|---|
item | Await | Standby for exchange |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.CreateAwaitByStampSheet(
&exchange.CreateAwaitByStampSheetRequest {
StampSheet: pointy.String("stampSheet"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\CreateAwaitByStampSheetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createAwaitByStampSheet(
(new CreateAwaitByStampSheetRequest())
->withStampSheet(self::stampSheet)
->withKeyId(self::key-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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.CreateAwaitByStampSheetRequest;
import io.gs2.exchange.result.CreateAwaitByStampSheetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
CreateAwaitByStampSheetResult result = client.createAwaitByStampSheet(
new CreateAwaitByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
Await item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.CreateAwaitByStampSheetRequest;
using Gs2.Gs2Exchange.Result.CreateAwaitByStampSheetResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.CreateAwaitByStampSheetResult> asyncResult = null;
yield return client.CreateAwaitByStampSheet(
new Gs2.Gs2Exchange.Request.CreateAwaitByStampSheetRequest()
.WithStampSheet("stampSheet")
.WithKeyId("key-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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.createAwaitByStampSheet(
new Gs2Exchange.CreateAwaitByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.create_await_by_stamp_sheet(
exchange.CreateAwaitByStampSheetRequest()
.with_stamp_sheet(self.stamp_sheet)
.with_key_id(self.key1.key_id)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.create_await_by_stamp_sheet({
stampSheet="stampSheet",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.create_await_by_stamp_sheet_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['message'])
end
result = api_result.result
item = result.item;
acquireForceByStampSheet
Execute acquisition of exchange standby as acquire action without waiting for the waiting time
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
stampSheet | string | ✓ | ~ 5242880 chars | Transaction | ||
keyId | string | ✓ | ~ 1024 chars | encryption key GRN |
Result
Type | Description | |
---|---|---|
item | Await | Standby for exchange |
transactionId | string | Issed transaction ID |
stampSheet | string | Stamp sheet used to execute the reward acquisition process |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool? | Is transaction auto-execution enabled? |
atomicCommit | bool? | Transaction to commit atomically |
transaction | string | Issued transaction |
transactionResult | TransactionResult | Transaction execution result |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.AcquireForceByStampSheet(
&exchange.AcquireForceByStampSheetRequest {
StampSheet: pointy.String("stampSheet"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
atomicCommit := result.AtomicCommit
transaction := result.Transaction
transactionResult := result.TransactionResult
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\AcquireForceByStampSheetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->acquireForceByStampSheet(
(new AcquireForceByStampSheetRequest())
->withStampSheet(self::stampSheet)
->withKeyId(self::key-0001)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
$atomicCommit = $result->getAtomicCommit();
$transaction = $result->getTransaction();
$transactionResult = $result->getTransactionResult();
} 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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.AcquireForceByStampSheetRequest;
import io.gs2.exchange.result.AcquireForceByStampSheetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
AcquireForceByStampSheetResult result = client.acquireForceByStampSheet(
new AcquireForceByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
Await item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
boolean atomicCommit = result.getAtomicCommit();
String transaction = result.getTransaction();
TransactionResult transactionResult = result.getTransactionResult();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.AcquireForceByStampSheetRequest;
using Gs2.Gs2Exchange.Result.AcquireForceByStampSheetResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.AcquireForceByStampSheetResult> asyncResult = null;
yield return client.AcquireForceByStampSheet(
new Gs2.Gs2Exchange.Request.AcquireForceByStampSheetRequest()
.WithStampSheet("stampSheet")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
var atomicCommit = result.AtomicCommit;
var transaction = result.Transaction;
var transactionResult = result.TransactionResult;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.acquireForceByStampSheet(
new Gs2Exchange.AcquireForceByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
const atomicCommit = result.getAtomicCommit();
const transaction = result.getTransaction();
const transactionResult = result.getTransactionResult();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.acquire_force_by_stamp_sheet(
exchange.AcquireForceByStampSheetRequest()
.with_stamp_sheet(self.stamp_sheet)
.with_key_id(self.key1.key_id)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
atomic_commit = result.atomic_commit
transaction = result.transaction
transaction_result = result.transaction_result
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.acquire_force_by_stamp_sheet({
stampSheet="stampSheet",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
client = gs2('exchange')
api_result_handler = client.acquire_force_by_stamp_sheet_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['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;
skipByStampSheet
Execute skipping exchange standby as acquire action
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
stampSheet | string | ✓ | ~ 5242880 chars | Transaction | ||
keyId | string | ✓ | ~ 1024 chars | encryption key GRN |
Result
Type | Description | |
---|---|---|
item | Await | Standby for exchange |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.SkipByStampSheet(
&exchange.SkipByStampSheetRequest {
StampSheet: pointy.String("stampSheet"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\SkipByStampSheetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->skipByStampSheet(
(new SkipByStampSheetRequest())
->withStampSheet(self::stampSheet)
->withKeyId(self::key-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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.SkipByStampSheetRequest;
import io.gs2.exchange.result.SkipByStampSheetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
SkipByStampSheetResult result = client.skipByStampSheet(
new SkipByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
Await item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.SkipByStampSheetRequest;
using Gs2.Gs2Exchange.Result.SkipByStampSheetResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.SkipByStampSheetResult> asyncResult = null;
yield return client.SkipByStampSheet(
new Gs2.Gs2Exchange.Request.SkipByStampSheetRequest()
.WithStampSheet("stampSheet")
.WithKeyId("key-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 Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.skipByStampSheet(
new Gs2Exchange.SkipByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.skip_by_stamp_sheet(
exchange.SkipByStampSheetRequest()
.with_stamp_sheet(self.stamp_sheet)
.with_key_id(self.key1.key_id)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.skip_by_stamp_sheet({
stampSheet="stampSheet",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('exchange')
api_result_handler = client.skip_by_stamp_sheet_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['message'])
end
result = api_result.result
item = result.item;
deleteAwaitByStampTask
Delete Waiting for Exchange in Stamp Task
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
stampTask | string | ✓ | ~ 5242880 chars | Consume Action | ||
keyId | string | ✓ | ~ 1024 chars | encryption key GRN |
Result
Type | Description | |
---|---|---|
item | Await | Standby for exchange |
newContextStack | string | Request of context in which consume action execution results are recorded |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/exchange"
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 := exchange.Gs2ExchangeRestClient{
Session: &session,
}
result, err := client.DeleteAwaitByStampTask(
&exchange.DeleteAwaitByStampTaskRequest {
StampTask: pointy.String("stampTask"),
KeyId: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
newContextStack := result.NewContextStack
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Exchange\Gs2ExchangeRestClient;
use Gs2\Exchange\Request\DeleteAwaitByStampTaskRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteAwaitByStampTask(
(new DeleteAwaitByStampTaskRequest())
->withStampTask(self::stampTask)
->withKeyId(self::key-0001)
);
$item = $result->getItem();
$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.exchange.rest.Gs2ExchangeRestClient;
import io.gs2.exchange.request.DeleteAwaitByStampTaskRequest;
import io.gs2.exchange.result.DeleteAwaitByStampTaskResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2ExchangeRestClient client = new Gs2ExchangeRestClient(session);
try {
DeleteAwaitByStampTaskResult result = client.deleteAwaitByStampTask(
new DeleteAwaitByStampTaskRequest()
.withStampTask("stampTask")
.withKeyId("key-0001")
);
Await item = result.getItem();
String newContextStack = result.getNewContextStack();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Exchange.Gs2ExchangeRestClient;
using Gs2.Gs2Exchange.Request.DeleteAwaitByStampTaskRequest;
using Gs2.Gs2Exchange.Result.DeleteAwaitByStampTaskResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ExchangeRestClient(session);
AsyncResult<Gs2.Gs2Exchange.Result.DeleteAwaitByStampTaskResult> asyncResult = null;
yield return client.DeleteAwaitByStampTask(
new Gs2.Gs2Exchange.Request.DeleteAwaitByStampTaskRequest()
.WithStampTask("stampTask")
.WithKeyId("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var newContextStack = result.NewContextStack;
import Gs2Core from '@/gs2/core';
import * as Gs2Exchange from '@/gs2/exchange';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Exchange.Gs2ExchangeRestClient(session);
try {
const result = await client.deleteAwaitByStampTask(
new Gs2Exchange.DeleteAwaitByStampTaskRequest()
.withStampTask("stampTask")
.withKeyId("key-0001")
);
const item = result.getItem();
const newContextStack = result.getNewContextStack();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import exchange
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = exchange.Gs2ExchangeRestClient(session)
try:
result = client.delete_await_by_stamp_task(
exchange.DeleteAwaitByStampTaskRequest()
.with_stamp_task(self.stamp_task)
.with_key_id(self.key1.key_id)
)
item = result.item
new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
exit(1)
client = gs2('exchange')
api_result = client.delete_await_by_stamp_task({
stampTask="stampTask",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
newContextStack = result.newContextStack;
client = gs2('exchange')
api_result_handler = client.delete_await_by_stamp_task_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['message'])
end
result = api_result.result
item = result.item;
newContextStack = result.newContextStack;