GS2-Money SDK API リファレンス 各種プログラミング言語向け GS2-SDK の モデルの仕様 と API のリファレンス
モデル Namespace ネームスペース
ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。 GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
型 有効化条件 必須 デフォルト 値の制限 説明 namespaceId string ✓ ~ 1024文字 ネームスペースGRN name string ✓ ~ 128文字 ネームスペースの名前 description string ~ 1024文字 説明文 priority enum { “free”, “paid” } ✓ ~ 128文字 消費優先度 shareFree bool ✓ 無償課金通貨を異なるスロットで共有するか currency enum { “JPY”, “USD”, “TWD” } ✓ ~ 128文字 通貨の種類 appleKey string ~ 1024文字 Apple AppStore のバンドルID googleKey string ~ 5120文字 Google PlayStore の秘密鍵 enableFakeReceipt bool ✓ false UnityEditorが出力する偽のレシートで決済できるようにするか createWalletScript ScriptSetting ウォレット新規作成したときに実行するスクリプト depositScript ScriptSetting ウォレット残高加算したときに実行するスクリプト withdrawScript ScriptSetting ウォレット残高消費したときに実行するスクリプト balance double ✓ 0.0 ~ 281474976710653 未使用残高 logSetting LogSetting ログの出力設定 createdAt long ✓ 現在時刻 作成日時 (UNIX時間 単位:ミリ秒) updatedAt long ✓ 現在時刻 最終更新日時 (UNIX時間 単位:ミリ秒) revision long 0 ~ 9223372036854775805 リビジョン
priority に指定する列挙型の定義 定義 説明 free 無償通貨を優先して使用する paid 有償通貨を優先して使用する
currency に指定する列挙型の定義 Wallet ウォレット
ウォレット内の通貨は大きく有償で購入した通貨と、無償で入手した通貨が分けて管理されます。 有償で購入した通貨は更に購入時の単価毎に管理され、サービス終了になってしまった際の返金や資金決済法に該当するだけの残高が存在するかが集計できます。
ウォレットにはスロットがあり、スロットごとに異なる残高を管理できます。 プラットフォームをまたいで残高を共有できない場合にはプラットフォーム毎に異なるスロットを利用することで分けて管理することができます。 その際に無償で入手した通貨は全てのプラットフォームで共通した値を利用することもできます。
型 有効化条件 必須 デフォルト 値の制限 説明 walletId string ✓ ~ 1024文字 ウォレットGRN userId string ✓ ~ 128文字 ユーザーID slot int ✓ ~ 100000000 スロット番号 paid int ✓ 0 ~ 2147483646 有償課金通貨所持量 free int ✓ 0 ~ 2147483646 無償課金通貨所持量 detail List<WalletDetail> [] ~ 1000 items ウォレットの詳細リスト shareFree bool ✓ false 無償課金通貨を共有するか createdAt long ✓ 現在時刻 作成日時 (UNIX時間 単位:ミリ秒) updatedAt long ✓ 現在時刻 最終更新日時 (UNIX時間 単位:ミリ秒) revision long 0 ~ 9223372036854775805 リビジョン
Receipt レシート
レシートは決済履歴を記録するエンティティです。 決済履歴とは、課金通貨の増減に関するリクエストだけではなく、各種配信プラットフォームにおける決済トランザクションの履歴も含まれます。
型 有効化条件 必須 デフォルト 値の制限 説明 receiptId string ✓ ~ 1024文字 レシートGRN transactionId string ✓ ~ 1024文字 トランザクションID purchaseToken string ~ 4096文字 Google Play での決済における purchaseToken userId string ✓ ~ 128文字 ユーザーID type enum { “purchase”, “deposit”, “withdraw” } ✓ ~ 128文字 種類 slot int {type} != “purchase” ✓ ~ 100000000 スロット番号 price float {type} != “purchase” ✓ ~ 100000.0 単価 paid int {type} != “purchase” ✓ ~ 2147483646 有償課金通貨 free int {type} != “purchase” ✓ ~ 2147483646 無償課金通貨 total int {type} != “purchase” ✓ ~ 2147483646 総数 contentsId string {type} == “purchase” ~ 1024文字 ストアプラットフォームで販売されているコンテンツID createdAt long ✓ 現在時刻 作成日時 (UNIX時間 単位:ミリ秒) revision long 0 ~ 9223372036854775805 リビジョン
type に指定する列挙型の定義 定義 説明 purchase 購入 deposit 加算 withdraw 消費
WalletDetail ウォレットの詳細
型 有効化条件 必須 デフォルト 値の制限 説明 price float ✓ ~ 100000.0 単価 count int ✓ ~ 2147483646 所持量
ScriptSetting スクリプト設定
GS2 ではマイクロサービスのイベントに関連づけて、カスタムスクリプトを実行することができます。 このモデルは、スクリプトの実行をトリガーするための設定を保持します。
スクリプトの実行方式は大きく2種類あり、それは「同期実行」と「非同期実行」です。 同期実行は、スクリプトの実行が完了するまで処理がブロックされます。 かわりに、スクリプトの実行結果を使ってAPIの実行を止めたり、APIの結果を改ざんすることができます。
一方、非同期実行は、スクリプトの実行が完了するまで処理がブロックされません。 かわりに、スクリプトの実行結果を使ってAPIの実行を止めたり、APIの結果を改ざんすることはできません。 しかし、非同期実行は、スクリプトの実行が完了するまで処理がブロックされないため、APIの応答に影響を与えないため、原則非同期実行を使用することをおすすめします。
非同期実行には実行方式が2種類あり、GS2-Script と Amazon EventBridge があります。 Amazon EventBridge を使用することで、Lua 以外の言語で処理を記述することができます。
型 有効化条件 必須 デフォルト 値の制限 説明 triggerScriptId string ~ 1024文字 スクリプトGRN doneTriggerTargetType enum { “none”, “gs2_script”, “aws” } ✓ “none” ~ 128文字 完了通知の通知先 doneTriggerScriptId string {doneTriggerTargetType} == “gs2_script” ~ 1024文字 スクリプトGRN doneTriggerQueueNamespaceId string {doneTriggerTargetType} == “gs2_script” ~ 1024文字 ネームスペースGRN
doneTriggerTargetType に指定する列挙型の定義 定義 説明 none なし gs2_script GS2-Script aws Amazon EventBridge
LogSetting ログの書き出し設定
ログデータの書き出し設定を管理します。この型は、ログデータを書き出すために使用されるログ名前空間の識別子(Namespace ID)を保持します。 ログ名前空間IDは、ログデータを集約し、保存する対象の GS2-Log の名前空間を指定します。 この設定を通じて、この名前空間以下のAPIリクエスト・レスポンスログデータが対象の GS2-Log へ出力されるようになります。 GS2-Log にはリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。
型 有効化条件 必須 デフォルト 値の制限 説明 loggingNamespaceId string ✓ ~ 1024文字 ネームスペースGRN
メソッド describeNamespaces ネームスペースの一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン limit int ✓ 30 1 ~ 1000 データの取得件数
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . DescribeNamespaces (
& money . 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\Money\Gs2MoneyRestClient ;
use Gs2\Money\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.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.DescribeNamespacesRequest ;
import io.gs2.money.result.DescribeNamespacesResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.DescribeNamespacesRequest ;
using Gs2.Gs2Money.Result.DescribeNamespacesResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . DescribeNamespacesResult > asyncResult = null ;
yield return client . DescribeNamespaces (
new Gs2 . Gs2Money . Request . DescribeNamespacesRequest ()
. WithPageToken ( null )
. WithLimit ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var items = result . Items ;
var nextPageToken = result . NextPageToken ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . describeNamespaces (
new Gs2Money . 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 money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . describe_namespaces (
money . 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 ( 'money' )
api_result = client.describe_namespaces ({
pageToken = nil ,
limit = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
client = gs2 ( 'money' )
api_result_handler = client.describe_namespaces_async ({
pageToken = nil ,
limit = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
createNamespace ネームスペースを新規作成
Request 型 有効化条件 必須 デフォルト 値の制限 説明 name string ✓ ~ 128文字 ネームスペースの名前 description string ~ 1024文字 説明文 priority enum { “free”, “paid” } ✓ ~ 128文字 消費優先度 shareFree bool ✓ 無償課金通貨を異なるスロットで共有するか currency enum { “JPY”, “USD”, “TWD” } ✓ ~ 128文字 通貨の種類 appleKey string ~ 1024文字 Apple AppStore のバンドルID googleKey string ~ 5120文字 Google PlayStore の秘密鍵 enableFakeReceipt bool ✓ false UnityEditorが出力する偽のレシートで決済できるようにするか createWalletScript ScriptSetting ウォレット新規作成したときに実行するスクリプト depositScript ScriptSetting ウォレット残高加算したときに実行するスクリプト withdrawScript ScriptSetting ウォレット残高消費したときに実行するスクリプト logSetting LogSetting ログの出力設定
priority に指定する列挙型の定義 定義 説明 free 無償通貨を優先して使用する paid 有償通貨を優先して使用する
currency に指定する列挙型の定義 Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . CreateNamespace (
& money . CreateNamespaceRequest {
Name : pointy . String ( "namespace-0001" ),
Description : nil ,
Priority : pointy . String ( "paid" ),
ShareFree : pointy . Bool ( false ),
Currency : pointy . String ( "USD" ),
AppleKey : nil ,
GoogleKey : nil ,
EnableFakeReceipt : nil ,
CreateWalletScript : nil ,
DepositScript : nil ,
WithdrawScript : nil ,
LogSetting : & money . LogSetting {
LoggingNamespaceId : pointy . String ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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\Money\Gs2MoneyRestClient ;
use Gs2\Money\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 ( "namespace-0001" )
-> withDescription ( null )
-> withPriority ( "paid" )
-> withShareFree ( False )
-> withCurrency ( "USD" )
-> withAppleKey ( null )
-> withGoogleKey ( null )
-> withEnableFakeReceipt ( null )
-> withCreateWalletScript ( null )
-> withDepositScript ( null )
-> withWithdrawScript ( null )
-> withLogSetting (( new \Gs2\Money\Model\LogSetting ())
-> withLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001" ))
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.CreateNamespaceRequest ;
import io.gs2.money.result.CreateNamespaceResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
CreateNamespaceResult result = client . createNamespace (
new CreateNamespaceRequest ()
. withName ( "namespace-0001" )
. withDescription ( null )
. withPriority ( "paid" )
. withShareFree ( false )
. withCurrency ( "USD" )
. withAppleKey ( null )
. withGoogleKey ( null )
. withEnableFakeReceipt ( null )
. withCreateWalletScript ( null )
. withDepositScript ( null )
. withWithdrawScript ( null )
. withLogSetting ( new io . gs2 . money . model . LogSetting ()
. withLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001" ))
);
Namespace item = result . getItem ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.CreateNamespaceRequest ;
using Gs2.Gs2Money.Result.CreateNamespaceResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . CreateNamespaceResult > asyncResult = null ;
yield return client . CreateNamespace (
new Gs2 . Gs2Money . Request . CreateNamespaceRequest ()
. WithName ( "namespace-0001" )
. WithDescription ( null )
. WithPriority ( "paid" )
. WithShareFree ( false )
. WithCurrency ( "USD" )
. WithAppleKey ( null )
. WithGoogleKey ( null )
. WithEnableFakeReceipt ( null )
. WithCreateWalletScript ( null )
. WithDepositScript ( null )
. WithWithdrawScript ( null )
. WithLogSetting ( new Gs2 . Gs2Money . Model . LogSetting ()
. WithLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001" )),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . createNamespace (
new Gs2Money . CreateNamespaceRequest ()
. withName ( "namespace-0001" )
. withDescription ( null )
. withPriority ( "paid" )
. withShareFree ( false )
. withCurrency ( "USD" )
. withAppleKey ( null )
. withGoogleKey ( null )
. withEnableFakeReceipt ( null )
. withCreateWalletScript ( null )
. withDepositScript ( null )
. withWithdrawScript ( null )
. withLogSetting ( new Gs2Money . model . LogSetting ()
. withLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001" ))
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . create_namespace (
money . CreateNamespaceRequest ()
. with_name ( 'namespace-0001' )
. with_description ( None )
. with_priority ( 'paid' )
. with_share_free ( False )
. with_currency ( 'USD' )
. with_apple_key ( None )
. with_google_key ( None )
. with_enable_fake_receipt ( None )
. with_create_wallet_script ( None )
. with_deposit_script ( None )
. with_withdraw_script ( None )
. with_log_setting (
money . LogSetting ()
. with_logging_namespace_id ( 'grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001' ))
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.create_namespace ({
name = "namespace-0001" ,
description = nil ,
priority = "paid" ,
shareFree = false ,
currency = "USD" ,
appleKey = nil ,
googleKey = nil ,
enableFakeReceipt = nil ,
createWalletScript = nil ,
depositScript = nil ,
withdrawScript = nil ,
logSetting = {
loggingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001" ,
},
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'money' )
api_result_handler = client.create_namespace_async ({
name = "namespace-0001" ,
description = nil ,
priority = "paid" ,
shareFree = false ,
currency = "USD" ,
appleKey = nil ,
googleKey = nil ,
enableFakeReceipt = nil ,
createWalletScript = nil ,
depositScript = nil ,
withdrawScript = nil ,
logSetting = {
loggingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001" ,
},
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
getNamespaceStatus ネームスペースの状態を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . GetNamespaceStatus (
& money . GetNamespaceStatusRequest {
NamespaceName : pointy . String ( "namespace-0001" ),
}
)
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\Money\Gs2MoneyRestClient ;
use Gs2\Money\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 ( "namespace-0001" )
);
$status = $result -> getStatus ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.GetNamespaceStatusRequest ;
import io.gs2.money.result.GetNamespaceStatusResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
GetNamespaceStatusResult result = client . getNamespaceStatus (
new GetNamespaceStatusRequest ()
. withNamespaceName ( "namespace-0001" )
);
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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.GetNamespaceStatusRequest ;
using Gs2.Gs2Money.Result.GetNamespaceStatusResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . GetNamespaceStatusResult > asyncResult = null ;
yield return client . GetNamespaceStatus (
new Gs2 . Gs2Money . Request . GetNamespaceStatusRequest ()
. WithNamespaceName ( "namespace-0001" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var status = result . Status ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . getNamespaceStatus (
new Gs2Money . GetNamespaceStatusRequest ()
. withNamespaceName ( "namespace-0001" )
);
const status = result . getStatus ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . get_namespace_status (
money . GetNamespaceStatusRequest ()
. with_namespace_name ( 'namespace-0001' )
)
status = result . status
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.get_namespace_status ({
namespaceName = "namespace-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
status = result.status ;
client = gs2 ( 'money' )
api_result_handler = client.get_namespace_status_async ({
namespaceName = "namespace-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
status = result.status ;
getNamespace ネームスペースを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . GetNamespace (
& money . GetNamespaceRequest {
NamespaceName : pointy . String ( "namespace-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\Money\Gs2MoneyRestClient ;
use Gs2\Money\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 ( "namespace-0001" )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.GetNamespaceRequest ;
import io.gs2.money.result.GetNamespaceResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
GetNamespaceResult result = client . getNamespace (
new GetNamespaceRequest ()
. withNamespaceName ( "namespace-0001" )
);
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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.GetNamespaceRequest ;
using Gs2.Gs2Money.Result.GetNamespaceResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . GetNamespaceResult > asyncResult = null ;
yield return client . GetNamespace (
new Gs2 . Gs2Money . Request . GetNamespaceRequest ()
. WithNamespaceName ( "namespace-0001" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . getNamespace (
new Gs2Money . GetNamespaceRequest ()
. withNamespaceName ( "namespace-0001" )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . get_namespace (
money . GetNamespaceRequest ()
. with_namespace_name ( 'namespace-0001' )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.get_namespace ({
namespaceName = "namespace-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'money' )
api_result_handler = client.get_namespace_async ({
namespaceName = "namespace-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
updateNamespace ネームスペースを更新
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 description string ~ 1024文字 説明文 priority enum { “free”, “paid” } ✓ ~ 128文字 消費優先度 appleKey string ~ 1024文字 Apple AppStore のバンドルID googleKey string ~ 5120文字 Google PlayStore の秘密鍵 enableFakeReceipt bool ✓ false UnityEditorが出力する偽のレシートで決済できるようにするか createWalletScript ScriptSetting ウォレット新規作成したときに実行するスクリプト depositScript ScriptSetting ウォレット残高加算したときに実行するスクリプト withdrawScript ScriptSetting ウォレット残高消費したときに実行するスクリプト logSetting LogSetting ログの出力設定
priority に指定する列挙型の定義 定義 説明 free 無償通貨を優先して使用する paid 有償通貨を優先して使用する
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . UpdateNamespace (
& money . UpdateNamespaceRequest {
NamespaceName : pointy . String ( "namespace-0001" ),
Description : pointy . String ( "description1" ),
Priority : pointy . String ( "paid" ),
AppleKey : pointy . String ( "io.gs2.sample" ),
GoogleKey : pointy . String ( "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB" ),
EnableFakeReceipt : nil ,
CreateWalletScript : & money . ScriptSetting {
TriggerScriptId : pointy . String ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001" ),
DoneTriggerScriptId : pointy . String ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002" ),
},
DepositScript : & money . ScriptSetting {
TriggerScriptId : pointy . String ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003" ),
DoneTriggerScriptId : pointy . String ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004" ),
},
WithdrawScript : & money . ScriptSetting {
TriggerScriptId : pointy . String ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005" ),
DoneTriggerScriptId : pointy . String ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006" ),
},
LogSetting : & money . LogSetting {
LoggingNamespaceId : pointy . String ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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\Money\Gs2MoneyRestClient ;
use Gs2\Money\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 ( "namespace-0001" )
-> withDescription ( "description1" )
-> withPriority ( "paid" )
-> withAppleKey ( "io.gs2.sample" )
-> withGoogleKey ( "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB" )
-> withEnableFakeReceipt ( null )
-> withCreateWalletScript (( new \Gs2\Money\Model\ScriptSetting ())
-> withTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001" )
-> withDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002" ))
-> withDepositScript (( new \Gs2\Money\Model\ScriptSetting ())
-> withTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003" )
-> withDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004" ))
-> withWithdrawScript (( new \Gs2\Money\Model\ScriptSetting ())
-> withTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005" )
-> withDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006" ))
-> withLogSetting (( new \Gs2\Money\Model\LogSetting ())
-> withLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001" ))
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.UpdateNamespaceRequest ;
import io.gs2.money.result.UpdateNamespaceResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
UpdateNamespaceResult result = client . updateNamespace (
new UpdateNamespaceRequest ()
. withNamespaceName ( "namespace-0001" )
. withDescription ( "description1" )
. withPriority ( "paid" )
. withAppleKey ( "io.gs2.sample" )
. withGoogleKey ( "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB" )
. withEnableFakeReceipt ( null )
. withCreateWalletScript ( new io . gs2 . money . model . ScriptSetting ()
. withTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001" )
. withDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002" ))
. withDepositScript ( new io . gs2 . money . model . ScriptSetting ()
. withTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003" )
. withDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004" ))
. withWithdrawScript ( new io . gs2 . money . model . ScriptSetting ()
. withTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005" )
. withDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006" ))
. withLogSetting ( new io . gs2 . money . model . LogSetting ()
. withLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001" ))
);
Namespace item = result . getItem ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.UpdateNamespaceRequest ;
using Gs2.Gs2Money.Result.UpdateNamespaceResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . UpdateNamespaceResult > asyncResult = null ;
yield return client . UpdateNamespace (
new Gs2 . Gs2Money . Request . UpdateNamespaceRequest ()
. WithNamespaceName ( "namespace-0001" )
. WithDescription ( "description1" )
. WithPriority ( "paid" )
. WithAppleKey ( "io.gs2.sample" )
. WithGoogleKey ( "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB" )
. WithEnableFakeReceipt ( null )
. WithCreateWalletScript ( new Gs2 . Gs2Money . Model . ScriptSetting ()
. WithTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001" )
. WithDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002" ))
. WithDepositScript ( new Gs2 . Gs2Money . Model . ScriptSetting ()
. WithTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003" )
. WithDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004" ))
. WithWithdrawScript ( new Gs2 . Gs2Money . Model . ScriptSetting ()
. WithTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005" )
. WithDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006" ))
. WithLogSetting ( new Gs2 . Gs2Money . Model . LogSetting ()
. WithLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001" )),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . updateNamespace (
new Gs2Money . UpdateNamespaceRequest ()
. withNamespaceName ( "namespace-0001" )
. withDescription ( "description1" )
. withPriority ( "paid" )
. withAppleKey ( "io.gs2.sample" )
. withGoogleKey ( "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB" )
. withEnableFakeReceipt ( null )
. withCreateWalletScript ( new Gs2Money . model . ScriptSetting ()
. withTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001" )
. withDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002" ))
. withDepositScript ( new Gs2Money . model . ScriptSetting ()
. withTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003" )
. withDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004" ))
. withWithdrawScript ( new Gs2Money . model . ScriptSetting ()
. withTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005" )
. withDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006" ))
. withLogSetting ( new Gs2Money . model . LogSetting ()
. withLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001" ))
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . update_namespace (
money . UpdateNamespaceRequest ()
. with_namespace_name ( 'namespace-0001' )
. with_description ( 'description1' )
. with_priority ( 'paid' )
. with_apple_key ( 'io.gs2.sample' )
. with_google_key ( 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB' )
. with_enable_fake_receipt ( None )
. with_create_wallet_script (
money . ScriptSetting ()
. with_trigger_script_id ( 'grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001' )
. with_done_trigger_script_id ( 'grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002' ))
. with_deposit_script (
money . ScriptSetting ()
. with_trigger_script_id ( 'grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003' )
. with_done_trigger_script_id ( 'grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004' ))
. with_withdraw_script (
money . ScriptSetting ()
. with_trigger_script_id ( 'grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005' )
. with_done_trigger_script_id ( 'grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006' ))
. with_log_setting (
money . LogSetting ()
. with_logging_namespace_id ( 'grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001' ))
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.update_namespace ({
namespaceName = "namespace-0001" ,
description = "description1" ,
priority = "paid" ,
appleKey = "io.gs2.sample" ,
googleKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB" ,
enableFakeReceipt = nil ,
createWalletScript = {
triggerScriptId = "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001" ,
doneTriggerScriptId = "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002" ,
},
depositScript = {
triggerScriptId = "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003" ,
doneTriggerScriptId = "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004" ,
},
withdrawScript = {
triggerScriptId = "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005" ,
doneTriggerScriptId = "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006" ,
},
logSetting = {
loggingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001" ,
},
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'money' )
api_result_handler = client.update_namespace_async ({
namespaceName = "namespace-0001" ,
description = "description1" ,
priority = "paid" ,
appleKey = "io.gs2.sample" ,
googleKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB" ,
enableFakeReceipt = nil ,
createWalletScript = {
triggerScriptId = "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001" ,
doneTriggerScriptId = "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002" ,
},
depositScript = {
triggerScriptId = "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003" ,
doneTriggerScriptId = "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004" ,
},
withdrawScript = {
triggerScriptId = "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005" ,
doneTriggerScriptId = "grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006" ,
},
logSetting = {
loggingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001" ,
},
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
deleteNamespace ネームスペースを削除
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . DeleteNamespace (
& money . DeleteNamespaceRequest {
NamespaceName : pointy . String ( "namespace-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\Money\Gs2MoneyRestClient ;
use Gs2\Money\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 ( "namespace-0001" )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.DeleteNamespaceRequest ;
import io.gs2.money.result.DeleteNamespaceResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
DeleteNamespaceResult result = client . deleteNamespace (
new DeleteNamespaceRequest ()
. withNamespaceName ( "namespace-0001" )
);
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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.DeleteNamespaceRequest ;
using Gs2.Gs2Money.Result.DeleteNamespaceResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . DeleteNamespaceResult > asyncResult = null ;
yield return client . DeleteNamespace (
new Gs2 . Gs2Money . Request . DeleteNamespaceRequest ()
. WithNamespaceName ( "namespace-0001" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . deleteNamespace (
new Gs2Money . DeleteNamespaceRequest ()
. withNamespaceName ( "namespace-0001" )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . delete_namespace (
money . DeleteNamespaceRequest ()
. with_namespace_name ( 'namespace-0001' )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.delete_namespace ({
namespaceName = "namespace-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'money' )
api_result_handler = client.delete_namespace_async ({
namespaceName = "namespace-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
getServiceVersion マイクロサービスのバージョンを取得
Request Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . GetServiceVersion (
& money . GetServiceVersionRequest {
}
)
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\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\GetServiceVersionRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getServiceVersion (
( new GetServiceVersionRequest ())
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.GetServiceVersionRequest ;
import io.gs2.money.result.GetServiceVersionResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
GetServiceVersionResult result = client . getServiceVersion (
new GetServiceVersionRequest ()
);
String 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.GetServiceVersionRequest ;
using Gs2.Gs2Money.Result.GetServiceVersionResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . GetServiceVersionResult > asyncResult = null ;
yield return client . GetServiceVersion (
new Gs2 . Gs2Money . Request . GetServiceVersionRequest (),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . getServiceVersion (
new Gs2Money . GetServiceVersionRequest ()
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . get_service_version (
money . GetServiceVersionRequest ()
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.get_service_version ({
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'money' )
api_result_handler = client.get_service_version_async ({
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
dumpUserDataByUserId 指定したユーザーIDに紐づくデータのダンプを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . DumpUserDataByUserId (
& money . DumpUserDataByUserIdRequest {
UserId : pointy . String ( "user-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\DumpUserDataByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> dumpUserDataByUserId (
( new DumpUserDataByUserIdRequest ())
-> withUserId ( "user-0001" )
-> withTimeOffsetToken ( null )
);
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.DumpUserDataByUserIdRequest ;
import io.gs2.money.result.DumpUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
DumpUserDataByUserIdResult result = client . dumpUserDataByUserId (
new DumpUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.DumpUserDataByUserIdRequest ;
using Gs2.Gs2Money.Result.DumpUserDataByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . DumpUserDataByUserIdResult > asyncResult = null ;
yield return client . DumpUserDataByUserId (
new Gs2 . Gs2Money . Request . DumpUserDataByUserIdRequest ()
. WithUserId ( "user-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . dumpUserDataByUserId (
new Gs2Money . DumpUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . dump_user_data_by_user_id (
money . DumpUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.dump_user_data_by_user_id ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
client = gs2 ( 'money' )
api_result_handler = client.dump_user_data_by_user_id_async ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
checkDumpUserDataByUserId 指定したユーザーIDに紐づくデータのダンプが完了しているか確認
Request 型 有効化条件 必須 デフォルト 値の制限 説明 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . CheckDumpUserDataByUserId (
& money . CheckDumpUserDataByUserIdRequest {
UserId : pointy . String ( "user-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
url := result . Url
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\CheckDumpUserDataByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> checkDumpUserDataByUserId (
( new CheckDumpUserDataByUserIdRequest ())
-> withUserId ( "user-0001" )
-> withTimeOffsetToken ( null )
);
$url = $result -> getUrl ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.CheckDumpUserDataByUserIdRequest ;
import io.gs2.money.result.CheckDumpUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
CheckDumpUserDataByUserIdResult result = client . checkDumpUserDataByUserId (
new CheckDumpUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
String url = result . getUrl ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.CheckDumpUserDataByUserIdRequest ;
using Gs2.Gs2Money.Result.CheckDumpUserDataByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . CheckDumpUserDataByUserIdResult > asyncResult = null ;
yield return client . CheckDumpUserDataByUserId (
new Gs2 . Gs2Money . Request . CheckDumpUserDataByUserIdRequest ()
. WithUserId ( "user-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var url = result . Url ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . checkDumpUserDataByUserId (
new Gs2Money . CheckDumpUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
const url = result . getUrl ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . check_dump_user_data_by_user_id (
money . CheckDumpUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
url = result . url
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.check_dump_user_data_by_user_id ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
url = result.url ;
client = gs2 ( 'money' )
api_result_handler = client.check_dump_user_data_by_user_id_async ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
url = result.url ;
cleanUserDataByUserId 指定したユーザーIDに紐づくデータのダンプを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . CleanUserDataByUserId (
& money . CleanUserDataByUserIdRequest {
UserId : pointy . String ( "user-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\CleanUserDataByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> cleanUserDataByUserId (
( new CleanUserDataByUserIdRequest ())
-> withUserId ( "user-0001" )
-> withTimeOffsetToken ( null )
);
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.CleanUserDataByUserIdRequest ;
import io.gs2.money.result.CleanUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
CleanUserDataByUserIdResult result = client . cleanUserDataByUserId (
new CleanUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.CleanUserDataByUserIdRequest ;
using Gs2.Gs2Money.Result.CleanUserDataByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . CleanUserDataByUserIdResult > asyncResult = null ;
yield return client . CleanUserDataByUserId (
new Gs2 . Gs2Money . Request . CleanUserDataByUserIdRequest ()
. WithUserId ( "user-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . cleanUserDataByUserId (
new Gs2Money . CleanUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . clean_user_data_by_user_id (
money . CleanUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.clean_user_data_by_user_id ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
client = gs2 ( 'money' )
api_result_handler = client.clean_user_data_by_user_id_async ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
checkCleanUserDataByUserId 指定したユーザーIDに紐づくデータのダンプが完了しているか確認
Request 型 有効化条件 必須 デフォルト 値の制限 説明 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . CheckCleanUserDataByUserId (
& money . CheckCleanUserDataByUserIdRequest {
UserId : pointy . String ( "user-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\CheckCleanUserDataByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> checkCleanUserDataByUserId (
( new CheckCleanUserDataByUserIdRequest ())
-> withUserId ( "user-0001" )
-> withTimeOffsetToken ( null )
);
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.CheckCleanUserDataByUserIdRequest ;
import io.gs2.money.result.CheckCleanUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
CheckCleanUserDataByUserIdResult result = client . checkCleanUserDataByUserId (
new CheckCleanUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.CheckCleanUserDataByUserIdRequest ;
using Gs2.Gs2Money.Result.CheckCleanUserDataByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . CheckCleanUserDataByUserIdResult > asyncResult = null ;
yield return client . CheckCleanUserDataByUserId (
new Gs2 . Gs2Money . Request . CheckCleanUserDataByUserIdRequest ()
. WithUserId ( "user-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . checkCleanUserDataByUserId (
new Gs2Money . CheckCleanUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . check_clean_user_data_by_user_id (
money . CheckCleanUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.check_clean_user_data_by_user_id ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
client = gs2 ( 'money' )
api_result_handler = client.check_clean_user_data_by_user_id_async ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
prepareImportUserDataByUserId 指定したユーザーIDに紐づくデータのインポートを開始
Request 型 有効化条件 必須 デフォルト 値の制限 説明 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 型 説明 uploadToken string アップロード後に結果を反映する際に使用するトークン uploadUrl string ユーザーデータアップロード処理の実行に使用するURL
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . PrepareImportUserDataByUserId (
& money . PrepareImportUserDataByUserIdRequest {
UserId : pointy . String ( "user-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
uploadToken := result . UploadToken
uploadUrl := result . UploadUrl
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\PrepareImportUserDataByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> prepareImportUserDataByUserId (
( new PrepareImportUserDataByUserIdRequest ())
-> withUserId ( "user-0001" )
-> withTimeOffsetToken ( null )
);
$uploadToken = $result -> getUploadToken ();
$uploadUrl = $result -> getUploadUrl ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.PrepareImportUserDataByUserIdRequest ;
import io.gs2.money.result.PrepareImportUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
PrepareImportUserDataByUserIdResult result = client . prepareImportUserDataByUserId (
new PrepareImportUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
String uploadToken = result . getUploadToken ();
String uploadUrl = result . getUploadUrl ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.PrepareImportUserDataByUserIdRequest ;
using Gs2.Gs2Money.Result.PrepareImportUserDataByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . PrepareImportUserDataByUserIdResult > asyncResult = null ;
yield return client . PrepareImportUserDataByUserId (
new Gs2 . Gs2Money . Request . PrepareImportUserDataByUserIdRequest ()
. WithUserId ( "user-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var uploadToken = result . UploadToken ;
var uploadUrl = result . UploadUrl ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . prepareImportUserDataByUserId (
new Gs2Money . PrepareImportUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
const uploadToken = result . getUploadToken ();
const uploadUrl = result . getUploadUrl ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . prepare_import_user_data_by_user_id (
money . PrepareImportUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
upload_token = result . upload_token
upload_url = result . upload_url
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.prepare_import_user_data_by_user_id ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
uploadToken = result.uploadToken ;
uploadUrl = result.uploadUrl ;
client = gs2 ( 'money' )
api_result_handler = client.prepare_import_user_data_by_user_id_async ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
uploadToken = result.uploadToken ;
uploadUrl = result.uploadUrl ;
importUserDataByUserId 指定したユーザーIDに紐づくデータのインポートを開始
Request 型 有効化条件 必須 デフォルト 値の制限 説明 userId string ✓ ~ 128文字 ユーザーID uploadToken string ✓ ~ 1024文字 アップロード準備で受け取ったトークン timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . ImportUserDataByUserId (
& money . ImportUserDataByUserIdRequest {
UserId : pointy . String ( "user-0001" ),
UploadToken : pointy . String ( "upload-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\ImportUserDataByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> importUserDataByUserId (
( new ImportUserDataByUserIdRequest ())
-> withUserId ( "user-0001" )
-> withUploadToken ( "upload-0001" )
-> withTimeOffsetToken ( null )
);
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.ImportUserDataByUserIdRequest ;
import io.gs2.money.result.ImportUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
ImportUserDataByUserIdResult result = client . importUserDataByUserId (
new ImportUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withUploadToken ( "upload-0001" )
. withTimeOffsetToken ( null )
);
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.ImportUserDataByUserIdRequest ;
using Gs2.Gs2Money.Result.ImportUserDataByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . ImportUserDataByUserIdResult > asyncResult = null ;
yield return client . ImportUserDataByUserId (
new Gs2 . Gs2Money . Request . ImportUserDataByUserIdRequest ()
. WithUserId ( "user-0001" )
. WithUploadToken ( "upload-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . importUserDataByUserId (
new Gs2Money . ImportUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withUploadToken ( "upload-0001" )
. withTimeOffsetToken ( null )
);
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . import_user_data_by_user_id (
money . ImportUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_upload_token ( 'upload-0001' )
. with_time_offset_token ( None )
)
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.import_user_data_by_user_id ({
userId = "user-0001" ,
uploadToken = "upload-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
client = gs2 ( 'money' )
api_result_handler = client.import_user_data_by_user_id_async ({
userId = "user-0001" ,
uploadToken = "upload-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
checkImportUserDataByUserId 指定したユーザーIDに紐づくデータのインポートが完了しているか確認
Request 型 有効化条件 必須 デフォルト 値の制限 説明 userId string ✓ ~ 128文字 ユーザーID uploadToken string ✓ ~ 1024文字 アップロード準備で受け取ったトークン timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . CheckImportUserDataByUserId (
& money . CheckImportUserDataByUserIdRequest {
UserId : pointy . String ( "user-0001" ),
UploadToken : pointy . String ( "upload-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
url := result . Url
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\CheckImportUserDataByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> checkImportUserDataByUserId (
( new CheckImportUserDataByUserIdRequest ())
-> withUserId ( "user-0001" )
-> withUploadToken ( "upload-0001" )
-> withTimeOffsetToken ( null )
);
$url = $result -> getUrl ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.CheckImportUserDataByUserIdRequest ;
import io.gs2.money.result.CheckImportUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
CheckImportUserDataByUserIdResult result = client . checkImportUserDataByUserId (
new CheckImportUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withUploadToken ( "upload-0001" )
. withTimeOffsetToken ( null )
);
String url = result . getUrl ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.CheckImportUserDataByUserIdRequest ;
using Gs2.Gs2Money.Result.CheckImportUserDataByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . CheckImportUserDataByUserIdResult > asyncResult = null ;
yield return client . CheckImportUserDataByUserId (
new Gs2 . Gs2Money . Request . CheckImportUserDataByUserIdRequest ()
. WithUserId ( "user-0001" )
. WithUploadToken ( "upload-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var url = result . Url ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . checkImportUserDataByUserId (
new Gs2Money . CheckImportUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withUploadToken ( "upload-0001" )
. withTimeOffsetToken ( null )
);
const url = result . getUrl ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . check_import_user_data_by_user_id (
money . CheckImportUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_upload_token ( 'upload-0001' )
. with_time_offset_token ( None )
)
url = result . url
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.check_import_user_data_by_user_id ({
userId = "user-0001" ,
uploadToken = "upload-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
url = result.url ;
client = gs2 ( 'money' )
api_result_handler = client.check_import_user_data_by_user_id_async ({
userId = "user-0001" ,
uploadToken = "upload-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
url = result.url ;
describeWallets ウォレット一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 accessToken string ✓ ~ 128文字 アクセストークン pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン limit int ✓ 30 1 ~ 1000 データの取得件数
Result 型 説明 items List<Wallet> ウォレットのリスト nextPageToken string リストの続きを取得するためのページトークン
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . DescribeWallets (
& money . DescribeWalletsRequest {
NamespaceName : pointy . String ( "namespace-0001" ),
AccessToken : pointy . String ( "accessToken-0001" ),
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\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\DescribeWalletsRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> describeWallets (
( new DescribeWalletsRequest ())
-> withNamespaceName ( "namespace-0001" )
-> withAccessToken ( "accessToken-0001" )
-> 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.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.DescribeWalletsRequest ;
import io.gs2.money.result.DescribeWalletsResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
DescribeWalletsResult result = client . describeWallets (
new DescribeWalletsRequest ()
. withNamespaceName ( "namespace-0001" )
. withAccessToken ( "accessToken-0001" )
. withPageToken ( null )
. withLimit ( null )
);
List < Wallet > 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.DescribeWalletsRequest ;
using Gs2.Gs2Money.Result.DescribeWalletsResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . DescribeWalletsResult > asyncResult = null ;
yield return client . DescribeWallets (
new Gs2 . Gs2Money . Request . DescribeWalletsRequest ()
. WithNamespaceName ( "namespace-0001" )
. WithAccessToken ( "accessToken-0001" )
. 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 Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . describeWallets (
new Gs2Money . DescribeWalletsRequest ()
. withNamespaceName ( "namespace-0001" )
. withAccessToken ( "accessToken-0001" )
. withPageToken ( null )
. withLimit ( null )
);
const items = result . getItems ();
const nextPageToken = result . getNextPageToken ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . describe_wallets (
money . DescribeWalletsRequest ()
. with_namespace_name ( 'namespace-0001' )
. with_access_token ( 'accessToken-0001' )
. 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 ( 'money' )
api_result = client.describe_wallets ({
namespaceName = "namespace-0001" ,
accessToken = "accessToken-0001" ,
pageToken = nil ,
limit = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
client = gs2 ( 'money' )
api_result_handler = client.describe_wallets_async ({
namespaceName = "namespace-0001" ,
accessToken = "accessToken-0001" ,
pageToken = nil ,
limit = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
describeWalletsByUserId ユーザーIDを指定してウォレット一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 userId string ✓ ~ 128文字 ユーザーID pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン limit int ✓ 30 1 ~ 1000 データの取得件数 timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 型 説明 items List<Wallet> ウォレットのリスト nextPageToken string リストの続きを取得するためのページトークン
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . DescribeWalletsByUserId (
& money . DescribeWalletsByUserIdRequest {
NamespaceName : pointy . String ( "namespace-0001" ),
UserId : pointy . String ( "user-0001" ),
PageToken : nil ,
Limit : nil ,
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
items := result . Items
nextPageToken := result . NextPageToken
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\DescribeWalletsByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> describeWalletsByUserId (
( new DescribeWalletsByUserIdRequest ())
-> withNamespaceName ( "namespace-0001" )
-> withUserId ( "user-0001" )
-> withPageToken ( null )
-> withLimit ( null )
-> withTimeOffsetToken ( null )
);
$items = $result -> getItems ();
$nextPageToken = $result -> getNextPageToken ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.DescribeWalletsByUserIdRequest ;
import io.gs2.money.result.DescribeWalletsByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
DescribeWalletsByUserIdResult result = client . describeWalletsByUserId (
new DescribeWalletsByUserIdRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withPageToken ( null )
. withLimit ( null )
. withTimeOffsetToken ( null )
);
List < Wallet > 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.DescribeWalletsByUserIdRequest ;
using Gs2.Gs2Money.Result.DescribeWalletsByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . DescribeWalletsByUserIdResult > asyncResult = null ;
yield return client . DescribeWalletsByUserId (
new Gs2 . Gs2Money . Request . DescribeWalletsByUserIdRequest ()
. WithNamespaceName ( "namespace-0001" )
. WithUserId ( "user-0001" )
. WithPageToken ( null )
. WithLimit ( null )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var items = result . Items ;
var nextPageToken = result . NextPageToken ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . describeWalletsByUserId (
new Gs2Money . DescribeWalletsByUserIdRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withPageToken ( null )
. withLimit ( null )
. withTimeOffsetToken ( null )
);
const items = result . getItems ();
const nextPageToken = result . getNextPageToken ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . describe_wallets_by_user_id (
money . DescribeWalletsByUserIdRequest ()
. with_namespace_name ( 'namespace-0001' )
. with_user_id ( 'user-0001' )
. with_page_token ( None )
. with_limit ( None )
. with_time_offset_token ( None )
)
items = result . items
next_page_token = result . next_page_token
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.describe_wallets_by_user_id ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
pageToken = nil ,
limit = nil ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
client = gs2 ( 'money' )
api_result_handler = client.describe_wallets_by_user_id_async ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
pageToken = nil ,
limit = nil ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
getWallet ウォレットを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 accessToken string ✓ ~ 128文字 アクセストークン slot int ✓ ~ 100000000 スロット番号
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . GetWallet (
& money . GetWalletRequest {
NamespaceName : pointy . String ( "namespace-0001" ),
AccessToken : pointy . String ( "accessToken-0001" ),
Slot : pointy . Int32 ( 0 ),
}
)
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\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\GetWalletRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getWallet (
( new GetWalletRequest ())
-> withNamespaceName ( "namespace-0001" )
-> withAccessToken ( "accessToken-0001" )
-> withSlot ( 0 )
);
$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.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.GetWalletRequest ;
import io.gs2.money.result.GetWalletResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
GetWalletResult result = client . getWallet (
new GetWalletRequest ()
. withNamespaceName ( "namespace-0001" )
. withAccessToken ( "accessToken-0001" )
. withSlot ( 0 )
);
Wallet 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.GetWalletRequest ;
using Gs2.Gs2Money.Result.GetWalletResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . GetWalletResult > asyncResult = null ;
yield return client . GetWallet (
new Gs2 . Gs2Money . Request . GetWalletRequest ()
. WithNamespaceName ( "namespace-0001" )
. WithAccessToken ( "accessToken-0001" )
. WithSlot ( 0 ),
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 Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . getWallet (
new Gs2Money . GetWalletRequest ()
. withNamespaceName ( "namespace-0001" )
. withAccessToken ( "accessToken-0001" )
. withSlot ( 0 )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . get_wallet (
money . GetWalletRequest ()
. with_namespace_name ( 'namespace-0001' )
. with_access_token ( 'accessToken-0001' )
. with_slot ( 0 )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.get_wallet ({
namespaceName = "namespace-0001" ,
accessToken = "accessToken-0001" ,
slot = 0 ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'money' )
api_result_handler = client.get_wallet_async ({
namespaceName = "namespace-0001" ,
accessToken = "accessToken-0001" ,
slot = 0 ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
getWalletByUserId ユーザーIDを指定してウォレットを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 userId string ✓ ~ 128文字 ユーザーID slot int ✓ ~ 100000000 スロット番号 timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . GetWalletByUserId (
& money . GetWalletByUserIdRequest {
NamespaceName : pointy . String ( "namespace-0001" ),
UserId : pointy . String ( "user-0001" ),
Slot : pointy . Int32 ( 0 ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\GetWalletByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getWalletByUserId (
( new GetWalletByUserIdRequest ())
-> withNamespaceName ( "namespace-0001" )
-> withUserId ( "user-0001" )
-> withSlot ( 0 )
-> withTimeOffsetToken ( null )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.GetWalletByUserIdRequest ;
import io.gs2.money.result.GetWalletByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
GetWalletByUserIdResult result = client . getWalletByUserId (
new GetWalletByUserIdRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withSlot ( 0 )
. withTimeOffsetToken ( null )
);
Wallet 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.GetWalletByUserIdRequest ;
using Gs2.Gs2Money.Result.GetWalletByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . GetWalletByUserIdResult > asyncResult = null ;
yield return client . GetWalletByUserId (
new Gs2 . Gs2Money . Request . GetWalletByUserIdRequest ()
. WithNamespaceName ( "namespace-0001" )
. WithUserId ( "user-0001" )
. WithSlot ( 0 )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . getWalletByUserId (
new Gs2Money . GetWalletByUserIdRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withSlot ( 0 )
. withTimeOffsetToken ( null )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . get_wallet_by_user_id (
money . GetWalletByUserIdRequest ()
. with_namespace_name ( 'namespace-0001' )
. with_user_id ( 'user-0001' )
. with_slot ( 0 )
. with_time_offset_token ( None )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.get_wallet_by_user_id ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
slot = 0 ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'money' )
api_result_handler = client.get_wallet_by_user_id_async ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
slot = 0 ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
depositByUserId ユーザーIDを指定してウォレットに残高を加算
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 userId string ✓ ~ 128文字 ユーザーID slot int ✓ ~ 100000000 スロット番号 price float ✓ ~ 100000.0 購入価格 count int ✓ 1 ~ 2147483646 付与する課金通貨の数量 timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . DepositByUserId (
& money . DepositByUserIdRequest {
NamespaceName : pointy . String ( "namespace-0001" ),
UserId : pointy . String ( "user-0001" ),
Slot : pointy . Int32 ( 0 ),
Price : pointy . Float32 ( 120 ),
Count : pointy . Int32 ( 50 ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\DepositByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> depositByUserId (
( new DepositByUserIdRequest ())
-> withNamespaceName ( "namespace-0001" )
-> withUserId ( "user-0001" )
-> withSlot ( 0 )
-> withPrice ( 120 )
-> withCount ( 50 )
-> withTimeOffsetToken ( null )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.DepositByUserIdRequest ;
import io.gs2.money.result.DepositByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
DepositByUserIdResult result = client . depositByUserId (
new DepositByUserIdRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withSlot ( 0 )
. withPrice ( 120f )
. withCount ( 50 )
. withTimeOffsetToken ( null )
);
Wallet 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.DepositByUserIdRequest ;
using Gs2.Gs2Money.Result.DepositByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . DepositByUserIdResult > asyncResult = null ;
yield return client . DepositByUserId (
new Gs2 . Gs2Money . Request . DepositByUserIdRequest ()
. WithNamespaceName ( "namespace-0001" )
. WithUserId ( "user-0001" )
. WithSlot ( 0 )
. WithPrice ( 120f )
. WithCount ( 50 )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . depositByUserId (
new Gs2Money . DepositByUserIdRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withSlot ( 0 )
. withPrice ( 120 )
. withCount ( 50 )
. withTimeOffsetToken ( null )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . deposit_by_user_id (
money . DepositByUserIdRequest ()
. with_namespace_name ( 'namespace-0001' )
. with_user_id ( 'user-0001' )
. with_slot ( 0 )
. with_price ( 120 )
. with_count ( 50 )
. with_time_offset_token ( None )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.deposit_by_user_id ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
slot = 0 ,
price = 120 ,
count = 50 ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'money' )
api_result_handler = client.deposit_by_user_id_async ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
slot = 0 ,
price = 120 ,
count = 50 ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
withdraw ウォレットから残高を消費
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 accessToken string ✓ ~ 128文字 アクセストークン slot int ✓ ~ 100000000 スロット番号 count int ✓ 1 ~ 2147483646 消費する課金通貨の数量 paidOnly bool ✓ false 有償課金通貨のみを対象とするか
Result 型 説明 item Wallet 消費後のウォレット price float 消費した通貨の価格
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . Withdraw (
& money . WithdrawRequest {
NamespaceName : pointy . String ( "namespace-0001" ),
AccessToken : pointy . String ( "accessToken-0001" ),
Slot : pointy . Int32 ( 0 ),
Count : pointy . Int32 ( 50 ),
PaidOnly : pointy . Bool ( false ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
price := result . Price
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\WithdrawRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> withdraw (
( new WithdrawRequest ())
-> withNamespaceName ( "namespace-0001" )
-> withAccessToken ( "accessToken-0001" )
-> withSlot ( 0 )
-> withCount ( 50 )
-> withPaidOnly ( False )
);
$item = $result -> getItem ();
$price = $result -> getPrice ();
} 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.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.WithdrawRequest ;
import io.gs2.money.result.WithdrawResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
WithdrawResult result = client . withdraw (
new WithdrawRequest ()
. withNamespaceName ( "namespace-0001" )
. withAccessToken ( "accessToken-0001" )
. withSlot ( 0 )
. withCount ( 50 )
. withPaidOnly ( false )
);
Wallet item = result . getItem ();
float price = result . getPrice ();
} 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.WithdrawRequest ;
using Gs2.Gs2Money.Result.WithdrawResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . WithdrawResult > asyncResult = null ;
yield return client . Withdraw (
new Gs2 . Gs2Money . Request . WithdrawRequest ()
. WithNamespaceName ( "namespace-0001" )
. WithAccessToken ( "accessToken-0001" )
. WithSlot ( 0 )
. WithCount ( 50 )
. WithPaidOnly ( false ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var price = result . Price ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . withdraw (
new Gs2Money . WithdrawRequest ()
. withNamespaceName ( "namespace-0001" )
. withAccessToken ( "accessToken-0001" )
. withSlot ( 0 )
. withCount ( 50 )
. withPaidOnly ( false )
);
const item = result . getItem ();
const price = result . getPrice ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . withdraw (
money . WithdrawRequest ()
. with_namespace_name ( 'namespace-0001' )
. with_access_token ( 'accessToken-0001' )
. with_slot ( 0 )
. with_count ( 50 )
. with_paid_only ( False )
)
item = result . item
price = result . price
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.withdraw ({
namespaceName = "namespace-0001" ,
accessToken = "accessToken-0001" ,
slot = 0 ,
count = 50 ,
paidOnly = false ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
price = result.price ;
client = gs2 ( 'money' )
api_result_handler = client.withdraw_async ({
namespaceName = "namespace-0001" ,
accessToken = "accessToken-0001" ,
slot = 0 ,
count = 50 ,
paidOnly = false ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
price = result.price ;
withdrawByUserId ユーザーIDを指定してウォレットから残高を消費
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 userId string ✓ ~ 128文字 ユーザーID slot int ✓ ~ 100000000 スロット番号 count int ✓ 1 ~ 2147483646 消費する課金通貨の数量 paidOnly bool ✓ false 有償課金通貨のみを対象とするか timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 型 説明 item Wallet 消費後のウォレット price float 消費した通貨の価格
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . WithdrawByUserId (
& money . WithdrawByUserIdRequest {
NamespaceName : pointy . String ( "namespace-0001" ),
UserId : pointy . String ( "user-0001" ),
Slot : pointy . Int32 ( 0 ),
Count : pointy . Int32 ( 50 ),
PaidOnly : pointy . Bool ( false ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
price := result . Price
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\WithdrawByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> withdrawByUserId (
( new WithdrawByUserIdRequest ())
-> withNamespaceName ( "namespace-0001" )
-> withUserId ( "user-0001" )
-> withSlot ( 0 )
-> withCount ( 50 )
-> withPaidOnly ( False )
-> withTimeOffsetToken ( null )
);
$item = $result -> getItem ();
$price = $result -> getPrice ();
} 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.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.WithdrawByUserIdRequest ;
import io.gs2.money.result.WithdrawByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
WithdrawByUserIdResult result = client . withdrawByUserId (
new WithdrawByUserIdRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withSlot ( 0 )
. withCount ( 50 )
. withPaidOnly ( false )
. withTimeOffsetToken ( null )
);
Wallet item = result . getItem ();
float price = result . getPrice ();
} 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.WithdrawByUserIdRequest ;
using Gs2.Gs2Money.Result.WithdrawByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . WithdrawByUserIdResult > asyncResult = null ;
yield return client . WithdrawByUserId (
new Gs2 . Gs2Money . Request . WithdrawByUserIdRequest ()
. WithNamespaceName ( "namespace-0001" )
. WithUserId ( "user-0001" )
. WithSlot ( 0 )
. WithCount ( 50 )
. WithPaidOnly ( false )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var price = result . Price ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . withdrawByUserId (
new Gs2Money . WithdrawByUserIdRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withSlot ( 0 )
. withCount ( 50 )
. withPaidOnly ( false )
. withTimeOffsetToken ( null )
);
const item = result . getItem ();
const price = result . getPrice ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . withdraw_by_user_id (
money . WithdrawByUserIdRequest ()
. with_namespace_name ( 'namespace-0001' )
. with_user_id ( 'user-0001' )
. with_slot ( 0 )
. with_count ( 50 )
. with_paid_only ( False )
. with_time_offset_token ( None )
)
item = result . item
price = result . price
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.withdraw_by_user_id ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
slot = 0 ,
count = 50 ,
paidOnly = false ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
price = result.price ;
client = gs2 ( 'money' )
api_result_handler = client.withdraw_by_user_id_async ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
slot = 0 ,
count = 50 ,
paidOnly = false ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
price = result.price ;
depositByStampSheet 入手アクションとしてウォレットに残高の加算を実行
Request 型 有効化条件 必須 デフォルト 値の制限 説明 stampSheet string ✓ ~ 5242880文字 トランザクション keyId string ✓ ~ 1024文字 暗号鍵GRN
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . DepositByStampSheet (
& money . DepositByStampSheetRequest {
StampSheet : pointy . String ( "stampSheet" ),
KeyId : pointy . String ( "key-0001" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\DepositByStampSheetRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> depositByStampSheet (
( new DepositByStampSheetRequest ())
-> withStampSheet ( "stampSheet" )
-> withKeyId ( "key-0001" )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.DepositByStampSheetRequest ;
import io.gs2.money.result.DepositByStampSheetResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
DepositByStampSheetResult result = client . depositByStampSheet (
new DepositByStampSheetRequest ()
. withStampSheet ( "stampSheet" )
. withKeyId ( "key-0001" )
);
Wallet 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.DepositByStampSheetRequest ;
using Gs2.Gs2Money.Result.DepositByStampSheetResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . DepositByStampSheetResult > asyncResult = null ;
yield return client . DepositByStampSheet (
new Gs2 . Gs2Money . Request . DepositByStampSheetRequest ()
. WithStampSheet ( "stampSheet" )
. WithKeyId ( "key-0001" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . depositByStampSheet (
new Gs2Money . DepositByStampSheetRequest ()
. withStampSheet ( "stampSheet" )
. withKeyId ( "key-0001" )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . deposit_by_stamp_sheet (
money . DepositByStampSheetRequest ()
. with_stamp_sheet ( 'stampSheet' )
. with_key_id ( 'key-0001' )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.deposit_by_stamp_sheet ({
stampSheet = "stampSheet" ,
keyId = "key-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'money' )
api_result_handler = client.deposit_by_stamp_sheet_async ({
stampSheet = "stampSheet" ,
keyId = "key-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
withdrawByStampTask 消費アクションとしてウォレットから残高の消費を実行
Request 型 有効化条件 必須 デフォルト 値の制限 説明 stampTask string ✓ ~ 5242880文字 消費アクション keyId string ✓ ~ 1024文字 暗号鍵GRN
Result 型 説明 item Wallet 消費後のウォレット price float 消費した通貨の価格 newContextStack string 消費アクションの実行結果を記録したコンテキスト
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . WithdrawByStampTask (
& money . WithdrawByStampTaskRequest {
StampTask : pointy . String ( "stampTask" ),
KeyId : pointy . String ( "key-0001" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
price := result . Price
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\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\WithdrawByStampTaskRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> withdrawByStampTask (
( new WithdrawByStampTaskRequest ())
-> withStampTask ( "stampTask" )
-> withKeyId ( "key-0001" )
);
$item = $result -> getItem ();
$price = $result -> getPrice ();
$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.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.WithdrawByStampTaskRequest ;
import io.gs2.money.result.WithdrawByStampTaskResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
WithdrawByStampTaskResult result = client . withdrawByStampTask (
new WithdrawByStampTaskRequest ()
. withStampTask ( "stampTask" )
. withKeyId ( "key-0001" )
);
Wallet item = result . getItem ();
float price = result . getPrice ();
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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.WithdrawByStampTaskRequest ;
using Gs2.Gs2Money.Result.WithdrawByStampTaskResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . WithdrawByStampTaskResult > asyncResult = null ;
yield return client . WithdrawByStampTask (
new Gs2 . Gs2Money . Request . WithdrawByStampTaskRequest ()
. WithStampTask ( "stampTask" )
. WithKeyId ( "key-0001" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var price = result . Price ;
var newContextStack = result . NewContextStack ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . withdrawByStampTask (
new Gs2Money . WithdrawByStampTaskRequest ()
. withStampTask ( "stampTask" )
. withKeyId ( "key-0001" )
);
const item = result . getItem ();
const price = result . getPrice ();
const newContextStack = result . getNewContextStack ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . withdraw_by_stamp_task (
money . WithdrawByStampTaskRequest ()
. with_stamp_task ( 'stampTask' )
. with_key_id ( 'key-0001' )
)
item = result . item
price = result . price
new_context_stack = result . new_context_stack
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.withdraw_by_stamp_task ({
stampTask = "stampTask" ,
keyId = "key-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
price = result.price ;
newContextStack = result.newContextStack ;
client = gs2 ( 'money' )
api_result_handler = client.withdraw_by_stamp_task_async ({
stampTask = "stampTask" ,
keyId = "key-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
price = result.price ;
newContextStack = result.newContextStack ;
describeReceipts レシートの一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 userId string ✓ ~ 128文字 ユーザーID slot int ~ 100000000 スロット begin long ✓ 現在時刻からの差分(-30日) 検索開始日時 (UNIX時間 単位:ミリ秒) end long ✓ 現在時刻 検索終了日時 (UNIX時間 単位:ミリ秒) pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン limit int ✓ 30 1 ~ 1000 データの取得件数 timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 型 説明 items List<Receipt> レシートのリスト nextPageToken string リストの続きを取得するためのページトークン
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . DescribeReceipts (
& money . DescribeReceiptsRequest {
NamespaceName : pointy . String ( "namespace-0001" ),
UserId : pointy . String ( "user-0001" ),
Slot : pointy . Int32 ( 0 ),
Begin : nil ,
End : nil ,
PageToken : nil ,
Limit : nil ,
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
items := result . Items
nextPageToken := result . NextPageToken
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\DescribeReceiptsRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> describeReceipts (
( new DescribeReceiptsRequest ())
-> withNamespaceName ( "namespace-0001" )
-> withUserId ( "user-0001" )
-> withSlot ( 0 )
-> withBegin ( null )
-> withEnd ( null )
-> withPageToken ( null )
-> withLimit ( null )
-> withTimeOffsetToken ( null )
);
$items = $result -> getItems ();
$nextPageToken = $result -> getNextPageToken ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.DescribeReceiptsRequest ;
import io.gs2.money.result.DescribeReceiptsResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
DescribeReceiptsResult result = client . describeReceipts (
new DescribeReceiptsRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withSlot ( 0 )
. withBegin ( null )
. withEnd ( null )
. withPageToken ( null )
. withLimit ( null )
. withTimeOffsetToken ( null )
);
List < Receipt > 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.DescribeReceiptsRequest ;
using Gs2.Gs2Money.Result.DescribeReceiptsResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . DescribeReceiptsResult > asyncResult = null ;
yield return client . DescribeReceipts (
new Gs2 . Gs2Money . Request . DescribeReceiptsRequest ()
. WithNamespaceName ( "namespace-0001" )
. WithUserId ( "user-0001" )
. WithSlot ( 0 )
. WithBegin ( null )
. WithEnd ( null )
. WithPageToken ( null )
. WithLimit ( null )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var items = result . Items ;
var nextPageToken = result . NextPageToken ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . describeReceipts (
new Gs2Money . DescribeReceiptsRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withSlot ( 0 )
. withBegin ( null )
. withEnd ( null )
. withPageToken ( null )
. withLimit ( null )
. withTimeOffsetToken ( null )
);
const items = result . getItems ();
const nextPageToken = result . getNextPageToken ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . describe_receipts (
money . DescribeReceiptsRequest ()
. with_namespace_name ( 'namespace-0001' )
. with_user_id ( 'user-0001' )
. with_slot ( 0 )
. with_begin ( None )
. with_end ( None )
. with_page_token ( None )
. with_limit ( None )
. with_time_offset_token ( None )
)
items = result . items
next_page_token = result . next_page_token
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.describe_receipts ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
slot = 0 ,
begin = nil ,
end = nil ,
pageToken = nil ,
limit = nil ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
client = gs2 ( 'money' )
api_result_handler = client.describe_receipts_async ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
slot = 0 ,
begin = nil ,
end = nil ,
pageToken = nil ,
limit = nil ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
getByUserIdAndTransactionId ユーザーIDとトランザクションIDを指定してレシートを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 userId string ✓ ~ 128文字 ユーザーID transactionId string ✓ ~ 1024文字 トランザクションID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . GetByUserIdAndTransactionId (
& money . GetByUserIdAndTransactionIdRequest {
NamespaceName : pointy . String ( "namespace-0001" ),
UserId : pointy . String ( "user-0001" ),
TransactionId : pointy . String ( "transaction-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\GetByUserIdAndTransactionIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getByUserIdAndTransactionId (
( new GetByUserIdAndTransactionIdRequest ())
-> withNamespaceName ( "namespace-0001" )
-> withUserId ( "user-0001" )
-> withTransactionId ( "transaction-0001" )
-> withTimeOffsetToken ( null )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.GetByUserIdAndTransactionIdRequest ;
import io.gs2.money.result.GetByUserIdAndTransactionIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
GetByUserIdAndTransactionIdResult result = client . getByUserIdAndTransactionId (
new GetByUserIdAndTransactionIdRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withTransactionId ( "transaction-0001" )
. withTimeOffsetToken ( null )
);
Receipt 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.GetByUserIdAndTransactionIdRequest ;
using Gs2.Gs2Money.Result.GetByUserIdAndTransactionIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . GetByUserIdAndTransactionIdResult > asyncResult = null ;
yield return client . GetByUserIdAndTransactionId (
new Gs2 . Gs2Money . Request . GetByUserIdAndTransactionIdRequest ()
. WithNamespaceName ( "namespace-0001" )
. WithUserId ( "user-0001" )
. WithTransactionId ( "transaction-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . getByUserIdAndTransactionId (
new Gs2Money . GetByUserIdAndTransactionIdRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withTransactionId ( "transaction-0001" )
. withTimeOffsetToken ( null )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . get_by_user_id_and_transaction_id (
money . GetByUserIdAndTransactionIdRequest ()
. with_namespace_name ( 'namespace-0001' )
. with_user_id ( 'user-0001' )
. with_transaction_id ( 'transaction-0001' )
. with_time_offset_token ( None )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.get_by_user_id_and_transaction_id ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
transactionId = "transaction-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'money' )
api_result_handler = client.get_by_user_id_and_transaction_id_async ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
transactionId = "transaction-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
recordReceipt レシートを記録
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 userId string ✓ ~ 128文字 ユーザーID contentsId string ✓ ~ 1024文字 ストアプラットフォームで販売されているコンテンツID receipt string ✓ ~ 524288文字 レシート timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . RecordReceipt (
& money . RecordReceiptRequest {
NamespaceName : pointy . String ( "namespace-0001" ),
UserId : pointy . String ( "user-0001" ),
ContentsId : pointy . String ( "contents-0001" ),
Receipt : pointy . String ( "receipt..." ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\RecordReceiptRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> recordReceipt (
( new RecordReceiptRequest ())
-> withNamespaceName ( "namespace-0001" )
-> withUserId ( "user-0001" )
-> withContentsId ( "contents-0001" )
-> withReceipt ( "receipt..." )
-> withTimeOffsetToken ( null )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.RecordReceiptRequest ;
import io.gs2.money.result.RecordReceiptResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
RecordReceiptResult result = client . recordReceipt (
new RecordReceiptRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withContentsId ( "contents-0001" )
. withReceipt ( "receipt..." )
. withTimeOffsetToken ( null )
);
Receipt 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.RecordReceiptRequest ;
using Gs2.Gs2Money.Result.RecordReceiptResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . RecordReceiptResult > asyncResult = null ;
yield return client . RecordReceipt (
new Gs2 . Gs2Money . Request . RecordReceiptRequest ()
. WithNamespaceName ( "namespace-0001" )
. WithUserId ( "user-0001" )
. WithContentsId ( "contents-0001" )
. WithReceipt ( "receipt..." )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . recordReceipt (
new Gs2Money . RecordReceiptRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withContentsId ( "contents-0001" )
. withReceipt ( "receipt..." )
. withTimeOffsetToken ( null )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . record_receipt (
money . RecordReceiptRequest ()
. with_namespace_name ( 'namespace-0001' )
. with_user_id ( 'user-0001' )
. with_contents_id ( 'contents-0001' )
. with_receipt ( 'receipt...' )
. with_time_offset_token ( None )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.record_receipt ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
contentsId = "contents-0001" ,
receipt = "receipt..." ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'money' )
api_result_handler = client.record_receipt_async ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
contentsId = "contents-0001" ,
receipt = "receipt..." ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
revertRecordReceipt ユーザーIDを指定してレシートの記録の削除
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペースの名前 userId string ✓ ~ 128文字 ユーザーID receipt string ✓ ~ 524288文字 レシート timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . RevertRecordReceipt (
& money . RevertRecordReceiptRequest {
NamespaceName : pointy . String ( "namespace-0001" ),
UserId : pointy . String ( "user-0001" ),
Receipt : pointy . String ( "receipt..." ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\RevertRecordReceiptRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> revertRecordReceipt (
( new RevertRecordReceiptRequest ())
-> withNamespaceName ( "namespace-0001" )
-> withUserId ( "user-0001" )
-> withReceipt ( "receipt..." )
-> withTimeOffsetToken ( null )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.RevertRecordReceiptRequest ;
import io.gs2.money.result.RevertRecordReceiptResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
RevertRecordReceiptResult result = client . revertRecordReceipt (
new RevertRecordReceiptRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withReceipt ( "receipt..." )
. withTimeOffsetToken ( null )
);
Receipt 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.RevertRecordReceiptRequest ;
using Gs2.Gs2Money.Result.RevertRecordReceiptResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . RevertRecordReceiptResult > asyncResult = null ;
yield return client . RevertRecordReceipt (
new Gs2 . Gs2Money . Request . RevertRecordReceiptRequest ()
. WithNamespaceName ( "namespace-0001" )
. WithUserId ( "user-0001" )
. WithReceipt ( "receipt..." )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . revertRecordReceipt (
new Gs2Money . RevertRecordReceiptRequest ()
. withNamespaceName ( "namespace-0001" )
. withUserId ( "user-0001" )
. withReceipt ( "receipt..." )
. withTimeOffsetToken ( null )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . revert_record_receipt (
money . RevertRecordReceiptRequest ()
. with_namespace_name ( 'namespace-0001' )
. with_user_id ( 'user-0001' )
. with_receipt ( 'receipt...' )
. with_time_offset_token ( None )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.revert_record_receipt ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
receipt = "receipt..." ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'money' )
api_result_handler = client.revert_record_receipt_async ({
namespaceName = "namespace-0001" ,
userId = "user-0001" ,
receipt = "receipt..." ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
recordReceiptByStampTask 消費アクションとしてレシートの記録を実行
Request 型 有効化条件 必須 デフォルト 値の制限 説明 stampTask string ✓ ~ 5242880文字 消費アクション keyId string ✓ ~ 1024文字 暗号鍵GRN
Result 型 説明 item Receipt 記録したレシート newContextStack string 消費アクションの実行結果を記録したコンテキスト
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . RecordReceiptByStampTask (
& money . RecordReceiptByStampTaskRequest {
StampTask : pointy . String ( "stampTask" ),
KeyId : pointy . String ( "key-0001" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
newContextStack := result . NewContextStack
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\RecordReceiptByStampTaskRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> recordReceiptByStampTask (
( new RecordReceiptByStampTaskRequest ())
-> withStampTask ( "stampTask" )
-> withKeyId ( "key-0001" )
);
$item = $result -> getItem ();
$newContextStack = $result -> getNewContextStack ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.RecordReceiptByStampTaskRequest ;
import io.gs2.money.result.RecordReceiptByStampTaskResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
RecordReceiptByStampTaskResult result = client . recordReceiptByStampTask (
new RecordReceiptByStampTaskRequest ()
. withStampTask ( "stampTask" )
. withKeyId ( "key-0001" )
);
Receipt 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.RecordReceiptByStampTaskRequest ;
using Gs2.Gs2Money.Result.RecordReceiptByStampTaskResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . RecordReceiptByStampTaskResult > asyncResult = null ;
yield return client . RecordReceiptByStampTask (
new Gs2 . Gs2Money . Request . RecordReceiptByStampTaskRequest ()
. WithStampTask ( "stampTask" )
. WithKeyId ( "key-0001" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var newContextStack = result . NewContextStack ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . recordReceiptByStampTask (
new Gs2Money . RecordReceiptByStampTaskRequest ()
. withStampTask ( "stampTask" )
. withKeyId ( "key-0001" )
);
const item = result . getItem ();
const newContextStack = result . getNewContextStack ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . record_receipt_by_stamp_task (
money . RecordReceiptByStampTaskRequest ()
. with_stamp_task ( 'stampTask' )
. with_key_id ( 'key-0001' )
)
item = result . item
new_context_stack = result . new_context_stack
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.record_receipt_by_stamp_task ({
stampTask = "stampTask" ,
keyId = "key-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
newContextStack = result.newContextStack ;
client = gs2 ( 'money' )
api_result_handler = client.record_receipt_by_stamp_task_async ({
stampTask = "stampTask" ,
keyId = "key-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
newContextStack = result.newContextStack ;
revertRecordReceiptByStampSheet 入手アクションとしてレシートの記録の削除を実行
Request 型 有効化条件 必須 デフォルト 値の制限 説明 stampSheet string ✓ ~ 5242880文字 トランザクション keyId string ✓ ~ 1024文字 暗号鍵GRN
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
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 := money . Gs2MoneyRestClient {
Session : & session ,
}
result , err := client . RevertRecordReceiptByStampSheet (
& money . RevertRecordReceiptByStampSheetRequest {
StampSheet : pointy . String ( "stampSheet" ),
KeyId : pointy . String ( "key-0001" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Money\Gs2MoneyRestClient ;
use Gs2\Money\Request\RevertRecordReceiptByStampSheetRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> revertRecordReceiptByStampSheet (
( new RevertRecordReceiptByStampSheetRequest ())
-> withStampSheet ( "stampSheet" )
-> withKeyId ( "key-0001" )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.money.rest.Gs2MoneyRestClient ;
import io.gs2.money.request.RevertRecordReceiptByStampSheetRequest ;
import io.gs2.money.result.RevertRecordReceiptByStampSheetResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2MoneyRestClient client = new Gs2MoneyRestClient ( session );
try {
RevertRecordReceiptByStampSheetResult result = client . revertRecordReceiptByStampSheet (
new RevertRecordReceiptByStampSheetRequest ()
. withStampSheet ( "stampSheet" )
. withKeyId ( "key-0001" )
);
Receipt 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.Gs2Money.Gs2MoneyRestClient ;
using Gs2.Gs2Money.Request.RevertRecordReceiptByStampSheetRequest ;
using Gs2.Gs2Money.Result.RevertRecordReceiptByStampSheetResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2MoneyRestClient ( session );
AsyncResult < Gs2 . Gs2Money . Result . RevertRecordReceiptByStampSheetResult > asyncResult = null ;
yield return client . RevertRecordReceiptByStampSheet (
new Gs2 . Gs2Money . Request . RevertRecordReceiptByStampSheetRequest ()
. WithStampSheet ( "stampSheet" )
. WithKeyId ( "key-0001" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2Money from '@/gs2/money' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2Money . Gs2MoneyRestClient ( session );
try {
const result = await client . revertRecordReceiptByStampSheet (
new Gs2Money . RevertRecordReceiptByStampSheetRequest ()
. withStampSheet ( "stampSheet" )
. withKeyId ( "key-0001" )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import money
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = money . Gs2MoneyRestClient ( session )
try :
result = client . revert_record_receipt_by_stamp_sheet (
money . RevertRecordReceiptByStampSheetRequest ()
. with_stamp_sheet ( 'stampSheet' )
. with_key_id ( 'key-0001' )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'money' )
api_result = client.revert_record_receipt_by_stamp_sheet ({
stampSheet = "stampSheet" ,
keyId = "key-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'money' )
api_result_handler = client.revert_record_receipt_by_stamp_sheet_async ({
stampSheet = "stampSheet" ,
keyId = "key-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;