NAV
go python java php typescript csharp GS2-Script

GS2-Exchange

GS2-SDK のリファレンス

モデル

Namespace

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

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

説明
namespaceId string ネームスペースGRN
name string ネームスペース名
description string 説明文
enableDirectExchange bool 直接交換APIの呼び出しを許可する。許可しない場合はスタンプシート経由でしか交換できない
enableAwaitExchange bool 交換結果の受け取りに待ち時間の発生する交換機能を利用するか
queueNamespaceId string スタンプシートの実行に使用する GS2-JobQueue のネームスペース
keyId string スタンプシートの発行に使用する GS2-Key のネームスペース
logSetting LogSetting ログの出力設定
createdAt long 作成日時
updatedAt long 最終更新日時

RateModel

交換レートはリソースとリソースを交換する際に使用するレートを定義するエンティティです。

直ちに交換できるレートだけでなく、現実時間で一定時間経過したのちに交換できるレートを設定できます。 現実時間での時間経過が必要な交換レートには、更に即時交換を実行するために必要なリソースを定義することが可能です。

説明
rateModelId string 交換レートモデルGRN
name string 交換レートの種類名
metadata string メタデータ
consumeActions ConsumeAction[] 消費アクションリスト
timingType string 交換の種類
lockTime int 交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分)
enableSkip bool スキップをすることができるか
skipConsumeActions ConsumeAction[] 時短消費アクションリスト
acquireActions AcquireAction[] 入手アクションリスト

RateModelMaster

交換レートはリソースとリソースを交換する際に使用するレートを定義するエンティティです。

直ちに交換できるレートだけでなく、現実時間で一定時間経過したのちに交換できるレートを設定できます。 現実時間での時間経過が必要な交換レートには、更に即時交換を実行するために必要なリソースを定義することが可能です。

説明
rateModelId string 交換レートマスターGRN
name string 交換レート名
description string 説明文
metadata string メタデータ
consumeActions ConsumeAction[] 消費アクションリスト
timingType string 交換の種類
lockTime int 交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分)
enableSkip bool スキップをすることができるか
skipConsumeActions ConsumeAction[] 時短消費アクションリスト
acquireActions AcquireAction[] 入手アクションリスト
createdAt long 作成日時
updatedAt long 最終更新日時

CurrentRateMaster

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

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

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

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

Await

現実時間の時間経過が交換条件の交換処理の実行状態を表すエンティティ。

説明
awaitId string 交換待機GRN
userId string ユーザーID
rateName string 交換レート名
name string 交換待機の名前
count int 交換数
exchangedAt long 作成日時

Config

説明
key string 名前
value string

GitHubCheckoutSetting

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

LogSetting

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

AcquireAction

説明
action string スタンプシートで実行するアクションの種類
request string 消費リクエストのJSON

ConsumeAction

説明
action string スタンプタスクで実行するアクションの種類
request string 入手リクエストのJSON

メソッド

describeNamespaces

describeNamespaces

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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeNamespaces(
    new DescribeNamespacesRequest()
        .withPageToken(null)
        .withLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as 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
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

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

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

Request

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

Result

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

createNamespace

createNamespace

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/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,
        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"),
        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)
            ->withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
            ->withKeyId('grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001')
            ->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)
            .withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
            .withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001")
            .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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createNamespace(
    new CreateNamespaceRequest()
        .withName("namespace1")
        .withDescription(null)
        .withEnableAwaitExchange(null)
        .withEnableDirectExchange(null)
        .withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
        .withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001")
        .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)
            .withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
            .withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001")
            .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_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_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,
    queueNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001',
    keyId='grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001',
    logSetting={
        loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
    },
});

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

result = api_result.result
item = result.item;

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

Request

必須 デフォルト 値の制限 説明
name string ~ 32文字 ネームスペース名
description string ~ 1024文字 説明文
enableAwaitExchange bool false 交換結果の受け取りに待ち時間の発生する交換機能を利用するか
enableDirectExchange bool true 直接交換APIの呼び出しを許可する。許可しない場合はスタンプシート経由でしか交換できない
queueNamespaceId string ~ 1024文字 スタンプシートの実行に使用する GS2-JobQueue のネームスペース
keyId string ~ 1024文字 スタンプシートの発行に使用する GS2-Key のネームスペース
logSetting LogSetting ログの出力設定

Result

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

getNamespaceStatus

getNamespaceStatus

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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getNamespaceStatus(
    new GetNamespaceStatusRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as 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
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
status = result.status;

ネームスペースを取得

Request

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

Result

説明
status string

getNamespace

getNamespace

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getNamespace(
    new GetNamespaceRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ネームスペースを取得

Request

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

Result

説明
item Namespace ネームスペース

updateNamespace

updateNamespace

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/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,
        QueueNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002"),
        KeyId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace2:key:key-0001"),
        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)
            ->withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
            ->withKeyId('grn:gs2:ap-northeast-1:YourOwnerId:key:namespace2:key:key-0001')
            ->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)
            .withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
            .withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace2:key:key-0001")
            .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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateNamespace(
    new UpdateNamespaceRequest()
        .withNamespaceName("namespace1")
        .withDescription("description1")
        .withEnableAwaitExchange(true)
        .withEnableDirectExchange(null)
        .withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
        .withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace2:key:key-0001")
        .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)
            .withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
            .withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace2:key:key-0001")
            .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_queue_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002')
            .with_key_id('grn:gs2:ap-northeast-1:YourOwnerId:key:namespace2:key:key-0001')
            .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,
    queueNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002',
    keyId='grn:gs2:ap-northeast-1:YourOwnerId:key:namespace2:key:key-0001',
    logSetting={
        loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
    },
});

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

result = api_result.result
item = result.item;

ネームスペースを更新

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
description string ~ 1024文字 説明文
enableAwaitExchange bool false 交換結果の受け取りに待ち時間の発生する交換機能を利用するか
enableDirectExchange bool true 直接交換APIの呼び出しを許可する。許可しない場合はスタンプシート経由でしか交換できない
queueNamespaceId string ~ 1024文字 スタンプシートの実行に使用する GS2-JobQueue のネームスペース
keyId string ~ 1024文字 スタンプシートの発行に使用する GS2-Key のネームスペース
logSetting LogSetting ログの出力設定

Result

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

deleteNamespace

deleteNamespace

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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteNamespace(
    new DeleteNamespaceRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ネームスペースを削除

Request

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

Result

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

describeRateModels

describeRateModels

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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeRateModels(
    new 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
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;

交換レートモデルの一覧を取得

Request

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

Result

説明
items RateModel[] 交換レートモデルのリスト

getRateModel

getRateModel

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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getRateModel(
    new 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
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

交換レートモデルを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
rateName string ~ 128文字 交換レートの種類名

Result

説明
item RateModel 交換レートモデル

describeRateModelMasters

describeRateModelMasters

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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeRateModelMasters(
    new 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
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

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

交換レートマスターの一覧を取得

Request

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

Result

説明
items RateModelMaster[] 交換レートマスターのリスト
nextPageToken string リストの続きを取得するためのページトークン

createRateModelMaster

createRateModelMaster

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,
        EnableSkip: nil,
        SkipConsumeActions: 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}"),
            },
        },
        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)
            ->withEnableSkip(null)
            ->withSkipConsumeActions(null)
            ->withAcquireActions([    (new \Gs2\Exchange\Model\AcquireAction())
                ->withAction("Gs2Inventory:AcquireItemSetByUserId")
                ->withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}"),
            ])
            ->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)
            .withEnableSkip(null)
            .withSkipConsumeActions(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}")
            ))
            .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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createRateModelMaster(
    new CreateRateModelMasterRequest()
        .withNamespaceName("namespace1")
        .withName("rate-0001")
        .withDescription(null)
        .withMetadata("N2R")
        .withTimingType(null)
        .withLockTime(null)
        .withEnableSkip(null)
        .withSkipConsumeActions(null)
        .withAcquireActions(new Gs2.Gs2Exchange.Model.AcquireAction[] {
            new Gs2.Gs2Exchange.Model.AcquireAction()
                .WithAction("Gs2Inventory:AcquireItemSetByUserId")
                .WithRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}")
        })
        .withConsumeActions(new Gs2.Gs2Exchange.Model.ConsumeAction[] {
            new Gs2.Gs2Exchange.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)
            .withEnableSkip(null)
            .withSkipConsumeActions(null)
            .withAcquireActions([
                new Gs2Exchange.Model.AcquireAction()
                    .withAction("Gs2Inventory:AcquireItemSetByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"item\", \"itemName\": \"item-0002\", \"userId\": \"#{userId}\", \"acquireCount\": 1}")
            ])
            .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_enable_skip(None)
            .with_skip_consume_actions(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_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,
    enableSkip=nil,
    skipConsumeActions=nil,
    acquireActions={
        {
            action='Gs2Inventory:AcquireItemSetByUserId',
            request='{"namespaceName": "namespace-0001", "inventoryName": "item", "itemName": "item-0002", "userId": "#{userId}", "acquireCount": 1}',
        }
    },
    consumeActions={
        {
            action='Gs2Inventory:ConsumeItemSetByUserId',
            request='{"namespaceName": "namespace-0001", "inventoryName": "item", "itemName": "item-0001", "userId": "#{userId}", "consumeCount": 10}',
        }
    },
});

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

result = api_result.result
item = result.item;

交換レートマスターを新規作成

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
name string ~ 128文字 交換レート名
description string ~ 1024文字 説明文
metadata string ~ 2048文字 メタデータ
timingType string "immediate" ~ 128文字 交換の種類
lockTime int {timingType} == "await" ~ 525600 交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分)
enableSkip bool {timingType} == "await" false スキップをすることができるか
skipConsumeActions ConsumeAction[] {enableSkip} [] 時短消費アクションリスト
acquireActions AcquireAction[] [] 入手アクションリスト
consumeActions ConsumeAction[] [] 消費アクションリスト

Result

説明
item RateModelMaster 作成した交換レートマスター

getRateModelMaster

getRateModelMaster

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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getRateModelMaster(
    new 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
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

交換レートマスターを取得

Request

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

Result

説明
item RateModelMaster 交換レートマスター

updateRateModelMaster

updateRateModelMaster

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),
        EnableSkip: pointy.Bool(false),
        SkipConsumeActions: 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}"),
            },
        },
        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)
            ->withEnableSkip(False)
            ->withSkipConsumeActions(null)
            ->withAcquireActions([    (new \Gs2\Exchange\Model\AcquireAction())
                ->withAction("Gs2Stamina:RecoverStaminaByUserId")
                ->withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}"),
            ])
            ->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)
            .withEnableSkip(false)
            .withSkipConsumeActions(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}")
            ))
            .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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateRateModelMaster(
    new UpdateRateModelMasterRequest()
        .withNamespaceName("namespace1")
        .withRateName("rate-0001")
        .withDescription("description1")
        .withMetadata("RATE_0001")
        .withTimingType("await")
        .withLockTime(180)
        .withEnableSkip(false)
        .withSkipConsumeActions(null)
        .withAcquireActions(new Gs2.Gs2Exchange.Model.AcquireAction[] {
            new Gs2.Gs2Exchange.Model.AcquireAction()
                .WithAction("Gs2Stamina:RecoverStaminaByUserId")
                .WithRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}")
        })
        .withConsumeActions(new Gs2.Gs2Exchange.Model.ConsumeAction[] {
            new Gs2.Gs2Exchange.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)
            .withEnableSkip(false)
            .withSkipConsumeActions(null)
            .withAcquireActions([
                new Gs2Exchange.Model.AcquireAction()
                    .withAction("Gs2Stamina:RecoverStaminaByUserId")
                    .withRequest("{\"moneyName\": \"money-0001\", \"userId\": \"user-0001\", \"slot\": 0, \"count\": 200, \"paidOnly\": false}")
            ])
            .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_enable_skip(False)
            .with_skip_consume_actions(None)
            .with_acquire_actions([    exchange.AcquireAction()
                .with_action('Gs2Stamina:RecoverStaminaByUserId')
                .with_request('{"moneyName": "money-0001", "userId": "user-0001", "slot": 0, "count": 200, "paidOnly": false}'),
            ])
            .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,
    enableSkip=false,
    skipConsumeActions=nil,
    acquireActions={
        {
            action='Gs2Stamina:RecoverStaminaByUserId',
            request='{"moneyName": "money-0001", "userId": "user-0001", "slot": 0, "count": 200, "paidOnly": false}',
        }
    },
    consumeActions={
        {
            action='Gs2Money:WithdrawByUserId',
            request='{"moneyName": "money-0001", "userId": "user-0001", "slot": 0, "count": 200, "paidOnly": false}',
        }
    },
});

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

result = api_result.result
item = result.item;

交換レートマスターを更新

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
rateName string ~ 128文字 交換レート名
description string ~ 1024文字 説明文
metadata string ~ 2048文字 メタデータ
timingType string "immediate" ~ 128文字 交換の種類
lockTime int {timingType} == "await" ~ 525600 交換実行から実際に報酬を受け取れるようになるまでの待ち時間(分)
enableSkip bool {timingType} == "await" false スキップをすることができるか
skipConsumeActions ConsumeAction[] {enableSkip} [] 時短消費アクションリスト
acquireActions AcquireAction[] [] 入手アクションリスト
consumeActions ConsumeAction[] [] 消費アクションリスト

Result

説明
item RateModelMaster 更新した交換レートマスター

deleteRateModelMaster

deleteRateModelMaster

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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteRateModelMaster(
    new 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
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

交換レートマスターを削除

Request

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

Result

説明
item RateModelMaster 削除した交換レートマスター

exchange

exchange

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("$access_token_0001"),
        Count: pointy.Int32(1),
        Config: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
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();
    $stampSheet = $result->getStampSheet();
    $stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
} 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("$access_token_0001")
            .withCount(1)
            .withConfig(null)
    );
    RateModel item = result.getItem();
    String stampSheet = result.getStampSheet();
    String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.exchange(
    new ExchangeRequest()
        .withNamespaceName("namespace1")
        .withRateName("rate-0001")
        .withAccessToken("$access_token_0001")
        .withCount(1)
        .withConfig(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
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("$access_token_0001")
            .withCount(1)
            .withConfig(null)
    );
    const item = result.getItem();
    const stampSheet = result.getStampSheet();
    const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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
    stamp_sheet = result.stamp_sheet
    stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
except core.Gs2Exception as e:
    exit(1)

client = gs2('exchange')

api_result = client.exchange({
    namespaceName='namespace1',
    rateName='rate-0001',
    accessToken='$access_token_0001',
    count=1,
    config=nil,
});

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

result = api_result.result
item = result.item;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;

交換を実行

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
rateName string ~ 128文字 交換レートの種類名
accessToken string ~ 128文字 ユーザーID
count int 1 ~ 9223372036854775807 交換するロット数
config Config[] [] 設定値

Result

説明
item RateModel 交換レートモデル
stampSheet string 交換処理の実行に使用するスタンプシート
stampSheetEncryptionKeyId string スタンプシートの署名計算に使用した暗号鍵GRN

exchangeByUserId

exchangeByUserId

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,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
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)
    );
    $item = $result->getItem();
    $stampSheet = $result->getStampSheet();
    $stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
} 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)
    );
    RateModel item = result.getItem();
    String stampSheet = result.getStampSheet();
    String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.exchangeByUserId(
    new ExchangeByUserIdRequest()
        .withNamespaceName("namespace1")
        .withRateName("rate-0001")
        .withUserId("user-0001")
        .withCount(1)
        .withConfig(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
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)
    );
    const item = result.getItem();
    const stampSheet = result.getStampSheet();
    const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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)
    )
    item = result.item
    stamp_sheet = result.stamp_sheet
    stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
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,
});

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

result = api_result.result
item = result.item;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;

ユーザIDを指定して交換を実行

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
rateName string ~ 128文字 交換レートの種類名
userId string ~ 128文字 ユーザーID
count int 1 ~ 9223372036854775807 交換するロット数
config Config[] [] 設定値

Result

説明
item RateModel 交換レートモデル
stampSheet string 交換処理の実行に使用するスタンプシート
stampSheetEncryptionKeyId string スタンプシートの署名計算に使用した暗号鍵GRN

exchangeByStampSheet

exchangeByStampSheet

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("$key1.keyId"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
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::$key1.keyId)
    );
    $item = $result->getItem();
    $stampSheet = $result->getStampSheet();
    $stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
} 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("$key1.keyId")
    );
    RateModel item = result.getItem();
    String stampSheet = result.getStampSheet();
    String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.exchangeByStampSheet(
    new ExchangeByStampSheetRequest()
        .withStampSheet("$stampSheet")
        .withKeyId("$key1.keyId"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
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("$key1.keyId")
    );
    const item = result.getItem();
    const stampSheet = result.getStampSheet();
    const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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
    stamp_sheet = result.stamp_sheet
    stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
except core.Gs2Exception as e:
    exit(1)

client = gs2('exchange')

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

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

result = api_result.result
item = result.item;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;

スタンプシートで交換を実行

Request

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

Result

説明
item RateModel 交換レートモデル
stampSheet string 交換処理の実行に使用するスタンプシート
stampSheetEncryptionKeyId string スタンプシートの署名計算に使用した暗号鍵GRN

exportMaster

exportMaster

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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.exportMaster(
    new ExportMasterRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

現在有効な交換レート設定のマスターデータをエクスポートします

Request

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

Result

説明
item CurrentRateMaster 現在有効な交換レート設定

getCurrentRateMaster

getCurrentRateMaster

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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getCurrentRateMaster(
    new 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
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

現在有効な交換レート設定を取得します

Request

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

Result

説明
item CurrentRateMaster 現在有効な交換レート設定

updateCurrentRateMaster

updateCurrentRateMaster

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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return 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}"),
    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
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

現在有効な交換レート設定を更新します

Request

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

Result

説明
item CurrentRateMaster 更新した現在有効な交換レート設定

updateCurrentRateMasterFromGitHub

updateCurrentRateMasterFromGitHub

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: {'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'},
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': '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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateCurrentRateMasterFromGitHub(
    new UpdateCurrentRateMasterFromGitHubRequest()
        .withNamespaceName("namespace1")
        .withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'}),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import 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({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': '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={'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'},
});

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

result = api_result.result
item = result.item;

現在有効な交換レート設定を更新します

Request

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

Result

説明
item CurrentRateMaster 更新した現在有効な交換レート設定

createAwaitByUserId

createAwaitByUserId

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,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
unlockAt := result.UnlockAt
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)
    );
    $item = $result->getItem();
    $unlockAt = $result->getUnlockAt();
} 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)
    );
    Await item = result.getItem();
    long unlockAt = result.getUnlockAt();
} 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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createAwaitByUserId(
    new CreateAwaitByUserIdRequest()
        .withNamespaceName("namespace1")
        .withUserId("user-0001")
        .withRateName("material_n_to_r")
        .withCount(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var unlockAt = result.UnlockAt;
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)
    );
    const item = result.getItem();
    const unlockAt = result.getUnlockAt();
} 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)
    )
    item = result.item
    unlock_at = result.unlock_at
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,
});

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

result = api_result.result
item = result.item;
unlockAt = result.unlockAt;

交換待機を作成

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
userId string ~ 128文字 ユーザーID
rateName string ~ 128文字 交換レート名
count int 1 1 ~ 10000 交換数

Result

説明
item Await 交換待機
unlockAt long 取得できるようになる日時

describeAwaits

describeAwaits

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("$access_token_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("$access_token_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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeAwaits(
    new DescribeAwaitsRequest()
        .withNamespaceName("namespace1")
        .withAccessToken("$access_token_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("$access_token_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='$access_token_0001',
    rateName='material_n_to_r',
    pageToken=nil,
    limit=nil,
});

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

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

交換待機の一覧を取得

Request

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

Result

説明
items Await[] 交換待機のリスト
nextPageToken string 次のページを取得するためのトークン

describeAwaitsByUserId

describeAwaitsByUserId

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,
    }
)
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)
    );
    $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)
    );
    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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeAwaitsByUserId(
    new DescribeAwaitsByUserIdRequest()
        .withNamespaceName("namespace2")
        .withUserId("user-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.describeAwaitsByUserId(
        new Gs2Exchange.DescribeAwaitsByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-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_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)
    )
    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,
});

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

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

交換待機の一覧を取得

Request

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

Result

説明
items Await[] 交換待機のリスト
nextPageToken string 次のページを取得するためのトークン

getAwait

getAwait

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("$access_token_0001"),
        RateName: pointy.String("material_n_to_r"),
        AwaitName: pointy.String("$await1.name"),
    }
)
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)
            ->withRateName("material_n_to_r")
            ->withAwaitName(self::$await1.name)
    );
    $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("$access_token_0001")
            .withRateName("material_n_to_r")
            .withAwaitName("$await1.name")
    );
    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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getAwait(
    new GetAwaitRequest()
        .withNamespaceName("namespace1")
        .withAccessToken("$access_token_0001")
        .withRateName("material_n_to_r")
        .withAwaitName("$await1.name"),
    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("$access_token_0001")
            .withRateName("material_n_to_r")
            .withAwaitName("$await1.name")
    );
    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_rate_name('material_n_to_r')
            .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='$access_token_0001',
    rateName='material_n_to_r',
    awaitName='$await1.name',
});

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

result = api_result.result
item = result.item;

交換待機を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID
rateName string ~ 128文字 交換レート名
awaitName string UUID ~ 36文字 交換待機の名前

Result

説明
item Await 交換待機

getAwaitByUserId

getAwaitByUserId

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"),
        RateName: pointy.String("material_n_to_r"),
        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\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")
            ->withRateName("material_n_to_r")
            ->withAwaitName("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.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")
            .withRateName("material_n_to_r")
            .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.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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getAwaitByUserId(
    new GetAwaitByUserIdRequest()
        .withNamespaceName("namespace2")
        .withUserId("user-0001")
        .withRateName("material_n_to_r")
        .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.getAwaitByUserId(
        new Gs2Exchange.GetAwaitByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-0001")
            .withRateName("material_n_to_r")
            .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_by_user_id(
        exchange.GetAwaitByUserIdRequest()
            .with_namespace_name(self.hash2)
            .with_user_id('user-0001')
            .with_rate_name('material_n_to_r')
            .with_await_name('await-0001')
    )
    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',
    rateName='material_n_to_r',
    awaitName='await-0001',
});

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

result = api_result.result
item = result.item;

交換待機を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
userId string ~ 128文字 ユーザーID
rateName string ~ 128文字 交換レート名
awaitName string UUID ~ 36文字 交換待機の名前

Result

説明
item Await 交換待機

acquire

acquire

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("$access_token_0001"),
        RateName: pointy.String("material_n_to_r"),
        AwaitName: pointy.String("await-0001"),
        Config: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
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)
            ->withRateName("material_n_to_r")
            ->withAwaitName("await-0001")
            ->withConfig(null)
    );
    $item = $result->getItem();
    $stampSheet = $result->getStampSheet();
    $stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
} 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("$access_token_0001")
            .withRateName("material_n_to_r")
            .withAwaitName("await-0001")
            .withConfig(null)
    );
    Await item = result.getItem();
    String stampSheet = result.getStampSheet();
    String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.acquire(
    new AcquireRequest()
        .withNamespaceName("namespace2")
        .withAccessToken("$access_token_0001")
        .withRateName("material_n_to_r")
        .withAwaitName("await-0001")
        .withConfig(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
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("$access_token_0001")
            .withRateName("material_n_to_r")
            .withAwaitName("await-0001")
            .withConfig(null)
    );
    const item = result.getItem();
    const stampSheet = result.getStampSheet();
    const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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_rate_name('material_n_to_r')
            .with_await_name('await-0001')
            .with_config(None)
    )
    item = result.item
    stamp_sheet = result.stamp_sheet
    stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
except core.Gs2Exception as e:
    exit(1)

client = gs2('exchange')

api_result = client.acquire({
    namespaceName='namespace2',
    accessToken='$access_token_0001',
    rateName='material_n_to_r',
    awaitName='await-0001',
    config=nil,
});

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

result = api_result.result
item = result.item;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;

交換待機の報酬を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID
rateName string ~ 128文字 交換レート名
awaitName string UUID ~ 36文字 交換待機の名前
config Config[] [] 設定値

Result

説明
item Await 交換待機
stampSheet string 報酬取得処理の実行に使用するスタンプシート
stampSheetEncryptionKeyId string スタンプシートの署名計算に使用した暗号鍵GRN

acquireByUserId

acquireByUserId

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"),
        RateName: pointy.String("material_n_to_r"),
        AwaitName: pointy.String("await-0001"),
        Config: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
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")
            ->withRateName("material_n_to_r")
            ->withAwaitName("await-0001")
            ->withConfig(null)
    );
    $item = $result->getItem();
    $stampSheet = $result->getStampSheet();
    $stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
} 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")
            .withRateName("material_n_to_r")
            .withAwaitName("await-0001")
            .withConfig(null)
    );
    Await item = result.getItem();
    String stampSheet = result.getStampSheet();
    String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.acquireByUserId(
    new AcquireByUserIdRequest()
        .withNamespaceName("namespace2")
        .withUserId("user-0001")
        .withRateName("material_n_to_r")
        .withAwaitName("await-0001")
        .withConfig(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
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")
            .withRateName("material_n_to_r")
            .withAwaitName("await-0001")
            .withConfig(null)
    );
    const item = result.getItem();
    const stampSheet = result.getStampSheet();
    const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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_rate_name('material_n_to_r')
            .with_await_name('await-0001')
            .with_config(None)
    )
    item = result.item
    stamp_sheet = result.stamp_sheet
    stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
except core.Gs2Exception as e:
    exit(1)

client = gs2('exchange')

api_result = client.acquire_by_user_id({
    namespaceName='namespace2',
    userId='user-0001',
    rateName='material_n_to_r',
    awaitName='await-0001',
    config=nil,
});

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

result = api_result.result
item = result.item;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;

交換待機の報酬を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
userId string ~ 128文字 ユーザーID
rateName string ~ 128文字 交換レート名
awaitName string UUID ~ 36文字 交換待機の名前
config Config[] [] 設定値

Result

説明
item Await 交換待機
stampSheet string 報酬取得処理の実行に使用するスタンプシート
stampSheetEncryptionKeyId string スタンプシートの署名計算に使用した暗号鍵GRN

acquireForceByUserId

acquireForceByUserId

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"),
        RateName: pointy.String("material_n_to_r"),
        AwaitName: pointy.String("await-0001"),
        Config: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
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")
            ->withRateName("material_n_to_r")
            ->withAwaitName("await-0001")
            ->withConfig(null)
    );
    $item = $result->getItem();
    $stampSheet = $result->getStampSheet();
    $stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
} 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")
            .withRateName("material_n_to_r")
            .withAwaitName("await-0001")
            .withConfig(null)
    );
    Await item = result.getItem();
    String stampSheet = result.getStampSheet();
    String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.acquireForceByUserId(
    new AcquireForceByUserIdRequest()
        .withNamespaceName("namespace2")
        .withUserId("user-0001")
        .withRateName("material_n_to_r")
        .withAwaitName("await-0001")
        .withConfig(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
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")
            .withRateName("material_n_to_r")
            .withAwaitName("await-0001")
            .withConfig(null)
    );
    const item = result.getItem();
    const stampSheet = result.getStampSheet();
    const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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_rate_name('material_n_to_r')
            .with_await_name('await-0001')
            .with_config(None)
    )
    item = result.item
    stamp_sheet = result.stamp_sheet
    stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
except core.Gs2Exception as e:
    exit(1)

client = gs2('exchange')

api_result = client.acquire_force_by_user_id({
    namespaceName='namespace2',
    userId='user-0001',
    rateName='material_n_to_r',
    awaitName='await-0001',
    config=nil,
});

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

result = api_result.result
item = result.item;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;

交換待機の報酬を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
userId string ~ 128文字 ユーザーID
rateName string ~ 128文字 交換レート名
awaitName string UUID ~ 36文字 交換待機の名前
config Config[] [] 設定値

Result

説明
item Await 交換待機
stampSheet string 報酬取得処理の実行に使用するスタンプシート
stampSheetEncryptionKeyId string スタンプシートの署名計算に使用した暗号鍵GRN

skip

skip

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.Skip(
    &exchange.SkipRequest {
        NamespaceName: pointy.String("namespace2"),
        AccessToken: pointy.String("$access_token_0001"),
        RateName: pointy.String("material_n_to_r"),
        AwaitName: pointy.String("await-0001"),
        Config: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
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\SkipRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->skip(
        (new SkipRequest())
            ->withNamespaceName(self::namespace2)
            ->withAccessToken(self::$accessToken0001)
            ->withRateName("material_n_to_r")
            ->withAwaitName("await-0001")
            ->withConfig(null)
    );
    $item = $result->getItem();
    $stampSheet = $result->getStampSheet();
    $stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
} 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.SkipRequest;
import io.gs2.exchange.result.SkipResult;

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

try {
    SkipResult result = client.skip(
        new SkipRequest()
            .withNamespaceName("namespace2")
            .withAccessToken("$access_token_0001")
            .withRateName("material_n_to_r")
            .withAwaitName("await-0001")
            .withConfig(null)
    );
    Await item = result.getItem();
    String stampSheet = result.getStampSheet();
    String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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.SkipRequest;
using Gs2.Gs2Exchange.Result.SkipResult;

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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.skip(
    new SkipRequest()
        .withNamespaceName("namespace2")
        .withAccessToken("$access_token_0001")
        .withRateName("material_n_to_r")
        .withAwaitName("await-0001")
        .withConfig(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
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.skip(
        new Gs2Exchange.SkipRequest()
            .withNamespaceName("namespace2")
            .withAccessToken("$access_token_0001")
            .withRateName("material_n_to_r")
            .withAwaitName("await-0001")
            .withConfig(null)
    );
    const item = result.getItem();
    const stampSheet = result.getStampSheet();
    const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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(
        exchange.SkipRequest()
            .with_namespace_name(self.hash2)
            .with_access_token(self.access_token_0001)
            .with_rate_name('material_n_to_r')
            .with_await_name('await-0001')
            .with_config(None)
    )
    item = result.item
    stamp_sheet = result.stamp_sheet
    stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
except core.Gs2Exception as e:
    exit(1)

client = gs2('exchange')

api_result = client.skip({
    namespaceName='namespace2',
    accessToken='$access_token_0001',
    rateName='material_n_to_r',
    awaitName='await-0001',
    config=nil,
});

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

result = api_result.result
item = result.item;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;

交換待機を対価を払ってスキップ

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID
rateName string ~ 128文字 交換レート名
awaitName string UUID ~ 36文字 交換待機の名前
config Config[] [] 設定値

Result

説明
item Await 交換待機
stampSheet string 報酬取得処理の実行に使用するスタンプシート
stampSheetEncryptionKeyId string スタンプシートの署名計算に使用した暗号鍵GRN

skipByUserId

skipByUserId

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"),
        RateName: pointy.String("material_n_to_r"),
        AwaitName: pointy.String("await-0001"),
        Config: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
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")
            ->withRateName("material_n_to_r")
            ->withAwaitName("await-0001")
            ->withConfig(null)
    );
    $item = $result->getItem();
    $stampSheet = $result->getStampSheet();
    $stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
} 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")
            .withRateName("material_n_to_r")
            .withAwaitName("await-0001")
            .withConfig(null)
    );
    Await item = result.getItem();
    String stampSheet = result.getStampSheet();
    String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.skipByUserId(
    new SkipByUserIdRequest()
        .withNamespaceName("namespace2")
        .withUserId("user-0001")
        .withRateName("material_n_to_r")
        .withAwaitName("await-0001")
        .withConfig(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
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")
            .withRateName("material_n_to_r")
            .withAwaitName("await-0001")
            .withConfig(null)
    );
    const item = result.getItem();
    const stampSheet = result.getStampSheet();
    const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
} 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_rate_name('material_n_to_r')
            .with_await_name('await-0001')
            .with_config(None)
    )
    item = result.item
    stamp_sheet = result.stamp_sheet
    stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
except core.Gs2Exception as e:
    exit(1)

client = gs2('exchange')

api_result = client.skip_by_user_id({
    namespaceName='namespace2',
    userId='user-0001',
    rateName='material_n_to_r',
    awaitName='await-0001',
    config=nil,
});

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

result = api_result.result
item = result.item;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;

交換待機を対価を払ってスキップ

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
userId string ~ 128文字 ユーザーID
rateName string ~ 128文字 交換レート名
awaitName string UUID ~ 36文字 交換待機の名前
config Config[] [] 設定値

Result

説明
item Await 交換待機
stampSheet string 報酬取得処理の実行に使用するスタンプシート
stampSheetEncryptionKeyId string スタンプシートの署名計算に使用した暗号鍵GRN

deleteAwait

deleteAwait

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("$access_token_0001"),
        RateName: pointy.String("material_n_to_r"),
        AwaitName: pointy.String("$await1.name"),
    }
)
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)
            ->withRateName("material_n_to_r")
            ->withAwaitName(self::$await1.name)
    );
    $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("$access_token_0001")
            .withRateName("material_n_to_r")
            .withAwaitName("$await1.name")
    );
    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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteAwait(
    new DeleteAwaitRequest()
        .withNamespaceName("namespace1")
        .withAccessToken("$access_token_0001")
        .withRateName("material_n_to_r")
        .withAwaitName("$await1.name"),
    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("$access_token_0001")
            .withRateName("material_n_to_r")
            .withAwaitName("$await1.name")
    );
    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_rate_name('material_n_to_r')
            .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='$access_token_0001',
    rateName='material_n_to_r',
    awaitName='$await1.name',
});

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

result = api_result.result
item = result.item;

交換待機を削除

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID
rateName string ~ 128文字 交換レート名
awaitName string UUID ~ 36文字 交換待機の名前

Result

説明
item Await 交換待機

deleteAwaitByUserId

deleteAwaitByUserId

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"),
        RateName: pointy.String("material_n_to_r"),
        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\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")
            ->withRateName("material_n_to_r")
            ->withAwaitName("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.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")
            .withRateName("material_n_to_r")
            .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.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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteAwaitByUserId(
    new DeleteAwaitByUserIdRequest()
        .withNamespaceName("namespace2")
        .withUserId("user-0001")
        .withRateName("material_n_to_r")
        .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.deleteAwaitByUserId(
        new Gs2Exchange.DeleteAwaitByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-0001")
            .withRateName("material_n_to_r")
            .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_by_user_id(
        exchange.DeleteAwaitByUserIdRequest()
            .with_namespace_name(self.hash2)
            .with_user_id('user-0001')
            .with_rate_name('material_n_to_r')
            .with_await_name('await-0001')
    )
    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',
    rateName='material_n_to_r',
    awaitName='await-0001',
});

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

result = api_result.result
item = result.item;

交換待機を削除

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
userId string ~ 128文字 ユーザーID
rateName string ~ 128文字 交換レート名
awaitName string UUID ~ 36文字 交換待機の名前

Result

説明
item Await 交換待機

createAwaitByStampSheet

createAwaitByStampSheet

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("$key1.keyId"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
unlockAt := result.UnlockAt
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::$key1.keyId)
    );
    $item = $result->getItem();
    $unlockAt = $result->getUnlockAt();
} 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("$key1.keyId")
    );
    Await item = result.getItem();
    long unlockAt = result.getUnlockAt();
} 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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createAwaitByStampSheet(
    new CreateAwaitByStampSheetRequest()
        .withStampSheet("$stampSheet")
        .withKeyId("$key1.keyId"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var unlockAt = result.UnlockAt;
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("$key1.keyId")
    );
    const item = result.getItem();
    const unlockAt = result.getUnlockAt();
} 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
    unlock_at = result.unlock_at
except core.Gs2Exception as e:
    exit(1)

client = gs2('exchange')

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

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

result = api_result.result
item = result.item;
unlockAt = result.unlockAt;

スタンプシートで交換待機 を作成

Request

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

Result

説明
item Await 交換待機
unlockAt long 取得できるようになる日時

deleteAwaitByStampTask

deleteAwaitByStampTask

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("$key1.keyId"),
    }
)
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::$key1.keyId)
    );
    $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("$key1.keyId")
    );
    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.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteAwaitByStampTask(
    new DeleteAwaitByStampTaskRequest()
        .withStampTask("$stampTask")
        .withKeyId("$key1.keyId"),
    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("$key1.keyId")
    );
    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='$key1.keyId',
});

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

result = api_result.result
item = result.item;
newContextStack = result.newContextStack;

スタンプタスクで 交換待機 を削除

Request

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

Result

説明
item Await 交換待機
newContextStack string スタンプタスクの実行結果を記録したコンテキスト