GS2-Script SDK API リファレンス

モデル

Namespace

ネームスペース

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

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

有効化条件必須デフォルト値の制限説明
namespaceIdstring~ 1024文字ネームスペースGRN
namestring~ 128文字ネームスペース名
descriptionstring~ 1024文字説明文
transactionSettingTransactionSettingトランザクション設定
logSettingLogSettingログの出力設定
createdAtlong現在時刻作成日時 (UNIX時間 単位:ミリ秒)
updatedAtlong現在時刻最終更新日時 (UNIX時間 単位:ミリ秒)
revisionlong0~ 9223372036854775805リビジョン

Script

スクリプト

GS2 では標準の機能だけで機能を実現できない時のためにスクリプトで機能を拡張できるようになっています。
スクリプトは Lua 言語で記述することができます。

スクリプト内から GS2 のサービスのデータを取得することもできますので、柔軟な処理を記述できます。
詳細はドキュメントを参照してください。

有効化条件必須デフォルト値の制限説明
scriptIdstring~ 1024文字スクリプトGRN
namestring~ 128文字スクリプト名
descriptionstring~ 1024文字説明文
scriptstring~ 5242880文字Luaスクリプト
disableStringNumberToNumberboolfalse数値のみで構成された文字列を数値に変換しない
createdAtlong現在時刻作成日時 (UNIX時間 単位:ミリ秒)
updatedAtlong現在時刻最終更新日時 (UNIX時間 単位:ミリ秒)
revisionlong0~ 9223372036854775805リビジョン

RandomStatus

乱数の状態

有効化条件必須デフォルト値の制限説明
seedlong~ 4294967294乱数シード
usedList<RandomUsed>~ 1000 items使用済み乱数リスト

RandomUsed

使用済み乱数

有効化条件必須デフォルト値の制限説明
categorylong~ 4294967294カテゴリ
usedlong~ 4294967294使用済み乱数

AcquireAction

入手アクション

有効化条件必須デフォルト値の制限説明
actionenum {
"Gs2AdReward:AcquirePointByUserId",
"Gs2Dictionary:AddEntriesByUserId",
"Gs2Enchant:ReDrawBalanceParameterStatusByUserId",
"Gs2Enchant:SetBalanceParameterStatusByUserId",
"Gs2Enchant:ReDrawRarityParameterStatusByUserId",
"Gs2Enchant:AddRarityParameterStatusByUserId",
"Gs2Enchant:SetRarityParameterStatusByUserId",
"Gs2Enhance:DirectEnhanceByUserId",
"Gs2Enhance:UnleashByUserId",
"Gs2Enhance:CreateProgressByUserId",
"Gs2Exchange:ExchangeByUserId",
"Gs2Exchange:IncrementalExchangeByUserId",
"Gs2Exchange:CreateAwaitByUserId",
"Gs2Exchange:AcquireForceByUserId",
"Gs2Exchange:SkipByUserId",
"Gs2Experience:AddExperienceByUserId",
"Gs2Experience:SetExperienceByUserId",
"Gs2Experience:AddRankCapByUserId",
"Gs2Experience:SetRankCapByUserId",
"Gs2Experience:MultiplyAcquireActionsByUserId",
"Gs2Formation:AddMoldCapacityByUserId",
"Gs2Formation:SetMoldCapacityByUserId",
"Gs2Formation:AcquireActionsToFormProperties",
"Gs2Formation:SetFormByUserId",
"Gs2Formation:AcquireActionsToPropertyFormProperties",
"Gs2Friend:UpdateProfileByUserId",
"Gs2Grade:AddGradeByUserId",
"Gs2Grade:ApplyRankCapByUserId",
"Gs2Grade:MultiplyAcquireActionsByUserId",
"Gs2Guild:IncreaseMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Guild:SetMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Idle:IncreaseMaximumIdleMinutesByUserId",
"Gs2Idle:SetMaximumIdleMinutesByUserId",
"Gs2Idle:ReceiveByUserId",
"Gs2Inbox:SendMessageByUserId",
"Gs2Inventory:AddCapacityByUserId",
"Gs2Inventory:SetCapacityByUserId",
"Gs2Inventory:AcquireItemSetByUserId",
"Gs2Inventory:AcquireItemSetWithGradeByUserId",
"Gs2Inventory:AddReferenceOfByUserId",
"Gs2Inventory:DeleteReferenceOfByUserId",
"Gs2Inventory:AcquireSimpleItemsByUserId",
"Gs2Inventory:SetSimpleItemsByUserId",
"Gs2Inventory:AcquireBigItemByUserId",
"Gs2Inventory:SetBigItemByUserId",
"Gs2JobQueue:PushByUserId",
"Gs2Limit:CountDownByUserId",
"Gs2Limit:DeleteCounterByUserId",
"Gs2LoginReward:DeleteReceiveStatusByUserId",
"Gs2LoginReward:UnmarkReceivedByUserId",
"Gs2Lottery:DrawByUserId",
"Gs2Lottery:ResetBoxByUserId",
"Gs2Mission:RevertReceiveByUserId",
"Gs2Mission:IncreaseCounterByUserId",
"Gs2Mission:SetCounterByUserId",
"Gs2Money:DepositByUserId",
"Gs2Money:RevertRecordReceipt",
"Gs2Money2:DepositByUserId",
"Gs2Quest:CreateProgressByUserId",
"Gs2Schedule:TriggerByUserId",
"Gs2Script:InvokeScript",
"Gs2SerialKey:RevertUseByUserId",
"Gs2SerialKey:IssueOnce",
"Gs2Showcase:DecrementPurchaseCountByUserId",
"Gs2Showcase:ForceReDrawByUserId",
"Gs2SkillTree:MarkReleaseByUserId",
"Gs2Stamina:RecoverStaminaByUserId",
"Gs2Stamina:RaiseMaxValueByUserId",
"Gs2Stamina:SetMaxValueByUserId",
"Gs2Stamina:SetRecoverIntervalByUserId",
"Gs2Stamina:SetRecoverValueByUserId",
"Gs2StateMachine:StartStateMachineByUserId",
}
~ 128文字入手アクションで実行するアクションの種類
requeststring~ 1048576文字リクエストのJSON

ConsumeAction

消費アクション

有効化条件必須デフォルト値の制限説明
actionenum {
"Gs2AdReward:ConsumePointByUserId",
"Gs2Dictionary:DeleteEntriesByUserId",
"Gs2Enhance:DeleteProgressByUserId",
"Gs2Exchange:DeleteAwaitByUserId",
"Gs2Experience:SubExperienceByUserId",
"Gs2Experience:SubRankCapByUserId",
"Gs2Formation:SubMoldCapacityByUserId",
"Gs2Grade:SubGradeByUserId",
"Gs2Guild:DecreaseMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Idle:DecreaseMaximumIdleMinutesByUserId",
"Gs2Inbox:OpenMessageByUserId",
"Gs2Inbox:DeleteMessageByUserId",
"Gs2Inventory:ConsumeItemSetByUserId",
"Gs2Inventory:ConsumeSimpleItemsByUserId",
"Gs2Inventory:ConsumeBigItemByUserId",
"Gs2JobQueue:DeleteJobByUserId",
"Gs2Limit:CountUpByUserId",
"Gs2LoginReward:MarkReceivedByUserId",
"Gs2Mission:ReceiveByUserId",
"Gs2Mission:BatchReceiveByUserId",
"Gs2Mission:DecreaseCounterByUserId",
"Gs2Money:WithdrawByUserId",
"Gs2Money:RecordReceipt",
"Gs2Money2:WithdrawByUserId",
"Gs2Money2:VerifyReceiptByUserId",
"Gs2Quest:DeleteProgressByUserId",
"Gs2Ranking2:CreateGlobalRankingReceivedRewardByUserId",
"Gs2Ranking2:CreateClusterRankingReceivedRewardByUserId",
"Gs2Schedule:DeleteTriggerByUserId",
"Gs2SerialKey:UseByUserId",
"Gs2Showcase:IncrementPurchaseCountByUserId",
"Gs2SkillTree:MarkRestrainByUserId",
"Gs2Stamina:DecreaseMaxValueByUserId",
"Gs2Stamina:ConsumeStaminaByUserId",
}
~ 128文字消費アクションで実行するアクションの種類
requeststring~ 1048576文字リクエストのJSON

VerifyAction

検証アクション

有効化条件必須デフォルト値の制限説明
actionenum {
"Gs2Dictionary:VerifyEntryByUserId",
"Gs2Distributor:IfExpressionByUserId",
"Gs2Distributor:AndExpressionByUserId",
"Gs2Distributor:OrExpressionByUserId",
"Gs2Enchant:VerifyRarityParameterStatusByUserId",
"Gs2Experience:VerifyRankByUserId",
"Gs2Experience:VerifyRankCapByUserId",
"Gs2Grade:VerifyGradeByUserId",
"Gs2Grade:VerifyGradeUpMaterialByUserId",
"Gs2Guild:VerifyCurrentMaximumMemberCountByGuildName",
"Gs2Guild:VerifyIncludeMemberByUserId",
"Gs2Inventory:VerifyInventoryCurrentMaxCapacityByUserId",
"Gs2Inventory:VerifyItemSetByUserId",
"Gs2Inventory:VerifyReferenceOfByUserId",
"Gs2Inventory:VerifySimpleItemByUserId",
"Gs2Inventory:VerifyBigItemByUserId",
"Gs2Limit:VerifyCounterByUserId",
"Gs2Matchmaking:VerifyIncludeParticipantByUserId",
"Gs2Mission:VerifyCompleteByUserId",
"Gs2Mission:VerifyCounterValueByUserId",
"Gs2Ranking2:VerifyGlobalRankingScoreByUserId",
"Gs2Ranking2:VerifyClusterRankingScoreByUserId",
"Gs2Ranking2:VerifySubscribeRankingScoreByUserId",
"Gs2Schedule:VerifyTriggerByUserId",
"Gs2Schedule:VerifyEventByUserId",
"Gs2SerialKey:VerifyCodeByUserId",
}
~ 128文字検証アクションで実行するアクションの種類
requeststring~ 1048576文字リクエストのJSON

Transaction

トランザクション

有効化条件必須デフォルト値の制限説明
transactionIdstring~ 128文字トランザクションID
verifyActionsList<VerifyAction>~ 100 items検証アクションのリスト
consumeActionsList<ConsumeAction>~ 100 items消費アクションのリスト
acquireActionsList<AcquireAction>~ 100 items入手アクションのリスト

VerifyActionResult

検証アクションの実行結果

有効化条件必須デフォルト値の制限説明
actionenum {
}
~ 128文字検証アクションで実行するアクションの種類
verifyRequeststring~ 1048576文字リクエストのJSON
statusCodeint~ 999ステータスコード
verifyResultstring~ 1048576文字結果内容

action に指定する列挙型の定義

定義説明

ConsumeActionResult

消費アクションの実行結果

有効化条件必須デフォルト値の制限説明
actionenum {
}
~ 128文字消費アクションで実行するアクションの種類
consumeRequeststring~ 1048576文字リクエストのJSON
statusCodeint~ 999ステータスコード
consumeResultstring~ 1048576文字結果内容

action に指定する列挙型の定義

定義説明

AcquireActionResult

入手アクションの実行結果

有効化条件必須デフォルト値の制限説明
actionenum {
}
~ 128文字入手アクションで実行するアクションの種類
acquireRequeststring~ 1048576文字リクエストのJSON
statusCodeint~ 999ステータスコード
acquireResultstring~ 1048576文字結果内容

action に指定する列挙型の定義

定義説明

TransactionResult

トランザクション実行結果

サーバーサイドでのトランザクションの自動実行機能を利用して実行されたトランザクションの実行結果

有効化条件必須デフォルト値の制限説明
transactionIdstring36 ~ 36文字トランザクションID
verifyResultsList<VerifyActionResult>~ 10 items検証アクションの実行結果リスト
consumeResultsList<ConsumeActionResult>~ 10 items消費アクションの実行結果リスト
acquireResultsList<AcquireActionResult>~ 100 items入手アクションの実行結果リスト

TransactionSetting

トランザクション設定

有効化条件必須デフォルト値の制限説明
enableAutoRunboolfalse発行したトランザクションをサーバーサイドで自動的に実行するか
enableAtomicCommitbool{enableAutoRun} == truefalseトランザクションの実行をアトミックにコミットするか
transactionUseDistributorbool{enableAtomicCommit} == truefalseトランザクションを非同期処理で実行する
acquireActionUseJobQueuebool{enableAtomicCommit} == truefalse入手アクションを実行する際に GS2-JobQueue を使用するか
distributorNamespaceIdstring“grn:gs2:{region}:{ownerId}:distributor:default”~ 1024文字トランザクションの実行に使用する GS2-Distributor ネームスペース
queueNamespaceIdstring“grn:gs2:{region}:{ownerId}:queue:default”~ 1024文字トランザクションの実行に使用する GS2-JobQueue のネームスペース

GitHubCheckoutSetting

GitHubからマスターデータをチェックアウトする設定

有効化条件必須デフォルト値の制限説明
apiKeyIdstring~ 1024文字GitHub のAPIキーGRN
repositoryNamestring~ 1024文字リポジトリ名
sourcePathstring~ 1024文字ソースコードのファイルパス
referenceTypeenum {
    “commit_hash”,
    “branch”,
    “tag”
}
~ 128文字コードの取得元
commitHashstring{referenceType} == “commit_hash”~ 1024文字コミットハッシュ
branchNamestring{referenceType} == “branch”~ 1024文字ブランチ名
tagNamestring{referenceType} == “tag”~ 1024文字タグ名

referenceType に指定する列挙型の定義

定義説明
commit_hashコミットハッシュ
branchブランチ
tagタグ

LogSetting

ログの書き出し設定

ログデータの書き出し設定を管理します。この型は、ログデータを書き出すために使用されるログ名前空間の識別子(Namespace ID)を保持します。
ログ名前空間IDは、ログデータを集約し、保存する対象の GS2-Log の名前空間を指定します。
この設定を通じて、この名前空間以下のAPIリクエスト・レスポンスログデータが対象の GS2-Log へ出力されるようになります。
GS2-Log にはリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。

有効化条件必須デフォルト値の制限説明
loggingNamespaceIdstring~ 1024文字ネームスペースGRN

メソッド

describeNamespaces

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

Request

有効化条件必須デフォルト値の制限説明
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<Namespace>ネームスペースのリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.DescribeNamespaces(
    &script.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\Script\Gs2ScriptRestClient;
use Gs2\Script\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.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.DescribeNamespacesRequest;
import io.gs2.script.result.DescribeNamespacesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2ScriptRestClient client = new Gs2ScriptRestClient(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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.DescribeNamespacesRequest;
using Gs2.Gs2Script.Result.DescribeNamespacesResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
    new Gs2.Gs2Script.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 Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.describeNamespaces(
        new Gs2Script.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 script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.describe_namespaces(
        script.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('script')

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('script')

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

有効化条件必須デフォルト値の制限説明
namestring~ 128文字ネームスペース名
descriptionstring~ 1024文字説明文
transactionSettingTransactionSettingトランザクション設定
logSettingLogSettingログの出力設定

Result

説明
itemNamespace作成したネームスペース

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &script.CreateNamespaceRequest {
        Name: pointy.String("namespace1"),
        Description: nil,
        TransactionSetting: nil,
        LogSetting: &script.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\Script\Gs2ScriptRestClient;
use Gs2\Script\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)
            ->withLogSetting((new \Gs2\Script\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.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.CreateNamespaceRequest;
import io.gs2.script.result.CreateNamespaceResult;

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

try {
    CreateNamespaceResult result = client.createNamespace(
        new CreateNamespaceRequest()
            .withName("namespace1")
            .withDescription(null)
            .withTransactionSetting(null)
            .withLogSetting(new io.gs2.script.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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.CreateNamespaceRequest;
using Gs2.Gs2Script.Result.CreateNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
    new Gs2.Gs2Script.Request.CreateNamespaceRequest()
        .WithName("namespace1")
        .WithDescription(null)
        .WithTransactionSetting(null)
        .WithLogSetting(new Gs2.Gs2Script.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 Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.createNamespace(
        new Gs2Script.CreateNamespaceRequest()
            .withName("namespace1")
            .withDescription(null)
            .withTransactionSetting(null)
            .withLogSetting(new Gs2Script.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 script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.create_namespace(
        script.CreateNamespaceRequest()
            .with_name(self.hash1)
            .with_description(None)
            .with_transaction_setting(None)
            .with_log_setting(
                script.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('script')

api_result = client.create_namespace({
    name="namespace1",
    description=nil,
    transactionSetting=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('script')

api_result_handler = client.create_namespace_async({
    name="namespace1",
    description=nil,
    transactionSetting=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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名

Result

説明
statusstring

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.GetNamespaceStatus(
    &script.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\Script\Gs2ScriptRestClient;
use Gs2\Script\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.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.GetNamespaceStatusRequest;
import io.gs2.script.result.GetNamespaceStatusResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2ScriptRestClient client = new Gs2ScriptRestClient(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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Script.Result.GetNamespaceStatusResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
    new Gs2.Gs2Script.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 Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.getNamespaceStatus(
        new Gs2Script.GetNamespaceStatusRequest()
            .withNamespaceName("namespace1")
    );
    const status = result.getStatus();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.get_namespace_status(
        script.GetNamespaceStatusRequest()
            .with_namespace_name(self.hash1)
    )
    status = result.status
except core.Gs2Exception as e:
    exit(1)
client = gs2('script')

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('script')

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名

Result

説明
itemNamespaceネームスペース

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.GetNamespace(
    &script.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\Script\Gs2ScriptRestClient;
use Gs2\Script\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.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.GetNamespaceRequest;
import io.gs2.script.result.GetNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2ScriptRestClient client = new Gs2ScriptRestClient(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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.GetNamespaceRequest;
using Gs2.Gs2Script.Result.GetNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
    new Gs2.Gs2Script.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 Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.getNamespace(
        new Gs2Script.GetNamespaceRequest()
            .withNamespaceName("namespace1")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.get_namespace(
        script.GetNamespaceRequest()
            .with_namespace_name(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('script')

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('script')

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

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
descriptionstring~ 1024文字説明文
transactionSettingTransactionSettingトランザクション設定
logSettingLogSettingログの出力設定

Result

説明
itemNamespace更新したネームスペース

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &script.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace1"),
        Description: pointy.String("description1"),
        TransactionSetting: nil,
        LogSetting: &script.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\Script\Gs2ScriptRestClient;
use Gs2\Script\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)
            ->withLogSetting((new \Gs2\Script\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.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.UpdateNamespaceRequest;
import io.gs2.script.result.UpdateNamespaceResult;

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

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withTransactionSetting(null)
            .withLogSetting(new io.gs2.script.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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.UpdateNamespaceRequest;
using Gs2.Gs2Script.Result.UpdateNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
    new Gs2.Gs2Script.Request.UpdateNamespaceRequest()
        .WithNamespaceName("namespace1")
        .WithDescription("description1")
        .WithTransactionSetting(null)
        .WithLogSetting(new Gs2.Gs2Script.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 Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.updateNamespace(
        new Gs2Script.UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withTransactionSetting(null)
            .withLogSetting(new Gs2Script.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 script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.update_namespace(
        script.UpdateNamespaceRequest()
            .with_namespace_name(self.hash1)
            .with_description('description1')
            .with_transaction_setting(None)
            .with_log_setting(
                script.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('script')

api_result = client.update_namespace({
    namespaceName="namespace1",
    description="description1",
    transactionSetting=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('script')

api_result_handler = client.update_namespace_async({
    namespaceName="namespace1",
    description="description1",
    transactionSetting=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
    },
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

deleteNamespace

ネームスペースを削除

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名

Result

説明
itemNamespace削除したネームスペース

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.DeleteNamespace(
    &script.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\Script\Gs2ScriptRestClient;
use Gs2\Script\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.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.DeleteNamespaceRequest;
import io.gs2.script.result.DeleteNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2ScriptRestClient client = new Gs2ScriptRestClient(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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.DeleteNamespaceRequest;
using Gs2.Gs2Script.Result.DeleteNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
    new Gs2.Gs2Script.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 Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.deleteNamespace(
        new Gs2Script.DeleteNamespaceRequest()
            .withNamespaceName("namespace1")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.delete_namespace(
        script.DeleteNamespaceRequest()
            .with_namespace_name(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('script')

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('script')

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;

describeScripts

スクリプトの一覧を取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<Script>スクリプトのリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.DescribeScripts(
    &script.DescribeScriptsRequest {
        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\Script\Gs2ScriptRestClient;
use Gs2\Script\Request\DescribeScriptsRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeScripts(
        (new DescribeScriptsRequest())
            ->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.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.DescribeScriptsRequest;
import io.gs2.script.result.DescribeScriptsResult;

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

try {
    DescribeScriptsResult result = client.describeScripts(
        new DescribeScriptsRequest()
            .withNamespaceName("namespace1")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Script> 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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.DescribeScriptsRequest;
using Gs2.Gs2Script.Result.DescribeScriptsResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.DescribeScriptsResult> asyncResult = null;
yield return client.DescribeScripts(
    new Gs2.Gs2Script.Request.DescribeScriptsRequest()
        .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 Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.describeScripts(
        new Gs2Script.DescribeScriptsRequest()
            .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 script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.describe_scripts(
        script.DescribeScriptsRequest()
            .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('script')

api_result = client.describe_scripts({
    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('script')

api_result_handler = client.describe_scripts_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;

createScript

スクリプトを新規作成

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
namestring~ 128文字スクリプト名
descriptionstring~ 1024文字説明文
scriptstring~ 5242880文字Luaスクリプト
disableStringNumberToNumberboolfalse数値のみで構成された文字列を数値に変換しない

Result

説明
itemScript作成したスクリプト

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.CreateScript(
    &script.CreateScriptRequest {
        NamespaceName: pointy.String("namespace1"),
        Name: pointy.String("script-0001"),
        Description: nil,
        Script: pointy.String("result = {permit=true}"),
        DisableStringNumberToNumber: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Script\Gs2ScriptRestClient;
use Gs2\Script\Request\CreateScriptRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createScript(
        (new CreateScriptRequest())
            ->withNamespaceName(self::namespace1)
            ->withName("script-0001")
            ->withDescription(null)
            ->withScript("result = {permit=true}")
            ->withDisableStringNumberToNumber(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.CreateScriptRequest;
import io.gs2.script.result.CreateScriptResult;

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

try {
    CreateScriptResult result = client.createScript(
        new CreateScriptRequest()
            .withNamespaceName("namespace1")
            .withName("script-0001")
            .withDescription(null)
            .withScript("result = {permit=true}")
            .withDisableStringNumberToNumber(null)
    );
    Script 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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.CreateScriptRequest;
using Gs2.Gs2Script.Result.CreateScriptResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.CreateScriptResult> asyncResult = null;
yield return client.CreateScript(
    new Gs2.Gs2Script.Request.CreateScriptRequest()
        .WithNamespaceName("namespace1")
        .WithName("script-0001")
        .WithDescription(null)
        .WithScript("result = {permit=true}")
        .WithDisableStringNumberToNumber(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.createScript(
        new Gs2Script.CreateScriptRequest()
            .withNamespaceName("namespace1")
            .withName("script-0001")
            .withDescription(null)
            .withScript("result = {permit=true}")
            .withDisableStringNumberToNumber(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.create_script(
        script.CreateScriptRequest()
            .with_namespace_name(self.hash1)
            .with_name('script-0001')
            .with_description(None)
            .with_script('result = {permit=true}')
            .with_disable_string_number_to_number(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('script')

api_result = client.create_script({
    namespaceName="namespace1",
    name="script-0001",
    description=nil,
    script="result = {permit=true}",
    disableStringNumberToNumber=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;
client = gs2('script')

api_result_handler = client.create_script_async({
    namespaceName="namespace1",
    name="script-0001",
    description=nil,
    script="result = {permit=true}",
    disableStringNumberToNumber=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

createScriptFromGitHub

GitHubリポジトリのコードからスクリプトを新規作成

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
namestring~ 128文字スクリプト名
descriptionstring~ 1024文字説明文
checkoutSettingGitHubCheckoutSettingGitHubからソースコードをチェックアウトしてくる設定
disableStringNumberToNumberboolfalse数値のみで構成された文字列を数値に変換しない

Result

説明
itemScript作成したスクリプト

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.CreateScriptFromGitHub(
    &script.CreateScriptFromGitHubRequest {
        NamespaceName: pointy.String("namespace1"),
        Name: pointy.String("script-0001"),
        Description: nil,
        CheckoutSetting: &script.GitHubCheckoutSetting{
            ApiKeyId: pointy.String("$gitHubApiKey1.apiKeyId"),
            RepositoryName: pointy.String("gs2io/script-data"),
            SourcePath: pointy.String("path/to/file.json"),
            ReferenceType: pointy.String("branch"),
            BranchName: pointy.String("develop"),
        },
        DisableStringNumberToNumber: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Script\Gs2ScriptRestClient;
use Gs2\Script\Request\CreateScriptFromGitHubRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createScriptFromGitHub(
        (new CreateScriptFromGitHubRequest())
            ->withNamespaceName(self::namespace1)
            ->withName("script-0001")
            ->withDescription(null)
            ->withCheckoutSetting((new GitHubCheckoutSetting())
                ->withApiKeyId(self::$gitHubApiKey1.apiKeyId)
                ->withRepositoryName("gs2io/script-data")
                ->withSourcePath("path/to/file.json")
                ->withReferenceType("branch")
                ->withBranchName("develop")
            )
            ->withDisableStringNumberToNumber(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.CreateScriptFromGitHubRequest;
import io.gs2.script.result.CreateScriptFromGitHubResult;

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

try {
    CreateScriptFromGitHubResult result = client.createScriptFromGitHub(
        new CreateScriptFromGitHubRequest()
            .withNamespaceName("namespace1")
            .withName("script-0001")
            .withDescription(null)
            .withCheckoutSetting(new GitHubCheckoutSetting()
                .withApiKeyId("$gitHubApiKey1.apiKeyId")
                .withRepositoryName("gs2io/script-data")
                .withSourcePath("path/to/file.json")
                .withReferenceType("branch")
                .withBranchName("develop")
            )
            .withDisableStringNumberToNumber(null)
    );
    Script 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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.CreateScriptFromGitHubRequest;
using Gs2.Gs2Script.Result.CreateScriptFromGitHubResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.CreateScriptFromGitHubResult> asyncResult = null;
yield return client.CreateScriptFromGitHub(
    new Gs2.Gs2Script.Request.CreateScriptFromGitHubRequest()
        .WithNamespaceName("namespace1")
        .WithName("script-0001")
        .WithDescription(null)
        .WithCheckoutSetting(new Gs2.Gs2Script.Model.GitHubCheckoutSetting()
            .WithApiKeyId("$gitHubApiKey1.apiKeyId")
            .WithRepositoryName("gs2io/script-data")
            .WithSourcePath("path/to/file.json")
            .WithReferenceType("branch")
            .WithBranchName("develop")
        )
        .WithDisableStringNumberToNumber(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.createScriptFromGitHub(
        new Gs2Script.CreateScriptFromGitHubRequest()
            .withNamespaceName("namespace1")
            .withName("script-0001")
            .withDescription(null)
            .withCheckoutSetting(new Gs2Script.model.GitHubCheckoutSetting()
                .withApiKeyId("$gitHubApiKey1.apiKeyId")
                .withRepositoryName("gs2io/script-data")
                .withSourcePath("path/to/file.json")
                .withReferenceType("branch")
                .withBranchName("develop")
            )
            .withDisableStringNumberToNumber(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.create_script_from_git_hub(
        script.CreateScriptFromGitHubRequest()
            .with_namespace_name(self.hash1)
            .with_name('script-0001')
            .with_description(None)
            .with_checkout_setting(script.GitHubCheckoutSetting()
                .with_api_key_id(self.git_hub_api_key1.api_key_id)
                .with_repository_name('gs2io/script-data')
                .with_source_path('path/to/file.json')
                .with_reference_type('branch')
                .with_branch_name('develop')
            )
            .with_disable_string_number_to_number(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('script')

api_result = client.create_script_from_git_hub({
    namespaceName="namespace1",
    name="script-0001",
    description=nil,
    checkoutSetting={
        api_key_id="$gitHubApiKey1.apiKeyId",
        repository_name="gs2io/script-data",
        source_path="path/to/file.json",
        reference_type="branch",
        branch_name="develop",
    },
    disableStringNumberToNumber=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;
client = gs2('script')

api_result_handler = client.create_script_from_git_hub_async({
    namespaceName="namespace1",
    name="script-0001",
    description=nil,
    checkoutSetting={
        api_key_id="$gitHubApiKey1.apiKeyId",
        repository_name="gs2io/script-data",
        source_path="path/to/file.json",
        reference_type="branch",
        branch_name="develop",
    },
    disableStringNumberToNumber=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

getScript

スクリプトを取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
scriptNamestring~ 128文字スクリプト名

Result

説明
itemScriptスクリプト

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.GetScript(
    &script.GetScriptRequest {
        NamespaceName: pointy.String("namespace1"),
        ScriptName: pointy.String("script-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\Script\Gs2ScriptRestClient;
use Gs2\Script\Request\GetScriptRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getScript(
        (new GetScriptRequest())
            ->withNamespaceName(self::namespace1)
            ->withScriptName("script-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.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.GetScriptRequest;
import io.gs2.script.result.GetScriptResult;

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

try {
    GetScriptResult result = client.getScript(
        new GetScriptRequest()
            .withNamespaceName("namespace1")
            .withScriptName("script-0001")
    );
    Script 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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.GetScriptRequest;
using Gs2.Gs2Script.Result.GetScriptResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.GetScriptResult> asyncResult = null;
yield return client.GetScript(
    new Gs2.Gs2Script.Request.GetScriptRequest()
        .WithNamespaceName("namespace1")
        .WithScriptName("script-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 Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.getScript(
        new Gs2Script.GetScriptRequest()
            .withNamespaceName("namespace1")
            .withScriptName("script-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.get_script(
        script.GetScriptRequest()
            .with_namespace_name(self.hash1)
            .with_script_name('script-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('script')

api_result = client.get_script({
    namespaceName="namespace1",
    scriptName="script-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('script')

api_result_handler = client.get_script_async({
    namespaceName="namespace1",
    scriptName="script-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;

updateScript

スクリプトを更新

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
scriptNamestring~ 128文字スクリプト名
descriptionstring~ 1024文字説明文
scriptstring~ 5242880文字Luaスクリプト
disableStringNumberToNumberboolfalse数値のみで構成された文字列を数値に変換しない

Result

説明
itemScript更新したスクリプト

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.UpdateScript(
    &script.UpdateScriptRequest {
        NamespaceName: pointy.String("namespace1"),
        ScriptName: pointy.String("script-0001"),
        Description: pointy.String("description1"),
        Script: pointy.String("result = \"hogehoge\""),
        DisableStringNumberToNumber: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Script\Gs2ScriptRestClient;
use Gs2\Script\Request\UpdateScriptRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateScript(
        (new UpdateScriptRequest())
            ->withNamespaceName(self::namespace1)
            ->withScriptName("script-0001")
            ->withDescription("description1")
            ->withScript("result = \"hogehoge\"")
            ->withDisableStringNumberToNumber(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.UpdateScriptRequest;
import io.gs2.script.result.UpdateScriptResult;

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

try {
    UpdateScriptResult result = client.updateScript(
        new UpdateScriptRequest()
            .withNamespaceName("namespace1")
            .withScriptName("script-0001")
            .withDescription("description1")
            .withScript("result = \"hogehoge\"")
            .withDisableStringNumberToNumber(null)
    );
    Script 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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.UpdateScriptRequest;
using Gs2.Gs2Script.Result.UpdateScriptResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.UpdateScriptResult> asyncResult = null;
yield return client.UpdateScript(
    new Gs2.Gs2Script.Request.UpdateScriptRequest()
        .WithNamespaceName("namespace1")
        .WithScriptName("script-0001")
        .WithDescription("description1")
        .WithScript("result = \"hogehoge\"")
        .WithDisableStringNumberToNumber(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.updateScript(
        new Gs2Script.UpdateScriptRequest()
            .withNamespaceName("namespace1")
            .withScriptName("script-0001")
            .withDescription("description1")
            .withScript("result = \"hogehoge\"")
            .withDisableStringNumberToNumber(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.update_script(
        script.UpdateScriptRequest()
            .with_namespace_name(self.hash1)
            .with_script_name('script-0001')
            .with_description('description1')
            .with_script('result = "hogehoge"')
            .with_disable_string_number_to_number(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('script')

api_result = client.update_script({
    namespaceName="namespace1",
    scriptName="script-0001",
    description="description1",
    script="result = \"hogehoge\"",
    disableStringNumberToNumber=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;
client = gs2('script')

api_result_handler = client.update_script_async({
    namespaceName="namespace1",
    scriptName="script-0001",
    description="description1",
    script="result = \"hogehoge\"",
    disableStringNumberToNumber=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

updateScriptFromGitHub

GitHub をデータソースとしてスクリプトを更新

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
scriptNamestring~ 128文字スクリプト名
descriptionstring~ 1024文字説明文
checkoutSettingGitHubCheckoutSettingGitHubからソースコードをチェックアウトしてくる設定
disableStringNumberToNumberboolfalse数値のみで構成された文字列を数値に変換しない

Result

説明
itemScript更新したスクリプト

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.UpdateScriptFromGitHub(
    &script.UpdateScriptFromGitHubRequest {
        NamespaceName: pointy.String("namespace1"),
        ScriptName: pointy.String("script-0001"),
        Description: nil,
        CheckoutSetting: &script.GitHubCheckoutSetting{
            ApiKeyId: pointy.String("$gitHubApiKey1.apiKeyId"),
            RepositoryName: pointy.String("gs2io/script-data"),
            SourcePath: pointy.String("path/to/file.json"),
            ReferenceType: pointy.String("branch"),
            BranchName: pointy.String("develop"),
        },
        DisableStringNumberToNumber: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Script\Gs2ScriptRestClient;
use Gs2\Script\Request\UpdateScriptFromGitHubRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateScriptFromGitHub(
        (new UpdateScriptFromGitHubRequest())
            ->withNamespaceName(self::namespace1)
            ->withScriptName("script-0001")
            ->withDescription(null)
            ->withCheckoutSetting((new GitHubCheckoutSetting())
                ->withApiKeyId(self::$gitHubApiKey1.apiKeyId)
                ->withRepositoryName("gs2io/script-data")
                ->withSourcePath("path/to/file.json")
                ->withReferenceType("branch")
                ->withBranchName("develop")
            )
            ->withDisableStringNumberToNumber(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.UpdateScriptFromGitHubRequest;
import io.gs2.script.result.UpdateScriptFromGitHubResult;

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

try {
    UpdateScriptFromGitHubResult result = client.updateScriptFromGitHub(
        new UpdateScriptFromGitHubRequest()
            .withNamespaceName("namespace1")
            .withScriptName("script-0001")
            .withDescription(null)
            .withCheckoutSetting(new GitHubCheckoutSetting()
                .withApiKeyId("$gitHubApiKey1.apiKeyId")
                .withRepositoryName("gs2io/script-data")
                .withSourcePath("path/to/file.json")
                .withReferenceType("branch")
                .withBranchName("develop")
            )
            .withDisableStringNumberToNumber(null)
    );
    Script 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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.UpdateScriptFromGitHubRequest;
using Gs2.Gs2Script.Result.UpdateScriptFromGitHubResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.UpdateScriptFromGitHubResult> asyncResult = null;
yield return client.UpdateScriptFromGitHub(
    new Gs2.Gs2Script.Request.UpdateScriptFromGitHubRequest()
        .WithNamespaceName("namespace1")
        .WithScriptName("script-0001")
        .WithDescription(null)
        .WithCheckoutSetting(new Gs2.Gs2Script.Model.GitHubCheckoutSetting()
            .WithApiKeyId("$gitHubApiKey1.apiKeyId")
            .WithRepositoryName("gs2io/script-data")
            .WithSourcePath("path/to/file.json")
            .WithReferenceType("branch")
            .WithBranchName("develop")
        )
        .WithDisableStringNumberToNumber(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.updateScriptFromGitHub(
        new Gs2Script.UpdateScriptFromGitHubRequest()
            .withNamespaceName("namespace1")
            .withScriptName("script-0001")
            .withDescription(null)
            .withCheckoutSetting(new Gs2Script.model.GitHubCheckoutSetting()
                .withApiKeyId("$gitHubApiKey1.apiKeyId")
                .withRepositoryName("gs2io/script-data")
                .withSourcePath("path/to/file.json")
                .withReferenceType("branch")
                .withBranchName("develop")
            )
            .withDisableStringNumberToNumber(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.update_script_from_git_hub(
        script.UpdateScriptFromGitHubRequest()
            .with_namespace_name(self.hash1)
            .with_script_name('script-0001')
            .with_description(None)
            .with_checkout_setting(script.GitHubCheckoutSetting()
                .with_api_key_id(self.git_hub_api_key1.api_key_id)
                .with_repository_name('gs2io/script-data')
                .with_source_path('path/to/file.json')
                .with_reference_type('branch')
                .with_branch_name('develop')
            )
            .with_disable_string_number_to_number(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('script')

api_result = client.update_script_from_git_hub({
    namespaceName="namespace1",
    scriptName="script-0001",
    description=nil,
    checkoutSetting={
        api_key_id="$gitHubApiKey1.apiKeyId",
        repository_name="gs2io/script-data",
        source_path="path/to/file.json",
        reference_type="branch",
        branch_name="develop",
    },
    disableStringNumberToNumber=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;
client = gs2('script')

api_result_handler = client.update_script_from_git_hub_async({
    namespaceName="namespace1",
    scriptName="script-0001",
    description=nil,
    checkoutSetting={
        api_key_id="$gitHubApiKey1.apiKeyId",
        repository_name="gs2io/script-data",
        source_path="path/to/file.json",
        reference_type="branch",
        branch_name="develop",
    },
    disableStringNumberToNumber=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

deleteScript

スクリプトを削除

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 128文字ネームスペース名
scriptNamestring~ 128文字スクリプト名

Result

説明
itemScript削除したスクリプト

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.DeleteScript(
    &script.DeleteScriptRequest {
        NamespaceName: pointy.String("namespace1"),
        ScriptName: pointy.String("script-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\Script\Gs2ScriptRestClient;
use Gs2\Script\Request\DeleteScriptRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteScript(
        (new DeleteScriptRequest())
            ->withNamespaceName(self::namespace1)
            ->withScriptName("script-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.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.DeleteScriptRequest;
import io.gs2.script.result.DeleteScriptResult;

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

try {
    DeleteScriptResult result = client.deleteScript(
        new DeleteScriptRequest()
            .withNamespaceName("namespace1")
            .withScriptName("script-0001")
    );
    Script 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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.DeleteScriptRequest;
using Gs2.Gs2Script.Result.DeleteScriptResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.DeleteScriptResult> asyncResult = null;
yield return client.DeleteScript(
    new Gs2.Gs2Script.Request.DeleteScriptRequest()
        .WithNamespaceName("namespace1")
        .WithScriptName("script-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 Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.deleteScript(
        new Gs2Script.DeleteScriptRequest()
            .withNamespaceName("namespace1")
            .withScriptName("script-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.delete_script(
        script.DeleteScriptRequest()
            .with_namespace_name(self.hash1)
            .with_script_name('script-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('script')

api_result = client.delete_script({
    namespaceName="namespace1",
    scriptName="script-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('script')

api_result_handler = client.delete_script_async({
    namespaceName="namespace1",
    scriptName="script-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;

invokeScript

スクリプトを実行

Request

有効化条件必須デフォルト値の制限説明
scriptIdstring~ 1024文字スクリプトGRN
userIdstring~ 128文字ユーザーID
argsstring“{}”~ 5242880文字引数 (JSON形式)
randomStatusRandomStatus乱数の状態
timeOffsetTokenstring~ 1024文字タイムオフセットトークン

Result

説明
codeintステータスコード
resultstring戻り値
transactionTransactionトランザクション
randomStatusRandomStatus乱数の状態
executeTimeintスクリプトの実行時間(ミリ秒)
chargedint費用の計算対象となった時間(秒)
outputList<string>標準出力の内容のリスト

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.InvokeScript(
    &script.InvokeScriptRequest {
        ScriptId: pointy.String("script-0001"),
        UserId: nil,
        Args: pointy.String("{}"),
        RandomStatus: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
code := result.Code
result := result.Result
transaction := result.Transaction
randomStatus := result.RandomStatus
executeTime := result.ExecuteTime
charged := result.Charged
output := result.Output
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Script\Gs2ScriptRestClient;
use Gs2\Script\Request\InvokeScriptRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->invokeScript(
        (new InvokeScriptRequest())
            ->withScriptId("script-0001")
            ->withUserId(null)
            ->withArgs("{}")
            ->withRandomStatus(null)
            ->withTimeOffsetToken(null)
    );
    $code = $result->getCode();
    $result = $result->getResult();
    $transaction = $result->getTransaction();
    $randomStatus = $result->getRandomStatus();
    $executeTime = $result->getExecuteTime();
    $charged = $result->getCharged();
    $output = $result->getOutput();
} 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.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.InvokeScriptRequest;
import io.gs2.script.result.InvokeScriptResult;

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

try {
    InvokeScriptResult result = client.invokeScript(
        new InvokeScriptRequest()
            .withScriptId("script-0001")
            .withUserId(null)
            .withArgs("{}")
            .withRandomStatus(null)
            .withTimeOffsetToken(null)
    );
    int code = result.getCode();
    String result = result.getResult();
    Transaction transaction = result.getTransaction();
    RandomStatus randomStatus = result.getRandomStatus();
    int executeTime = result.getExecuteTime();
    int charged = result.getCharged();
    List<String> output = result.getOutput();
} 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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.InvokeScriptRequest;
using Gs2.Gs2Script.Result.InvokeScriptResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.InvokeScriptResult> asyncResult = null;
yield return client.InvokeScript(
    new Gs2.Gs2Script.Request.InvokeScriptRequest()
        .WithScriptId("script-0001")
        .WithUserId(null)
        .WithArgs("{}")
        .WithRandomStatus(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var code = result.Code;
var result = result.Result;
var transaction = result.Transaction;
var randomStatus = result.RandomStatus;
var executeTime = result.ExecuteTime;
var charged = result.Charged;
var output = result.Output;
import Gs2Core from '@/gs2/core';
import * as Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.invokeScript(
        new Gs2Script.InvokeScriptRequest()
            .withScriptId("script-0001")
            .withUserId(null)
            .withArgs("{}")
            .withRandomStatus(null)
            .withTimeOffsetToken(null)
    );
    const code = result.getCode();
    const result = result.getResult();
    const transaction = result.getTransaction();
    const randomStatus = result.getRandomStatus();
    const executeTime = result.getExecuteTime();
    const charged = result.getCharged();
    const output = result.getOutput();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.invoke_script(
        script.InvokeScriptRequest()
            .with_script_id('script-0001')
            .with_user_id(None)
            .with_args('{}')
            .with_random_status(None)
            .with_time_offset_token(None)
    )
    code = result.code
    result = result.result
    transaction = result.transaction
    random_status = result.random_status
    execute_time = result.execute_time
    charged = result.charged
    output = result.output
except core.Gs2Exception as e:
    exit(1)
client = gs2('script')

api_result = client.invoke_script({
    scriptId="script-0001",
    userId=nil,
    args="{}",
    randomStatus=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
code = result.code;
result = result.result;
transaction = result.transaction;
randomStatus = result.randomStatus;
executeTime = result.executeTime;
charged = result.charged;
output = result.output;
client = gs2('script')

api_result_handler = client.invoke_script_async({
    scriptId="script-0001",
    userId=nil,
    args="{}",
    randomStatus=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
code = result.code;
result = result.result;
transaction = result.transaction;
randomStatus = result.randomStatus;
executeTime = result.executeTime;
charged = result.charged;
output = result.output;

debugInvoke

スクリプトを実行

Request

有効化条件必須デフォルト値の制限説明
scriptstring~ 5242880文字Luaスクリプト
argsstring“{}”~ 5242880文字引数 (JSON形式)
randomStatusRandomStatus乱数の状態
disableStringNumberToNumberboolfalse数値のみで構成された文字列を数値に変換しない

Result

説明
codeintステータスコード
resultstring戻り値
transactionTransactionトランザクション
randomStatusRandomStatus乱数の状態
executeTimeintスクリプトの実行時間(ミリ秒)
chargedint費用の計算対象となった時間(秒)
outputList<string>標準出力の内容のリスト

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.DebugInvoke(
    &script.DebugInvokeRequest {
        Script: pointy.String("result = \"hello\""),
        Args: pointy.String("{}"),
        RandomStatus: nil,
        DisableStringNumberToNumber: nil,
    }
)
if err != nil {
    panic("error occurred")
}
code := result.Code
result := result.Result
transaction := result.Transaction
randomStatus := result.RandomStatus
executeTime := result.ExecuteTime
charged := result.Charged
output := result.Output
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Script\Gs2ScriptRestClient;
use Gs2\Script\Request\DebugInvokeRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->debugInvoke(
        (new DebugInvokeRequest())
            ->withScript("result = \"hello\"")
            ->withArgs("{}")
            ->withRandomStatus(null)
            ->withDisableStringNumberToNumber(null)
    );
    $code = $result->getCode();
    $result = $result->getResult();
    $transaction = $result->getTransaction();
    $randomStatus = $result->getRandomStatus();
    $executeTime = $result->getExecuteTime();
    $charged = $result->getCharged();
    $output = $result->getOutput();
} 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.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.DebugInvokeRequest;
import io.gs2.script.result.DebugInvokeResult;

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

try {
    DebugInvokeResult result = client.debugInvoke(
        new DebugInvokeRequest()
            .withScript("result = \"hello\"")
            .withArgs("{}")
            .withRandomStatus(null)
            .withDisableStringNumberToNumber(null)
    );
    int code = result.getCode();
    String result = result.getResult();
    Transaction transaction = result.getTransaction();
    RandomStatus randomStatus = result.getRandomStatus();
    int executeTime = result.getExecuteTime();
    int charged = result.getCharged();
    List<String> output = result.getOutput();
} 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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.DebugInvokeRequest;
using Gs2.Gs2Script.Result.DebugInvokeResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.DebugInvokeResult> asyncResult = null;
yield return client.DebugInvoke(
    new Gs2.Gs2Script.Request.DebugInvokeRequest()
        .WithScript("result = \"hello\"")
        .WithArgs("{}")
        .WithRandomStatus(null)
        .WithDisableStringNumberToNumber(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var code = result.Code;
var result = result.Result;
var transaction = result.Transaction;
var randomStatus = result.RandomStatus;
var executeTime = result.ExecuteTime;
var charged = result.Charged;
var output = result.Output;
import Gs2Core from '@/gs2/core';
import * as Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.debugInvoke(
        new Gs2Script.DebugInvokeRequest()
            .withScript("result = \"hello\"")
            .withArgs("{}")
            .withRandomStatus(null)
            .withDisableStringNumberToNumber(null)
    );
    const code = result.getCode();
    const result = result.getResult();
    const transaction = result.getTransaction();
    const randomStatus = result.getRandomStatus();
    const executeTime = result.getExecuteTime();
    const charged = result.getCharged();
    const output = result.getOutput();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.debug_invoke(
        script.DebugInvokeRequest()
            .with_script('result = "hello"')
            .with_args('{}')
            .with_random_status(None)
            .with_disable_string_number_to_number(None)
    )
    code = result.code
    result = result.result
    transaction = result.transaction
    random_status = result.random_status
    execute_time = result.execute_time
    charged = result.charged
    output = result.output
except core.Gs2Exception as e:
    exit(1)
client = gs2('script')

api_result = client.debug_invoke({
    script="result = \"hello\"",
    args="{}",
    randomStatus=nil,
    disableStringNumberToNumber=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
code = result.code;
result = result.result;
transaction = result.transaction;
randomStatus = result.randomStatus;
executeTime = result.executeTime;
charged = result.charged;
output = result.output;
client = gs2('script')

api_result_handler = client.debug_invoke_async({
    script="result = \"hello\"",
    args="{}",
    randomStatus=nil,
    disableStringNumberToNumber=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
code = result.code;
result = result.result;
transaction = result.transaction;
randomStatus = result.randomStatus;
executeTime = result.executeTime;
charged = result.charged;
output = result.output;

invokeByStampSheet

入手アクションとしてスクリプトを実行

Request

有効化条件必須デフォルト値の制限説明
stampSheetstring~ 5242880文字トランザクション
keyIdstring~ 1024文字暗号鍵GRN

Result

説明
codeintステータスコード
resultstring戻り値
transactionTransactionトランザクション
randomStatusRandomStatus乱数の状態
executeTimeintスクリプトの実行時間(ミリ秒)
chargedint費用の計算対象となった時間(秒)
outputList<string>標準出力の内容のリスト

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/script"
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 := script.Gs2ScriptRestClient{
    Session: &session,
}
result, err := client.InvokeByStampSheet(
    &script.InvokeByStampSheetRequest {
        StampSheet: pointy.String("stampSheet"),
        KeyId: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
code := result.Code
result := result.Result
transaction := result.Transaction
randomStatus := result.RandomStatus
executeTime := result.ExecuteTime
charged := result.Charged
output := result.Output
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Script\Gs2ScriptRestClient;
use Gs2\Script\Request\InvokeByStampSheetRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->invokeByStampSheet(
        (new InvokeByStampSheetRequest())
            ->withStampSheet(self::stampSheet)
            ->withKeyId(self::key-0001)
    );
    $code = $result->getCode();
    $result = $result->getResult();
    $transaction = $result->getTransaction();
    $randomStatus = $result->getRandomStatus();
    $executeTime = $result->getExecuteTime();
    $charged = $result->getCharged();
    $output = $result->getOutput();
} 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.script.rest.Gs2ScriptRestClient;
import io.gs2.script.request.InvokeByStampSheetRequest;
import io.gs2.script.result.InvokeByStampSheetResult;

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

try {
    InvokeByStampSheetResult result = client.invokeByStampSheet(
        new InvokeByStampSheetRequest()
            .withStampSheet("stampSheet")
            .withKeyId("key-0001")
    );
    int code = result.getCode();
    String result = result.getResult();
    Transaction transaction = result.getTransaction();
    RandomStatus randomStatus = result.getRandomStatus();
    int executeTime = result.getExecuteTime();
    int charged = result.getCharged();
    List<String> output = result.getOutput();
} 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.Gs2Script.Gs2ScriptRestClient;
using Gs2.Gs2Script.Request.InvokeByStampSheetRequest;
using Gs2.Gs2Script.Result.InvokeByStampSheetResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2ScriptRestClient(session);

AsyncResult<Gs2.Gs2Script.Result.InvokeByStampSheetResult> asyncResult = null;
yield return client.InvokeByStampSheet(
    new Gs2.Gs2Script.Request.InvokeByStampSheetRequest()
        .WithStampSheet("stampSheet")
        .WithKeyId("key-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var code = result.Code;
var result = result.Result;
var transaction = result.Transaction;
var randomStatus = result.RandomStatus;
var executeTime = result.ExecuteTime;
var charged = result.Charged;
var output = result.Output;
import Gs2Core from '@/gs2/core';
import * as Gs2Script from '@/gs2/script';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Script.Gs2ScriptRestClient(session);

try {
    const result = await client.invokeByStampSheet(
        new Gs2Script.InvokeByStampSheetRequest()
            .withStampSheet("stampSheet")
            .withKeyId("key-0001")
    );
    const code = result.getCode();
    const result = result.getResult();
    const transaction = result.getTransaction();
    const randomStatus = result.getRandomStatus();
    const executeTime = result.getExecuteTime();
    const charged = result.getCharged();
    const output = result.getOutput();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import script

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = script.Gs2ScriptRestClient(session)

try:
    result = client.invoke_by_stamp_sheet(
        script.InvokeByStampSheetRequest()
            .with_stamp_sheet(self.stamp_sheet)
            .with_key_id(self.key1.key_id)
    )
    code = result.code
    result = result.result
    transaction = result.transaction
    random_status = result.random_status
    execute_time = result.execute_time
    charged = result.charged
    output = result.output
except core.Gs2Exception as e:
    exit(1)
client = gs2('script')

api_result = client.invoke_by_stamp_sheet({
    stampSheet="stampSheet",
    keyId="key-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
code = result.code;
result = result.result;
transaction = result.transaction;
randomStatus = result.randomStatus;
executeTime = result.executeTime;
charged = result.charged;
output = result.output;
client = gs2('script')

api_result_handler = client.invoke_by_stamp_sheet_async({
    stampSheet="stampSheet",
    keyId="key-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
code = result.code;
result = result.result;
transaction = result.transaction;
randomStatus = result.randomStatus;
executeTime = result.executeTime;
charged = result.charged;
output = result.output;