GS2-Grade SDK API リファレンス
モデル
Namespace
ネームスペース
ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。
GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceId | string | ✓ | ~ 1024文字 | ネームスペースGRN | ||
name | string | ✓ | ~ 128文字 | ネームスペース名 | ||
description | string | ~ 1024文字 | 説明文 | |||
transactionSetting | TransactionSetting | トランザクション設定 | ||||
changeGradeScript | ScriptSetting | グレード変化したときに実行するスクリプト | ||||
logSetting | LogSetting | ログの出力設定 | ||||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
GradeModelMaster
グレードモデルマスター
グレードモデルとは、ランクアップに必要なグレードの閾値や、デフォルトのランクキャップ・最大ランクキャップ毎に設定するエンティティです。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
gradeModelId | string | ✓ | ~ 1024文字 | グレードモデルマスターGRN | ||
name | string | ✓ | ~ 128文字 | グレードモデル名 | ||
description | string | ~ 1024文字 | 説明文 | |||
metadata | string | ~ 2048文字 | メタデータ | |||
defaultGrades | List<DefaultGradeModel> | ~ 100 items | デフォルトグレードモデルリスト | |||
experienceModelId | string | ✓ | ~ 1024文字 | グレードとランクキャップを連動させる経験値モデルGRN | ||
gradeEntries | List<GradeEntryModel> | ~ 100 items | グレードエントリリスト | |||
acquireActionRates | List<AcquireActionRate> | ~ 100 items | 報酬加算テーブルリスト | |||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
GradeModel
グレードモデル
グレードとは、キャラクターや装備のランクを示すエンティティで、グレードによって GS2-Experience のランクキャップを設定することができます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
gradeModelId | string | ✓ | ~ 1024文字 | グレードモデルGRN | ||
name | string | ✓ | ~ 128文字 | グレードモデル名 | ||
metadata | string | ~ 2048文字 | メタデータ | |||
defaultGrades | List<DefaultGradeModel> | ~ 100 items | デフォルトグレードモデルリスト | |||
experienceModelId | string | ✓ | ~ 1024文字 | グレードとランクキャップを連動させる経験値モデルGRN | ||
gradeEntries | List<GradeEntryModel> | ✓ | 1 ~ 100 items | グレードエントリリスト | ||
acquireActionRates | List<AcquireActionRate> | ~ 100 items | 報酬加算テーブルリスト |
Status
ステータス
ステータスとはプロパティID毎に存在するエンティティで、
現在のグレードの値を保持します。
プロパティID とはステータス固有のIDで、開発者が任意の値を設定できます。
連動する GS2-Experience のプロパティIDと完全に一致する値を使用することを強く推奨しています。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
statusId | string | ✓ | ~ 1024文字 | ステータスGRN | ||
gradeName | string | ✓ | ~ 128文字 | グレードモデルの名前 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
propertyId | string | ✓ | ~ 1024文字 | プロパティID | ||
gradeValue | long | ✓ | 1 | 1 ~ 9223372036854775805 | 現在のグレード | |
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
DefaultGradeModel
デフォルトグレードモデル
グレードを新規作成する際にプロパティIDの正規表現へのマッチに応じてデフォルトのグレード値を設定することができます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
propertyIdRegex | string | ✓ | ~ 1024文字 | デフォルト値を適用するプロパティIDの正規表現 | ||
defaultGradeValue | long | ✓ | ~ 9223372036854775805 | デフォルトのグレード値 |
GradeEntryModel
グレードエントリ
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
metadata | string | ~ 2048文字 | メタデータ | |||
rankCapValue | long | ✓ | ~ 9223372036854775805 | GS2-Experience に設定するランクキャップ値 | ||
propertyIdRegex | string | ✓ | ~ 1024文字 | プロパティIDからグレードアップに使用可能なリソースを特定するための変数を取り出すための正規表現 | ||
gradeUpPropertyIdRegex | string | ✓ | ~ 1024文字 | グレードアップに利用可能なリソースのプロパティIDの正規表現 |
AcquireActionRate
報酬加算テーブルマスター
グレードに応じて報酬の量を調整することができます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
name | string | ✓ | ~ 128文字 | 報酬加算テーブル名 | ||
mode | enum { “double”, “big” } | ✓ | “double” | ~ 128文字 | 報酬加算テーブルの種類 | |
rates | List<double> | {mode} == “double” | ✓ | 1 ~ 1000 items | グレードごとの加算量(倍率) | |
bigRates | List<string> | {mode} == “big” | ✓ | 1 ~ 1000 items | グレードごとの加算量(倍率) |
mode に指定する列挙型の定義
定義 | 説明 |
---|---|
double | 2^48 未満の浮動小数点数 |
big | 文字列表記で1024桁未満の浮動小数点数 |
CurrentGradeMaster
現在有効なマスターデータ
GS2ではマスターデータの管理にJSON形式のファイルを使用します。
ファイルをアップロードすることで、実際にサーバーに設定を反映することができます。
JSONファイルを作成する方法として、マネージメントコンソール上でのマスターデータエディタを提供していますが
よりゲームの運営に相応しいツールを作成し、適切なフォーマットのJSONファイルを書き出すことでもサービスを利用可能です。
Note
JSONファイルの形式については GS2-Grade マスターデータリファレンス をご参照ください。型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceId | string | ✓ | ~ 1024文字 | 現在有効なグレード設定GRN | ||
settings | string | ✓ | ~ 5242880文字 | マスターデータ |
AcquireAction
入手アクション
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 | タグ |
ScriptSetting
スクリプト設定
GS2 ではマイクロサービスのイベントに関連づけて、カスタムスクリプトを実行することができます。
このモデルは、スクリプトの実行をトリガーするための設定を保持します。
スクリプトの実行方式は大きく2種類あり、それは「同期実行」と「非同期実行」です。
同期実行は、スクリプトの実行が完了するまで処理がブロックされます。
かわりに、スクリプトの実行結果を使ってAPIの実行を止めたり、APIの結果を改ざんすることができます。
一方、非同期実行は、スクリプトの実行が完了するまで処理がブロックされません。
かわりに、スクリプトの実行結果を使ってAPIの実行を止めたり、APIの結果を改ざんすることはできません。
しかし、非同期実行は、スクリプトの実行が完了するまで処理がブロックされないため、APIの応答に影響を与えないため、原則非同期実行を使用することをおすすめします。
非同期実行には実行方式が2種類あり、GS2-Script と Amazon EventBridge があります。
Amazon EventBridge を使用することで、Lua 以外の言語で処理を記述することができます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
triggerScriptId | string | ~ 1024文字 | スクリプトGRN | |||
doneTriggerTargetType | enum { “none”, “gs2_script”, “aws” } | ✓ | “none” | ~ 128文字 | 完了通知の通知先 | |
doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024文字 | スクリプトGRN | ||
doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024文字 | ネームスペースGRN |
doneTriggerTargetType に指定する列挙型の定義
定義 | 説明 |
---|---|
none | なし |
gs2_script | GS2-Script |
aws | Amazon EventBridge |
LogSetting
ログの書き出し設定
ログデータの書き出し設定を管理します。この型は、ログデータを書き出すために使用されるログ名前空間の識別子(Namespace ID)を保持します。
ログ名前空間IDは、ログデータを集約し、保存する対象の GS2-Log の名前空間を指定します。
この設定を通じて、この名前空間以下のAPIリクエスト・レスポンスログデータが対象の GS2-Log へ出力されるようになります。
GS2-Log にはリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
loggingNamespaceId | string | ✓ | ~ 1024文字 | ネームスペースGRN |
TransactionSetting
トランザクション設定
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
enableAutoRun | bool | ✓ | false | 発行したトランザクションをサーバーサイドで自動的に実行するか | ||
distributorNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024文字 | トランザクションの実行に使用する GS2-Distributor ネームスペース | |
queueNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024文字 | トランザクションの実行に使用する GS2-JobQueue のネームスペース |
メソッド
describeNamespaces
ネームスペースの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | List<Namespace> | ネームスペースのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DescribeNamespacesRequest;
import io.gs2.grade.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DescribeNamespacesRequest;
using Gs2.Gs2Grade.Result.DescribeNamespacesResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2Grade.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 grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.describe_namespaces(
grade.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('grade')
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('grade')
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文字 | 説明文 | |||
transactionSetting | TransactionSetting | トランザクション設定 | ||||
changeGradeScript | ScriptSetting | グレード変化したときに実行するスクリプト | ||||
logSetting | LogSetting | ログの出力設定 |
Result
型 | 説明 | |
---|---|---|
item | Namespace | 作成したネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&grade.CreateNamespaceRequest {
Name: pointy.String("namespace1"),
Description: nil,
TransactionSetting: nil,
ChangeGradeScript: nil,
LogSetting: &grade.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Grade\Gs2GradeRestClient;
use Gs2\Grade\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)
->withTransactionSetting(null)
->withChangeGradeScript(null)
->withLogSetting((new \Gs2\Grade\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.CreateNamespaceRequest;
import io.gs2.grade.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withTransactionSetting(null)
.withChangeGradeScript(null)
.withLogSetting(new io.gs2.grade.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.CreateNamespaceRequest;
using Gs2.Gs2Grade.Result.CreateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Grade.Request.CreateNamespaceRequest()
.WithName("namespace1")
.WithDescription(null)
.WithTransactionSetting(null)
.WithChangeGradeScript(null)
.WithLogSetting(new Gs2.Gs2Grade.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.createNamespace(
new Gs2Grade.CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withTransactionSetting(null)
.withChangeGradeScript(null)
.withLogSetting(new Gs2Grade.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.create_namespace(
grade.CreateNamespaceRequest()
.with_name(self.hash1)
.with_description(None)
.with_transaction_setting(None)
.with_change_grade_script(None)
.with_log_setting(
grade.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('grade')
api_result = client.create_namespace({
name="namespace1",
description=nil,
transactionSetting=nil,
changeGradeScript=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('grade')
api_result_handler = client.create_namespace_async({
name="namespace1",
description=nil,
transactionSetting=nil,
changeGradeScript=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getNamespaceStatus
ネームスペースの状態を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
status | string |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.GetNamespaceStatusRequest;
import io.gs2.grade.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Grade.Result.GetNamespaceStatusResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2Grade.GetNamespaceStatusRequest()
.withNamespaceName("namespace1")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.get_namespace_status(
grade.GetNamespaceStatusRequest()
.with_namespace_name(self.hash1)
)
status = result.status
except core.Gs2Exception as e:
exit(1)
client = gs2('grade')
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('grade')
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
型 | 説明 | |
---|---|---|
item | Namespace | ネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.GetNamespaceRequest;
import io.gs2.grade.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.GetNamespaceRequest;
using Gs2.Gs2Grade.Result.GetNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.getNamespace(
new Gs2Grade.GetNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.get_namespace(
grade.GetNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('grade')
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('grade')
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文字 | 説明文 | |||
transactionSetting | TransactionSetting | トランザクション設定 | ||||
changeGradeScript | ScriptSetting | グレード変化したときに実行するスクリプト | ||||
logSetting | LogSetting | ログの出力設定 |
Result
型 | 説明 | |
---|---|---|
item | Namespace | 更新したネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&grade.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
Description: pointy.String("description1"),
TransactionSetting: nil,
ChangeGradeScript: &grade.ScriptSetting{
TriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002"),
DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003"),
},
LogSetting: &grade.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Grade\Gs2GradeRestClient;
use Gs2\Grade\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")
->withTransactionSetting(null)
->withChangeGradeScript((new \Gs2\Grade\Model\ScriptSetting())
->withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:\namespace1:script:script-1002")
->withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:\namespace1:script:script-1003"))
->withLogSetting((new \Gs2\Grade\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.UpdateNamespaceRequest;
import io.gs2.grade.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withTransactionSetting(null)
.withChangeGradeScript(new io.gs2.grade.model.ScriptSetting()
.withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002")
.withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003"))
.withLogSetting(new io.gs2.grade.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.UpdateNamespaceRequest;
using Gs2.Gs2Grade.Result.UpdateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Grade.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace1")
.WithDescription("description1")
.WithTransactionSetting(null)
.WithChangeGradeScript(new Gs2.Gs2Grade.Model.ScriptSetting()
.WithTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002")
.WithDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003"))
.WithLogSetting(new Gs2.Gs2Grade.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2Grade.UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withTransactionSetting(null)
.withChangeGradeScript(new Gs2Grade.model.ScriptSetting()
.withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002")
.withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003"))
.withLogSetting(new Gs2Grade.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.update_namespace(
grade.UpdateNamespaceRequest()
.with_namespace_name(self.hash1)
.with_description('description1')
.with_transaction_setting(None)
.with_change_grade_script(
grade.ScriptSetting()
.with_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002')
.with_done_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003'))
.with_log_setting(
grade.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('grade')
api_result = client.update_namespace({
namespaceName="namespace1",
description="description1",
transactionSetting=nil,
changeGradeScript={
triggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002",
doneTriggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003",
},
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('grade')
api_result_handler = client.update_namespace_async({
namespaceName="namespace1",
description="description1",
transactionSetting=nil,
changeGradeScript={
triggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002",
doneTriggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003",
},
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
deleteNamespace
ネームスペースを削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
item | Namespace | 削除したネームスペース |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DeleteNamespaceRequest;
import io.gs2.grade.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DeleteNamespaceRequest;
using Gs2.Gs2Grade.Result.DeleteNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2Grade.DeleteNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.delete_namespace(
grade.DeleteNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('grade')
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('grade')
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
型 | 説明 |
---|
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.DumpUserDataByUserId(
&grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DumpUserDataByUserIdRequest;
import io.gs2.grade.result.DumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DumpUserDataByUserIdRequest;
using Gs2.Gs2Grade.Result.DumpUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.dumpUserDataByUserId(
new Gs2Grade.DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.dump_user_data_by_user_id(
grade.DumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('grade')
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('grade')
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
型 | 説明 | |
---|---|---|
url | string | 出力データのURL |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
&grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.grade.result.CheckDumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.CheckDumpUserDataByUserIdRequest;
using Gs2.Gs2Grade.Result.CheckDumpUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.checkDumpUserDataByUserId(
new Gs2Grade.CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.check_dump_user_data_by_user_id(
grade.CheckDumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)
client = gs2('grade')
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('grade')
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
型 | 説明 |
---|
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.CleanUserDataByUserId(
&grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.CleanUserDataByUserIdRequest;
import io.gs2.grade.result.CleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.CleanUserDataByUserIdRequest;
using Gs2.Gs2Grade.Result.CleanUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.cleanUserDataByUserId(
new Gs2Grade.CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.clean_user_data_by_user_id(
grade.CleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('grade')
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('grade')
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
型 | 説明 |
---|
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
&grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.grade.result.CheckCleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.CheckCleanUserDataByUserIdRequest;
using Gs2.Gs2Grade.Result.CheckCleanUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.checkCleanUserDataByUserId(
new Gs2Grade.CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.check_clean_user_data_by_user_id(
grade.CheckCleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('grade')
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('grade')
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 |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
&grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.grade.result.PrepareImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.PrepareImportUserDataByUserIdRequest;
using Gs2.Gs2Grade.Result.PrepareImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.prepareImportUserDataByUserId(
new Gs2Grade.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 grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.prepare_import_user_data_by_user_id(
grade.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('grade')
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('grade')
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
型 | 説明 |
---|
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.ImportUserDataByUserId(
&grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.ImportUserDataByUserIdRequest;
import io.gs2.grade.result.ImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.ImportUserDataByUserIdRequest;
using Gs2.Gs2Grade.Result.ImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.importUserDataByUserId(
new Gs2Grade.ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.import_user_data_by_user_id(
grade.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('grade')
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('grade')
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
型 | 説明 | |
---|---|---|
url | string | 出力ログのURL |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
&grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.CheckImportUserDataByUserIdRequest;
import io.gs2.grade.result.CheckImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.CheckImportUserDataByUserIdRequest;
using Gs2.Gs2Grade.Result.CheckImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.checkImportUserDataByUserId(
new Gs2Grade.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 grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.check_import_user_data_by_user_id(
grade.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('grade')
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('grade')
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;
describeGradeModelMasters
グレードモデルマスターの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | List<GradeModelMaster> | グレードモデルマスターのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.DescribeGradeModelMasters(
&grade.DescribeGradeModelMastersRequest {
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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\DescribeGradeModelMastersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeGradeModelMasters(
(new DescribeGradeModelMastersRequest())
->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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DescribeGradeModelMastersRequest;
import io.gs2.grade.result.DescribeGradeModelMastersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(session);
try {
DescribeGradeModelMastersResult result = client.describeGradeModelMasters(
new DescribeGradeModelMastersRequest()
.withNamespaceName("namespace1")
.withPageToken(null)
.withLimit(null)
);
List<GradeModelMaster> 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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DescribeGradeModelMastersRequest;
using Gs2.Gs2Grade.Result.DescribeGradeModelMastersResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.DescribeGradeModelMastersResult> asyncResult = null;
yield return client.DescribeGradeModelMasters(
new Gs2.Gs2Grade.Request.DescribeGradeModelMastersRequest()
.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 Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.describeGradeModelMasters(
new Gs2Grade.DescribeGradeModelMastersRequest()
.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 grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.describe_grade_model_masters(
grade.DescribeGradeModelMastersRequest()
.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('grade')
api_result = client.describe_grade_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('grade')
api_result_handler = client.describe_grade_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;
createGradeModelMaster
グレードモデルマスターを新規作成
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
name | string | ✓ | ~ 128文字 | グレードモデル名 | ||
description | string | ~ 1024文字 | 説明文 | |||
metadata | string | ~ 2048文字 | メタデータ | |||
defaultGrades | List<DefaultGradeModel> | ~ 100 items | デフォルトグレードモデルリスト | |||
experienceModelId | string | ✓ | ~ 1024文字 | グレードとランクキャップを連動させる経験値モデルGRN | ||
gradeEntries | List<GradeEntryModel> | ~ 100 items | グレードエントリリスト | |||
acquireActionRates | List<AcquireActionRate> | ~ 100 items | 報酬加算テーブルリスト |
Result
型 | 説明 | |
---|---|---|
item | GradeModelMaster | 作成したグレードモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.CreateGradeModelMaster(
&grade.CreateGradeModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
Name: pointy.String("grade-model-0001"),
Description: nil,
Metadata: nil,
DefaultGrades: []grade.DefaultGradeModel{
grade.DefaultGradeModel{
PropertyIdRegex: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*"),
DefaultGradeValue: pointy.Int64(2),
},
},
ExperienceModelId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001"),
GradeEntries: []grade.GradeEntryModel{
grade.GradeEntryModel{
Metadata: pointy.String("GRADE_ENTRY_METADATA"),
RankCapValue: pointy.Int64(50),
PropertyIdRegex: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*"),
GradeUpPropertyIdRegex: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*"),
},
},
AcquireActionRates: []grade.AcquireActionRate{
grade.AcquireActionRate{
Name: pointy.String("rate-0001"),
Rates: []*float64{
pointy.Float64(1.0),
pointy.Float64(1.5),
pointy.Float64(2.0),
},
},
grade.AcquireActionRate{
Name: pointy.String("rate-0002"),
Rates: []*float64{
pointy.Float64(10.0),
pointy.Float64(15.5),
pointy.Float64(20.0),
},
},
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\CreateGradeModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createGradeModelMaster(
(new CreateGradeModelMasterRequest())
->withNamespaceName(self::namespace1)
->withName("grade-model-0001")
->withDescription(null)
->withMetadata(null)
->withDefaultGrades([
(new \Gs2\Grade\Model\DefaultGradeModel())
->withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*")
->withDefaultGradeValue(2),
])
->withExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
->withGradeEntries([
(new \Gs2\Grade\Model\GradeEntryModel())
->withMetadata("GRADE_ENTRY_METADATA")
->withRankCapValue(50)
->withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*")
->withGradeUpPropertyIdRegex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*'),
])
->withAcquireActionRates([
(new \Gs2\Grade\Model\AcquireActionRate())
->withName("rate-0001")
->withRates([
1.0,
1.5,
2.0,
]),
(new \Gs2\Grade\Model\AcquireActionRate())
->withName("rate-0002")
->withRates([
10.0,
15.5,
20.0,
]),
])
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.CreateGradeModelMasterRequest;
import io.gs2.grade.result.CreateGradeModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(session);
try {
CreateGradeModelMasterResult result = client.createGradeModelMaster(
new CreateGradeModelMasterRequest()
.withNamespaceName("namespace1")
.withName("grade-model-0001")
.withDescription(null)
.withMetadata(null)
.withDefaultGrades(Arrays.asList(
new io.gs2.grade.model.DefaultGradeModel()
.withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*")
.withDefaultGradeValue(2L)
))
.withExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
.withGradeEntries(Arrays.asList(
new io.gs2.grade.model.GradeEntryModel()
.withMetadata("GRADE_ENTRY_METADATA")
.withRankCapValue(50L)
.withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*")
.withGradeUpPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*")
))
.withAcquireActionRates(Arrays.asList(
new io.gs2.grade.model.AcquireActionRate()
.withName("rate-0001")
.withRates(Arrays.asList(
1.0,
1.5,
2.0
)),
new io.gs2.grade.model.AcquireActionRate()
.withName("rate-0002")
.withRates(Arrays.asList(
10.0,
15.5,
20.0
))
))
);
GradeModelMaster 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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.CreateGradeModelMasterRequest;
using Gs2.Gs2Grade.Result.CreateGradeModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.CreateGradeModelMasterResult> asyncResult = null;
yield return client.CreateGradeModelMaster(
new Gs2.Gs2Grade.Request.CreateGradeModelMasterRequest()
.WithNamespaceName("namespace1")
.WithName("grade-model-0001")
.WithDescription(null)
.WithMetadata(null)
.WithDefaultGrades(new Gs2.Gs2Grade.Model.DefaultGradeModel[] {
new Gs2.Gs2Grade.Model.DefaultGradeModel()
.WithPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*")
.WithDefaultGradeValue(2L),
})
.WithExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
.WithGradeEntries(new Gs2.Gs2Grade.Model.GradeEntryModel[] {
new Gs2.Gs2Grade.Model.GradeEntryModel()
.WithMetadata("GRADE_ENTRY_METADATA")
.WithRankCapValue(50L)
.WithPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*")
.WithGradeUpPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*"),
})
.WithAcquireActionRates(new Gs2.Gs2Grade.Model.AcquireActionRate[] {
new Gs2.Gs2Grade.Model.AcquireActionRate()
.WithName("rate-0001")
.WithRates(new double[] {
1.0,
1.5,
2.0,
}),
new Gs2.Gs2Grade.Model.AcquireActionRate()
.WithName("rate-0002")
.WithRates(new double[] {
10.0,
15.5,
20.0,
}),
}),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.createGradeModelMaster(
new Gs2Grade.CreateGradeModelMasterRequest()
.withNamespaceName("namespace1")
.withName("grade-model-0001")
.withDescription(null)
.withMetadata(null)
.withDefaultGrades([
new Gs2Grade.model.DefaultGradeModel()
.withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*")
.withDefaultGradeValue(2),
])
.withExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
.withGradeEntries([
new Gs2Grade.model.GradeEntryModel()
.withMetadata("GRADE_ENTRY_METADATA")
.withRankCapValue(50)
.withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*")
.withGradeUpPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*"),
])
.withAcquireActionRates([
new Gs2Grade.model.AcquireActionRate()
.withName("rate-0001")
.withRates([
1.0,
1.5,
2.0,
]),
new Gs2Grade.model.AcquireActionRate()
.withName("rate-0002")
.withRates([
10.0,
15.5,
20.0,
]),
])
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.create_grade_model_master(
grade.CreateGradeModelMasterRequest()
.with_namespace_name(self.hash1)
.with_name('grade-model-0001')
.with_description(None)
.with_metadata(None)
.with_default_grades([
grade.DefaultGradeModel()
.with_property_id_regex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*')
.with_default_grade_value(2),
])
.with_experience_model_id('grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001')
.with_grade_entries([
grade.GradeEntryModel()
.with_metadata('GRADE_ENTRY_METADATA')
.with_rank_cap_value(50)
.with_property_id_regex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*')
.with_grade_up_property_id_regex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*'),
])
.with_acquire_action_rates([
grade.AcquireActionRate()
.with_name('rate-0001')
.with_rates([
1.0,
1.5,
2.0,
]),
grade.AcquireActionRate()
.with_name('rate-0002')
.with_rates([
10.0,
15.5,
20.0,
]),
])
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('grade')
api_result = client.create_grade_model_master({
namespaceName="namespace1",
name="grade-model-0001",
description=nil,
metadata=nil,
defaultGrades={
{
propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*",
defaultGradeValue=2,
}
},
experienceModelId="grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001",
gradeEntries={
{
metadata="GRADE_ENTRY_METADATA",
rankCapValue=50,
propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*",
gradeUpPropertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*",
}
},
acquireActionRates={
{
name="rate-0001",
rates={
1.0,
1.5,
2.0
},
},
{
name="rate-0002",
rates={
10.0,
15.5,
20.0
},
}
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('grade')
api_result_handler = client.create_grade_model_master_async({
namespaceName="namespace1",
name="grade-model-0001",
description=nil,
metadata=nil,
defaultGrades={
{
propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*",
defaultGradeValue=2,
}
},
experienceModelId="grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001",
gradeEntries={
{
metadata="GRADE_ENTRY_METADATA",
rankCapValue=50,
propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*",
gradeUpPropertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*",
}
},
acquireActionRates={
{
name="rate-0001",
rates={
1.0,
1.5,
2.0
},
},
{
name="rate-0002",
rates={
10.0,
15.5,
20.0
},
}
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getGradeModelMaster
グレードモデルマスターを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
gradeName | string | ✓ | ~ 128文字 | グレードモデル名 |
Result
型 | 説明 | |
---|---|---|
item | GradeModelMaster | グレードモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.GetGradeModelMaster(
&grade.GetGradeModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
GradeName: pointy.String("grade-model-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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\GetGradeModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getGradeModelMaster(
(new GetGradeModelMasterRequest())
->withNamespaceName(self::namespace1)
->withGradeName("grade-model-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.GetGradeModelMasterRequest;
import io.gs2.grade.result.GetGradeModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(session);
try {
GetGradeModelMasterResult result = client.getGradeModelMaster(
new GetGradeModelMasterRequest()
.withNamespaceName("namespace1")
.withGradeName("grade-model-0001")
);
GradeModelMaster 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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.GetGradeModelMasterRequest;
using Gs2.Gs2Grade.Result.GetGradeModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.GetGradeModelMasterResult> asyncResult = null;
yield return client.GetGradeModelMaster(
new Gs2.Gs2Grade.Request.GetGradeModelMasterRequest()
.WithNamespaceName("namespace1")
.WithGradeName("grade-model-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.getGradeModelMaster(
new Gs2Grade.GetGradeModelMasterRequest()
.withNamespaceName("namespace1")
.withGradeName("grade-model-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.get_grade_model_master(
grade.GetGradeModelMasterRequest()
.with_namespace_name(self.hash1)
.with_grade_name('grade-model-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('grade')
api_result = client.get_grade_model_master({
namespaceName="namespace1",
gradeName="grade-model-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('grade')
api_result_handler = client.get_grade_model_master_async({
namespaceName="namespace1",
gradeName="grade-model-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateGradeModelMaster
グレードモデルマスターを更新
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
gradeName | string | ✓ | ~ 128文字 | グレードモデル名 | ||
description | string | ~ 1024文字 | 説明文 | |||
metadata | string | ~ 2048文字 | メタデータ | |||
defaultGrades | List<DefaultGradeModel> | ~ 100 items | デフォルトグレードモデルリスト | |||
experienceModelId | string | ✓ | ~ 1024文字 | グレードとランクキャップを連動させる経験値モデルGRN | ||
gradeEntries | List<GradeEntryModel> | ~ 100 items | グレードエントリリスト | |||
acquireActionRates | List<AcquireActionRate> | ~ 100 items | 報酬加算テーブルリスト |
Result
型 | 説明 | |
---|---|---|
item | GradeModelMaster | 更新したグレードモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.UpdateGradeModelMaster(
&grade.UpdateGradeModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
GradeName: pointy.String("grade-model-0001"),
Description: nil,
Metadata: nil,
DefaultGrades: []grade.DefaultGradeModel{
grade.DefaultGradeModel{
PropertyIdRegex: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*"),
DefaultGradeValue: pointy.Int64(3),
},
},
ExperienceModelId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001"),
GradeEntries: []grade.GradeEntryModel{
grade.GradeEntryModel{
Metadata: pointy.String("GRADE_ENTRY_METADATA1"),
RankCapValue: pointy.Int64(60),
PropertyIdRegex: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*"),
GradeUpPropertyIdRegex: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*"),
},
},
AcquireActionRates: []grade.AcquireActionRate{
grade.AcquireActionRate{
Name: pointy.String("rate-0001"),
Mode: pointy.String("big"),
BigRates: []*string{
pointy.String("100000000000000"),
pointy.String("10000000000000000000000000000"),
pointy.String("1000000000000000000000000000000000000000000"),
},
},
grade.AcquireActionRate{
Name: pointy.String("rate-0002"),
Mode: pointy.String("big"),
BigRates: []*string{
pointy.String("100000000000000"),
pointy.String("10000000000000000000000000000"),
pointy.String("1000000000000000000000000000000000000000000"),
},
},
},
}
)
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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\UpdateGradeModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateGradeModelMaster(
(new UpdateGradeModelMasterRequest())
->withNamespaceName(self::namespace1)
->withGradeName("grade-model-0001")
->withDescription(null)
->withMetadata(null)
->withDefaultGrades([
(new \Gs2\Grade\Model\DefaultGradeModel())
->withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*")
->withDefaultGradeValue(3),
])
->withExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
->withGradeEntries([
(new \Gs2\Grade\Model\GradeEntryModel())
->withMetadata("GRADE_ENTRY_METADATA1")
->withRankCapValue(60)
->withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*")
->withGradeUpPropertyIdRegex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*'),
])
->withAcquireActionRates([
(new \Gs2\Grade\Model\AcquireActionRate())
->withName("rate-0001")
->withMode("big")
->withBigRates([
"100000000000000",
"10000000000000000000000000000",
"1000000000000000000000000000000000000000000",
]),
(new \Gs2\Grade\Model\AcquireActionRate())
->withName("rate-0002")
->withMode("big")
->withBigRates([
"100000000000000",
"10000000000000000000000000000",
"1000000000000000000000000000000000000000000",
]),
])
);
$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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.UpdateGradeModelMasterRequest;
import io.gs2.grade.result.UpdateGradeModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(session);
try {
UpdateGradeModelMasterResult result = client.updateGradeModelMaster(
new UpdateGradeModelMasterRequest()
.withNamespaceName("namespace1")
.withGradeName("grade-model-0001")
.withDescription(null)
.withMetadata(null)
.withDefaultGrades(Arrays.asList(
new io.gs2.grade.model.DefaultGradeModel()
.withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*")
.withDefaultGradeValue(3L)
))
.withExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
.withGradeEntries(Arrays.asList(
new io.gs2.grade.model.GradeEntryModel()
.withMetadata("GRADE_ENTRY_METADATA1")
.withRankCapValue(60L)
.withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*")
.withGradeUpPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*")
))
.withAcquireActionRates(Arrays.asList(
new io.gs2.grade.model.AcquireActionRate()
.withName("rate-0001")
.withMode("big")
.withBigRates(Arrays.asList(
"100000000000000",
"10000000000000000000000000000",
"1000000000000000000000000000000000000000000"
)),
new io.gs2.grade.model.AcquireActionRate()
.withName("rate-0002")
.withMode("big")
.withBigRates(Arrays.asList(
"100000000000000",
"10000000000000000000000000000",
"1000000000000000000000000000000000000000000"
))
))
);
GradeModelMaster 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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.UpdateGradeModelMasterRequest;
using Gs2.Gs2Grade.Result.UpdateGradeModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.UpdateGradeModelMasterResult> asyncResult = null;
yield return client.UpdateGradeModelMaster(
new Gs2.Gs2Grade.Request.UpdateGradeModelMasterRequest()
.WithNamespaceName("namespace1")
.WithGradeName("grade-model-0001")
.WithDescription(null)
.WithMetadata(null)
.WithDefaultGrades(new Gs2.Gs2Grade.Model.DefaultGradeModel[] {
new Gs2.Gs2Grade.Model.DefaultGradeModel()
.WithPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*")
.WithDefaultGradeValue(3L),
})
.WithExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
.WithGradeEntries(new Gs2.Gs2Grade.Model.GradeEntryModel[] {
new Gs2.Gs2Grade.Model.GradeEntryModel()
.WithMetadata("GRADE_ENTRY_METADATA1")
.WithRankCapValue(60L)
.WithPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*")
.WithGradeUpPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*"),
})
.WithAcquireActionRates(new Gs2.Gs2Grade.Model.AcquireActionRate[] {
new Gs2.Gs2Grade.Model.AcquireActionRate()
.WithName("rate-0001")
.WithMode("big")
.WithBigRates(new string[] {
"100000000000000",
"10000000000000000000000000000",
"1000000000000000000000000000000000000000000",
}),
new Gs2.Gs2Grade.Model.AcquireActionRate()
.WithName("rate-0002")
.WithMode("big")
.WithBigRates(new string[] {
"100000000000000",
"10000000000000000000000000000",
"1000000000000000000000000000000000000000000",
}),
}),
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 Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.updateGradeModelMaster(
new Gs2Grade.UpdateGradeModelMasterRequest()
.withNamespaceName("namespace1")
.withGradeName("grade-model-0001")
.withDescription(null)
.withMetadata(null)
.withDefaultGrades([
new Gs2Grade.model.DefaultGradeModel()
.withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*")
.withDefaultGradeValue(3),
])
.withExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
.withGradeEntries([
new Gs2Grade.model.GradeEntryModel()
.withMetadata("GRADE_ENTRY_METADATA1")
.withRankCapValue(60)
.withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*")
.withGradeUpPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*"),
])
.withAcquireActionRates([
new Gs2Grade.model.AcquireActionRate()
.withName("rate-0001")
.withMode("big")
.withBigRates([
"100000000000000",
"10000000000000000000000000000",
"1000000000000000000000000000000000000000000",
]),
new Gs2Grade.model.AcquireActionRate()
.withName("rate-0002")
.withMode("big")
.withBigRates([
"100000000000000",
"10000000000000000000000000000",
"1000000000000000000000000000000000000000000",
]),
])
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.update_grade_model_master(
grade.UpdateGradeModelMasterRequest()
.with_namespace_name(self.hash1)
.with_grade_name('grade-model-0001')
.with_description(None)
.with_metadata(None)
.with_default_grades([
grade.DefaultGradeModel()
.with_property_id_regex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*')
.with_default_grade_value(3),
])
.with_experience_model_id('grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001')
.with_grade_entries([
grade.GradeEntryModel()
.with_metadata('GRADE_ENTRY_METADATA1')
.with_rank_cap_value(60)
.with_property_id_regex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*')
.with_grade_up_property_id_regex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*'),
])
.with_acquire_action_rates([
grade.AcquireActionRate()
.with_name('rate-0001')
.with_mode('big')
.with_big_rates([
'100000000000000',
'10000000000000000000000000000',
'1000000000000000000000000000000000000000000',
]),
grade.AcquireActionRate()
.with_name('rate-0002')
.with_mode('big')
.with_big_rates([
'100000000000000',
'10000000000000000000000000000',
'1000000000000000000000000000000000000000000',
]),
])
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('grade')
api_result = client.update_grade_model_master({
namespaceName="namespace1",
gradeName="grade-model-0001",
description=nil,
metadata=nil,
defaultGrades={
{
propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*",
defaultGradeValue=3,
}
},
experienceModelId="grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001",
gradeEntries={
{
metadata="GRADE_ENTRY_METADATA1",
rankCapValue=60,
propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*",
gradeUpPropertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*",
}
},
acquireActionRates={
{
name="rate-0001",
mode="big",
bigRates={
"100000000000000",
"10000000000000000000000000000",
"1000000000000000000000000000000000000000000"
},
},
{
name="rate-0002",
mode="big",
bigRates={
"100000000000000",
"10000000000000000000000000000",
"1000000000000000000000000000000000000000000"
},
}
},
})
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('grade')
api_result_handler = client.update_grade_model_master_async({
namespaceName="namespace1",
gradeName="grade-model-0001",
description=nil,
metadata=nil,
defaultGrades={
{
propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*",
defaultGradeValue=3,
}
},
experienceModelId="grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001",
gradeEntries={
{
metadata="GRADE_ENTRY_METADATA1",
rankCapValue=60,
propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*",
gradeUpPropertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*",
}
},
acquireActionRates={
{
name="rate-0001",
mode="big",
bigRates={
"100000000000000",
"10000000000000000000000000000",
"1000000000000000000000000000000000000000000"
},
},
{
name="rate-0002",
mode="big",
bigRates={
"100000000000000",
"10000000000000000000000000000",
"1000000000000000000000000000000000000000000"
},
}
},
})
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;
deleteGradeModelMaster
グレードモデルマスターを削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
gradeName | string | ✓ | ~ 128文字 | グレードモデル名 |
Result
型 | 説明 | |
---|---|---|
item | GradeModelMaster | 削除したグレードモデルマスター |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.DeleteGradeModelMaster(
&grade.DeleteGradeModelMasterRequest {
NamespaceName: pointy.String("namespace1"),
GradeName: pointy.String("grade-model-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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\DeleteGradeModelMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteGradeModelMaster(
(new DeleteGradeModelMasterRequest())
->withNamespaceName(self::namespace1)
->withGradeName("grade-model-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DeleteGradeModelMasterRequest;
import io.gs2.grade.result.DeleteGradeModelMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(session);
try {
DeleteGradeModelMasterResult result = client.deleteGradeModelMaster(
new DeleteGradeModelMasterRequest()
.withNamespaceName("namespace1")
.withGradeName("grade-model-0001")
);
GradeModelMaster 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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DeleteGradeModelMasterRequest;
using Gs2.Gs2Grade.Result.DeleteGradeModelMasterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.DeleteGradeModelMasterResult> asyncResult = null;
yield return client.DeleteGradeModelMaster(
new Gs2.Gs2Grade.Request.DeleteGradeModelMasterRequest()
.WithNamespaceName("namespace1")
.WithGradeName("grade-model-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.deleteGradeModelMaster(
new Gs2Grade.DeleteGradeModelMasterRequest()
.withNamespaceName("namespace1")
.withGradeName("grade-model-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.delete_grade_model_master(
grade.DeleteGradeModelMasterRequest()
.with_namespace_name(self.hash1)
.with_grade_name('grade-model-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('grade')
api_result = client.delete_grade_model_master({
namespaceName="namespace1",
gradeName="grade-model-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('grade')
api_result_handler = client.delete_grade_model_master_async({
namespaceName="namespace1",
gradeName="grade-model-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
describeGradeModels
グレードモデルの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
items | List<GradeModel> | グレードモデルリスト |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
Session: &session,
}
result, err := client.DescribeGradeModels(
&grade.DescribeGradeModelsRequest {
NamespaceName: pointy.String("namespace2"),
}
)
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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\DescribeGradeModelsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeGradeModels(
(new DescribeGradeModelsRequest())
->withNamespaceName(self::namespace2)
);
$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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DescribeGradeModelsRequest;
import io.gs2.grade.result.DescribeGradeModelsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(session);
try {
DescribeGradeModelsResult result = client.describeGradeModels(
new DescribeGradeModelsRequest()
.withNamespaceName("namespace2")
);
List<GradeModel> 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.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DescribeGradeModelsRequest;
using Gs2.Gs2Grade.Result.DescribeGradeModelsResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);
AsyncResult<Gs2.Gs2Grade.Result.DescribeGradeModelsResult> asyncResult = null;
yield return client.DescribeGradeModels(
new Gs2.Gs2Grade.Request.DescribeGradeModelsRequest()
.WithNamespaceName("namespace2"),
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 Gs2Grade from '@/gs2/grade';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Grade.Gs2GradeRestClient(session);
try {
const result = await client.describeGradeModels(
new Gs2Grade.DescribeGradeModelsRequest()
.withNamespaceName("namespace2")
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import grade
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = grade.Gs2GradeRestClient(session)
try:
result = client.describe_grade_models(
grade.DescribeGradeModelsRequest()
.with_namespace_name(self.hash2)
)
items = result.items
except core.Gs2Exception as e:
exit(1)
client = gs2('grade')
api_result = client.describe_grade_models({
namespaceName="namespace2",
})
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('grade')
api_result_handler = client.describe_grade_models_async({
namespaceName="namespace2",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result