GS2-SerialKey SDK API リファレンス モデル Namespace ネームスペース
ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。 GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
型 有効化条件 必須 デフォルト 値の制限 説明 namespaceId string ✓ ~ 1024文字 ネームスペースGRN name string ✓ ~ 128文字 ネームスペース名 description string ~ 1024文字 説明文 logSetting LogSetting ログの出力設定 createdAt long ✓ 現在時刻 作成日時 (UNIX時間 単位:ミリ秒) updatedAt long ✓ 現在時刻 最終更新日時 (UNIX時間 単位:ミリ秒) revision long 0 ~ 9223372036854775805 リビジョン
IssueJob シリアルコード発行リクエスト
シリアルコードの発行処理を実行するとエンティティが作成されます。 発行数量には1〜100000の範囲を指定でき、発行処理の進行状況を確認することもできます。 発行処理が完了するとステータスが PROCESSING から COMPLETE に代わり、発行されたシリアルコードの情報にアクセスできるようになります。
型 有効化条件 必須 デフォルト 値の制限 説明 issueJobId string ✓ ~ 1024文字 発行ジョブGRN name string ✓ UUID ~ 36文字 発行ジョブID metadata string ~ 2048文字 メタデータ issuedCount int ✓ 0 ~ 1000000 シリアルキーの発行済み数量 issueRequestCount int ✓ 1 ~ 100000 シリアルキーの発行数量 status enum { “PROCESSING”, “COMPLETE” } ✓ “PROCESSING” ~ 128文字 ステータス createdAt long ✓ 現在時刻 作成日時 (UNIX時間 単位:ミリ秒) revision long 0 ~ 9223372036854775805 リビジョン
status に指定する列挙型の定義 定義 説明 PROCESSING 発行処理中 COMPLETE 発行完了
SerialKey シリアルコード
発行されたシリアルコードは1度のみ使用可能です。 シリアルコードは「RPCLP-FP7N-NCDMJ-FLVA-IRI4」のような形式で発行され、データ長を変更することはできません。 シリアルコード内にはキャンペーンの種類の情報も含まれており、シリアルコードを使用する際にはネームスペースを指定するだけで使用できます。
型 有効化条件 必須 デフォルト 値の制限 説明 serialKeyId string ✓ ~ 1024文字 シリアルキーGRN campaignModelName string ✓ ~ 128文字 キャンペーン名 code string ✓ ~ 48文字 シリアルコード metadata string ~ 2048文字 メタデータ status enum { “ACTIVE”, “USED”, “INACTIVE” } ✓ “ACTIVE” ~ 128文字 ステータス usedUserId string {status} == “USED” ✓ ~ 128文字 ユーザーID createdAt long ✓ 現在時刻 作成日時 (UNIX時間 単位:ミリ秒) usedAt long 使用日時 (UNIX時間 単位:ミリ秒) updatedAt long ✓ 現在時刻 最終更新日時 (UNIX時間 単位:ミリ秒) revision long 0 ~ 9223372036854775805 リビジョン
status に指定する列挙型の定義 定義 説明 ACTIVE 有効 USED 使用済み INACTIVE 無効
CampaignModel キャンペーンモデル
キャンペーンモデルはキャンペーンを定義し、シリアルコードと紐づけて管理するために使用されます。
型 有効化条件 必須 デフォルト 値の制限 説明 campaignId string ✓ ~ 1024文字 キャンペーンモデルGRN name string ✓ ~ 128文字 キャンペーン名 metadata string ~ 2048文字 メタデータ enableCampaignCode bool ✓ false キャンペーンコードでの引き換えを許可するか
CampaignModelMaster キャンペーンモデルマスターデータ
キャンペーンモデルはキャンペーンを定義し、シリアルコードと紐づけて管理するために使用されます。
型 有効化条件 必須 デフォルト 値の制限 説明 campaignId string ✓ ~ 1024文字 キャンペーンモデルマスターGRN name string ✓ ~ 128文字 キャンペーン名 description string ~ 1024文字 説明文 metadata string ~ 2048文字 メタデータ enableCampaignCode bool ✓ false キャンペーンコードでの引き換えを許可するか createdAt long ✓ 現在時刻 作成日時 (UNIX時間 単位:ミリ秒) updatedAt long ✓ 現在時刻 最終更新日時 (UNIX時間 単位:ミリ秒) revision long 0 ~ 9223372036854775805 リビジョン
CurrentCampaignMaster 現在有効なマスターデータ
GS2ではマスターデータの管理にJSON形式のファイルを使用します。 ファイルをアップロードすることで、実際にサーバーに設定を反映することができます。
JSONファイルを作成する方法として、マネージメントコンソール上でのマスターデータエディタを提供していますが よりゲームの運営に相応しいツールを作成し、適切なフォーマットのJSONファイルを書き出すことでもサービスを利用可能です。
型 有効化条件 必須 デフォルト 値の制限 説明 namespaceId string ✓ ~ 1024文字 現在有効なキャンペーンマスターGRN settings string ✓ ~ 5242880文字 マスターデータ
LogSetting ログの書き出し設定
ログデータの書き出し設定を管理します。この型は、ログデータを書き出すために使用されるログ名前空間の識別子(Namespace ID)を保持します。 ログ名前空間IDは、ログデータを集約し、保存する対象の GS2-Log の名前空間を指定します。 この設定を通じて、この名前空間以下のAPIリクエスト・レスポンスログデータが対象の GS2-Log へ出力されるようになります。 GS2-Log にはリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。
型 有効化条件 必須 デフォルト 値の制限 説明 loggingNamespaceId string ✓ ~ 1024文字 ネームスペースGRN
GitHubCheckoutSetting GitHubからマスターデータをチェックアウトする設定
型 有効化条件 必須 デフォルト 値の制限 説明 apiKeyId string ✓ ~ 1024文字 GitHub のAPIキーGRN repositoryName string ✓ ~ 1024文字 リポジトリ名 sourcePath string ✓ ~ 1024文字 ソースコードのファイルパス referenceType enum { “commit_hash”, “branch”, “tag” } ✓ ~ 128文字 コードの取得元 commitHash string {referenceType} == “commit_hash” ✓ ~ 1024文字 コミットハッシュ branchName string {referenceType} == “branch” ✓ ~ 1024文字 ブランチ名 tagName string {referenceType} == “tag” ✓ ~ 1024文字 タグ名
referenceType に指定する列挙型の定義 定義 説明 commit_hash コミットハッシュ branch ブランチ tag タグ
メソッド 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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . DescribeNamespaces (
& serial_key . 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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.DescribeNamespacesRequest ;
import io.gs2.serialKey.result.DescribeNamespacesResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.DescribeNamespacesRequest ;
using Gs2.Gs2SerialKey.Result.DescribeNamespacesResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . DescribeNamespacesResult > asyncResult = null ;
yield return client . DescribeNamespaces (
new Gs2 . Gs2SerialKey . 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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . describeNamespaces (
new Gs2SerialKey . 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 serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . describe_namespaces (
serial_key . 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 ( 'serialKey' )
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 ( 'serialKey' )
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文字 説明文 logSetting LogSetting ログの出力設定
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . CreateNamespace (
& serial_key . CreateNamespaceRequest {
Name : pointy . String ( "namespace1" ),
Description : nil ,
LogSetting : & serialKey . 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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\CreateNamespaceRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> createNamespace (
( new CreateNamespaceRequest ())
-> withName ( self :: namespace1 )
-> withDescription ( null )
-> withLogSetting (( new \Gs2\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.CreateNamespaceRequest ;
import io.gs2.serialKey.result.CreateNamespaceResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
CreateNamespaceResult result = client . createNamespace (
new CreateNamespaceRequest ()
. withName ( "namespace1" )
. withDescription ( null )
. withLogSetting ( new io . gs2 . serialKey . 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.CreateNamespaceRequest ;
using Gs2.Gs2SerialKey.Result.CreateNamespaceResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . CreateNamespaceResult > asyncResult = null ;
yield return client . CreateNamespace (
new Gs2 . Gs2SerialKey . Request . CreateNamespaceRequest ()
. WithName ( "namespace1" )
. WithDescription ( null )
. WithLogSetting ( new Gs2 . Gs2SerialKey . 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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . createNamespace (
new Gs2SerialKey . CreateNamespaceRequest ()
. withName ( "namespace1" )
. withDescription ( null )
. withLogSetting ( new Gs2SerialKey . 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 serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . create_namespace (
serial_key . CreateNamespaceRequest ()
. with_name ( self . hash1 )
. with_description ( None )
. with_log_setting (
serial_key . 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 ( 'serialKey' )
api_result = client.create_namespace ({
name = "namespace1" ,
description = 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 ( 'serialKey' )
api_result_handler = client.create_namespace_async ({
name = "namespace1" ,
description = 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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . GetNamespaceStatus (
& serial_key . GetNamespaceStatusRequest {
NamespaceName : pointy . String ( "namespace1" ),
}
)
if err != nil {
panic ( "error occurred" )
}
status := result . Status
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\GetNamespaceStatusRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getNamespaceStatus (
( new GetNamespaceStatusRequest ())
-> withNamespaceName ( self :: namespace1 )
);
$status = $result -> getStatus ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.GetNamespaceStatusRequest ;
import io.gs2.serialKey.result.GetNamespaceStatusResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
GetNamespaceStatusResult result = client . getNamespaceStatus (
new GetNamespaceStatusRequest ()
. withNamespaceName ( "namespace1" )
);
String status = result . getStatus ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.GetNamespaceStatusRequest ;
using Gs2.Gs2SerialKey.Result.GetNamespaceStatusResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . GetNamespaceStatusResult > asyncResult = null ;
yield return client . GetNamespaceStatus (
new Gs2 . Gs2SerialKey . Request . GetNamespaceStatusRequest ()
. WithNamespaceName ( "namespace1" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var status = result . Status ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . getNamespaceStatus (
new Gs2SerialKey . GetNamespaceStatusRequest ()
. withNamespaceName ( "namespace1" )
);
const status = result . getStatus ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . get_namespace_status (
serial_key . GetNamespaceStatusRequest ()
. with_namespace_name ( self . hash1 )
)
status = result . status
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.get_namespace_status ({
namespaceName = "namespace1" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
status = result.status ;
client = gs2 ( 'serialKey' )
api_result_handler = client.get_namespace_status_async ({
namespaceName = "namespace1" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
status = result.status ;
getNamespace ネームスペースを取得
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . GetNamespace (
& serial_key . GetNamespaceRequest {
NamespaceName : pointy . String ( "namespace1" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\GetNamespaceRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getNamespace (
( new GetNamespaceRequest ())
-> withNamespaceName ( self :: namespace1 )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.GetNamespaceRequest ;
import io.gs2.serialKey.result.GetNamespaceResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
GetNamespaceResult result = client . getNamespace (
new GetNamespaceRequest ()
. withNamespaceName ( "namespace1" )
);
Namespace item = result . getItem ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.GetNamespaceRequest ;
using Gs2.Gs2SerialKey.Result.GetNamespaceResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . GetNamespaceResult > asyncResult = null ;
yield return client . GetNamespace (
new Gs2 . Gs2SerialKey . Request . GetNamespaceRequest ()
. WithNamespaceName ( "namespace1" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . getNamespace (
new Gs2SerialKey . GetNamespaceRequest ()
. withNamespaceName ( "namespace1" )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . get_namespace (
serial_key . GetNamespaceRequest ()
. with_namespace_name ( self . hash1 )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.get_namespace ({
namespaceName = "namespace1" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'serialKey' )
api_result_handler = client.get_namespace_async ({
namespaceName = "namespace1" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
updateNamespace ネームスペースを更新
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 description string ~ 1024文字 説明文 logSetting LogSetting ログの出力設定
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . UpdateNamespace (
& serial_key . UpdateNamespaceRequest {
NamespaceName : pointy . String ( "namespace1" ),
Description : pointy . String ( "description1" ),
LogSetting : & serialKey . 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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\UpdateNamespaceRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> updateNamespace (
( new UpdateNamespaceRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withDescription ( "description1" )
-> withLogSetting (( new \Gs2\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.UpdateNamespaceRequest ;
import io.gs2.serialKey.result.UpdateNamespaceResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
UpdateNamespaceResult result = client . updateNamespace (
new UpdateNamespaceRequest ()
. withNamespaceName ( "namespace1" )
. withDescription ( "description1" )
. withLogSetting ( new io . gs2 . serialKey . 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.UpdateNamespaceRequest ;
using Gs2.Gs2SerialKey.Result.UpdateNamespaceResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . UpdateNamespaceResult > asyncResult = null ;
yield return client . UpdateNamespace (
new Gs2 . Gs2SerialKey . Request . UpdateNamespaceRequest ()
. WithNamespaceName ( "namespace1" )
. WithDescription ( "description1" )
. WithLogSetting ( new Gs2 . Gs2SerialKey . 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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . updateNamespace (
new Gs2SerialKey . UpdateNamespaceRequest ()
. withNamespaceName ( "namespace1" )
. withDescription ( "description1" )
. withLogSetting ( new Gs2SerialKey . 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 serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . update_namespace (
serial_key . UpdateNamespaceRequest ()
. with_namespace_name ( self . hash1 )
. with_description ( 'description1' )
. with_log_setting (
serial_key . 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 ( 'serialKey' )
api_result = client.update_namespace ({
namespaceName = "namespace1" ,
description = "description1" ,
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 ( 'serialKey' )
api_result_handler = client.update_namespace_async ({
namespaceName = "namespace1" ,
description = "description1" ,
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . DeleteNamespace (
& serial_key . DeleteNamespaceRequest {
NamespaceName : pointy . String ( "namespace1" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\DeleteNamespaceRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> deleteNamespace (
( new DeleteNamespaceRequest ())
-> withNamespaceName ( self :: namespace1 )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.DeleteNamespaceRequest ;
import io.gs2.serialKey.result.DeleteNamespaceResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
DeleteNamespaceResult result = client . deleteNamespace (
new DeleteNamespaceRequest ()
. withNamespaceName ( "namespace1" )
);
Namespace item = result . getItem ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.DeleteNamespaceRequest ;
using Gs2.Gs2SerialKey.Result.DeleteNamespaceResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . DeleteNamespaceResult > asyncResult = null ;
yield return client . DeleteNamespace (
new Gs2 . Gs2SerialKey . Request . DeleteNamespaceRequest ()
. WithNamespaceName ( "namespace1" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . deleteNamespace (
new Gs2SerialKey . DeleteNamespaceRequest ()
. withNamespaceName ( "namespace1" )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . delete_namespace (
serial_key . DeleteNamespaceRequest ()
. with_namespace_name ( self . hash1 )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.delete_namespace ({
namespaceName = "namespace1" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'serialKey' )
api_result_handler = client.delete_namespace_async ({
namespaceName = "namespace1" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
dumpUserDataByUserId 指定したユーザー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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . DumpUserDataByUserId (
& serial_key . 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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.DumpUserDataByUserIdRequest ;
import io.gs2.serialKey.result.DumpUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.DumpUserDataByUserIdRequest ;
using Gs2.Gs2SerialKey.Result.DumpUserDataByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . DumpUserDataByUserIdResult > asyncResult = null ;
yield return client . DumpUserDataByUserId (
new Gs2 . Gs2SerialKey . 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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . dumpUserDataByUserId (
new Gs2SerialKey . DumpUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . dump_user_data_by_user_id (
serial_key . DumpUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
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 ( 'serialKey' )
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . CheckDumpUserDataByUserId (
& serial_key . 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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.CheckDumpUserDataByUserIdRequest ;
import io.gs2.serialKey.result.CheckDumpUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.CheckDumpUserDataByUserIdRequest ;
using Gs2.Gs2SerialKey.Result.CheckDumpUserDataByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . CheckDumpUserDataByUserIdResult > asyncResult = null ;
yield return client . CheckDumpUserDataByUserId (
new Gs2 . Gs2SerialKey . 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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . checkDumpUserDataByUserId (
new Gs2SerialKey . CheckDumpUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
const url = result . getUrl ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . check_dump_user_data_by_user_id (
serial_key . CheckDumpUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
url = result . url
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
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 ( 'serialKey' )
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . CleanUserDataByUserId (
& serial_key . 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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.CleanUserDataByUserIdRequest ;
import io.gs2.serialKey.result.CleanUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.CleanUserDataByUserIdRequest ;
using Gs2.Gs2SerialKey.Result.CleanUserDataByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . CleanUserDataByUserIdResult > asyncResult = null ;
yield return client . CleanUserDataByUserId (
new Gs2 . Gs2SerialKey . 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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . cleanUserDataByUserId (
new Gs2SerialKey . CleanUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . clean_user_data_by_user_id (
serial_key . CleanUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
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 ( 'serialKey' )
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . CheckCleanUserDataByUserId (
& serial_key . 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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.CheckCleanUserDataByUserIdRequest ;
import io.gs2.serialKey.result.CheckCleanUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.CheckCleanUserDataByUserIdRequest ;
using Gs2.Gs2SerialKey.Result.CheckCleanUserDataByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . CheckCleanUserDataByUserIdResult > asyncResult = null ;
yield return client . CheckCleanUserDataByUserId (
new Gs2 . Gs2SerialKey . 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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . checkCleanUserDataByUserId (
new Gs2SerialKey . CheckCleanUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . check_clean_user_data_by_user_id (
serial_key . CheckCleanUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
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 ( 'serialKey' )
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . PrepareImportUserDataByUserId (
& serial_key . 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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.PrepareImportUserDataByUserIdRequest ;
import io.gs2.serialKey.result.PrepareImportUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.PrepareImportUserDataByUserIdRequest ;
using Gs2.Gs2SerialKey.Result.PrepareImportUserDataByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . PrepareImportUserDataByUserIdResult > asyncResult = null ;
yield return client . PrepareImportUserDataByUserId (
new Gs2 . Gs2SerialKey . 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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . prepareImportUserDataByUserId (
new Gs2SerialKey . 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 serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . prepare_import_user_data_by_user_id (
serial_key . 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 ( 'serialKey' )
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 ( 'serialKey' )
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . ImportUserDataByUserId (
& serial_key . 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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.ImportUserDataByUserIdRequest ;
import io.gs2.serialKey.result.ImportUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.ImportUserDataByUserIdRequest ;
using Gs2.Gs2SerialKey.Result.ImportUserDataByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . ImportUserDataByUserIdResult > asyncResult = null ;
yield return client . ImportUserDataByUserId (
new Gs2 . Gs2SerialKey . 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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . importUserDataByUserId (
new Gs2SerialKey . ImportUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withUploadToken ( "upload-0001" )
. withTimeOffsetToken ( null )
);
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . import_user_data_by_user_id (
serial_key . 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 ( 'serialKey' )
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 ( 'serialKey' )
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . CheckImportUserDataByUserId (
& serial_key . 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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.CheckImportUserDataByUserIdRequest ;
import io.gs2.serialKey.result.CheckImportUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.CheckImportUserDataByUserIdRequest ;
using Gs2.Gs2SerialKey.Result.CheckImportUserDataByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . CheckImportUserDataByUserIdResult > asyncResult = null ;
yield return client . CheckImportUserDataByUserId (
new Gs2 . Gs2SerialKey . 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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . checkImportUserDataByUserId (
new Gs2SerialKey . 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 serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . check_import_user_data_by_user_id (
serial_key . 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 ( 'serialKey' )
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 ( 'serialKey' )
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 ;
describeIssueJobs シリアルキー発行ジョブの一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 campaignModelName string ✓ ~ 128文字 キャンペーン名 pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン limit int ✓ 30 1 ~ 1000 データの取得件数
Result 型 説明 items List<IssueJob> シリアルキー発行ジョブのリスト 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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . DescribeIssueJobs (
& serial_key . DescribeIssueJobsRequest {
NamespaceName : pointy . String ( "namespace1" ),
CampaignModelName : pointy . String ( "campaign-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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\DescribeIssueJobsRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> describeIssueJobs (
( new DescribeIssueJobsRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withCampaignModelName ( "campaign-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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.DescribeIssueJobsRequest ;
import io.gs2.serialKey.result.DescribeIssueJobsResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
DescribeIssueJobsResult result = client . describeIssueJobs (
new DescribeIssueJobsRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
. withPageToken ( null )
. withLimit ( null )
);
List < IssueJob > 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.DescribeIssueJobsRequest ;
using Gs2.Gs2SerialKey.Result.DescribeIssueJobsResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . DescribeIssueJobsResult > asyncResult = null ;
yield return client . DescribeIssueJobs (
new Gs2 . Gs2SerialKey . Request . DescribeIssueJobsRequest ()
. WithNamespaceName ( "namespace1" )
. WithCampaignModelName ( "campaign-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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . describeIssueJobs (
new Gs2SerialKey . DescribeIssueJobsRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-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 serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . describe_issue_jobs (
serial_key . DescribeIssueJobsRequest ()
. with_namespace_name ( self . hash1 )
. with_campaign_model_name ( 'campaign-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 ( 'serialKey' )
api_result = client.describe_issue_jobs ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-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 ( 'serialKey' )
api_result_handler = client.describe_issue_jobs_async ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-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 ;
getIssueJob シリアルキー発行ジョブを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 campaignModelName string ✓ ~ 128文字 キャンペーン名 issueJobName string ✓ UUID ~ 36文字 発行ジョブID
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . GetIssueJob (
& serial_key . GetIssueJobRequest {
NamespaceName : pointy . String ( "namespace1" ),
CampaignModelName : pointy . String ( "campaign-0001" ),
IssueJobName : pointy . String ( "campaign-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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\GetIssueJobRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getIssueJob (
( new GetIssueJobRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withCampaignModelName ( "campaign-0001" )
-> withIssueJobName ( "campaign-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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.GetIssueJobRequest ;
import io.gs2.serialKey.result.GetIssueJobResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
GetIssueJobResult result = client . getIssueJob (
new GetIssueJobRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
. withIssueJobName ( "campaign-0001" )
);
IssueJob 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.GetIssueJobRequest ;
using Gs2.Gs2SerialKey.Result.GetIssueJobResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . GetIssueJobResult > asyncResult = null ;
yield return client . GetIssueJob (
new Gs2 . Gs2SerialKey . Request . GetIssueJobRequest ()
. WithNamespaceName ( "namespace1" )
. WithCampaignModelName ( "campaign-0001" )
. WithIssueJobName ( "campaign-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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . getIssueJob (
new Gs2SerialKey . GetIssueJobRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
. withIssueJobName ( "campaign-0001" )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . get_issue_job (
serial_key . GetIssueJobRequest ()
. with_namespace_name ( self . hash1 )
. with_campaign_model_name ( 'campaign-0001' )
. with_issue_job_name ( 'campaign-0001' )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.get_issue_job ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-0001" ,
issueJobName = "campaign-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 ( 'serialKey' )
api_result_handler = client.get_issue_job_async ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-0001" ,
issueJobName = "campaign-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 ;
issue シリアルキー発行ジョブを作成
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 campaignModelName string ✓ ~ 128文字 キャンペーン名 metadata string ~ 2048文字 メタデータ issueRequestCount int ✓ 1 ~ 100000 シリアルキーの発行数量
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . Issue (
& serial_key . IssueRequest {
NamespaceName : pointy . String ( "namespace1" ),
CampaignModelName : pointy . String ( "campaign-0001" ),
Metadata : nil ,
IssueRequestCount : pointy . Int32 ( 30 ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\IssueRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> issue (
( new IssueRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withCampaignModelName ( "campaign-0001" )
-> withMetadata ( null )
-> withIssueRequestCount ( 30 )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.IssueRequest ;
import io.gs2.serialKey.result.IssueResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
IssueResult result = client . issue (
new IssueRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
. withMetadata ( null )
. withIssueRequestCount ( 30 )
);
IssueJob 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.IssueRequest ;
using Gs2.Gs2SerialKey.Result.IssueResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . IssueResult > asyncResult = null ;
yield return client . Issue (
new Gs2 . Gs2SerialKey . Request . IssueRequest ()
. WithNamespaceName ( "namespace1" )
. WithCampaignModelName ( "campaign-0001" )
. WithMetadata ( null )
. WithIssueRequestCount ( 30 ),
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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . issue (
new Gs2SerialKey . IssueRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
. withMetadata ( null )
. withIssueRequestCount ( 30 )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . issue (
serial_key . IssueRequest ()
. with_namespace_name ( self . hash1 )
. with_campaign_model_name ( 'campaign-0001' )
. with_metadata ( None )
. with_issue_request_count ( 30 )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.issue ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-0001" ,
metadata = nil ,
issueRequestCount = 30 ,
})
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 ( 'serialKey' )
api_result_handler = client.issue_async ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-0001" ,
metadata = nil ,
issueRequestCount = 30 ,
})
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 ;
describeSerialKeys シリアルキーの一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 campaignModelName string ✓ ~ 128文字 キャンペーン名 issueJobName string ✓ UUID ~ 36文字 発行ジョブID 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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . DescribeSerialKeys (
& serial_key . DescribeSerialKeysRequest {
NamespaceName : pointy . String ( "namespace1" ),
CampaignModelName : pointy . String ( "campaign-0001" ),
IssueJobName : pointy . String ( "job-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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\DescribeSerialKeysRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> describeSerialKeys (
( new DescribeSerialKeysRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withCampaignModelName ( "campaign-0001" )
-> withIssueJobName ( "job-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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.DescribeSerialKeysRequest ;
import io.gs2.serialKey.result.DescribeSerialKeysResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
DescribeSerialKeysResult result = client . describeSerialKeys (
new DescribeSerialKeysRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
. withIssueJobName ( "job-0001" )
. withPageToken ( null )
. withLimit ( null )
);
List < SerialKey > 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.DescribeSerialKeysRequest ;
using Gs2.Gs2SerialKey.Result.DescribeSerialKeysResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . DescribeSerialKeysResult > asyncResult = null ;
yield return client . DescribeSerialKeys (
new Gs2 . Gs2SerialKey . Request . DescribeSerialKeysRequest ()
. WithNamespaceName ( "namespace1" )
. WithCampaignModelName ( "campaign-0001" )
. WithIssueJobName ( "job-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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . describeSerialKeys (
new Gs2SerialKey . DescribeSerialKeysRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
. withIssueJobName ( "job-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 serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . describe_serial_keys (
serial_key . DescribeSerialKeysRequest ()
. with_namespace_name ( self . hash1 )
. with_campaign_model_name ( 'campaign-0001' )
. with_issue_job_name ( 'job-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 ( 'serialKey' )
api_result = client.describe_serial_keys ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-0001" ,
issueJobName = "job-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 ( 'serialKey' )
api_result_handler = client.describe_serial_keys_async ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-0001" ,
issueJobName = "job-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 ;
downloadSerialCodes シリアルコードの一覧をファイル形式で取得シリアルコードの一覧をファイルで取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 campaignModelName string ✓ ~ 128文字 キャンペーン名 issueJobName string ✓ UUID ~ 36文字 発行ジョブID
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . DownloadSerialCodes (
& serial_key . DownloadSerialCodesRequest {
NamespaceName : pointy . String ( "namespace1" ),
CampaignModelName : pointy . String ( "campaign-0001" ),
IssueJobName : pointy . String ( "job-0001" ),
}
)
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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\DownloadSerialCodesRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> downloadSerialCodes (
( new DownloadSerialCodesRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withCampaignModelName ( "campaign-0001" )
-> withIssueJobName ( "job-0001" )
);
$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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.DownloadSerialCodesRequest ;
import io.gs2.serialKey.result.DownloadSerialCodesResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
DownloadSerialCodesResult result = client . downloadSerialCodes (
new DownloadSerialCodesRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
. withIssueJobName ( "job-0001" )
);
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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.DownloadSerialCodesRequest ;
using Gs2.Gs2SerialKey.Result.DownloadSerialCodesResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . DownloadSerialCodesResult > asyncResult = null ;
yield return client . DownloadSerialCodes (
new Gs2 . Gs2SerialKey . Request . DownloadSerialCodesRequest ()
. WithNamespaceName ( "namespace1" )
. WithCampaignModelName ( "campaign-0001" )
. WithIssueJobName ( "job-0001" ),
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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . downloadSerialCodes (
new Gs2SerialKey . DownloadSerialCodesRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
. withIssueJobName ( "job-0001" )
);
const url = result . getUrl ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . download_serial_codes (
serial_key . DownloadSerialCodesRequest ()
. with_namespace_name ( self . hash1 )
. with_campaign_model_name ( 'campaign-0001' )
. with_issue_job_name ( 'job-0001' )
)
url = result . url
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.download_serial_codes ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-0001" ,
issueJobName = "job-0001" ,
})
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 ( 'serialKey' )
api_result_handler = client.download_serial_codes_async ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-0001" ,
issueJobName = "job-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
url = result.url ;
issueOnce シリアルコードを1件発行
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 campaignModelName string ✓ ~ 128文字 キャンペーン名 metadata string ~ 2048文字 メタデータ
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . IssueOnce (
& serial_key . IssueOnceRequest {
NamespaceName : pointy . String ( "namespace1" ),
CampaignModelName : pointy . String ( "campaign-0001" ),
Metadata : 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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\IssueOnceRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> issueOnce (
( new IssueOnceRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withCampaignModelName ( "campaign-0001" )
-> withMetadata ( 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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.IssueOnceRequest ;
import io.gs2.serialKey.result.IssueOnceResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
IssueOnceResult result = client . issueOnce (
new IssueOnceRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
. withMetadata ( null )
);
SerialKey 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.IssueOnceRequest ;
using Gs2.Gs2SerialKey.Result.IssueOnceResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . IssueOnceResult > asyncResult = null ;
yield return client . IssueOnce (
new Gs2 . Gs2SerialKey . Request . IssueOnceRequest ()
. WithNamespaceName ( "namespace1" )
. WithCampaignModelName ( "campaign-0001" )
. WithMetadata ( 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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . issueOnce (
new Gs2SerialKey . IssueOnceRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
. withMetadata ( null )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . issue_once (
serial_key . IssueOnceRequest ()
. with_namespace_name ( self . hash1 )
. with_campaign_model_name ( 'campaign-0001' )
. with_metadata ( None )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.issue_once ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-0001" ,
metadata = 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 ( 'serialKey' )
api_result_handler = client.issue_once_async ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-0001" ,
metadata = 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 ;
getSerialKey シリアルコードを消費
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 code string ✓ ~ 48文字 シリアルコード
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . GetSerialKey (
& serial_key . GetSerialKeyRequest {
NamespaceName : pointy . String ( "namespace1" ),
Code : pointy . String ( "code-0001" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
campaignModel := result . CampaignModel
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\GetSerialKeyRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getSerialKey (
( new GetSerialKeyRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withCode ( "code-0001" )
);
$item = $result -> getItem ();
$campaignModel = $result -> getCampaignModel ();
} 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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.GetSerialKeyRequest ;
import io.gs2.serialKey.result.GetSerialKeyResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
GetSerialKeyResult result = client . getSerialKey (
new GetSerialKeyRequest ()
. withNamespaceName ( "namespace1" )
. withCode ( "code-0001" )
);
SerialKey item = result . getItem ();
CampaignModel campaignModel = result . getCampaignModel ();
} 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.GetSerialKeyRequest ;
using Gs2.Gs2SerialKey.Result.GetSerialKeyResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . GetSerialKeyResult > asyncResult = null ;
yield return client . GetSerialKey (
new Gs2 . Gs2SerialKey . Request . GetSerialKeyRequest ()
. WithNamespaceName ( "namespace1" )
. WithCode ( "code-0001" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var campaignModel = result . CampaignModel ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . getSerialKey (
new Gs2SerialKey . GetSerialKeyRequest ()
. withNamespaceName ( "namespace1" )
. withCode ( "code-0001" )
);
const item = result . getItem ();
const campaignModel = result . getCampaignModel ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . get_serial_key (
serial_key . GetSerialKeyRequest ()
. with_namespace_name ( self . hash1 )
. with_code ( 'code-0001' )
)
item = result . item
campaign_model = result . campaign_model
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.get_serial_key ({
namespaceName = "namespace1" ,
code = "code-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
campaignModel = result.campaignModel ;
client = gs2 ( 'serialKey' )
api_result_handler = client.get_serial_key_async ({
namespaceName = "namespace1" ,
code = "code-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 ;
campaignModel = result.campaignModel ;
verifyCode シリアルコードの有効性を確認
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 accessToken string ✓ ~ 128文字 ユーザーID code string ✓ ~ 48文字 シリアルコード campaignModelName string ~ 128文字 キャンペーン名 verifyType enum { “active”, “inactive” } ✓ ~ 128文字 検証タイプ
verifyType に指定する列挙型の定義 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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . VerifyCode (
& serial_key . VerifyCodeRequest {
NamespaceName : pointy . String ( "namespace1" ),
AccessToken : pointy . String ( "accessToken-0001" ),
Code : pointy . String ( "code-0001" ),
CampaignModelName : nil ,
VerifyType : pointy . String ( "used" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
campaignModel := result . CampaignModel
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\VerifyCodeRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> verifyCode (
( new VerifyCodeRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withAccessToken ( self :: $accessToken0001 )
-> withCode ( "code-0001" )
-> withCampaignModelName ( null )
-> withVerifyType ( "used" )
);
$item = $result -> getItem ();
$campaignModel = $result -> getCampaignModel ();
} 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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.VerifyCodeRequest ;
import io.gs2.serialKey.result.VerifyCodeResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
VerifyCodeResult result = client . verifyCode (
new VerifyCodeRequest ()
. withNamespaceName ( "namespace1" )
. withAccessToken ( "accessToken-0001" )
. withCode ( "code-0001" )
. withCampaignModelName ( null )
. withVerifyType ( "used" )
);
SerialKey item = result . getItem ();
CampaignModel campaignModel = result . getCampaignModel ();
} 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.VerifyCodeRequest ;
using Gs2.Gs2SerialKey.Result.VerifyCodeResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . VerifyCodeResult > asyncResult = null ;
yield return client . VerifyCode (
new Gs2 . Gs2SerialKey . Request . VerifyCodeRequest ()
. WithNamespaceName ( "namespace1" )
. WithAccessToken ( "accessToken-0001" )
. WithCode ( "code-0001" )
. WithCampaignModelName ( null )
. WithVerifyType ( "used" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var campaignModel = result . CampaignModel ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . verifyCode (
new Gs2SerialKey . VerifyCodeRequest ()
. withNamespaceName ( "namespace1" )
. withAccessToken ( "accessToken-0001" )
. withCode ( "code-0001" )
. withCampaignModelName ( null )
. withVerifyType ( "used" )
);
const item = result . getItem ();
const campaignModel = result . getCampaignModel ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . verify_code (
serial_key . VerifyCodeRequest ()
. with_namespace_name ( self . hash1 )
. with_access_token ( self . access_token_0001 )
. with_code ( 'code-0001' )
. with_campaign_model_name ( None )
. with_verify_type ( 'used' )
)
item = result . item
campaign_model = result . campaign_model
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.verify_code ({
namespaceName = "namespace1" ,
accessToken = "accessToken-0001" ,
code = "code-0001" ,
campaignModelName = nil ,
verifyType = "used" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
campaignModel = result.campaignModel ;
client = gs2 ( 'serialKey' )
api_result_handler = client.verify_code_async ({
namespaceName = "namespace1" ,
accessToken = "accessToken-0001" ,
code = "code-0001" ,
campaignModelName = nil ,
verifyType = "used" ,
})
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 ;
campaignModel = result.campaignModel ;
verifyCodeByUserId ユーザIDを指定してシリアルコードの有効性を確認
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 userId string ✓ ~ 128文字 ユーザーID code string ✓ ~ 48文字 シリアルコード campaignModelName string ~ 128文字 キャンペーン名 verifyType enum { “active”, “inactive” } ✓ ~ 128文字 検証タイプ timeOffsetToken string ~ 1024文字 タイムオフセットトークン
verifyType に指定する列挙型の定義 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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . VerifyCodeByUserId (
& serial_key . VerifyCodeByUserIdRequest {
NamespaceName : pointy . String ( "namespace1" ),
UserId : pointy . String ( "user-0001" ),
Code : pointy . String ( "code-0001" ),
CampaignModelName : nil ,
VerifyType : pointy . String ( "used" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
campaignModel := result . CampaignModel
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\VerifyCodeByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> verifyCodeByUserId (
( new VerifyCodeByUserIdRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withUserId ( "user-0001" )
-> withCode ( "code-0001" )
-> withCampaignModelName ( null )
-> withVerifyType ( "used" )
-> withTimeOffsetToken ( null )
);
$item = $result -> getItem ();
$campaignModel = $result -> getCampaignModel ();
} 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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.VerifyCodeByUserIdRequest ;
import io.gs2.serialKey.result.VerifyCodeByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
VerifyCodeByUserIdResult result = client . verifyCodeByUserId (
new VerifyCodeByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withCode ( "code-0001" )
. withCampaignModelName ( null )
. withVerifyType ( "used" )
. withTimeOffsetToken ( null )
);
SerialKey item = result . getItem ();
CampaignModel campaignModel = result . getCampaignModel ();
} 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.VerifyCodeByUserIdRequest ;
using Gs2.Gs2SerialKey.Result.VerifyCodeByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . VerifyCodeByUserIdResult > asyncResult = null ;
yield return client . VerifyCodeByUserId (
new Gs2 . Gs2SerialKey . Request . VerifyCodeByUserIdRequest ()
. WithNamespaceName ( "namespace1" )
. WithUserId ( "user-0001" )
. WithCode ( "code-0001" )
. WithCampaignModelName ( null )
. WithVerifyType ( "used" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var campaignModel = result . CampaignModel ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . verifyCodeByUserId (
new Gs2SerialKey . VerifyCodeByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withCode ( "code-0001" )
. withCampaignModelName ( null )
. withVerifyType ( "used" )
. withTimeOffsetToken ( null )
);
const item = result . getItem ();
const campaignModel = result . getCampaignModel ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . verify_code_by_user_id (
serial_key . VerifyCodeByUserIdRequest ()
. with_namespace_name ( self . hash1 )
. with_user_id ( 'user-0001' )
. with_code ( 'code-0001' )
. with_campaign_model_name ( None )
. with_verify_type ( 'used' )
. with_time_offset_token ( None )
)
item = result . item
campaign_model = result . campaign_model
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.verify_code_by_user_id ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
code = "code-0001" ,
campaignModelName = nil ,
verifyType = "used" ,
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 ;
campaignModel = result.campaignModel ;
client = gs2 ( 'serialKey' )
api_result_handler = client.verify_code_by_user_id_async ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
code = "code-0001" ,
campaignModelName = nil ,
verifyType = "used" ,
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 ;
campaignModel = result.campaignModel ;
use シリアルコードの使用済み化
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 accessToken string ✓ ~ 128文字 ユーザーID code string ✓ ~ 48文字 シリアルコード
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . Use (
& serial_key . UseRequest {
NamespaceName : pointy . String ( "namespace1" ),
AccessToken : pointy . String ( "accessToken-0001" ),
Code : pointy . String ( "code-0001" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
campaignModel := result . CampaignModel
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\UseRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> use (
( new UseRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withAccessToken ( self :: $accessToken0001 )
-> withCode ( "code-0001" )
);
$item = $result -> getItem ();
$campaignModel = $result -> getCampaignModel ();
} 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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.UseRequest ;
import io.gs2.serialKey.result.UseResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
UseResult result = client . use (
new UseRequest ()
. withNamespaceName ( "namespace1" )
. withAccessToken ( "accessToken-0001" )
. withCode ( "code-0001" )
);
SerialKey item = result . getItem ();
CampaignModel campaignModel = result . getCampaignModel ();
} 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.UseRequest ;
using Gs2.Gs2SerialKey.Result.UseResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . UseResult > asyncResult = null ;
yield return client . Use (
new Gs2 . Gs2SerialKey . Request . UseRequest ()
. WithNamespaceName ( "namespace1" )
. WithAccessToken ( "accessToken-0001" )
. WithCode ( "code-0001" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var campaignModel = result . CampaignModel ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . use (
new Gs2SerialKey . UseRequest ()
. withNamespaceName ( "namespace1" )
. withAccessToken ( "accessToken-0001" )
. withCode ( "code-0001" )
);
const item = result . getItem ();
const campaignModel = result . getCampaignModel ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . use (
serial_key . UseRequest ()
. with_namespace_name ( self . hash1 )
. with_access_token ( self . access_token_0001 )
. with_code ( 'code-0001' )
)
item = result . item
campaign_model = result . campaign_model
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.use ({
namespaceName = "namespace1" ,
accessToken = "accessToken-0001" ,
code = "code-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
campaignModel = result.campaignModel ;
client = gs2 ( 'serialKey' )
api_result_handler = client.use_async ({
namespaceName = "namespace1" ,
accessToken = "accessToken-0001" ,
code = "code-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 ;
campaignModel = result.campaignModel ;
useByUserId ユーザIDを指定してシリアルコードの使用済み化
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 userId string ✓ ~ 128文字 ユーザーID code string ✓ ~ 48文字 シリアルコード 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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . UseByUserId (
& serial_key . UseByUserIdRequest {
NamespaceName : pointy . String ( "namespace1" ),
UserId : pointy . String ( "user-0001" ),
Code : pointy . String ( "code-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
campaignModel := result . CampaignModel
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\UseByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> useByUserId (
( new UseByUserIdRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withUserId ( "user-0001" )
-> withCode ( "code-0001" )
-> withTimeOffsetToken ( null )
);
$item = $result -> getItem ();
$campaignModel = $result -> getCampaignModel ();
} 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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.UseByUserIdRequest ;
import io.gs2.serialKey.result.UseByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
UseByUserIdResult result = client . useByUserId (
new UseByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withCode ( "code-0001" )
. withTimeOffsetToken ( null )
);
SerialKey item = result . getItem ();
CampaignModel campaignModel = result . getCampaignModel ();
} 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.UseByUserIdRequest ;
using Gs2.Gs2SerialKey.Result.UseByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . UseByUserIdResult > asyncResult = null ;
yield return client . UseByUserId (
new Gs2 . Gs2SerialKey . Request . UseByUserIdRequest ()
. WithNamespaceName ( "namespace1" )
. WithUserId ( "user-0001" )
. WithCode ( "code-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var campaignModel = result . CampaignModel ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . useByUserId (
new Gs2SerialKey . UseByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withCode ( "code-0001" )
. withTimeOffsetToken ( null )
);
const item = result . getItem ();
const campaignModel = result . getCampaignModel ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . use_by_user_id (
serial_key . UseByUserIdRequest ()
. with_namespace_name ( self . hash1 )
. with_user_id ( 'user-0001' )
. with_code ( 'code-0001' )
. with_time_offset_token ( None )
)
item = result . item
campaign_model = result . campaign_model
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.use_by_user_id ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
code = "code-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 ;
campaignModel = result.campaignModel ;
client = gs2 ( 'serialKey' )
api_result_handler = client.use_by_user_id_async ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
code = "code-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 ;
campaignModel = result.campaignModel ;
revertUseByUserId ユーザIDを指定してシリアルコードを未使用化
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 userId string ✓ ~ 128文字 ユーザーID code string ✓ ~ 48文字 シリアルコード 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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . RevertUseByUserId (
& serial_key . RevertUseByUserIdRequest {
NamespaceName : pointy . String ( "namespace1" ),
UserId : pointy . String ( "user-0001" ),
Code : pointy . String ( "code-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
campaignModel := result . CampaignModel
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\RevertUseByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> revertUseByUserId (
( new RevertUseByUserIdRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withUserId ( "user-0001" )
-> withCode ( "code-0001" )
-> withTimeOffsetToken ( null )
);
$item = $result -> getItem ();
$campaignModel = $result -> getCampaignModel ();
} 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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.RevertUseByUserIdRequest ;
import io.gs2.serialKey.result.RevertUseByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
RevertUseByUserIdResult result = client . revertUseByUserId (
new RevertUseByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withCode ( "code-0001" )
. withTimeOffsetToken ( null )
);
SerialKey item = result . getItem ();
CampaignModel campaignModel = result . getCampaignModel ();
} 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.RevertUseByUserIdRequest ;
using Gs2.Gs2SerialKey.Result.RevertUseByUserIdResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . RevertUseByUserIdResult > asyncResult = null ;
yield return client . RevertUseByUserId (
new Gs2 . Gs2SerialKey . Request . RevertUseByUserIdRequest ()
. WithNamespaceName ( "namespace1" )
. WithUserId ( "user-0001" )
. WithCode ( "code-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var campaignModel = result . CampaignModel ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . revertUseByUserId (
new Gs2SerialKey . RevertUseByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withCode ( "code-0001" )
. withTimeOffsetToken ( null )
);
const item = result . getItem ();
const campaignModel = result . getCampaignModel ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . revert_use_by_user_id (
serial_key . RevertUseByUserIdRequest ()
. with_namespace_name ( self . hash1 )
. with_user_id ( 'user-0001' )
. with_code ( 'code-0001' )
. with_time_offset_token ( None )
)
item = result . item
campaign_model = result . campaign_model
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.revert_use_by_user_id ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
code = "code-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 ;
campaignModel = result.campaignModel ;
client = gs2 ( 'serialKey' )
api_result_handler = client.revert_use_by_user_id_async ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
code = "code-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 ;
campaignModel = result.campaignModel ;
useByStampTask 消費アクションとしてシリアルコードの使用済み化を実行
Request 型 有効化条件 必須 デフォルト 値の制限 説明 stampTask 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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . UseByStampTask (
& serial_key . UseByStampTaskRequest {
StampTask : pointy . String ( "stampTask" ),
KeyId : pointy . String ( "key-0001" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
campaignModel := result . CampaignModel
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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\UseByStampTaskRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> useByStampTask (
( new UseByStampTaskRequest ())
-> withStampTask ( self :: stampTask )
-> withKeyId ( self :: key - 0001 )
);
$item = $result -> getItem ();
$campaignModel = $result -> getCampaignModel ();
$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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.UseByStampTaskRequest ;
import io.gs2.serialKey.result.UseByStampTaskResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
UseByStampTaskResult result = client . useByStampTask (
new UseByStampTaskRequest ()
. withStampTask ( "stampTask" )
. withKeyId ( "key-0001" )
);
SerialKey item = result . getItem ();
CampaignModel campaignModel = result . getCampaignModel ();
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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.UseByStampTaskRequest ;
using Gs2.Gs2SerialKey.Result.UseByStampTaskResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . UseByStampTaskResult > asyncResult = null ;
yield return client . UseByStampTask (
new Gs2 . Gs2SerialKey . Request . UseByStampTaskRequest ()
. WithStampTask ( "stampTask" )
. WithKeyId ( "key-0001" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var campaignModel = result . CampaignModel ;
var newContextStack = result . NewContextStack ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . useByStampTask (
new Gs2SerialKey . UseByStampTaskRequest ()
. withStampTask ( "stampTask" )
. withKeyId ( "key-0001" )
);
const item = result . getItem ();
const campaignModel = result . getCampaignModel ();
const newContextStack = result . getNewContextStack ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . use_by_stamp_task (
serial_key . UseByStampTaskRequest ()
. with_stamp_task ( self . stamp_task )
. with_key_id ( self . key1 . key_id )
)
item = result . item
campaign_model = result . campaign_model
new_context_stack = result . new_context_stack
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.use_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 ;
campaignModel = result.campaignModel ;
newContextStack = result.newContextStack ;
client = gs2 ( 'serialKey' )
api_result_handler = client.use_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 ;
campaignModel = result.campaignModel ;
newContextStack = result.newContextStack ;
revertUseByStampSheet 入手アクションとしてシリアルコードを未使用化を実行
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . RevertUseByStampSheet (
& serial_key . RevertUseByStampSheetRequest {
StampSheet : pointy . String ( "stampSheet" ),
KeyId : pointy . String ( "key-0001" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
campaignModel := result . CampaignModel
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\RevertUseByStampSheetRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> revertUseByStampSheet (
( new RevertUseByStampSheetRequest ())
-> withStampSheet ( self :: stampSheet )
-> withKeyId ( self :: key - 0001 )
);
$item = $result -> getItem ();
$campaignModel = $result -> getCampaignModel ();
} 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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.RevertUseByStampSheetRequest ;
import io.gs2.serialKey.result.RevertUseByStampSheetResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
RevertUseByStampSheetResult result = client . revertUseByStampSheet (
new RevertUseByStampSheetRequest ()
. withStampSheet ( "stampSheet" )
. withKeyId ( "key-0001" )
);
SerialKey item = result . getItem ();
CampaignModel campaignModel = result . getCampaignModel ();
} 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.RevertUseByStampSheetRequest ;
using Gs2.Gs2SerialKey.Result.RevertUseByStampSheetResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . RevertUseByStampSheetResult > asyncResult = null ;
yield return client . RevertUseByStampSheet (
new Gs2 . Gs2SerialKey . Request . RevertUseByStampSheetRequest ()
. WithStampSheet ( "stampSheet" )
. WithKeyId ( "key-0001" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var campaignModel = result . CampaignModel ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . revertUseByStampSheet (
new Gs2SerialKey . RevertUseByStampSheetRequest ()
. withStampSheet ( "stampSheet" )
. withKeyId ( "key-0001" )
);
const item = result . getItem ();
const campaignModel = result . getCampaignModel ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . revert_use_by_stamp_sheet (
serial_key . RevertUseByStampSheetRequest ()
. with_stamp_sheet ( self . stamp_sheet )
. with_key_id ( self . key1 . key_id )
)
item = result . item
campaign_model = result . campaign_model
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.revert_use_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 ;
campaignModel = result.campaignModel ;
client = gs2 ( 'serialKey' )
api_result_handler = client.revert_use_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 ;
campaignModel = result.campaignModel ;
verifyByStampTask 検証アクションとしてシリアルコードの有効性を確認
Request 型 有効化条件 必須 デフォルト 値の制限 説明 stampTask 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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . VerifyByStampTask (
& serial_key . VerifyByStampTaskRequest {
StampTask : pointy . String ( "stampTask" ),
KeyId : pointy . String ( "key-0001" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
campaignModel := result . CampaignModel
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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\VerifyByStampTaskRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> verifyByStampTask (
( new VerifyByStampTaskRequest ())
-> withStampTask ( self :: stampTask )
-> withKeyId ( self :: key - 0001 )
);
$item = $result -> getItem ();
$campaignModel = $result -> getCampaignModel ();
$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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.VerifyByStampTaskRequest ;
import io.gs2.serialKey.result.VerifyByStampTaskResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
VerifyByStampTaskResult result = client . verifyByStampTask (
new VerifyByStampTaskRequest ()
. withStampTask ( "stampTask" )
. withKeyId ( "key-0001" )
);
SerialKey item = result . getItem ();
CampaignModel campaignModel = result . getCampaignModel ();
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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.VerifyByStampTaskRequest ;
using Gs2.Gs2SerialKey.Result.VerifyByStampTaskResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . VerifyByStampTaskResult > asyncResult = null ;
yield return client . VerifyByStampTask (
new Gs2 . Gs2SerialKey . Request . VerifyByStampTaskRequest ()
. WithStampTask ( "stampTask" )
. WithKeyId ( "key-0001" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var campaignModel = result . CampaignModel ;
var newContextStack = result . NewContextStack ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . verifyByStampTask (
new Gs2SerialKey . VerifyByStampTaskRequest ()
. withStampTask ( "stampTask" )
. withKeyId ( "key-0001" )
);
const item = result . getItem ();
const campaignModel = result . getCampaignModel ();
const newContextStack = result . getNewContextStack ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . verify_by_stamp_task (
serial_key . VerifyByStampTaskRequest ()
. with_stamp_task ( self . stamp_task )
. with_key_id ( self . key1 . key_id )
)
item = result . item
campaign_model = result . campaign_model
new_context_stack = result . new_context_stack
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.verify_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 ;
campaignModel = result.campaignModel ;
newContextStack = result.newContextStack ;
client = gs2 ( 'serialKey' )
api_result_handler = client.verify_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 ;
campaignModel = result.campaignModel ;
newContextStack = result.newContextStack ;
issueOnceByStampSheet 入手アクションとしてシリアルコードを未使用化を実行
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . IssueOnceByStampSheet (
& serial_key . IssueOnceByStampSheetRequest {
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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\IssueOnceByStampSheetRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> issueOnceByStampSheet (
( new IssueOnceByStampSheetRequest ())
-> withStampSheet ( self :: stampSheet )
-> withKeyId ( self :: key - 0001 )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.IssueOnceByStampSheetRequest ;
import io.gs2.serialKey.result.IssueOnceByStampSheetResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
IssueOnceByStampSheetResult result = client . issueOnceByStampSheet (
new IssueOnceByStampSheetRequest ()
. withStampSheet ( "stampSheet" )
. withKeyId ( "key-0001" )
);
SerialKey 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.IssueOnceByStampSheetRequest ;
using Gs2.Gs2SerialKey.Result.IssueOnceByStampSheetResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . IssueOnceByStampSheetResult > asyncResult = null ;
yield return client . IssueOnceByStampSheet (
new Gs2 . Gs2SerialKey . Request . IssueOnceByStampSheetRequest ()
. 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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . issueOnceByStampSheet (
new Gs2SerialKey . IssueOnceByStampSheetRequest ()
. withStampSheet ( "stampSheet" )
. withKeyId ( "key-0001" )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . issue_once_by_stamp_sheet (
serial_key . IssueOnceByStampSheetRequest ()
. with_stamp_sheet ( self . stamp_sheet )
. with_key_id ( self . key1 . key_id )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.issue_once_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 ( 'serialKey' )
api_result_handler = client.issue_once_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 ;
describeCampaignModels キャンペーンモデルの一覧を取得
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . DescribeCampaignModels (
& serial_key . DescribeCampaignModelsRequest {
NamespaceName : pointy . String ( "namespace1" ),
}
)
if err != nil {
panic ( "error occurred" )
}
items := result . Items
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\DescribeCampaignModelsRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> describeCampaignModels (
( new DescribeCampaignModelsRequest ())
-> withNamespaceName ( self :: namespace1 )
);
$items = $result -> getItems ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.DescribeCampaignModelsRequest ;
import io.gs2.serialKey.result.DescribeCampaignModelsResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
DescribeCampaignModelsResult result = client . describeCampaignModels (
new DescribeCampaignModelsRequest ()
. withNamespaceName ( "namespace1" )
);
List < CampaignModel > items = result . getItems ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.DescribeCampaignModelsRequest ;
using Gs2.Gs2SerialKey.Result.DescribeCampaignModelsResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . DescribeCampaignModelsResult > asyncResult = null ;
yield return client . DescribeCampaignModels (
new Gs2 . Gs2SerialKey . Request . DescribeCampaignModelsRequest ()
. WithNamespaceName ( "namespace1" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var items = result . Items ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . describeCampaignModels (
new Gs2SerialKey . DescribeCampaignModelsRequest ()
. withNamespaceName ( "namespace1" )
);
const items = result . getItems ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . describe_campaign_models (
serial_key . DescribeCampaignModelsRequest ()
. with_namespace_name ( self . hash1 )
)
items = result . items
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.describe_campaign_models ({
namespaceName = "namespace1" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
client = gs2 ( 'serialKey' )
api_result_handler = client.describe_campaign_models_async ({
namespaceName = "namespace1" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
getCampaignModel キャンペーンモデルを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 campaignModelName 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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . GetCampaignModel (
& serial_key . GetCampaignModelRequest {
NamespaceName : pointy . String ( "namespace1" ),
CampaignModelName : pointy . String ( "campaign-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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\GetCampaignModelRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getCampaignModel (
( new GetCampaignModelRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withCampaignModelName ( "campaign-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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.GetCampaignModelRequest ;
import io.gs2.serialKey.result.GetCampaignModelResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
GetCampaignModelResult result = client . getCampaignModel (
new GetCampaignModelRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
);
CampaignModel 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.GetCampaignModelRequest ;
using Gs2.Gs2SerialKey.Result.GetCampaignModelResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . GetCampaignModelResult > asyncResult = null ;
yield return client . GetCampaignModel (
new Gs2 . Gs2SerialKey . Request . GetCampaignModelRequest ()
. WithNamespaceName ( "namespace1" )
. WithCampaignModelName ( "campaign-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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . getCampaignModel (
new Gs2SerialKey . GetCampaignModelRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . get_campaign_model (
serial_key . GetCampaignModelRequest ()
. with_namespace_name ( self . hash1 )
. with_campaign_model_name ( 'campaign-0001' )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.get_campaign_model ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-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 ( 'serialKey' )
api_result_handler = client.get_campaign_model_async ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-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 ;
describeCampaignModelMasters キャンペーンモデルマスターの一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . DescribeCampaignModelMasters (
& serial_key . DescribeCampaignModelMastersRequest {
NamespaceName : pointy . String ( "namespace1" ),
PageToken : nil ,
Limit : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
items := result . Items
nextPageToken := result . NextPageToken
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\DescribeCampaignModelMastersRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> describeCampaignModelMasters (
( new DescribeCampaignModelMastersRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withPageToken ( null )
-> withLimit ( null )
);
$items = $result -> getItems ();
$nextPageToken = $result -> getNextPageToken ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.DescribeCampaignModelMastersRequest ;
import io.gs2.serialKey.result.DescribeCampaignModelMastersResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
DescribeCampaignModelMastersResult result = client . describeCampaignModelMasters (
new DescribeCampaignModelMastersRequest ()
. withNamespaceName ( "namespace1" )
. withPageToken ( null )
. withLimit ( null )
);
List < CampaignModelMaster > 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.DescribeCampaignModelMastersRequest ;
using Gs2.Gs2SerialKey.Result.DescribeCampaignModelMastersResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . DescribeCampaignModelMastersResult > asyncResult = null ;
yield return client . DescribeCampaignModelMasters (
new Gs2 . Gs2SerialKey . Request . DescribeCampaignModelMastersRequest ()
. WithNamespaceName ( "namespace1" )
. WithPageToken ( null )
. WithLimit ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var items = result . Items ;
var nextPageToken = result . NextPageToken ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . describeCampaignModelMasters (
new Gs2SerialKey . DescribeCampaignModelMastersRequest ()
. withNamespaceName ( "namespace1" )
. withPageToken ( null )
. withLimit ( null )
);
const items = result . getItems ();
const nextPageToken = result . getNextPageToken ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . describe_campaign_model_masters (
serial_key . DescribeCampaignModelMastersRequest ()
. with_namespace_name ( self . hash1 )
. with_page_token ( None )
. with_limit ( None )
)
items = result . items
next_page_token = result . next_page_token
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.describe_campaign_model_masters ({
namespaceName = "namespace1" ,
pageToken = nil ,
limit = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
client = gs2 ( 'serialKey' )
api_result_handler = client.describe_campaign_model_masters_async ({
namespaceName = "namespace1" ,
pageToken = nil ,
limit = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
nextPageToken = result.nextPageToken ;
createCampaignModelMaster キャンペーンモデルマスターを新規作成
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 name string ✓ ~ 128文字 キャンペーン名 description string ~ 1024文字 説明文 metadata string ~ 2048文字 メタデータ enableCampaignCode bool ✓ false キャンペーンコードでの引き換えを許可するか
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . CreateCampaignModelMaster (
& serial_key . CreateCampaignModelMasterRequest {
NamespaceName : pointy . String ( "namespace1" ),
Name : pointy . String ( "campaign-0001" ),
Description : nil ,
Metadata : nil ,
EnableCampaignCode : 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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\CreateCampaignModelMasterRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> createCampaignModelMaster (
( new CreateCampaignModelMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withName ( "campaign-0001" )
-> withDescription ( null )
-> withMetadata ( null )
-> withEnableCampaignCode ( 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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.CreateCampaignModelMasterRequest ;
import io.gs2.serialKey.result.CreateCampaignModelMasterResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
CreateCampaignModelMasterResult result = client . createCampaignModelMaster (
new CreateCampaignModelMasterRequest ()
. withNamespaceName ( "namespace1" )
. withName ( "campaign-0001" )
. withDescription ( null )
. withMetadata ( null )
. withEnableCampaignCode ( null )
);
CampaignModelMaster 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.CreateCampaignModelMasterRequest ;
using Gs2.Gs2SerialKey.Result.CreateCampaignModelMasterResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . CreateCampaignModelMasterResult > asyncResult = null ;
yield return client . CreateCampaignModelMaster (
new Gs2 . Gs2SerialKey . Request . CreateCampaignModelMasterRequest ()
. WithNamespaceName ( "namespace1" )
. WithName ( "campaign-0001" )
. WithDescription ( null )
. WithMetadata ( null )
. WithEnableCampaignCode ( 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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . createCampaignModelMaster (
new Gs2SerialKey . CreateCampaignModelMasterRequest ()
. withNamespaceName ( "namespace1" )
. withName ( "campaign-0001" )
. withDescription ( null )
. withMetadata ( null )
. withEnableCampaignCode ( null )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . create_campaign_model_master (
serial_key . CreateCampaignModelMasterRequest ()
. with_namespace_name ( self . hash1 )
. with_name ( 'campaign-0001' )
. with_description ( None )
. with_metadata ( None )
. with_enable_campaign_code ( None )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.create_campaign_model_master ({
namespaceName = "namespace1" ,
name = "campaign-0001" ,
description = nil ,
metadata = nil ,
enableCampaignCode = 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 ( 'serialKey' )
api_result_handler = client.create_campaign_model_master_async ({
namespaceName = "namespace1" ,
name = "campaign-0001" ,
description = nil ,
metadata = nil ,
enableCampaignCode = 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 ;
getCampaignModelMaster キャンペーンモデルマスターを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 campaignModelName 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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . GetCampaignModelMaster (
& serial_key . GetCampaignModelMasterRequest {
NamespaceName : pointy . String ( "namespace1" ),
CampaignModelName : pointy . String ( "campaign-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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\GetCampaignModelMasterRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getCampaignModelMaster (
( new GetCampaignModelMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withCampaignModelName ( "campaign-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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.GetCampaignModelMasterRequest ;
import io.gs2.serialKey.result.GetCampaignModelMasterResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
GetCampaignModelMasterResult result = client . getCampaignModelMaster (
new GetCampaignModelMasterRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
);
CampaignModelMaster 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.GetCampaignModelMasterRequest ;
using Gs2.Gs2SerialKey.Result.GetCampaignModelMasterResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . GetCampaignModelMasterResult > asyncResult = null ;
yield return client . GetCampaignModelMaster (
new Gs2 . Gs2SerialKey . Request . GetCampaignModelMasterRequest ()
. WithNamespaceName ( "namespace1" )
. WithCampaignModelName ( "campaign-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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . getCampaignModelMaster (
new Gs2SerialKey . GetCampaignModelMasterRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . get_campaign_model_master (
serial_key . GetCampaignModelMasterRequest ()
. with_namespace_name ( self . hash1 )
. with_campaign_model_name ( 'campaign-0001' )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.get_campaign_model_master ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-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 ( 'serialKey' )
api_result_handler = client.get_campaign_model_master_async ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-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 ;
updateCampaignModelMaster キャンペーンモデルマスターを更新
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 campaignModelName string ✓ ~ 128文字 キャンペーン名 description string ~ 1024文字 説明文 metadata string ~ 2048文字 メタデータ enableCampaignCode bool ✓ false キャンペーンコードでの引き換えを許可するか
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . UpdateCampaignModelMaster (
& serial_key . UpdateCampaignModelMasterRequest {
NamespaceName : pointy . String ( "namespace1" ),
CampaignModelName : pointy . String ( "campaign-0001" ),
Description : pointy . String ( "description1" ),
Metadata : pointy . String ( "{\"hoge\": \"fuga\"}" ),
EnableCampaignCode : 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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\UpdateCampaignModelMasterRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> updateCampaignModelMaster (
( new UpdateCampaignModelMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withCampaignModelName ( "campaign-0001" )
-> withDescription ( "description1" )
-> withMetadata ( "{ \" hoge \" : \" fuga \" }" )
-> withEnableCampaignCode ( 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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.UpdateCampaignModelMasterRequest ;
import io.gs2.serialKey.result.UpdateCampaignModelMasterResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
UpdateCampaignModelMasterResult result = client . updateCampaignModelMaster (
new UpdateCampaignModelMasterRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
. withDescription ( "description1" )
. withMetadata ( "{\"hoge\": \"fuga\"}" )
. withEnableCampaignCode ( null )
);
CampaignModelMaster 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.UpdateCampaignModelMasterRequest ;
using Gs2.Gs2SerialKey.Result.UpdateCampaignModelMasterResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . UpdateCampaignModelMasterResult > asyncResult = null ;
yield return client . UpdateCampaignModelMaster (
new Gs2 . Gs2SerialKey . Request . UpdateCampaignModelMasterRequest ()
. WithNamespaceName ( "namespace1" )
. WithCampaignModelName ( "campaign-0001" )
. WithDescription ( "description1" )
. WithMetadata ( "{\"hoge\": \"fuga\"}" )
. WithEnableCampaignCode ( 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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . updateCampaignModelMaster (
new Gs2SerialKey . UpdateCampaignModelMasterRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
. withDescription ( "description1" )
. withMetadata ( "{\"hoge\": \"fuga\"}" )
. withEnableCampaignCode ( null )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . update_campaign_model_master (
serial_key . UpdateCampaignModelMasterRequest ()
. with_namespace_name ( self . hash1 )
. with_campaign_model_name ( 'campaign-0001' )
. with_description ( 'description1' )
. with_metadata ( '{"hoge": "fuga"}' )
. with_enable_campaign_code ( None )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.update_campaign_model_master ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-0001" ,
description = "description1" ,
metadata = "{ \" hoge \" : \" fuga \" }" ,
enableCampaignCode = 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 ( 'serialKey' )
api_result_handler = client.update_campaign_model_master_async ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-0001" ,
description = "description1" ,
metadata = "{ \" hoge \" : \" fuga \" }" ,
enableCampaignCode = 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 ;
deleteCampaignModelMaster キャンペーンモデルマスターを削除
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 campaignModelName 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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . DeleteCampaignModelMaster (
& serial_key . DeleteCampaignModelMasterRequest {
NamespaceName : pointy . String ( "namespace1" ),
CampaignModelName : pointy . String ( "campaign-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\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\DeleteCampaignModelMasterRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> deleteCampaignModelMaster (
( new DeleteCampaignModelMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withCampaignModelName ( "campaign-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.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.DeleteCampaignModelMasterRequest ;
import io.gs2.serialKey.result.DeleteCampaignModelMasterResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
DeleteCampaignModelMasterResult result = client . deleteCampaignModelMaster (
new DeleteCampaignModelMasterRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
);
CampaignModelMaster 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.DeleteCampaignModelMasterRequest ;
using Gs2.Gs2SerialKey.Result.DeleteCampaignModelMasterResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . DeleteCampaignModelMasterResult > asyncResult = null ;
yield return client . DeleteCampaignModelMaster (
new Gs2 . Gs2SerialKey . Request . DeleteCampaignModelMasterRequest ()
. WithNamespaceName ( "namespace1" )
. WithCampaignModelName ( "campaign-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 Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . deleteCampaignModelMaster (
new Gs2SerialKey . DeleteCampaignModelMasterRequest ()
. withNamespaceName ( "namespace1" )
. withCampaignModelName ( "campaign-0001" )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . delete_campaign_model_master (
serial_key . DeleteCampaignModelMasterRequest ()
. with_namespace_name ( self . hash1 )
. with_campaign_model_name ( 'campaign-0001' )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.delete_campaign_model_master ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-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 ( 'serialKey' )
api_result_handler = client.delete_campaign_model_master_async ({
namespaceName = "namespace1" ,
campaignModelName = "campaign-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 ;
exportMaster 現在有効なキャンペーン設定のマスターデータをエクスポート
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . ExportMaster (
& serial_key . ExportMasterRequest {
NamespaceName : pointy . String ( "namespace1" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\ExportMasterRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> exportMaster (
( new ExportMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.ExportMasterRequest ;
import io.gs2.serialKey.result.ExportMasterResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
ExportMasterResult result = client . exportMaster (
new ExportMasterRequest ()
. withNamespaceName ( "namespace1" )
);
CurrentCampaignMaster 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.ExportMasterRequest ;
using Gs2.Gs2SerialKey.Result.ExportMasterResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . ExportMasterResult > asyncResult = null ;
yield return client . ExportMaster (
new Gs2 . Gs2SerialKey . Request . ExportMasterRequest ()
. WithNamespaceName ( "namespace1" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . exportMaster (
new Gs2SerialKey . ExportMasterRequest ()
. withNamespaceName ( "namespace1" )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . export_master (
serial_key . ExportMasterRequest ()
. with_namespace_name ( self . hash1 )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.export_master ({
namespaceName = "namespace1" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'serialKey' )
api_result_handler = client.export_master_async ({
namespaceName = "namespace1" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
getCurrentCampaignMaster 現在有効なキャンペーン設定を取得
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . GetCurrentCampaignMaster (
& serial_key . GetCurrentCampaignMasterRequest {
NamespaceName : pointy . String ( "namespace1" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\GetCurrentCampaignMasterRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getCurrentCampaignMaster (
( new GetCurrentCampaignMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.GetCurrentCampaignMasterRequest ;
import io.gs2.serialKey.result.GetCurrentCampaignMasterResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
GetCurrentCampaignMasterResult result = client . getCurrentCampaignMaster (
new GetCurrentCampaignMasterRequest ()
. withNamespaceName ( "namespace1" )
);
CurrentCampaignMaster 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.GetCurrentCampaignMasterRequest ;
using Gs2.Gs2SerialKey.Result.GetCurrentCampaignMasterResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . GetCurrentCampaignMasterResult > asyncResult = null ;
yield return client . GetCurrentCampaignMaster (
new Gs2 . Gs2SerialKey . Request . GetCurrentCampaignMasterRequest ()
. WithNamespaceName ( "namespace1" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . getCurrentCampaignMaster (
new Gs2SerialKey . GetCurrentCampaignMasterRequest ()
. withNamespaceName ( "namespace1" )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . get_current_campaign_master (
serial_key . GetCurrentCampaignMasterRequest ()
. with_namespace_name ( self . hash1 )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.get_current_campaign_master ({
namespaceName = "namespace1" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'serialKey' )
api_result_handler = client.get_current_campaign_master_async ({
namespaceName = "namespace1" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
updateCurrentCampaignMaster 現在有効なキャンペーン設定を更新
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 settings string ✓ ~ 5242880文字 マスターデータ
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . UpdateCurrentCampaignMaster (
& serial_key . UpdateCurrentCampaignMasterRequest {
NamespaceName : pointy . String ( "namespace1" ),
Settings : pointy . String ( "{\"version\": \"2022-09-13\", \"campaignModels\": [{\"name\": \"campaign-0001\", \"metadata\": \"CAMPAIGN_0001\", \"enableCampaignCode\": true, \"enableLimit\": false}]}" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\UpdateCurrentCampaignMasterRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> updateCurrentCampaignMaster (
( new UpdateCurrentCampaignMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withSettings ( "{ \" version \" : \" 2022-09-13 \" , \" campaignModels \" : [{ \" name \" : \" campaign-0001 \" , \" metadata \" : \" CAMPAIGN_0001 \" , \" enableCampaignCode \" : true, \" enableLimit \" : false}]}" )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.UpdateCurrentCampaignMasterRequest ;
import io.gs2.serialKey.result.UpdateCurrentCampaignMasterResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
UpdateCurrentCampaignMasterResult result = client . updateCurrentCampaignMaster (
new UpdateCurrentCampaignMasterRequest ()
. withNamespaceName ( "namespace1" )
. withSettings ( "{\"version\": \"2022-09-13\", \"campaignModels\": [{\"name\": \"campaign-0001\", \"metadata\": \"CAMPAIGN_0001\", \"enableCampaignCode\": true, \"enableLimit\": false}]}" )
);
CurrentCampaignMaster 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.UpdateCurrentCampaignMasterRequest ;
using Gs2.Gs2SerialKey.Result.UpdateCurrentCampaignMasterResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . UpdateCurrentCampaignMasterResult > asyncResult = null ;
yield return client . UpdateCurrentCampaignMaster (
new Gs2 . Gs2SerialKey . Request . UpdateCurrentCampaignMasterRequest ()
. WithNamespaceName ( "namespace1" )
. WithSettings ( "{\"version\": \"2022-09-13\", \"campaignModels\": [{\"name\": \"campaign-0001\", \"metadata\": \"CAMPAIGN_0001\", \"enableCampaignCode\": true, \"enableLimit\": false}]}" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . updateCurrentCampaignMaster (
new Gs2SerialKey . UpdateCurrentCampaignMasterRequest ()
. withNamespaceName ( "namespace1" )
. withSettings ( "{\"version\": \"2022-09-13\", \"campaignModels\": [{\"name\": \"campaign-0001\", \"metadata\": \"CAMPAIGN_0001\", \"enableCampaignCode\": true, \"enableLimit\": false}]}" )
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . update_current_campaign_master (
serial_key . UpdateCurrentCampaignMasterRequest ()
. with_namespace_name ( self . hash1 )
. with_settings ( '{"version": "2022-09-13", "campaignModels": [{"name": "campaign-0001", "metadata": "CAMPAIGN_0001", "enableCampaignCode": true, "enableLimit": false}]}' )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.update_current_campaign_master ({
namespaceName = "namespace1" ,
settings = "{ \" version \" : \" 2022-09-13 \" , \" campaignModels \" : [{ \" name \" : \" campaign-0001 \" , \" metadata \" : \" CAMPAIGN_0001 \" , \" enableCampaignCode \" : true, \" enableLimit \" : false}]}" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'serialKey' )
api_result_handler = client.update_current_campaign_master_async ({
namespaceName = "namespace1" ,
settings = "{ \" version \" : \" 2022-09-13 \" , \" campaignModels \" : [{ \" name \" : \" campaign-0001 \" , \" metadata \" : \" CAMPAIGN_0001 \" , \" enableCampaignCode \" : true, \" enableLimit \" : 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 ;
updateCurrentCampaignMasterFromGitHub 現在有効なキャンペーン設定を更新
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 checkoutSetting GitHubCheckoutSetting ✓ GitHubからマスターデータをチェックアウトしてくる設定
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/serial_key"
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 := serial_key . Gs2SerialKeyRestClient {
Session : & session ,
}
result , err := client . UpdateCurrentCampaignMasterFromGitHub (
& serial_key . UpdateCurrentCampaignMasterFromGitHubRequest {
NamespaceName : pointy . String ( "namespace1" ),
CheckoutSetting : & serialKey . GitHubCheckoutSetting {
ApiKeyId : pointy . String ( "$gitHubApiKey1.apiKeyId" ),
RepositoryName : pointy . String ( "gs2io/master-data" ),
SourcePath : pointy . String ( "path/to/file.json" ),
ReferenceType : pointy . String ( "branch" ),
BranchName : pointy . String ( "develop" ),
},
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\SerialKey\Gs2SerialKeyRestClient ;
use Gs2\SerialKey\Request\UpdateCurrentCampaignMasterFromGitHubRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> updateCurrentCampaignMasterFromGitHub (
( new UpdateCurrentCampaignMasterFromGitHubRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withCheckoutSetting (( new GitHubCheckoutSetting ())
-> withApiKeyId ( self :: $gitHubApiKey1 . apiKeyId )
-> withRepositoryName ( "gs2io/master-data" )
-> withSourcePath ( "path/to/file.json" )
-> withReferenceType ( "branch" )
-> withBranchName ( "develop" )
)
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient ;
import io.gs2.serialKey.request.UpdateCurrentCampaignMasterFromGitHubRequest ;
import io.gs2.serialKey.result.UpdateCurrentCampaignMasterFromGitHubResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient ( session );
try {
UpdateCurrentCampaignMasterFromGitHubResult result = client . updateCurrentCampaignMasterFromGitHub (
new UpdateCurrentCampaignMasterFromGitHubRequest ()
. withNamespaceName ( "namespace1" )
. withCheckoutSetting ( new GitHubCheckoutSetting ()
. withApiKeyId ( "$gitHubApiKey1.apiKeyId" )
. withRepositoryName ( "gs2io/master-data" )
. withSourcePath ( "path/to/file.json" )
. withReferenceType ( "branch" )
. withBranchName ( "develop" )
)
);
CurrentCampaignMaster 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.Gs2SerialKey.Gs2SerialKeyRestClient ;
using Gs2.Gs2SerialKey.Request.UpdateCurrentCampaignMasterFromGitHubRequest ;
using Gs2.Gs2SerialKey.Result.UpdateCurrentCampaignMasterFromGitHubResult ;
var session = new Gs2RestSession (
new BasicGs2Credential (
' your client id ' ,
' your client secret '
),
Region . ApNortheast1
);
yield return session . Open ();
var client = new Gs2SerialKeyRestClient ( session );
AsyncResult < Gs2 . Gs2SerialKey . Result . UpdateCurrentCampaignMasterFromGitHubResult > asyncResult = null ;
yield return client . UpdateCurrentCampaignMasterFromGitHub (
new Gs2 . Gs2SerialKey . Request . UpdateCurrentCampaignMasterFromGitHubRequest ()
. WithNamespaceName ( "namespace1" )
. WithCheckoutSetting ( new Gs2 . Gs2SerialKey . Model . GitHubCheckoutSetting ()
. WithApiKeyId ( "$gitHubApiKey1.apiKeyId" )
. WithRepositoryName ( "gs2io/master-data" )
. WithSourcePath ( "path/to/file.json" )
. WithReferenceType ( "branch" )
. WithBranchName ( "develop" )
),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as Gs2SerialKey from '@/gs2/serialKey' ;
const session = new Gs2Core . Gs2RestSession (
"ap-northeast-1" ,
new Gs2Core . BasicGs2Credential (
'your client id' ,
'your client secret'
)
);
await session . connect ();
const client = new Gs2SerialKey . Gs2SerialKeyRestClient ( session );
try {
const result = await client . updateCurrentCampaignMasterFromGitHub (
new Gs2SerialKey . UpdateCurrentCampaignMasterFromGitHubRequest ()
. withNamespaceName ( "namespace1" )
. withCheckoutSetting ( new Gs2SerialKey . model . GitHubCheckoutSetting ()
. withApiKeyId ( "$gitHubApiKey1.apiKeyId" )
. withRepositoryName ( "gs2io/master-data" )
. withSourcePath ( "path/to/file.json" )
. withReferenceType ( "branch" )
. withBranchName ( "develop" )
)
);
const item = result . getItem ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import serial_key
session = core . Gs2RestSession (
core . BasicGs2Credential (
'your client id' ,
'your client secret'
),
"ap-northeast-1" ,
)
session . connect ()
client = serial_key . Gs2SerialKeyRestClient ( session )
try :
result = client . update_current_campaign_master_from_git_hub (
serial_key . UpdateCurrentCampaignMasterFromGitHubRequest ()
. with_namespace_name ( self . hash1 )
. with_checkout_setting ( serial_key . GitHubCheckoutSetting ()
. with_api_key_id ( self . git_hub_api_key1 . api_key_id )
. with_repository_name ( 'gs2io/master-data' )
. with_source_path ( 'path/to/file.json' )
. with_reference_type ( 'branch' )
. with_branch_name ( 'develop' )
)
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'serialKey' )
api_result = client.update_current_campaign_master_from_git_hub ({
namespaceName = "namespace1" ,
checkoutSetting = {
api_key_id = "$gitHubApiKey1.apiKeyId" ,
repository_name = "gs2io/master-data" ,
source_path = "path/to/file.json" ,
reference_type = "branch" ,
branch_name = "develop" ,
},
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'serialKey' )
api_result_handler = client.update_current_campaign_master_from_git_hub_async ({
namespaceName = "namespace1" ,
checkoutSetting = {
api_key_id = "$gitHubApiKey1.apiKeyId" ,
repository_name = "gs2io/master-data" ,
source_path = "path/to/file.json" ,
reference_type = "branch" ,
branch_name = "develop" ,
},
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;