NAV
go python java php typescript csharp GS2-Script

GS2-Limit

GS2-SDK のリファレンス

モデル

Namespace

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

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

説明
namespaceId string ネームスペースGRN
name string ネームスペース名
description string 説明文
logSetting LogSetting ログの出力設定
createdAt long 作成日時
updatedAt long 最終更新日時

Counter

回数制限の現在の値を保持するエンティティです。

説明
counterId string カウンターGRN
limitName string 回数制限の種類の名前
name string カウンターの名前
userId string ユーザーID
count int カウント値
createdAt long 作成日時
updatedAt long 最終更新日時

LimitModelMaster

回数制限の情報を定義するエンティティです。

回数制限にはリセット間隔を設定できます。 リセット間隔は 毎日・毎週・毎月・リセットしない の4種類から選択ができます。 全ての時間は協定世界時(UTC)で指定します。

回数制限の最大値はマスターデータでは設定しません。 なぜなら、ステップアップガチャのような仕組みで、購入回数カウンターが 3 回未満の場合に購入できる商品。 前述の商品を購入することが出来ず、購入回数カウンターが 5 回未満の場合に購入できる商品。というようにコンテキストによって最大値を変更できるようにするためです。

ここで定義した回数制限設定に紐づくカウンターは複数作成できます。 例えば、1回しか受け取れないクエスト報酬があるときに、クエストごとに回数制限を用意するのではなく 1つの回数制限を用意し、クエスト毎のカウンターを用意することで、設定の数を爆発させないことができます。

説明
limitModelId string 回数制限の種類マスターGRN
name string 回数制限の種類名
description string 説明文
metadata string メタデータ
resetType string リセットタイミング
resetDayOfMonth int リセットをする日にち
resetDayOfWeek string リセットする曜日
resetHour int リセット時刻
createdAt long 作成日時
updatedAt long 最終更新日時

CurrentLimitMaster

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

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

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

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

GitHubCheckoutSetting

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

LogSetting

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

LimitModel

回数制限の情報を定義するエンティティです。

回数制限にはリセット間隔を設定できます。 リセット間隔は 毎日・毎週・毎月・リセットしない の4種類から選択ができます。

回数制限の最大値はマスターデータでは設定しません。 なぜなら、ステップアップガチャのような仕組みで、購入回数カウンターが 3 回未満の場合に購入できる商品。 前述の商品を購入することが出来ず、購入回数カウンターが 5 回未満の場合に購入できる商品。というようにコンテキストによって最大値を変更できるようにするためです。

説明
limitModelId string 回数制限の種類GRN
name string 回数制限の種類名
metadata string メタデータ
resetType string リセットタイミング
resetDayOfMonth int リセットをする日にち
resetDayOfWeek string リセットする曜日
resetHour int リセット時刻

メソッド

describeNamespaces

describeNamespaces

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

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

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeNamespaces(
    new DescribeNamespacesRequest()
        .withPageToken(null)
        .withLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

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

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

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

api_result = client.describe_namespaces({
    pageToken=nil,
    limit=nil,
});

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

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

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

Request

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

Result

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

createNamespace

createNamespace

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &limit.CreateNamespaceRequest {
        Name: pointy.String("namespace1"),
        Description: nil,
        LogSetting: &limit.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CreateNamespaceRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName(self::namespace1)
            ->withDescription(null)
            ->withLogSetting((new \Gs2\Limit\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CreateNamespaceRequest;
import io.gs2.limit.result.CreateNamespaceResult;

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

try {
    CreateNamespaceResult result = client.createNamespace(
        new CreateNamespaceRequest()
            .withName("namespace1")
            .withDescription(null)
            .withLogSetting(new io.gs2.limit.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.CreateNamespaceRequest;
using Gs2.Gs2Limit.Result.CreateNamespaceResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createNamespace(
    new CreateNamespaceRequest()
        .withName("namespace1")
        .withDescription(null)
        .withLogSetting(new Gs2.Gs2Limit.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.createNamespace(
        new Gs2Limit.CreateNamespaceRequest()
            .withName("namespace1")
            .withDescription(null)
            .withLogSetting(new Gs2Limit.Model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.create_namespace(
        limit.CreateNamespaceRequest()
            .with_name(self.hash1)
            .with_description(None)
            .with_log_setting(
                limit.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.create_namespace({
    name='namespace1',
    description=nil,
    logSetting={
        loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
    },
});

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

result = api_result.result
item = result.item;

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

Request

必須 デフォルト 値の制限 説明
name string ~ 32文字 ネームスペース名
description string ~ 1024文字 説明文
logSetting LogSetting ログの出力設定

Result

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

getNamespaceStatus

getNamespaceStatus

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

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

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getNamespaceStatus(
    new GetNamespaceStatusRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

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

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

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

client = gs2('limit')

api_result = client.get_namespace_status({
    namespaceName='namespace1',
});

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

result = api_result.result
status = result.status;

ネームスペースの状態を取得

Request

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

Result

説明
status string

getNamespace

getNamespace

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

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

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getNamespace(
    new GetNamespaceRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

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

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

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

client = gs2('limit')

api_result = client.get_namespace({
    namespaceName='namespace1',
});

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

result = api_result.result
item = result.item;

ネームスペースを取得

Request

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

Result

説明
item Namespace ネームスペース

updateNamespace

updateNamespace

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &limit.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace1"),
        Description: pointy.String("description1"),
        LogSetting: &limit.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\UpdateNamespaceRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateNamespace(
        (new UpdateNamespaceRequest())
            ->withNamespaceName(self::namespace1)
            ->withDescription("description1")
            ->withLogSetting((new \Gs2\Limit\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.UpdateNamespaceRequest;
import io.gs2.limit.result.UpdateNamespaceResult;

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

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withLogSetting(new io.gs2.limit.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.UpdateNamespaceRequest;
using Gs2.Gs2Limit.Result.UpdateNamespaceResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateNamespace(
    new UpdateNamespaceRequest()
        .withNamespaceName("namespace1")
        .withDescription("description1")
        .withLogSetting(new Gs2.Gs2Limit.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.updateNamespace(
        new Gs2Limit.UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withLogSetting(new Gs2Limit.Model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.update_namespace(
        limit.UpdateNamespaceRequest()
            .with_namespace_name(self.hash1)
            .with_description('description1')
            .with_log_setting(
                limit.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.update_namespace({
    namespaceName='namespace1',
    description='description1',
    logSetting={
        loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
    },
});

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

result = api_result.result
item = result.item;

ネームスペースを更新

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
description string ~ 1024文字 説明文
logSetting LogSetting ログの出力設定

Result

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

deleteNamespace

deleteNamespace

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

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

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteNamespace(
    new DeleteNamespaceRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

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

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

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

client = gs2('limit')

api_result = client.delete_namespace({
    namespaceName='namespace1',
});

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

result = api_result.result
item = result.item;

ネームスペースを削除

Request

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

Result

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

describeCounters

describeCounters

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DescribeCounters(
    &limit.DescribeCountersRequest {
        NamespaceName: pointy.String("namespace1"),
        AccessToken: pointy.String("$access_token_0001"),
        LimitName: pointy.String("daily"),
        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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DescribeCountersRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeCounters(
        (new DescribeCountersRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->withLimitName("daily")
            ->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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DescribeCountersRequest;
import io.gs2.limit.result.DescribeCountersResult;

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

try {
    DescribeCountersResult result = client.describeCounters(
        new DescribeCountersRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
            .withLimitName("daily")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Counter> 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.DescribeCountersRequest;
using Gs2.Gs2Limit.Result.DescribeCountersResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeCounters(
    new DescribeCountersRequest()
        .withNamespaceName("namespace1")
        .withAccessToken("$access_token_0001")
        .withLimitName("daily")
        .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 Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.describeCounters(
        new Gs2Limit.DescribeCountersRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
            .withLimitName("daily")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.describe_counters(
        limit.DescribeCountersRequest()
            .with_namespace_name(self.hash1)
            .with_access_token(self.access_token_0001)
            .with_limit_name('daily')
            .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('limit')

api_result = client.describe_counters({
    namespaceName='namespace1',
    accessToken='$access_token_0001',
    limitName='daily',
    pageToken=nil,
    limit=nil,
});

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

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

カウンターの一覧を取得

Request

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

Result

説明
items Counter[] カウンターのリスト
nextPageToken string リストの続きを取得するためのページトークン

describeCountersByUserId

describeCountersByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DescribeCountersByUserId(
    &limit.DescribeCountersByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        UserId: pointy.String("user-0001"),
        LimitName: pointy.String("daily"),
        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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DescribeCountersByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeCountersByUserId(
        (new DescribeCountersByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId("user-0001")
            ->withLimitName("daily")
            ->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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DescribeCountersByUserIdRequest;
import io.gs2.limit.result.DescribeCountersByUserIdResult;

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

try {
    DescribeCountersByUserIdResult result = client.describeCountersByUserId(
        new DescribeCountersByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withLimitName("daily")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Counter> 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.DescribeCountersByUserIdRequest;
using Gs2.Gs2Limit.Result.DescribeCountersByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeCountersByUserId(
    new DescribeCountersByUserIdRequest()
        .withNamespaceName("namespace1")
        .withUserId("user-0001")
        .withLimitName("daily")
        .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 Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.describeCountersByUserId(
        new Gs2Limit.DescribeCountersByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withLimitName("daily")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.describe_counters_by_user_id(
        limit.DescribeCountersByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_limit_name('daily')
            .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('limit')

api_result = client.describe_counters_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
    limitName='daily',
    pageToken=nil,
    limit=nil,
});

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

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

カウンターの一覧を取得

Request

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

Result

説明
items Counter[] カウンターのリスト
nextPageToken string リストの続きを取得するためのページトークン

getCounter

getCounter

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.GetCounter(
    &limit.GetCounterRequest {
        NamespaceName: pointy.String("namespace1"),
        LimitName: pointy.String("daily"),
        AccessToken: pointy.String("$access_token_0001"),
        CounterName: pointy.String("counter1"),
    }
)
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetCounterRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getCounter(
        (new GetCounterRequest())
            ->withNamespaceName(self::namespace1)
            ->withLimitName("daily")
            ->withAccessToken(self::$accessToken0001)
            ->withCounterName("counter1")
    );
    $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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetCounterRequest;
import io.gs2.limit.result.GetCounterResult;

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

try {
    GetCounterResult result = client.getCounter(
        new GetCounterRequest()
            .withNamespaceName("namespace1")
            .withLimitName("daily")
            .withAccessToken("$access_token_0001")
            .withCounterName("counter1")
    );
    Counter 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.GetCounterRequest;
using Gs2.Gs2Limit.Result.GetCounterResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getCounter(
    new GetCounterRequest()
        .withNamespaceName("namespace1")
        .withLimitName("daily")
        .withAccessToken("$access_token_0001")
        .withCounterName("counter1"),
    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 Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.getCounter(
        new Gs2Limit.GetCounterRequest()
            .withNamespaceName("namespace1")
            .withLimitName("daily")
            .withAccessToken("$access_token_0001")
            .withCounterName("counter1")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.get_counter(
        limit.GetCounterRequest()
            .with_namespace_name(self.hash1)
            .with_limit_name('daily')
            .with_access_token(self.access_token_0001)
            .with_counter_name('counter1')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.get_counter({
    namespaceName='namespace1',
    limitName='daily',
    accessToken='$access_token_0001',
    counterName='counter1',
});

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

result = api_result.result
item = result.item;

カウンターを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
limitName string ~ 128文字 回数制限の種類の名前
accessToken string ~ 128文字 ユーザーID
counterName string ~ 128文字 カウンターの名前

Result

説明
item Counter カウンター

getCounterByUserId

getCounterByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.GetCounterByUserId(
    &limit.GetCounterByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        LimitName: pointy.String("daily"),
        UserId: pointy.String("user-0001"),
        CounterName: pointy.String("counter2"),
    }
)
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetCounterByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getCounterByUserId(
        (new GetCounterByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withLimitName("daily")
            ->withUserId("user-0001")
            ->withCounterName("counter2")
    );
    $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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetCounterByUserIdRequest;
import io.gs2.limit.result.GetCounterByUserIdResult;

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

try {
    GetCounterByUserIdResult result = client.getCounterByUserId(
        new GetCounterByUserIdRequest()
            .withNamespaceName("namespace1")
            .withLimitName("daily")
            .withUserId("user-0001")
            .withCounterName("counter2")
    );
    Counter 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.GetCounterByUserIdRequest;
using Gs2.Gs2Limit.Result.GetCounterByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getCounterByUserId(
    new GetCounterByUserIdRequest()
        .withNamespaceName("namespace1")
        .withLimitName("daily")
        .withUserId("user-0001")
        .withCounterName("counter2"),
    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 Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.getCounterByUserId(
        new Gs2Limit.GetCounterByUserIdRequest()
            .withNamespaceName("namespace1")
            .withLimitName("daily")
            .withUserId("user-0001")
            .withCounterName("counter2")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.get_counter_by_user_id(
        limit.GetCounterByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_limit_name('daily')
            .with_user_id('user-0001')
            .with_counter_name('counter2')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.get_counter_by_user_id({
    namespaceName='namespace1',
    limitName='daily',
    userId='user-0001',
    counterName='counter2',
});

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

result = api_result.result
item = result.item;

ユーザIDを指定してカウンターを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
limitName string ~ 128文字 回数制限の種類の名前
userId string ~ 128文字 ユーザーID
counterName string ~ 128文字 カウンターの名前

Result

説明
item Counter カウンター

countUp

countUp

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.CountUp(
    &limit.CountUpRequest {
        NamespaceName: pointy.String("namespace1"),
        LimitName: pointy.String("daily"),
        CounterName: pointy.String("counter1"),
        AccessToken: pointy.String("$access_token_0001"),
        CountUpValue: pointy.Int32(1),
        MaxValue: pointy.Int32(100),
    }
)
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CountUpRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->countUp(
        (new CountUpRequest())
            ->withNamespaceName(self::namespace1)
            ->withLimitName("daily")
            ->withCounterName("counter1")
            ->withAccessToken(self::$accessToken0001)
            ->withCountUpValue(1)
            ->withMaxValue(100)
    );
    $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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CountUpRequest;
import io.gs2.limit.result.CountUpResult;

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

try {
    CountUpResult result = client.countUp(
        new CountUpRequest()
            .withNamespaceName("namespace1")
            .withLimitName("daily")
            .withCounterName("counter1")
            .withAccessToken("$access_token_0001")
            .withCountUpValue(1)
            .withMaxValue(100)
    );
    Counter 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.CountUpRequest;
using Gs2.Gs2Limit.Result.CountUpResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.countUp(
    new CountUpRequest()
        .withNamespaceName("namespace1")
        .withLimitName("daily")
        .withCounterName("counter1")
        .withAccessToken("$access_token_0001")
        .withCountUpValue(1)
        .withMaxValue(100),
    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 Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.countUp(
        new Gs2Limit.CountUpRequest()
            .withNamespaceName("namespace1")
            .withLimitName("daily")
            .withCounterName("counter1")
            .withAccessToken("$access_token_0001")
            .withCountUpValue(1)
            .withMaxValue(100)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.count_up(
        limit.CountUpRequest()
            .with_namespace_name(self.hash1)
            .with_limit_name('daily')
            .with_counter_name('counter1')
            .with_access_token(self.access_token_0001)
            .with_count_up_value(1)
            .with_max_value(100)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.count_up({
    namespaceName='namespace1',
    limitName='daily',
    counterName='counter1',
    accessToken='$access_token_0001',
    countUpValue=1,
    maxValue=100,
});

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

result = api_result.result
item = result.item;

カウントアップ

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
limitName string ~ 128文字 回数制限の種類の名前
counterName string ~ 128文字 カウンターの名前
accessToken string ~ 128文字 ユーザーID
countUpValue int 1 1 ~ 9223372036854775807 カウントアップする量
maxValue int 1 ~ 9223372036854775807 カウントアップを許容する最大値 を入力してください

Result

説明
item Counter カウントを増やしたカウンター

countUpByUserId

countUpByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.CountUpByUserId(
    &limit.CountUpByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        LimitName: pointy.String("daily"),
        CounterName: pointy.String("counter2"),
        UserId: pointy.String("user-0001"),
        CountUpValue: pointy.Int32(2),
        MaxValue: pointy.Int32(100),
    }
)
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CountUpByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->countUpByUserId(
        (new CountUpByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withLimitName("daily")
            ->withCounterName("counter2")
            ->withUserId("user-0001")
            ->withCountUpValue(2)
            ->withMaxValue(100)
    );
    $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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CountUpByUserIdRequest;
import io.gs2.limit.result.CountUpByUserIdResult;

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

try {
    CountUpByUserIdResult result = client.countUpByUserId(
        new CountUpByUserIdRequest()
            .withNamespaceName("namespace1")
            .withLimitName("daily")
            .withCounterName("counter2")
            .withUserId("user-0001")
            .withCountUpValue(2)
            .withMaxValue(100)
    );
    Counter 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.CountUpByUserIdRequest;
using Gs2.Gs2Limit.Result.CountUpByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.countUpByUserId(
    new CountUpByUserIdRequest()
        .withNamespaceName("namespace1")
        .withLimitName("daily")
        .withCounterName("counter2")
        .withUserId("user-0001")
        .withCountUpValue(2)
        .withMaxValue(100),
    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 Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.countUpByUserId(
        new Gs2Limit.CountUpByUserIdRequest()
            .withNamespaceName("namespace1")
            .withLimitName("daily")
            .withCounterName("counter2")
            .withUserId("user-0001")
            .withCountUpValue(2)
            .withMaxValue(100)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.count_up_by_user_id(
        limit.CountUpByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_limit_name('daily')
            .with_counter_name('counter2')
            .with_user_id('user-0001')
            .with_count_up_value(2)
            .with_max_value(100)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.count_up_by_user_id({
    namespaceName='namespace1',
    limitName='daily',
    counterName='counter2',
    userId='user-0001',
    countUpValue=2,
    maxValue=100,
});

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

result = api_result.result
item = result.item;

ユーザIDを指定してカウントアップ

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
limitName string ~ 128文字 回数制限の種類の名前
counterName string ~ 128文字 カウンターの名前
userId string ~ 128文字 ユーザーID
countUpValue int 1 1 ~ 9223372036854775807 カウントアップする量
maxValue int 1 ~ 9223372036854775807 カウントアップを許容する最大値 を入力してください

Result

説明
item Counter カウントを増やしたカウンター

deleteCounterByUserId

deleteCounterByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DeleteCounterByUserId(
    &limit.DeleteCounterByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        LimitName: pointy.String("daily"),
        UserId: pointy.String("user-0001"),
        CounterName: pointy.String("counter1"),
    }
)
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DeleteCounterByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteCounterByUserId(
        (new DeleteCounterByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withLimitName("daily")
            ->withUserId("user-0001")
            ->withCounterName("counter1")
    );
    $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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DeleteCounterByUserIdRequest;
import io.gs2.limit.result.DeleteCounterByUserIdResult;

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

try {
    DeleteCounterByUserIdResult result = client.deleteCounterByUserId(
        new DeleteCounterByUserIdRequest()
            .withNamespaceName("namespace1")
            .withLimitName("daily")
            .withUserId("user-0001")
            .withCounterName("counter1")
    );
    Counter 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.DeleteCounterByUserIdRequest;
using Gs2.Gs2Limit.Result.DeleteCounterByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteCounterByUserId(
    new DeleteCounterByUserIdRequest()
        .withNamespaceName("namespace1")
        .withLimitName("daily")
        .withUserId("user-0001")
        .withCounterName("counter1"),
    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 Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.deleteCounterByUserId(
        new Gs2Limit.DeleteCounterByUserIdRequest()
            .withNamespaceName("namespace1")
            .withLimitName("daily")
            .withUserId("user-0001")
            .withCounterName("counter1")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.delete_counter_by_user_id(
        limit.DeleteCounterByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_limit_name('daily')
            .with_user_id('user-0001')
            .with_counter_name('counter1')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.delete_counter_by_user_id({
    namespaceName='namespace1',
    limitName='daily',
    userId='user-0001',
    counterName='counter1',
});

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

result = api_result.result
item = result.item;

ユーザIDを指定してカウンターを削除

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
limitName string ~ 128文字 回数制限の種類の名前
userId string ~ 128文字 ユーザーID
counterName string ~ 128文字 カウンターの名前

Result

説明
item Counter カウンター

countUpByStampTask

countUpByStampTask

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.CountUpByStampTask(
    &limit.CountUpByStampTaskRequest {
        StampTask: pointy.String("$stampTask"),
        KeyId: pointy.String("$key1.keyId"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
newContextStack := result.NewContextStack
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CountUpByStampTaskRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->countUpByStampTask(
        (new CountUpByStampTaskRequest())
            ->withStampTask(self::$stampTask)
            ->withKeyId(self::$key1.keyId)
    );
    $item = $result->getItem();
    $newContextStack = $result->getNewContextStack();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CountUpByStampTaskRequest;
import io.gs2.limit.result.CountUpByStampTaskResult;

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

try {
    CountUpByStampTaskResult result = client.countUpByStampTask(
        new CountUpByStampTaskRequest()
            .withStampTask("$stampTask")
            .withKeyId("$key1.keyId")
    );
    Counter item = result.getItem();
    String newContextStack = result.getNewContextStack();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.CountUpByStampTaskRequest;
using Gs2.Gs2Limit.Result.CountUpByStampTaskResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.countUpByStampTask(
    new CountUpByStampTaskRequest()
        .withStampTask("$stampTask")
        .withKeyId("$key1.keyId"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var newContextStack = result.NewContextStack;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.countUpByStampTask(
        new Gs2Limit.CountUpByStampTaskRequest()
            .withStampTask("$stampTask")
            .withKeyId("$key1.keyId")
    );
    const item = result.getItem();
    const newContextStack = result.getNewContextStack();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.count_up_by_stamp_task(
        limit.CountUpByStampTaskRequest()
            .with_stamp_task(self.stamp_task)
            .with_key_id(self.key1.key_id)
    )
    item = result.item
    new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.count_up_by_stamp_task({
    stampTask='$stampTask',
    keyId='$key1.keyId',
});

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

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

スタンプシートでカウントアップ

Request

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

Result

説明
item Counter カウントを増やしたカウンター
newContextStack string スタンプタスクの実行結果を記録したコンテキスト

deleteByStampSheet

deleteByStampSheet

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DeleteByStampSheet(
    &limit.DeleteByStampSheetRequest {
        StampSheet: pointy.String("$stampSheet"),
        KeyId: pointy.String("$key1.keyId"),
    }
)
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DeleteByStampSheetRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteByStampSheet(
        (new DeleteByStampSheetRequest())
            ->withStampSheet(self::$stampSheet)
            ->withKeyId(self::$key1.keyId)
    );
    $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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DeleteByStampSheetRequest;
import io.gs2.limit.result.DeleteByStampSheetResult;

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

try {
    DeleteByStampSheetResult result = client.deleteByStampSheet(
        new DeleteByStampSheetRequest()
            .withStampSheet("$stampSheet")
            .withKeyId("$key1.keyId")
    );
    Counter 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.DeleteByStampSheetRequest;
using Gs2.Gs2Limit.Result.DeleteByStampSheetResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteByStampSheet(
    new DeleteByStampSheetRequest()
        .withStampSheet("$stampSheet")
        .withKeyId("$key1.keyId"),
    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 Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.deleteByStampSheet(
        new Gs2Limit.DeleteByStampSheetRequest()
            .withStampSheet("$stampSheet")
            .withKeyId("$key1.keyId")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.delete_by_stamp_sheet(
        limit.DeleteByStampSheetRequest()
            .with_stamp_sheet(self.stamp_sheet)
            .with_key_id(self.key1.key_id)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

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

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

result = api_result.result
item = result.item;

スタンプシートでカウンターを削除

Request

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

Result

説明
item Counter カウンター

describeLimitModelMasters

describeLimitModelMasters

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DescribeLimitModelMasters(
    &limit.DescribeLimitModelMastersRequest {
        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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DescribeLimitModelMastersRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeLimitModelMasters(
        (new DescribeLimitModelMastersRequest())
            ->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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DescribeLimitModelMastersRequest;
import io.gs2.limit.result.DescribeLimitModelMastersResult;

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

try {
    DescribeLimitModelMastersResult result = client.describeLimitModelMasters(
        new DescribeLimitModelMastersRequest()
            .withNamespaceName("namespace1")
            .withPageToken(null)
            .withLimit(null)
    );
    List<LimitModelMaster> 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.DescribeLimitModelMastersRequest;
using Gs2.Gs2Limit.Result.DescribeLimitModelMastersResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeLimitModelMasters(
    new DescribeLimitModelMastersRequest()
        .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 Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.describeLimitModelMasters(
        new Gs2Limit.DescribeLimitModelMastersRequest()
            .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 limit

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

try:
    result = client.describe_limit_model_masters(
        limit.DescribeLimitModelMastersRequest()
            .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('limit')

api_result = client.describe_limit_model_masters({
    namespaceName='namespace1',
    pageToken=nil,
    limit=nil,
});

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

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

回数制限の種類マスターの一覧を取得

Request

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

Result

説明
items LimitModelMaster[] 回数制限の種類マスターのリスト
nextPageToken string リストの続きを取得するためのページトークン

createLimitModelMaster

createLimitModelMaster

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.CreateLimitModelMaster(
    &limit.CreateLimitModelMasterRequest {
        NamespaceName: pointy.String("namespace1"),
        Name: pointy.String("limit-model-0001"),
        Description: nil,
        Metadata: nil,
        ResetType: pointy.String("monthly"),
        ResetDayOfMonth: pointy.Int32(1),
        ResetDayOfWeek: pointy.String("monday"),
        ResetHour: pointy.Int32(5),
    }
)
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CreateLimitModelMasterRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createLimitModelMaster(
        (new CreateLimitModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->withName("limit-model-0001")
            ->withDescription(null)
            ->withMetadata(null)
            ->withResetType("monthly")
            ->withResetDayOfMonth(1)
            ->withResetDayOfWeek("monday")
            ->withResetHour(5)
    );
    $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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CreateLimitModelMasterRequest;
import io.gs2.limit.result.CreateLimitModelMasterResult;

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

try {
    CreateLimitModelMasterResult result = client.createLimitModelMaster(
        new CreateLimitModelMasterRequest()
            .withNamespaceName("namespace1")
            .withName("limit-model-0001")
            .withDescription(null)
            .withMetadata(null)
            .withResetType("monthly")
            .withResetDayOfMonth(1)
            .withResetDayOfWeek("monday")
            .withResetHour(5)
    );
    LimitModelMaster 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.CreateLimitModelMasterRequest;
using Gs2.Gs2Limit.Result.CreateLimitModelMasterResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createLimitModelMaster(
    new CreateLimitModelMasterRequest()
        .withNamespaceName("namespace1")
        .withName("limit-model-0001")
        .withDescription(null)
        .withMetadata(null)
        .withResetType("monthly")
        .withResetDayOfMonth(1)
        .withResetDayOfWeek("monday")
        .withResetHour(5),
    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 Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.createLimitModelMaster(
        new Gs2Limit.CreateLimitModelMasterRequest()
            .withNamespaceName("namespace1")
            .withName("limit-model-0001")
            .withDescription(null)
            .withMetadata(null)
            .withResetType("monthly")
            .withResetDayOfMonth(1)
            .withResetDayOfWeek("monday")
            .withResetHour(5)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.create_limit_model_master(
        limit.CreateLimitModelMasterRequest()
            .with_namespace_name(self.hash1)
            .with_name('limit-model-0001')
            .with_description(None)
            .with_metadata(None)
            .with_reset_type('monthly')
            .with_reset_day_of_month(1)
            .with_reset_day_of_week('monday')
            .with_reset_hour(5)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.create_limit_model_master({
    namespaceName='namespace1',
    name='limit-model-0001',
    description=nil,
    metadata=nil,
    resetType='monthly',
    resetDayOfMonth=1,
    resetDayOfWeek='monday',
    resetHour=5,
});

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

result = api_result.result
item = result.item;

回数制限の種類マスターを新規作成

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
name string ~ 128文字 回数制限の種類名
description string ~ 1024文字 説明文
metadata string ~ 2048文字 メタデータ
resetType string ~ 128文字 リセットタイミング
resetDayOfMonth int {resetType} == "monthly" 1 ~ 31 リセットをする日にち
resetDayOfWeek string {resetType} == "weekly" ~ 128文字 リセットする曜日
resetHour int {resetType} in ["monthly", "weekly", "daily"] ~ 23 リセット時刻

Result

説明
item LimitModelMaster 作成した回数制限の種類マスター

getLimitModelMaster

getLimitModelMaster

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.GetLimitModelMaster(
    &limit.GetLimitModelMasterRequest {
        NamespaceName: pointy.String("namespace1"),
        LimitName: pointy.String("limit-model-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetLimitModelMasterRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getLimitModelMaster(
        (new GetLimitModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->withLimitName("limit-model-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetLimitModelMasterRequest;
import io.gs2.limit.result.GetLimitModelMasterResult;

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

try {
    GetLimitModelMasterResult result = client.getLimitModelMaster(
        new GetLimitModelMasterRequest()
            .withNamespaceName("namespace1")
            .withLimitName("limit-model-0001")
    );
    LimitModelMaster 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.GetLimitModelMasterRequest;
using Gs2.Gs2Limit.Result.GetLimitModelMasterResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getLimitModelMaster(
    new GetLimitModelMasterRequest()
        .withNamespaceName("namespace1")
        .withLimitName("limit-model-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.getLimitModelMaster(
        new Gs2Limit.GetLimitModelMasterRequest()
            .withNamespaceName("namespace1")
            .withLimitName("limit-model-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.get_limit_model_master(
        limit.GetLimitModelMasterRequest()
            .with_namespace_name(self.hash1)
            .with_limit_name('limit-model-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.get_limit_model_master({
    namespaceName='namespace1',
    limitName='limit-model-0001',
});

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

result = api_result.result
item = result.item;

回数制限の種類マスターを取得

Request

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

Result

説明
item LimitModelMaster 回数制限の種類マスター

updateLimitModelMaster

updateLimitModelMaster

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.UpdateLimitModelMaster(
    &limit.UpdateLimitModelMasterRequest {
        NamespaceName: pointy.String("namespace1"),
        LimitName: pointy.String("limit-model-0001"),
        Description: pointy.String("description1"),
        Metadata: pointy.String("{\"hoge\": \"fuga\"}"),
        ResetType: pointy.String("daily"),
        ResetDayOfMonth: pointy.Int32(1),
        ResetDayOfWeek: pointy.String("monday"),
        ResetHour: pointy.Int32(18),
    }
)
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\UpdateLimitModelMasterRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateLimitModelMaster(
        (new UpdateLimitModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->withLimitName("limit-model-0001")
            ->withDescription("description1")
            ->withMetadata("{\"hoge\": \"fuga\"}")
            ->withResetType("daily")
            ->withResetDayOfMonth(1)
            ->withResetDayOfWeek("monday")
            ->withResetHour(18)
    );
    $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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.UpdateLimitModelMasterRequest;
import io.gs2.limit.result.UpdateLimitModelMasterResult;

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

try {
    UpdateLimitModelMasterResult result = client.updateLimitModelMaster(
        new UpdateLimitModelMasterRequest()
            .withNamespaceName("namespace1")
            .withLimitName("limit-model-0001")
            .withDescription("description1")
            .withMetadata("{\"hoge\": \"fuga\"}")
            .withResetType("daily")
            .withResetDayOfMonth(1)
            .withResetDayOfWeek("monday")
            .withResetHour(18)
    );
    LimitModelMaster 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.UpdateLimitModelMasterRequest;
using Gs2.Gs2Limit.Result.UpdateLimitModelMasterResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateLimitModelMaster(
    new UpdateLimitModelMasterRequest()
        .withNamespaceName("namespace1")
        .withLimitName("limit-model-0001")
        .withDescription("description1")
        .withMetadata("{\"hoge\": \"fuga\"}")
        .withResetType("daily")
        .withResetDayOfMonth(1)
        .withResetDayOfWeek("monday")
        .withResetHour(18),
    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 Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.updateLimitModelMaster(
        new Gs2Limit.UpdateLimitModelMasterRequest()
            .withNamespaceName("namespace1")
            .withLimitName("limit-model-0001")
            .withDescription("description1")
            .withMetadata("{\"hoge\": \"fuga\"}")
            .withResetType("daily")
            .withResetDayOfMonth(1)
            .withResetDayOfWeek("monday")
            .withResetHour(18)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.update_limit_model_master(
        limit.UpdateLimitModelMasterRequest()
            .with_namespace_name(self.hash1)
            .with_limit_name('limit-model-0001')
            .with_description('description1')
            .with_metadata('{"hoge": "fuga"}')
            .with_reset_type('daily')
            .with_reset_day_of_month(1)
            .with_reset_day_of_week('monday')
            .with_reset_hour(18)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.update_limit_model_master({
    namespaceName='namespace1',
    limitName='limit-model-0001',
    description='description1',
    metadata='{"hoge": "fuga"}',
    resetType='daily',
    resetDayOfMonth=1,
    resetDayOfWeek='monday',
    resetHour=18,
});

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

result = api_result.result
item = result.item;

回数制限の種類マスターを更新

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
limitName string ~ 128文字 回数制限の種類名
description string ~ 1024文字 説明文
metadata string ~ 2048文字 メタデータ
resetType string ~ 128文字 リセットタイミング
resetDayOfMonth int {resetType} == "monthly" 1 ~ 31 リセットをする日にち
resetDayOfWeek string {resetType} == "weekly" ~ 128文字 リセットする曜日
resetHour int {resetType} in ["monthly", "weekly", "daily"] ~ 23 リセット時刻

Result

説明
item LimitModelMaster 更新した回数制限の種類マスター

deleteLimitModelMaster

deleteLimitModelMaster

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DeleteLimitModelMaster(
    &limit.DeleteLimitModelMasterRequest {
        NamespaceName: pointy.String("namespace1"),
        LimitName: pointy.String("limit-model-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DeleteLimitModelMasterRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteLimitModelMaster(
        (new DeleteLimitModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->withLimitName("limit-model-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DeleteLimitModelMasterRequest;
import io.gs2.limit.result.DeleteLimitModelMasterResult;

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

try {
    DeleteLimitModelMasterResult result = client.deleteLimitModelMaster(
        new DeleteLimitModelMasterRequest()
            .withNamespaceName("namespace1")
            .withLimitName("limit-model-0001")
    );
    LimitModelMaster 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.DeleteLimitModelMasterRequest;
using Gs2.Gs2Limit.Result.DeleteLimitModelMasterResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteLimitModelMaster(
    new DeleteLimitModelMasterRequest()
        .withNamespaceName("namespace1")
        .withLimitName("limit-model-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.deleteLimitModelMaster(
        new Gs2Limit.DeleteLimitModelMasterRequest()
            .withNamespaceName("namespace1")
            .withLimitName("limit-model-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.delete_limit_model_master(
        limit.DeleteLimitModelMasterRequest()
            .with_namespace_name(self.hash1)
            .with_limit_name('limit-model-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.delete_limit_model_master({
    namespaceName='namespace1',
    limitName='limit-model-0001',
});

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

result = api_result.result
item = result.item;

回数制限の種類マスターを削除

Request

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

Result

説明
item LimitModelMaster 削除した回数制限の種類マスター

exportMaster

exportMaster

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.ExportMaster(
    &limit.ExportMasterRequest {
        NamespaceName: pointy.String("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\ExportMasterRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->exportMaster(
        (new ExportMasterRequest())
            ->withNamespaceName(self::namespace1)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.ExportMasterRequest;
import io.gs2.limit.result.ExportMasterResult;

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

try {
    ExportMasterResult result = client.exportMaster(
        new ExportMasterRequest()
            .withNamespaceName("namespace1")
    );
    CurrentLimitMaster 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.ExportMasterRequest;
using Gs2.Gs2Limit.Result.ExportMasterResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.exportMaster(
    new ExportMasterRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.exportMaster(
        new Gs2Limit.ExportMasterRequest()
            .withNamespaceName("namespace1")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.export_master(
        limit.ExportMasterRequest()
            .with_namespace_name(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.export_master({
    namespaceName='namespace1',
});

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

result = api_result.result
item = result.item;

現在有効な回数制限設定のマスターデータをエクスポートします

Request

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

Result

説明
item CurrentLimitMaster 現在有効な回数制限設定

getCurrentLimitMaster

getCurrentLimitMaster

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.GetCurrentLimitMaster(
    &limit.GetCurrentLimitMasterRequest {
        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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetCurrentLimitMasterRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getCurrentLimitMaster(
        (new GetCurrentLimitMasterRequest())
            ->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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetCurrentLimitMasterRequest;
import io.gs2.limit.result.GetCurrentLimitMasterResult;

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

try {
    GetCurrentLimitMasterResult result = client.getCurrentLimitMaster(
        new GetCurrentLimitMasterRequest()
            .withNamespaceName("namespace1")
    );
    CurrentLimitMaster 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.GetCurrentLimitMasterRequest;
using Gs2.Gs2Limit.Result.GetCurrentLimitMasterResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getCurrentLimitMaster(
    new GetCurrentLimitMasterRequest()
        .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 Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.getCurrentLimitMaster(
        new Gs2Limit.GetCurrentLimitMasterRequest()
            .withNamespaceName("namespace1")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.get_current_limit_master(
        limit.GetCurrentLimitMasterRequest()
            .with_namespace_name(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.get_current_limit_master({
    namespaceName='namespace1',
});

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

result = api_result.result
item = result.item;

現在有効な回数制限設定を取得します

Request

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

Result

説明
item CurrentLimitMaster 現在有効な回数制限設定

updateCurrentLimitMaster

updateCurrentLimitMaster

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentLimitMaster(
    &limit.UpdateCurrentLimitMasterRequest {
        NamespaceName: pointy.String("namespace1"),
        Settings: pointy.String("{\n  \"version\": \"2019-04-05\",\n  \"limitModels\": [\n    {\n      \"name\": \"daily\",\n      \"metadata\": \"DAILY\",\n      \"resetType\": \"daily\",\n      \"resetHour\": 9\n    },\n    {\n      \"name\": \"weekly\",\n      \"metadata\": \"WEEKLY\",\n      \"resetType\": \"weekly\",\n      \"resetDayOfWeek\": \"sunday\",\n      \"resetHour\": 18\n    }\n  ]\n}"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\UpdateCurrentLimitMasterRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateCurrentLimitMaster(
        (new UpdateCurrentLimitMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->withSettings("{\n  \"version\": \"2019-04-05\",\n  \"limitModels\": [\n    {\n      \"name\": \"daily\",\n      \"metadata\": \"DAILY\",\n      \"resetType\": \"daily\",\n      \"resetHour\": 9\n    },\n    {\n      \"name\": \"weekly\",\n      \"metadata\": \"WEEKLY\",\n      \"resetType\": \"weekly\",\n      \"resetDayOfWeek\": \"sunday\",\n      \"resetHour\": 18\n    }\n  ]\n}")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.UpdateCurrentLimitMasterRequest;
import io.gs2.limit.result.UpdateCurrentLimitMasterResult;

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

try {
    UpdateCurrentLimitMasterResult result = client.updateCurrentLimitMaster(
        new UpdateCurrentLimitMasterRequest()
            .withNamespaceName("namespace1")
            .withSettings("{\n  \"version\": \"2019-04-05\",\n  \"limitModels\": [\n    {\n      \"name\": \"daily\",\n      \"metadata\": \"DAILY\",\n      \"resetType\": \"daily\",\n      \"resetHour\": 9\n    },\n    {\n      \"name\": \"weekly\",\n      \"metadata\": \"WEEKLY\",\n      \"resetType\": \"weekly\",\n      \"resetDayOfWeek\": \"sunday\",\n      \"resetHour\": 18\n    }\n  ]\n}")
    );
    CurrentLimitMaster 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.UpdateCurrentLimitMasterRequest;
using Gs2.Gs2Limit.Result.UpdateCurrentLimitMasterResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateCurrentLimitMaster(
    new UpdateCurrentLimitMasterRequest()
        .withNamespaceName("namespace1")
        .withSettings("{\n  \"version\": \"2019-04-05\",\n  \"limitModels\": [\n    {\n      \"name\": \"daily\",\n      \"metadata\": \"DAILY\",\n      \"resetType\": \"daily\",\n      \"resetHour\": 9\n    },\n    {\n      \"name\": \"weekly\",\n      \"metadata\": \"WEEKLY\",\n      \"resetType\": \"weekly\",\n      \"resetDayOfWeek\": \"sunday\",\n      \"resetHour\": 18\n    }\n  ]\n}"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.updateCurrentLimitMaster(
        new Gs2Limit.UpdateCurrentLimitMasterRequest()
            .withNamespaceName("namespace1")
            .withSettings("{\n  \"version\": \"2019-04-05\",\n  \"limitModels\": [\n    {\n      \"name\": \"daily\",\n      \"metadata\": \"DAILY\",\n      \"resetType\": \"daily\",\n      \"resetHour\": 9\n    },\n    {\n      \"name\": \"weekly\",\n      \"metadata\": \"WEEKLY\",\n      \"resetType\": \"weekly\",\n      \"resetDayOfWeek\": \"sunday\",\n      \"resetHour\": 18\n    }\n  ]\n}")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.update_current_limit_master(
        limit.UpdateCurrentLimitMasterRequest()
            .with_namespace_name(self.hash1)
            .with_settings('{\n  "version": "2019-04-05",\n  "limitModels": [\n    {\n      "name": "daily",\n      "metadata": "DAILY",\n      "resetType": "daily",\n      "resetHour": 9\n    },\n    {\n      "name": "weekly",\n      "metadata": "WEEKLY",\n      "resetType": "weekly",\n      "resetDayOfWeek": "sunday",\n      "resetHour": 18\n    }\n  ]\n}')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.update_current_limit_master({
    namespaceName='namespace1',
    settings='{\n  "version": "2019-04-05",\n  "limitModels": [\n    {\n      "name": "daily",\n      "metadata": "DAILY",\n      "resetType": "daily",\n      "resetHour": 9\n    },\n    {\n      "name": "weekly",\n      "metadata": "WEEKLY",\n      "resetType": "weekly",\n      "resetDayOfWeek": "sunday",\n      "resetHour": 18\n    }\n  ]\n}',
});

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

result = api_result.result
item = result.item;

現在有効な回数制限設定を更新します

Request

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

Result

説明
item CurrentLimitMaster 更新した現在有効な回数制限設定

updateCurrentLimitMasterFromGitHub

updateCurrentLimitMasterFromGitHub

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentLimitMasterFromGitHub(
    &limit.UpdateCurrentLimitMasterFromGitHubRequest {
        NamespaceName: pointy.String("namespace1"),
        CheckoutSetting: {'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'},
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\UpdateCurrentLimitMasterFromGitHubRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateCurrentLimitMasterFromGitHub(
        (new UpdateCurrentLimitMasterFromGitHubRequest())
            ->withNamespaceName(self::namespace1)
            ->withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.UpdateCurrentLimitMasterFromGitHubRequest;
import io.gs2.limit.result.UpdateCurrentLimitMasterFromGitHubResult;

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

try {
    UpdateCurrentLimitMasterFromGitHubResult result = client.updateCurrentLimitMasterFromGitHub(
        new UpdateCurrentLimitMasterFromGitHubRequest()
            .withNamespaceName("namespace1")
            .withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    );
    CurrentLimitMaster 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.UpdateCurrentLimitMasterFromGitHubRequest;
using Gs2.Gs2Limit.Result.UpdateCurrentLimitMasterFromGitHubResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateCurrentLimitMasterFromGitHub(
    new UpdateCurrentLimitMasterFromGitHubRequest()
        .withNamespaceName("namespace1")
        .withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'}),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.updateCurrentLimitMasterFromGitHub(
        new Gs2Limit.UpdateCurrentLimitMasterFromGitHubRequest()
            .withNamespaceName("namespace1")
            .withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.update_current_limit_master_from_git_hub(
        limit.UpdateCurrentLimitMasterFromGitHubRequest()
            .with_namespace_name(self.hash1)
            .with_checkout_setting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.update_current_limit_master_from_git_hub({
    namespaceName='namespace1',
    checkoutSetting={'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'},
});

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

result = api_result.result
item = result.item;

現在有効な回数制限設定を更新します

Request

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

Result

説明
item CurrentLimitMaster 更新した現在有効な回数制限設定

describeLimitModels

describeLimitModels

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DescribeLimitModels(
    &limit.DescribeLimitModelsRequest {
        NamespaceName: pointy.String("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DescribeLimitModelsRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeLimitModels(
        (new DescribeLimitModelsRequest())
            ->withNamespaceName(self::namespace1)
    );
    $items = $result->getItems();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DescribeLimitModelsRequest;
import io.gs2.limit.result.DescribeLimitModelsResult;

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

try {
    DescribeLimitModelsResult result = client.describeLimitModels(
        new DescribeLimitModelsRequest()
            .withNamespaceName("namespace1")
    );
    List<LimitModel> items = result.getItems();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.DescribeLimitModelsRequest;
using Gs2.Gs2Limit.Result.DescribeLimitModelsResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeLimitModels(
    new DescribeLimitModelsRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.describeLimitModels(
        new Gs2Limit.DescribeLimitModelsRequest()
            .withNamespaceName("namespace1")
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.describe_limit_models(
        limit.DescribeLimitModelsRequest()
            .with_namespace_name(self.hash1)
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.describe_limit_models({
    namespaceName='namespace1',
});

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

result = api_result.result
items = result.items;

回数制限の種類の一覧を取得

Request

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

Result

説明
items LimitModel[] 回数制限の種類のリスト

getLimitModel

getLimitModel

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.GetLimitModel(
    &limit.GetLimitModelRequest {
        NamespaceName: pointy.String("namespace1"),
        LimitName: pointy.String("limit-model-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetLimitModelRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getLimitModel(
        (new GetLimitModelRequest())
            ->withNamespaceName(self::namespace1)
            ->withLimitName("limit-model-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetLimitModelRequest;
import io.gs2.limit.result.GetLimitModelResult;

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

try {
    GetLimitModelResult result = client.getLimitModel(
        new GetLimitModelRequest()
            .withNamespaceName("namespace1")
            .withLimitName("limit-model-0001")
    );
    LimitModel 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.GetLimitModelRequest;
using Gs2.Gs2Limit.Result.GetLimitModelResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getLimitModel(
    new GetLimitModelRequest()
        .withNamespaceName("namespace1")
        .withLimitName("limit-model-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.getLimitModel(
        new Gs2Limit.GetLimitModelRequest()
            .withNamespaceName("namespace1")
            .withLimitName("limit-model-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import limit

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

try:
    result = client.get_limit_model(
        limit.GetLimitModelRequest()
            .with_namespace_name(self.hash1)
            .with_limit_name('limit-model-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('limit')

api_result = client.get_limit_model({
    namespaceName='namespace1',
    limitName='limit-model-0001',
});

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

result = api_result.result
item = result.item;

回数制限の種類を取得

Request

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

Result

説明
item LimitModel 回数制限の種類