NAV
go python java php typescript csharp GS2-Script

GS2-Ranking

GS2-SDK のリファレンス

モデル

Namespace

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

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

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

CategoryModel

カテゴリ毎に異なるランキングを作成できます。

カテゴリには登録できるスコアの最小値・最大値を設定でき、その範囲外のスコアは破棄されます。 ランキングを集計する際にスコアを小さいものを上位(昇順)にするか、大きいものを上位(降順)にするかを設定できます。

ランキングの種類として グローバルスコープ を選択できます。 グローバルは全プレイヤーが同じ結果を参照するもので、スコープはフレンド内ランキングや、ギルド内ランキングのようなゲームプレイヤー毎に結果の異なるランキングです。

グローバルランキングはカテゴリごとにランキングの集計間隔を15分~24時間で設定できます。 スコープランキングはリアルタイムで集計結果が反映されます。

ランキングデータには世代という設定があり、世代を変更することで登録されたスコアをリセットすることができます。

説明
categoryModelId string カテゴリGRN
name string カテゴリ名
metadata string メタデータ
minimumValue long スコアの最小値
maximumValue long スコアの最大値
orderDirection string スコアのソート方向
scope string ランキングの種類
uniqueByUserId bool ユーザID毎にスコアを1つしか登録されないようにする
calculateFixedTimingHour int スコアの固定集計開始時刻(時)
calculateFixedTimingMinute int スコアの固定集計開始時刻(分)
calculateIntervalMinutes int スコアの集計間隔(分)
entryPeriodEventId string イベントGRN
accessPeriodEventId string イベントGRN
generation string ランキングの世代

CategoryModelMaster

カテゴリ毎に異なるランキングを作成できます。

カテゴリには登録できるスコアの最小値・最大値を設定でき、その範囲外のスコアは破棄されます。 ランキングを集計する際にスコアを小さいものを上位(昇順)にするか、大きいものを上位(降順)にするかを設定できます。

ランキングの種類として グローバルスコープ を選択できます。 グローバルは全プレイヤーが同じ結果を参照するもので、スコープはフレンド内ランキングや、ギルド内ランキングのようなゲームプレイヤー毎に結果の異なるランキングです。

グローバルランキングはカテゴリごとにランキングの集計間隔を15分~24時間で設定できます。 スコープランキングはリアルタイムで集計結果が反映されます。

ランキングデータには世代という設定があり、世代を変更することで登録されたスコアをリセットすることができます。

説明
categoryModelId string カテゴリマスターGRN
name string カテゴリモデル名
description string 説明文
metadata string メタデータ
minimumValue long スコアの最小値
maximumValue long スコアの最大値
orderDirection string スコアのソート方向
scope string ランキングの種類
uniqueByUserId bool ユーザID毎にスコアを1つしか登録されないようにする
calculateFixedTimingHour int スコアの固定集計開始時刻(時)
calculateFixedTimingMinute int スコアの固定集計開始時刻(分)
calculateIntervalMinutes int スコアの集計間隔(分)
entryPeriodEventId string スコアの登録を受け付ける期間を設定した GS2-Schedule のイベント
accessPeriodEventId string ランキングを参照できる期間を設定した GS2-Schedule のイベント
generation string ランキングの世代
createdAt long 作成日時
updatedAt long 最終更新日時

Subscribe

スコープランキングでスコアの変化を購読している状況を保持するエンティティです。

説明
subscribeId string 購読GRN
categoryName string カテゴリ名
userId string ユーザーID
targetUserIds string[] 購読されるユーザIDリスト
createdAt long 作成日時

Score

ゲームプレイヤー毎×カテゴリ毎の登録されたスコアを保持するエンティティです。

説明
scoreId string スコアGRN
categoryName string カテゴリ名
userId string ユーザーID
uniqueId string スコアのユニークID
scorerUserId string ユーザーID
score long スコア
metadata string メタデータ
createdAt long 作成日時

Ranking

説明
rank long 順位
index long 1位からのインデックス
userId string ユーザーID
score long スコア
metadata string メタデータ
createdAt long 作成日時

CurrentRankingMaster

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

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

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

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

CalculatedAt

説明
categoryName string カテゴリ名
calculatedAt long 集計日時

SubscribeUser

説明
categoryName string カテゴリ名
userId string ユーザーID
targetUserId string 購読されるユーザID

GitHubCheckoutSetting

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

LogSetting

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

メソッド

describeNamespaces

describeNamespaces

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

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

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2RankingRestClient(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 Gs2Ranking from '@/gs2/ranking';

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

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

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

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

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/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &ranking.CreateNamespaceRequest {
        Name: pointy.String("namespace1"),
        Description: nil,
        LogSetting: &ranking.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\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\Ranking\Model\LogSetting())
                ->withLoggingNamespaceId('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.CreateNamespaceRequest;
import io.gs2.ranking.result.CreateNamespaceResult;

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

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

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

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

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

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

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

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

client = gs2('ranking')

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

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/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.GetNamespaceStatus(
    &ranking.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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.GetNamespaceStatusRequest;
import io.gs2.ranking.result.GetNamespaceStatusResult;

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

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2RankingRestClient(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 Gs2Ranking from '@/gs2/ranking';

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

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

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

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

client = gs2('ranking')

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/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.GetNamespace(
    &ranking.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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.GetNamespaceRequest;
import io.gs2.ranking.result.GetNamespaceResult;

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

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2RankingRestClient(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 Gs2Ranking from '@/gs2/ranking';

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

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

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

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

client = gs2('ranking')

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/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &ranking.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace1"),
        Description: pointy.String("description1"),
        LogSetting: &ranking.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\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\Ranking\Model\LogSetting())
                ->withLoggingNamespaceId('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.UpdateNamespaceRequest;
import io.gs2.ranking.result.UpdateNamespaceResult;

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

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

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

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

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

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

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

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

client = gs2('ranking')

api_result = client.update_namespace({
    namespaceName='namespace1',
    description='description1',
    logSetting={
        loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log: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文字 ネームスペース名
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/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.DeleteNamespace(
    &ranking.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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.DeleteNamespaceRequest;
import io.gs2.ranking.result.DeleteNamespaceResult;

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

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2RankingRestClient(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 Gs2Ranking from '@/gs2/ranking';

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

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

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

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

client = gs2('ranking')

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 削除したネームスペース

describeCategoryModels

describeCategoryModels

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.DescribeCategoryModels(
    &ranking.DescribeCategoryModelsRequest {
        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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\DescribeCategoryModelsRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeCategoryModels(
        (new DescribeCategoryModelsRequest())
            ->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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.DescribeCategoryModelsRequest;
import io.gs2.ranking.result.DescribeCategoryModelsResult;

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

try {
    DescribeCategoryModelsResult result = client.describeCategoryModels(
        new DescribeCategoryModelsRequest()
            .withNamespaceName("namespace1")
    );
    List<CategoryModel> 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.DescribeCategoryModelsRequest;
using Gs2.Gs2Ranking.Result.DescribeCategoryModelsResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeCategoryModels(
    new DescribeCategoryModelsRequest()
        .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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.describeCategoryModels(
        new Gs2Ranking.DescribeCategoryModelsRequest()
            .withNamespaceName("namespace1")
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.describe_category_models(
        ranking.DescribeCategoryModelsRequest()
            .with_namespace_name(self.hash1)
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.describe_category_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 CategoryModel[] カテゴリのリスト

getCategoryModel

getCategoryModel

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.GetCategoryModel(
    &ranking.GetCategoryModelRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\GetCategoryModelRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getCategoryModel(
        (new GetCategoryModelRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.GetCategoryModelRequest;
import io.gs2.ranking.result.GetCategoryModelResult;

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

try {
    GetCategoryModelResult result = client.getCategoryModel(
        new GetCategoryModelRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
    );
    CategoryModel 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.GetCategoryModelRequest;
using Gs2.Gs2Ranking.Result.GetCategoryModelResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getCategoryModel(
    new GetCategoryModelRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.getCategoryModel(
        new Gs2Ranking.GetCategoryModelRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.get_category_model(
        ranking.GetCategoryModelRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.get_category_model({
    namespaceName='namespace1',
    categoryName='category-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文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名

Result

説明
item CategoryModel カテゴリ

describeCategoryModelMasters

describeCategoryModelMasters

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.DescribeCategoryModelMasters(
    &ranking.DescribeCategoryModelMastersRequest {
        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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\DescribeCategoryModelMastersRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeCategoryModelMasters(
        (new DescribeCategoryModelMastersRequest())
            ->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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.DescribeCategoryModelMastersRequest;
import io.gs2.ranking.result.DescribeCategoryModelMastersResult;

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

try {
    DescribeCategoryModelMastersResult result = client.describeCategoryModelMasters(
        new DescribeCategoryModelMastersRequest()
            .withNamespaceName("namespace1")
            .withPageToken(null)
            .withLimit(null)
    );
    List<CategoryModelMaster> 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.DescribeCategoryModelMastersRequest;
using Gs2.Gs2Ranking.Result.DescribeCategoryModelMastersResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeCategoryModelMasters(
    new DescribeCategoryModelMastersRequest()
        .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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.describeCategoryModelMasters(
        new Gs2Ranking.DescribeCategoryModelMastersRequest()
            .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 ranking

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

try:
    result = client.describe_category_model_masters(
        ranking.DescribeCategoryModelMastersRequest()
            .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('ranking')

api_result = client.describe_category_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 CategoryModelMaster[] カテゴリマスターのリスト
nextPageToken string リストの続きを取得するためのページトークン

createCategoryModelMaster

createCategoryModelMaster

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.CreateCategoryModelMaster(
    &ranking.CreateCategoryModelMasterRequest {
        NamespaceName: pointy.String("namespace1"),
        Name: pointy.String("category-0001"),
        Description: nil,
        Metadata: nil,
        MinimumValue: nil,
        MaximumValue: nil,
        OrderDirection: pointy.String("asc"),
        Scope: pointy.String("global"),
        UniqueByUserId: pointy.Bool(false),
        CalculateFixedTimingHour: nil,
        CalculateFixedTimingMinute: nil,
        CalculateIntervalMinutes: pointy.Int32(15),
        EntryPeriodEventId: nil,
        AccessPeriodEventId: nil,
        Generation: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\CreateCategoryModelMasterRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createCategoryModelMaster(
        (new CreateCategoryModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->withName("category-0001")
            ->withDescription(null)
            ->withMetadata(null)
            ->withMinimumValue(null)
            ->withMaximumValue(null)
            ->withOrderDirection("asc")
            ->withScope("global")
            ->withUniqueByUserId(False)
            ->withCalculateFixedTimingHour(null)
            ->withCalculateFixedTimingMinute(null)
            ->withCalculateIntervalMinutes(15)
            ->withEntryPeriodEventId(null)
            ->withAccessPeriodEventId(null)
            ->withGeneration(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.CreateCategoryModelMasterRequest;
import io.gs2.ranking.result.CreateCategoryModelMasterResult;

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

try {
    CreateCategoryModelMasterResult result = client.createCategoryModelMaster(
        new CreateCategoryModelMasterRequest()
            .withNamespaceName("namespace1")
            .withName("category-0001")
            .withDescription(null)
            .withMetadata(null)
            .withMinimumValue(null)
            .withMaximumValue(null)
            .withOrderDirection("asc")
            .withScope("global")
            .withUniqueByUserId(false)
            .withCalculateFixedTimingHour(null)
            .withCalculateFixedTimingMinute(null)
            .withCalculateIntervalMinutes(15)
            .withEntryPeriodEventId(null)
            .withAccessPeriodEventId(null)
            .withGeneration(null)
    );
    CategoryModelMaster 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.CreateCategoryModelMasterRequest;
using Gs2.Gs2Ranking.Result.CreateCategoryModelMasterResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createCategoryModelMaster(
    new CreateCategoryModelMasterRequest()
        .withNamespaceName("namespace1")
        .withName("category-0001")
        .withDescription(null)
        .withMetadata(null)
        .withMinimumValue(null)
        .withMaximumValue(null)
        .withOrderDirection("asc")
        .withScope("global")
        .withUniqueByUserId(false)
        .withCalculateFixedTimingHour(null)
        .withCalculateFixedTimingMinute(null)
        .withCalculateIntervalMinutes(15)
        .withEntryPeriodEventId(null)
        .withAccessPeriodEventId(null)
        .withGeneration(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.createCategoryModelMaster(
        new Gs2Ranking.CreateCategoryModelMasterRequest()
            .withNamespaceName("namespace1")
            .withName("category-0001")
            .withDescription(null)
            .withMetadata(null)
            .withMinimumValue(null)
            .withMaximumValue(null)
            .withOrderDirection("asc")
            .withScope("global")
            .withUniqueByUserId(false)
            .withCalculateFixedTimingHour(null)
            .withCalculateFixedTimingMinute(null)
            .withCalculateIntervalMinutes(15)
            .withEntryPeriodEventId(null)
            .withAccessPeriodEventId(null)
            .withGeneration(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.create_category_model_master(
        ranking.CreateCategoryModelMasterRequest()
            .with_namespace_name(self.hash1)
            .with_name('category-0001')
            .with_description(None)
            .with_metadata(None)
            .with_minimum_value(None)
            .with_maximum_value(None)
            .with_order_direction('asc')
            .with_scope('global')
            .with_unique_by_user_id(False)
            .with_calculate_fixed_timing_hour(None)
            .with_calculate_fixed_timing_minute(None)
            .with_calculate_interval_minutes(15)
            .with_entry_period_event_id(None)
            .with_access_period_event_id(None)
            .with_generation(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.create_category_model_master({
    namespaceName='namespace1',
    name='category-0001',
    description=nil,
    metadata=nil,
    minimumValue=nil,
    maximumValue=nil,
    orderDirection='asc',
    scope='global',
    uniqueByUserId=false,
    calculateFixedTimingHour=nil,
    calculateFixedTimingMinute=nil,
    calculateIntervalMinutes=15,
    entryPeriodEventId=nil,
    accessPeriodEventId=nil,
    generation=nil,
});

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 ~ 1024文字 メタデータ
minimumValue long ~ 9223372036854775807 スコアの最小値
maximumValue long ~ 9223372036854775807 スコアの最大値
orderDirection string ~ 128文字 スコアのソート方向
scope string ~ 128文字 ランキングの種類
uniqueByUserId bool {scope} == "global" ユーザID毎にスコアを1つしか登録されないようにする
calculateFixedTimingHour int {scope} == "global" -1 ~ 23 スコアの固定集計開始時刻(時)
calculateFixedTimingMinute int {scope} == "global" 0 ~ 59 スコアの固定集計開始時刻(分)
calculateIntervalMinutes int {scope} == "global" 15 ~ 1440 スコアの集計間隔(分)
entryPeriodEventId string ~ 1024文字 スコアの登録を受け付ける期間を設定した GS2-Schedule のイベント
accessPeriodEventId string ~ 1024文字 ランキングを参照できる期間を設定した GS2-Schedule のイベント
generation string {scope} == "global" ~ 256文字 ランキングの世代

Result

説明
item CategoryModelMaster 作成したカテゴリマスター

getCategoryModelMaster

getCategoryModelMaster

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.GetCategoryModelMaster(
    &ranking.GetCategoryModelMasterRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\GetCategoryModelMasterRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getCategoryModelMaster(
        (new GetCategoryModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.GetCategoryModelMasterRequest;
import io.gs2.ranking.result.GetCategoryModelMasterResult;

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

try {
    GetCategoryModelMasterResult result = client.getCategoryModelMaster(
        new GetCategoryModelMasterRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
    );
    CategoryModelMaster 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.GetCategoryModelMasterRequest;
using Gs2.Gs2Ranking.Result.GetCategoryModelMasterResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getCategoryModelMaster(
    new GetCategoryModelMasterRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.getCategoryModelMaster(
        new Gs2Ranking.GetCategoryModelMasterRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.get_category_model_master(
        ranking.GetCategoryModelMasterRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.get_category_model_master({
    namespaceName='namespace1',
    categoryName='category-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文字 ネームスペース名
categoryName string ~ 128文字 カテゴリモデル名

Result

説明
item CategoryModelMaster カテゴリマスター

updateCategoryModelMaster

updateCategoryModelMaster

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.UpdateCategoryModelMaster(
    &ranking.UpdateCategoryModelMasterRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        Description: pointy.String("description1"),
        Metadata: pointy.String("CATEGORY_0001"),
        MinimumValue: pointy.Int64(100),
        MaximumValue: pointy.Int64(10000),
        OrderDirection: pointy.String("desc"),
        Scope: pointy.String("global"),
        UniqueByUserId: pointy.Bool(true),
        CalculateFixedTimingHour: nil,
        CalculateFixedTimingMinute: nil,
        CalculateIntervalMinutes: pointy.Int32(15),
        EntryPeriodEventId: nil,
        AccessPeriodEventId: nil,
        Generation: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\UpdateCategoryModelMasterRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateCategoryModelMaster(
        (new UpdateCategoryModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withDescription("description1")
            ->withMetadata("CATEGORY_0001")
            ->withMinimumValue(100)
            ->withMaximumValue(10000)
            ->withOrderDirection("desc")
            ->withScope("global")
            ->withUniqueByUserId(True)
            ->withCalculateFixedTimingHour(null)
            ->withCalculateFixedTimingMinute(null)
            ->withCalculateIntervalMinutes(15)
            ->withEntryPeriodEventId(null)
            ->withAccessPeriodEventId(null)
            ->withGeneration(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.UpdateCategoryModelMasterRequest;
import io.gs2.ranking.result.UpdateCategoryModelMasterResult;

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

try {
    UpdateCategoryModelMasterResult result = client.updateCategoryModelMaster(
        new UpdateCategoryModelMasterRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withDescription("description1")
            .withMetadata("CATEGORY_0001")
            .withMinimumValue(100L)
            .withMaximumValue(10000L)
            .withOrderDirection("desc")
            .withScope("global")
            .withUniqueByUserId(true)
            .withCalculateFixedTimingHour(null)
            .withCalculateFixedTimingMinute(null)
            .withCalculateIntervalMinutes(15)
            .withEntryPeriodEventId(null)
            .withAccessPeriodEventId(null)
            .withGeneration(null)
    );
    CategoryModelMaster 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.UpdateCategoryModelMasterRequest;
using Gs2.Gs2Ranking.Result.UpdateCategoryModelMasterResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateCategoryModelMaster(
    new UpdateCategoryModelMasterRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withDescription("description1")
        .withMetadata("CATEGORY_0001")
        .withMinimumValue(100L)
        .withMaximumValue(10000L)
        .withOrderDirection("desc")
        .withScope("global")
        .withUniqueByUserId(true)
        .withCalculateFixedTimingHour(null)
        .withCalculateFixedTimingMinute(null)
        .withCalculateIntervalMinutes(15)
        .withEntryPeriodEventId(null)
        .withAccessPeriodEventId(null)
        .withGeneration(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.updateCategoryModelMaster(
        new Gs2Ranking.UpdateCategoryModelMasterRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withDescription("description1")
            .withMetadata("CATEGORY_0001")
            .withMinimumValue(100)
            .withMaximumValue(10000)
            .withOrderDirection("desc")
            .withScope("global")
            .withUniqueByUserId(true)
            .withCalculateFixedTimingHour(null)
            .withCalculateFixedTimingMinute(null)
            .withCalculateIntervalMinutes(15)
            .withEntryPeriodEventId(null)
            .withAccessPeriodEventId(null)
            .withGeneration(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.update_category_model_master(
        ranking.UpdateCategoryModelMasterRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_description('description1')
            .with_metadata('CATEGORY_0001')
            .with_minimum_value(100)
            .with_maximum_value(10000)
            .with_order_direction('desc')
            .with_scope('global')
            .with_unique_by_user_id(True)
            .with_calculate_fixed_timing_hour(None)
            .with_calculate_fixed_timing_minute(None)
            .with_calculate_interval_minutes(15)
            .with_entry_period_event_id(None)
            .with_access_period_event_id(None)
            .with_generation(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.update_category_model_master({
    namespaceName='namespace1',
    categoryName='category-0001',
    description='description1',
    metadata='CATEGORY_0001',
    minimumValue=100,
    maximumValue=10000,
    orderDirection='desc',
    scope='global',
    uniqueByUserId=true,
    calculateFixedTimingHour=nil,
    calculateFixedTimingMinute=nil,
    calculateIntervalMinutes=15,
    entryPeriodEventId=nil,
    accessPeriodEventId=nil,
    generation=nil,
});

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

result = api_result.result
item = result.item;

カテゴリマスターを更新

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
categoryName string ~ 128文字 カテゴリモデル名
description string ~ 1024文字 説明文
metadata string ~ 1024文字 メタデータ
minimumValue long ~ 9223372036854775807 スコアの最小値
maximumValue long ~ 9223372036854775807 スコアの最大値
orderDirection string ~ 128文字 スコアのソート方向
scope string ~ 128文字 ランキングの種類
uniqueByUserId bool {scope} == "global" ユーザID毎にスコアを1つしか登録されないようにする
calculateFixedTimingHour int {scope} == "global" -1 ~ 23 スコアの固定集計開始時刻(時)
calculateFixedTimingMinute int {scope} == "global" 0 ~ 59 スコアの固定集計開始時刻(分)
calculateIntervalMinutes int {scope} == "global" 15 ~ 1440 スコアの集計間隔(分)
entryPeriodEventId string ~ 1024文字 スコアの登録を受け付ける期間を設定した GS2-Schedule のイベント
accessPeriodEventId string ~ 1024文字 ランキングを参照できる期間を設定した GS2-Schedule のイベント
generation string {scope} == "global" ~ 256文字 ランキングの世代

Result

説明
item CategoryModelMaster 更新したカテゴリマスター

deleteCategoryModelMaster

deleteCategoryModelMaster

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.DeleteCategoryModelMaster(
    &ranking.DeleteCategoryModelMasterRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\DeleteCategoryModelMasterRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteCategoryModelMaster(
        (new DeleteCategoryModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.DeleteCategoryModelMasterRequest;
import io.gs2.ranking.result.DeleteCategoryModelMasterResult;

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

try {
    DeleteCategoryModelMasterResult result = client.deleteCategoryModelMaster(
        new DeleteCategoryModelMasterRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
    );
    CategoryModelMaster 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.DeleteCategoryModelMasterRequest;
using Gs2.Gs2Ranking.Result.DeleteCategoryModelMasterResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteCategoryModelMaster(
    new DeleteCategoryModelMasterRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.deleteCategoryModelMaster(
        new Gs2Ranking.DeleteCategoryModelMasterRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.delete_category_model_master(
        ranking.DeleteCategoryModelMasterRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.delete_category_model_master({
    namespaceName='namespace1',
    categoryName='category-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文字 ネームスペース名
categoryName string ~ 128文字 カテゴリモデル名

Result

説明
item CategoryModelMaster 削除したカテゴリマスター

describeSubscribesByCategoryName

describeSubscribesByCategoryName

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.DescribeSubscribesByCategoryName(
    &ranking.DescribeSubscribesByCategoryNameRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: nil,
        AccessToken: pointy.String("$access_token_0001"),
    }
)
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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\DescribeSubscribesByCategoryNameRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeSubscribesByCategoryName(
        (new DescribeSubscribesByCategoryNameRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName(null)
            ->withAccessToken(self::$accessToken0001)
    );
    $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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.DescribeSubscribesByCategoryNameRequest;
import io.gs2.ranking.result.DescribeSubscribesByCategoryNameResult;

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

try {
    DescribeSubscribesByCategoryNameResult result = client.describeSubscribesByCategoryName(
        new DescribeSubscribesByCategoryNameRequest()
            .withNamespaceName("namespace1")
            .withCategoryName(null)
            .withAccessToken("$access_token_0001")
    );
    List<SubscribeUser> 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.DescribeSubscribesByCategoryNameRequest;
using Gs2.Gs2Ranking.Result.DescribeSubscribesByCategoryNameResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeSubscribesByCategoryName(
    new DescribeSubscribesByCategoryNameRequest()
        .withNamespaceName("namespace1")
        .withCategoryName(null)
        .withAccessToken("$access_token_0001"),
    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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.describeSubscribesByCategoryName(
        new Gs2Ranking.DescribeSubscribesByCategoryNameRequest()
            .withNamespaceName("namespace1")
            .withCategoryName(null)
            .withAccessToken("$access_token_0001")
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.describe_subscribes_by_category_name(
        ranking.DescribeSubscribesByCategoryNameRequest()
            .with_namespace_name(self.hash1)
            .with_category_name(None)
            .with_access_token(self.access_token_0001)
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.describe_subscribes_by_category_name({
    namespaceName='namespace1',
    categoryName=nil,
    accessToken='$access_token_0001',
});

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

result = api_result.result
items = result.items;

購読しているユーザIDの一覧取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
accessToken string ~ 128文字 ユーザーID

Result

説明
items SubscribeUser[] 購読対象のリスト

describeSubscribesByCategoryNameAndUserId

describeSubscribesByCategoryNameAndUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.DescribeSubscribesByCategoryNameAndUserId(
    &ranking.DescribeSubscribesByCategoryNameAndUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: nil,
        UserId: pointy.String("user-0001"),
    }
)
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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\DescribeSubscribesByCategoryNameAndUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeSubscribesByCategoryNameAndUserId(
        (new DescribeSubscribesByCategoryNameAndUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName(null)
            ->withUserId("user-0001")
    );
    $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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.DescribeSubscribesByCategoryNameAndUserIdRequest;
import io.gs2.ranking.result.DescribeSubscribesByCategoryNameAndUserIdResult;

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

try {
    DescribeSubscribesByCategoryNameAndUserIdResult result = client.describeSubscribesByCategoryNameAndUserId(
        new DescribeSubscribesByCategoryNameAndUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName(null)
            .withUserId("user-0001")
    );
    List<SubscribeUser> 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.DescribeSubscribesByCategoryNameAndUserIdRequest;
using Gs2.Gs2Ranking.Result.DescribeSubscribesByCategoryNameAndUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeSubscribesByCategoryNameAndUserId(
    new DescribeSubscribesByCategoryNameAndUserIdRequest()
        .withNamespaceName("namespace1")
        .withCategoryName(null)
        .withUserId("user-0001"),
    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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.describeSubscribesByCategoryNameAndUserId(
        new Gs2Ranking.DescribeSubscribesByCategoryNameAndUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName(null)
            .withUserId("user-0001")
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.describe_subscribes_by_category_name_and_user_id(
        ranking.DescribeSubscribesByCategoryNameAndUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_category_name(None)
            .with_user_id('user-0001')
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.describe_subscribes_by_category_name_and_user_id({
    namespaceName='namespace1',
    categoryName=nil,
    userId='user-0001',
});

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

result = api_result.result
items = result.items;

ユーザIDを指定して購読しているユーザIDの一覧取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
userId string ~ 128文字 ユーザーID

Result

説明
items SubscribeUser[] 購読対象のリスト

subscribe

subscribe

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.Subscribe(
    &ranking.SubscribeRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        AccessToken: pointy.String("$access_token_0001"),
        TargetUserId: pointy.String("user-0002"),
    }
)
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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\SubscribeRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->subscribe(
        (new SubscribeRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withAccessToken(self::$accessToken0001)
            ->withTargetUserId("user-0002")
    );
    $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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.SubscribeRequest;
import io.gs2.ranking.result.SubscribeResult;

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

try {
    SubscribeResult result = client.subscribe(
        new SubscribeRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withTargetUserId("user-0002")
    );
    SubscribeUser 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.SubscribeRequest;
using Gs2.Gs2Ranking.Result.SubscribeResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.subscribe(
    new SubscribeRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withAccessToken("$access_token_0001")
        .withTargetUserId("user-0002"),
    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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.subscribe(
        new Gs2Ranking.SubscribeRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withTargetUserId("user-0002")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.subscribe(
        ranking.SubscribeRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_access_token(self.access_token_0001)
            .with_target_user_id('user-0002')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.subscribe({
    namespaceName='namespace1',
    categoryName='category-0001',
    accessToken='$access_token_0001',
    targetUserId='user-0002',
});

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文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
accessToken string ~ 128文字 ユーザーID
targetUserId string ~ 128文字 購読するユーザーID

Result

説明
item SubscribeUser 購読した購読対象

subscribeByUserId

subscribeByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.SubscribeByUserId(
    &ranking.SubscribeByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: nil,
        UserId: pointy.String("user-0001"),
        TargetUserId: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\SubscribeByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->subscribeByUserId(
        (new SubscribeByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName(null)
            ->withUserId("user-0001")
            ->withTargetUserId(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.SubscribeByUserIdRequest;
import io.gs2.ranking.result.SubscribeByUserIdResult;

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

try {
    SubscribeByUserIdResult result = client.subscribeByUserId(
        new SubscribeByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName(null)
            .withUserId("user-0001")
            .withTargetUserId(null)
    );
    SubscribeUser 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.SubscribeByUserIdRequest;
using Gs2.Gs2Ranking.Result.SubscribeByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.subscribeByUserId(
    new SubscribeByUserIdRequest()
        .withNamespaceName("namespace1")
        .withCategoryName(null)
        .withUserId("user-0001")
        .withTargetUserId(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.subscribeByUserId(
        new Gs2Ranking.SubscribeByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName(null)
            .withUserId("user-0001")
            .withTargetUserId(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.subscribe_by_user_id(
        ranking.SubscribeByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_category_name(None)
            .with_user_id('user-0001')
            .with_target_user_id(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.subscribe_by_user_id({
    namespaceName='namespace1',
    categoryName=nil,
    userId='user-0001',
    targetUserId=nil,
});

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

result = api_result.result
item = result.item;

ユーザIDを指定してユーザIDを購読

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
userId string ~ 128文字 ユーザーID
targetUserId string ~ 128文字 購読するユーザーID

Result

説明
item SubscribeUser 購読した購読対象

getSubscribe

getSubscribe

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.GetSubscribe(
    &ranking.GetSubscribeRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        AccessToken: pointy.String("$access_token_0001"),
        TargetUserId: pointy.String("user-0002"),
    }
)
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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\GetSubscribeRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getSubscribe(
        (new GetSubscribeRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withAccessToken(self::$accessToken0001)
            ->withTargetUserId("user-0002")
    );
    $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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.GetSubscribeRequest;
import io.gs2.ranking.result.GetSubscribeResult;

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

try {
    GetSubscribeResult result = client.getSubscribe(
        new GetSubscribeRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withTargetUserId("user-0002")
    );
    SubscribeUser 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.GetSubscribeRequest;
using Gs2.Gs2Ranking.Result.GetSubscribeResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getSubscribe(
    new GetSubscribeRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withAccessToken("$access_token_0001")
        .withTargetUserId("user-0002"),
    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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.getSubscribe(
        new Gs2Ranking.GetSubscribeRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withTargetUserId("user-0002")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.get_subscribe(
        ranking.GetSubscribeRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_access_token(self.access_token_0001)
            .with_target_user_id('user-0002')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.get_subscribe({
    namespaceName='namespace1',
    categoryName='category-0001',
    accessToken='$access_token_0001',
    targetUserId='user-0002',
});

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

result = api_result.result
item = result.item;

購読を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
accessToken string ~ 128文字 ユーザーID
targetUserId string ~ 128文字 ユーザーID

Result

説明
item SubscribeUser 購読対象

getSubscribeByUserId

getSubscribeByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.GetSubscribeByUserId(
    &ranking.GetSubscribeByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: nil,
        UserId: pointy.String("user-0001"),
        TargetUserId: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\GetSubscribeByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getSubscribeByUserId(
        (new GetSubscribeByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName(null)
            ->withUserId("user-0001")
            ->withTargetUserId(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.GetSubscribeByUserIdRequest;
import io.gs2.ranking.result.GetSubscribeByUserIdResult;

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

try {
    GetSubscribeByUserIdResult result = client.getSubscribeByUserId(
        new GetSubscribeByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName(null)
            .withUserId("user-0001")
            .withTargetUserId(null)
    );
    SubscribeUser 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.GetSubscribeByUserIdRequest;
using Gs2.Gs2Ranking.Result.GetSubscribeByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getSubscribeByUserId(
    new GetSubscribeByUserIdRequest()
        .withNamespaceName("namespace1")
        .withCategoryName(null)
        .withUserId("user-0001")
        .withTargetUserId(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.getSubscribeByUserId(
        new Gs2Ranking.GetSubscribeByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName(null)
            .withUserId("user-0001")
            .withTargetUserId(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.get_subscribe_by_user_id(
        ranking.GetSubscribeByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_category_name(None)
            .with_user_id('user-0001')
            .with_target_user_id(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.get_subscribe_by_user_id({
    namespaceName='namespace1',
    categoryName=nil,
    userId='user-0001',
    targetUserId=nil,
});

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文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
userId string ~ 128文字 ユーザーID
targetUserId string ~ 128文字 ユーザーID

Result

説明
item SubscribeUser 購読対象

unsubscribe

unsubscribe

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.Unsubscribe(
    &ranking.UnsubscribeRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        AccessToken: pointy.String("$access_token_0001"),
        TargetUserId: pointy.String("user-0002"),
    }
)
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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\UnsubscribeRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->unsubscribe(
        (new UnsubscribeRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withAccessToken(self::$accessToken0001)
            ->withTargetUserId("user-0002")
    );
    $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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.UnsubscribeRequest;
import io.gs2.ranking.result.UnsubscribeResult;

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

try {
    UnsubscribeResult result = client.unsubscribe(
        new UnsubscribeRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withTargetUserId("user-0002")
    );
    SubscribeUser 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.UnsubscribeRequest;
using Gs2.Gs2Ranking.Result.UnsubscribeResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.unsubscribe(
    new UnsubscribeRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withAccessToken("$access_token_0001")
        .withTargetUserId("user-0002"),
    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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.unsubscribe(
        new Gs2Ranking.UnsubscribeRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withTargetUserId("user-0002")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.unsubscribe(
        ranking.UnsubscribeRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_access_token(self.access_token_0001)
            .with_target_user_id('user-0002')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.unsubscribe({
    namespaceName='namespace1',
    categoryName='category-0001',
    accessToken='$access_token_0001',
    targetUserId='user-0002',
});

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

result = api_result.result
item = result.item;

購読の購読を解除

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
accessToken string ~ 128文字 ユーザーID
targetUserId string ~ 128文字 購読するユーザーID

Result

説明
item SubscribeUser 解除した購読対象

unsubscribeByUserId

unsubscribeByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.UnsubscribeByUserId(
    &ranking.UnsubscribeByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: nil,
        UserId: pointy.String("user-0001"),
        TargetUserId: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\UnsubscribeByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->unsubscribeByUserId(
        (new UnsubscribeByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName(null)
            ->withUserId("user-0001")
            ->withTargetUserId(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.UnsubscribeByUserIdRequest;
import io.gs2.ranking.result.UnsubscribeByUserIdResult;

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

try {
    UnsubscribeByUserIdResult result = client.unsubscribeByUserId(
        new UnsubscribeByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName(null)
            .withUserId("user-0001")
            .withTargetUserId(null)
    );
    SubscribeUser 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.UnsubscribeByUserIdRequest;
using Gs2.Gs2Ranking.Result.UnsubscribeByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.unsubscribeByUserId(
    new UnsubscribeByUserIdRequest()
        .withNamespaceName("namespace1")
        .withCategoryName(null)
        .withUserId("user-0001")
        .withTargetUserId(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.unsubscribeByUserId(
        new Gs2Ranking.UnsubscribeByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName(null)
            .withUserId("user-0001")
            .withTargetUserId(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.unsubscribe_by_user_id(
        ranking.UnsubscribeByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_category_name(None)
            .with_user_id('user-0001')
            .with_target_user_id(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.unsubscribe_by_user_id({
    namespaceName='namespace1',
    categoryName=nil,
    userId='user-0001',
    targetUserId=nil,
});

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文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
userId string ~ 128文字 ユーザーID
targetUserId string ~ 128文字 購読するユーザーID

Result

説明
item SubscribeUser 解除した購読対象

describeScores

describeScores

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.DescribeScores(
    &ranking.DescribeScoresRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        AccessToken: pointy.String("$access_token_0001"),
        ScorerUserId: pointy.String("user-0002"),
        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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\DescribeScoresRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeScores(
        (new DescribeScoresRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withAccessToken(self::$accessToken0001)
            ->withScorerUserId("user-0002")
            ->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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.DescribeScoresRequest;
import io.gs2.ranking.result.DescribeScoresResult;

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

try {
    DescribeScoresResult result = client.describeScores(
        new DescribeScoresRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withScorerUserId("user-0002")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Score> 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.DescribeScoresRequest;
using Gs2.Gs2Ranking.Result.DescribeScoresResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeScores(
    new DescribeScoresRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withAccessToken("$access_token_0001")
        .withScorerUserId("user-0002")
        .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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.describeScores(
        new Gs2Ranking.DescribeScoresRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withScorerUserId("user-0002")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.describe_scores(
        ranking.DescribeScoresRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_access_token(self.access_token_0001)
            .with_scorer_user_id('user-0002')
            .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('ranking')

api_result = client.describe_scores({
    namespaceName='namespace1',
    categoryName='category-0001',
    accessToken='$access_token_0001',
    scorerUserId='user-0002',
    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文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
accessToken string ~ 128文字 ユーザーID
scorerUserId string ~ 128文字 ユーザーID
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

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

describeScoresByUserId

describeScoresByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.DescribeScoresByUserId(
    &ranking.DescribeScoresByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        UserId: pointy.String("user-0001"),
        ScorerUserId: pointy.String("user-0002"),
        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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\DescribeScoresByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeScoresByUserId(
        (new DescribeScoresByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withUserId("user-0001")
            ->withScorerUserId("user-0002")
            ->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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.DescribeScoresByUserIdRequest;
import io.gs2.ranking.result.DescribeScoresByUserIdResult;

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

try {
    DescribeScoresByUserIdResult result = client.describeScoresByUserId(
        new DescribeScoresByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withUserId("user-0001")
            .withScorerUserId("user-0002")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Score> 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.DescribeScoresByUserIdRequest;
using Gs2.Gs2Ranking.Result.DescribeScoresByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeScoresByUserId(
    new DescribeScoresByUserIdRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withUserId("user-0001")
        .withScorerUserId("user-0002")
        .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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.describeScoresByUserId(
        new Gs2Ranking.DescribeScoresByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withUserId("user-0001")
            .withScorerUserId("user-0002")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.describe_scores_by_user_id(
        ranking.DescribeScoresByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_user_id('user-0001')
            .with_scorer_user_id('user-0002')
            .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('ranking')

api_result = client.describe_scores_by_user_id({
    namespaceName='namespace1',
    categoryName='category-0001',
    userId='user-0001',
    scorerUserId='user-0002',
    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文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
userId string ~ 128文字 ユーザーID
scorerUserId string ~ 128文字 ユーザーID
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

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

getScore

getScore

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.GetScore(
    &ranking.GetScoreRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        AccessToken: pointy.String("$access_token_0001"),
        ScorerUserId: pointy.String("user-0002"),
        UniqueId: pointy.String("unique-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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\GetScoreRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getScore(
        (new GetScoreRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withAccessToken(self::$accessToken0001)
            ->withScorerUserId("user-0002")
            ->withUniqueId("unique-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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.GetScoreRequest;
import io.gs2.ranking.result.GetScoreResult;

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

try {
    GetScoreResult result = client.getScore(
        new GetScoreRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withScorerUserId("user-0002")
            .withUniqueId("unique-0001")
    );
    Score 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.GetScoreRequest;
using Gs2.Gs2Ranking.Result.GetScoreResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getScore(
    new GetScoreRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withAccessToken("$access_token_0001")
        .withScorerUserId("user-0002")
        .withUniqueId("unique-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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.getScore(
        new Gs2Ranking.GetScoreRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withScorerUserId("user-0002")
            .withUniqueId("unique-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.get_score(
        ranking.GetScoreRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_access_token(self.access_token_0001)
            .with_scorer_user_id('user-0002')
            .with_unique_id('unique-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.get_score({
    namespaceName='namespace1',
    categoryName='category-0001',
    accessToken='$access_token_0001',
    scorerUserId='user-0002',
    uniqueId='unique-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文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
accessToken string ~ 128文字 ユーザーID
scorerUserId string ~ 128文字 ユーザーID
uniqueId string UUID ~ 36文字 スコアのユニークID

Result

説明
item Score スコア

getScoreByUserId

getScoreByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.GetScoreByUserId(
    &ranking.GetScoreByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        UserId: pointy.String("user-0001"),
        ScorerUserId: pointy.String("user-0002"),
        UniqueId: pointy.String("unique-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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\GetScoreByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getScoreByUserId(
        (new GetScoreByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withUserId("user-0001")
            ->withScorerUserId("user-0002")
            ->withUniqueId("unique-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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.GetScoreByUserIdRequest;
import io.gs2.ranking.result.GetScoreByUserIdResult;

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

try {
    GetScoreByUserIdResult result = client.getScoreByUserId(
        new GetScoreByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withUserId("user-0001")
            .withScorerUserId("user-0002")
            .withUniqueId("unique-0001")
    );
    Score 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.GetScoreByUserIdRequest;
using Gs2.Gs2Ranking.Result.GetScoreByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getScoreByUserId(
    new GetScoreByUserIdRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withUserId("user-0001")
        .withScorerUserId("user-0002")
        .withUniqueId("unique-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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.getScoreByUserId(
        new Gs2Ranking.GetScoreByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withUserId("user-0001")
            .withScorerUserId("user-0002")
            .withUniqueId("unique-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.get_score_by_user_id(
        ranking.GetScoreByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_user_id('user-0001')
            .with_scorer_user_id('user-0002')
            .with_unique_id('unique-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.get_score_by_user_id({
    namespaceName='namespace1',
    categoryName='category-0001',
    userId='user-0001',
    scorerUserId='user-0002',
    uniqueId='unique-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文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
userId string ~ 128文字 ユーザーID
scorerUserId string ~ 128文字 ユーザーID
uniqueId string UUID ~ 36文字 スコアのユニークID

Result

説明
item Score スコア

describeRankings

describeRankings

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.DescribeRankings(
    &ranking.DescribeRankingsRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        AccessToken: pointy.String("$access_token_0001"),
        StartIndex: pointy.Int64(0),
        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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\DescribeRankingsRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeRankings(
        (new DescribeRankingsRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withAccessToken(self::$accessToken0001)
            ->withStartIndex(0)
            ->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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.DescribeRankingsRequest;
import io.gs2.ranking.result.DescribeRankingsResult;

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

try {
    DescribeRankingsResult result = client.describeRankings(
        new DescribeRankingsRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withStartIndex(0L)
            .withPageToken(null)
            .withLimit(null)
    );
    List<Ranking> 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.DescribeRankingsRequest;
using Gs2.Gs2Ranking.Result.DescribeRankingsResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeRankings(
    new DescribeRankingsRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withAccessToken("$access_token_0001")
        .withStartIndex(0L)
        .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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.describeRankings(
        new Gs2Ranking.DescribeRankingsRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withStartIndex(0)
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.describe_rankings(
        ranking.DescribeRankingsRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_access_token(self.access_token_0001)
            .with_start_index(0)
            .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('ranking')

api_result = client.describe_rankings({
    namespaceName='namespace1',
    categoryName='category-0001',
    accessToken='$access_token_0001',
    startIndex=0,
    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文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
accessToken string ~ 128文字 ユーザーID
startIndex long ~ 9223372036854775807 ランキングの取得を開始するインデックス
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Ranking[] ランキングのリスト
nextPageToken string リストの続きを取得するためのページトークン

describeRankingssByUserId

describeRankingssByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.DescribeRankingssByUserId(
    &ranking.DescribeRankingssByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        UserId: pointy.String("user-0001"),
        StartIndex: pointy.Int64(0),
        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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\DescribeRankingssByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeRankingssByUserId(
        (new DescribeRankingssByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withUserId("user-0001")
            ->withStartIndex(0)
            ->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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.DescribeRankingssByUserIdRequest;
import io.gs2.ranking.result.DescribeRankingssByUserIdResult;

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

try {
    DescribeRankingssByUserIdResult result = client.describeRankingssByUserId(
        new DescribeRankingssByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withUserId("user-0001")
            .withStartIndex(0L)
            .withPageToken(null)
            .withLimit(null)
    );
    List<Ranking> 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.DescribeRankingssByUserIdRequest;
using Gs2.Gs2Ranking.Result.DescribeRankingssByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeRankingssByUserId(
    new DescribeRankingssByUserIdRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withUserId("user-0001")
        .withStartIndex(0L)
        .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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.describeRankingssByUserId(
        new Gs2Ranking.DescribeRankingssByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withUserId("user-0001")
            .withStartIndex(0)
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.describe_rankingss_by_user_id(
        ranking.DescribeRankingssByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_user_id('user-0001')
            .with_start_index(0)
            .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('ranking')

api_result = client.describe_rankingss_by_user_id({
    namespaceName='namespace1',
    categoryName='category-0001',
    userId='user-0001',
    startIndex=0,
    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;

ユーザIDを指定してランキングを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
userId string ~ 128文字 ユーザーID
startIndex long ~ 9223372036854775807 ランキングの取得を開始するインデックス
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Ranking[] ランキングのリスト
nextPageToken string リストの続きを取得するためのページトークン

describeNearRankings

describeNearRankings

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.DescribeNearRankings(
    &ranking.DescribeNearRankingsRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        Score: pointy.Int64(1000),
    }
)
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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\DescribeNearRankingsRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeNearRankings(
        (new DescribeNearRankingsRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withScore(1000)
    );
    $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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.DescribeNearRankingsRequest;
import io.gs2.ranking.result.DescribeNearRankingsResult;

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

try {
    DescribeNearRankingsResult result = client.describeNearRankings(
        new DescribeNearRankingsRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withScore(1000L)
    );
    List<Ranking> 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.DescribeNearRankingsRequest;
using Gs2.Gs2Ranking.Result.DescribeNearRankingsResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeNearRankings(
    new DescribeNearRankingsRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withScore(1000L),
    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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.describeNearRankings(
        new Gs2Ranking.DescribeNearRankingsRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withScore(1000)
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.describe_near_rankings(
        ranking.DescribeNearRankingsRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_score(1000)
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.describe_near_rankings({
    namespaceName='namespace1',
    categoryName='category-0001',
    score=1000,
});

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

result = api_result.result
items = result.items;

指定したスコア付近のランキングを取得

このAPIはグローバルランキングのときのみ使用できます

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
score long ~ 9223372036854775807 スコア

Result

説明
items Ranking[] ランキングのリスト

getRanking

getRanking

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.GetRanking(
    &ranking.GetRankingRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        AccessToken: pointy.String("$access_token_0001"),
        ScorerUserId: pointy.String("user-0001"),
        UniqueId: pointy.String("unique-id"),
    }
)
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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\GetRankingRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getRanking(
        (new GetRankingRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withAccessToken(self::$accessToken0001)
            ->withScorerUserId("user-0001")
            ->withUniqueId("unique-id")
    );
    $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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.GetRankingRequest;
import io.gs2.ranking.result.GetRankingResult;

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

try {
    GetRankingResult result = client.getRanking(
        new GetRankingRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withScorerUserId("user-0001")
            .withUniqueId("unique-id")
    );
    Ranking 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.GetRankingRequest;
using Gs2.Gs2Ranking.Result.GetRankingResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getRanking(
    new GetRankingRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withAccessToken("$access_token_0001")
        .withScorerUserId("user-0001")
        .withUniqueId("unique-id"),
    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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.getRanking(
        new Gs2Ranking.GetRankingRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withScorerUserId("user-0001")
            .withUniqueId("unique-id")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.get_ranking(
        ranking.GetRankingRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_access_token(self.access_token_0001)
            .with_scorer_user_id('user-0001')
            .with_unique_id('unique-id')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.get_ranking({
    namespaceName='namespace1',
    categoryName='category-0001',
    accessToken='$access_token_0001',
    scorerUserId='user-0001',
    uniqueId='unique-id',
});

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

result = api_result.result
item = result.item;

ランキングを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
accessToken string ~ 128文字 ランキングを取得するユーザーID(GS2-Schedule の期間判定に使用されます。)
scorerUserId string ~ 128文字 スコアを獲得したユーザーのユーザーID。
uniqueId string "0" ~ 36文字 スコアのユニークID

Result

説明
item Ranking ランキング

getRankingByUserId

getRankingByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.GetRankingByUserId(
    &ranking.GetRankingByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        UserId: pointy.String("user-0001"),
        ScorerUserId: pointy.String("user-0001"),
        UniqueId: pointy.String("unique-id"),
    }
)
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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\GetRankingByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getRankingByUserId(
        (new GetRankingByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withUserId("user-0001")
            ->withScorerUserId("user-0001")
            ->withUniqueId("unique-id")
    );
    $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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.GetRankingByUserIdRequest;
import io.gs2.ranking.result.GetRankingByUserIdResult;

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

try {
    GetRankingByUserIdResult result = client.getRankingByUserId(
        new GetRankingByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withUserId("user-0001")
            .withScorerUserId("user-0001")
            .withUniqueId("unique-id")
    );
    Ranking 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.GetRankingByUserIdRequest;
using Gs2.Gs2Ranking.Result.GetRankingByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getRankingByUserId(
    new GetRankingByUserIdRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withUserId("user-0001")
        .withScorerUserId("user-0001")
        .withUniqueId("unique-id"),
    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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.getRankingByUserId(
        new Gs2Ranking.GetRankingByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withUserId("user-0001")
            .withScorerUserId("user-0001")
            .withUniqueId("unique-id")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.get_ranking_by_user_id(
        ranking.GetRankingByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_user_id('user-0001')
            .with_scorer_user_id('user-0001')
            .with_unique_id('unique-id')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.get_ranking_by_user_id({
    namespaceName='namespace1',
    categoryName='category-0001',
    userId='user-0001',
    scorerUserId='user-0001',
    uniqueId='unique-id',
});

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

result = api_result.result
item = result.item;

ランキングを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
userId string ~ 128文字 ランキングを取得するユーザーID(GS2-Schedule の期間判定に使用されます。)
scorerUserId string ~ 128文字 スコアを獲得したユーザーのユーザーID。
uniqueId string "0" ~ 36文字 スコアのユニークID

Result

説明
item Ranking ランキング

putScore

putScore

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.PutScore(
    &ranking.PutScoreRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        AccessToken: pointy.String("$access_token_0001"),
        Score: pointy.Int64(1000),
        Metadata: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\PutScoreRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->putScore(
        (new PutScoreRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withAccessToken(self::$accessToken0001)
            ->withScore(1000)
            ->withMetadata(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.PutScoreRequest;
import io.gs2.ranking.result.PutScoreResult;

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

try {
    PutScoreResult result = client.putScore(
        new PutScoreRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withScore(1000L)
            .withMetadata(null)
    );
    Score 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.PutScoreRequest;
using Gs2.Gs2Ranking.Result.PutScoreResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.putScore(
    new PutScoreRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withAccessToken("$access_token_0001")
        .withScore(1000L)
        .withMetadata(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.putScore(
        new Gs2Ranking.PutScoreRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withAccessToken("$access_token_0001")
            .withScore(1000)
            .withMetadata(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.put_score(
        ranking.PutScoreRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_access_token(self.access_token_0001)
            .with_score(1000)
            .with_metadata(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.put_score({
    namespaceName='namespace1',
    categoryName='category-0001',
    accessToken='$access_token_0001',
    score=1000,
    metadata=nil,
});

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

result = api_result.result
item = result.item;

スコアを登録

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
accessToken string ~ 128文字 ユーザーID
score long ~ 9223372036854775807 スコア
metadata string ~ 512文字 メタデータ

Result

説明
item Score 登録したスコア

putScoreByUserId

putScoreByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.PutScoreByUserId(
    &ranking.PutScoreByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        CategoryName: pointy.String("category-0001"),
        UserId: pointy.String("user-0001"),
        Score: pointy.Int64(1000),
        Metadata: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\PutScoreByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->putScoreByUserId(
        (new PutScoreByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withCategoryName("category-0001")
            ->withUserId("user-0001")
            ->withScore(1000)
            ->withMetadata(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.PutScoreByUserIdRequest;
import io.gs2.ranking.result.PutScoreByUserIdResult;

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

try {
    PutScoreByUserIdResult result = client.putScoreByUserId(
        new PutScoreByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withUserId("user-0001")
            .withScore(1000L)
            .withMetadata(null)
    );
    Score 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.PutScoreByUserIdRequest;
using Gs2.Gs2Ranking.Result.PutScoreByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.putScoreByUserId(
    new PutScoreByUserIdRequest()
        .withNamespaceName("namespace1")
        .withCategoryName("category-0001")
        .withUserId("user-0001")
        .withScore(1000L)
        .withMetadata(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.putScoreByUserId(
        new Gs2Ranking.PutScoreByUserIdRequest()
            .withNamespaceName("namespace1")
            .withCategoryName("category-0001")
            .withUserId("user-0001")
            .withScore(1000)
            .withMetadata(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.put_score_by_user_id(
        ranking.PutScoreByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_category_name('category-0001')
            .with_user_id('user-0001')
            .with_score(1000)
            .with_metadata(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.put_score_by_user_id({
    namespaceName='namespace1',
    categoryName='category-0001',
    userId='user-0001',
    score=1000,
    metadata=nil,
});

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文字 ネームスペース名
categoryName string ~ 128文字 カテゴリ名
userId string ~ 128文字 ユーザーID
score long ~ 9223372036854775807 スコア
metadata string ~ 512文字 メタデータ

Result

説明
item Score 登録したスコア

exportMaster

exportMaster

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.ExportMaster(
    &ranking.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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.ExportMasterRequest;
import io.gs2.ranking.result.ExportMasterResult;

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

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

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2RankingRestClient(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 Gs2Ranking from '@/gs2/ranking';

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

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

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

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

client = gs2('ranking')

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 CurrentRankingMaster 現在有効なランキング設定

getCurrentRankingMaster

getCurrentRankingMaster

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.GetCurrentRankingMaster(
    &ranking.GetCurrentRankingMasterRequest {
        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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\GetCurrentRankingMasterRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getCurrentRankingMaster(
        (new GetCurrentRankingMasterRequest())
            ->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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.GetCurrentRankingMasterRequest;
import io.gs2.ranking.result.GetCurrentRankingMasterResult;

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

try {
    GetCurrentRankingMasterResult result = client.getCurrentRankingMaster(
        new GetCurrentRankingMasterRequest()
            .withNamespaceName("namespace1")
    );
    CurrentRankingMaster 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.GetCurrentRankingMasterRequest;
using Gs2.Gs2Ranking.Result.GetCurrentRankingMasterResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getCurrentRankingMaster(
    new GetCurrentRankingMasterRequest()
        .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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.getCurrentRankingMaster(
        new Gs2Ranking.GetCurrentRankingMasterRequest()
            .withNamespaceName("namespace1")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.get_current_ranking_master(
        ranking.GetCurrentRankingMasterRequest()
            .with_namespace_name(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.get_current_ranking_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 CurrentRankingMaster 現在有効なランキング設定

updateCurrentRankingMaster

updateCurrentRankingMaster

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentRankingMaster(
    &ranking.UpdateCurrentRankingMasterRequest {
        NamespaceName: pointy.String("namespace1"),
        Settings: pointy.String("{\n  \"version\": \"2019-09-17\",\n  \"categories\": [\n    {\n      \"name\": \"category-0001\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": true\n    },\n    {\n      \"name\": \"category-0002\",\n      \"orderDirection\": \"desc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": false\n    },\n    {\n      \"name\": \"category-0003\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"scoped\",\n      \"minimumValue\": 100,\n      \"maximumValue\": 10000,\n      \"uniqueByUserId\": true\n    },\n    {\n      \"name\": \"category-0004\",\n      \"orderDirection\": \"desc\",\n      \"scope\": \"scoped\",\n      \"minimumValue\": 100,\n      \"maximumValue\": 10000,\n      \"uniqueByUserId\": false\n    },\n    {\n      \"name\": \"category-0005\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": true\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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\UpdateCurrentRankingMasterRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateCurrentRankingMaster(
        (new UpdateCurrentRankingMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->withSettings("{\n  \"version\": \"2019-09-17\",\n  \"categories\": [\n    {\n      \"name\": \"category-0001\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": true\n    },\n    {\n      \"name\": \"category-0002\",\n      \"orderDirection\": \"desc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": false\n    },\n    {\n      \"name\": \"category-0003\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"scoped\",\n      \"minimumValue\": 100,\n      \"maximumValue\": 10000,\n      \"uniqueByUserId\": true\n    },\n    {\n      \"name\": \"category-0004\",\n      \"orderDirection\": \"desc\",\n      \"scope\": \"scoped\",\n      \"minimumValue\": 100,\n      \"maximumValue\": 10000,\n      \"uniqueByUserId\": false\n    },\n    {\n      \"name\": \"category-0005\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": true\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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.UpdateCurrentRankingMasterRequest;
import io.gs2.ranking.result.UpdateCurrentRankingMasterResult;

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

try {
    UpdateCurrentRankingMasterResult result = client.updateCurrentRankingMaster(
        new UpdateCurrentRankingMasterRequest()
            .withNamespaceName("namespace1")
            .withSettings("{\n  \"version\": \"2019-09-17\",\n  \"categories\": [\n    {\n      \"name\": \"category-0001\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": true\n    },\n    {\n      \"name\": \"category-0002\",\n      \"orderDirection\": \"desc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": false\n    },\n    {\n      \"name\": \"category-0003\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"scoped\",\n      \"minimumValue\": 100,\n      \"maximumValue\": 10000,\n      \"uniqueByUserId\": true\n    },\n    {\n      \"name\": \"category-0004\",\n      \"orderDirection\": \"desc\",\n      \"scope\": \"scoped\",\n      \"minimumValue\": 100,\n      \"maximumValue\": 10000,\n      \"uniqueByUserId\": false\n    },\n    {\n      \"name\": \"category-0005\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": true\n    }\n  ]\n}")
    );
    CurrentRankingMaster 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.UpdateCurrentRankingMasterRequest;
using Gs2.Gs2Ranking.Result.UpdateCurrentRankingMasterResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateCurrentRankingMaster(
    new UpdateCurrentRankingMasterRequest()
        .withNamespaceName("namespace1")
        .withSettings("{\n  \"version\": \"2019-09-17\",\n  \"categories\": [\n    {\n      \"name\": \"category-0001\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": true\n    },\n    {\n      \"name\": \"category-0002\",\n      \"orderDirection\": \"desc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": false\n    },\n    {\n      \"name\": \"category-0003\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"scoped\",\n      \"minimumValue\": 100,\n      \"maximumValue\": 10000,\n      \"uniqueByUserId\": true\n    },\n    {\n      \"name\": \"category-0004\",\n      \"orderDirection\": \"desc\",\n      \"scope\": \"scoped\",\n      \"minimumValue\": 100,\n      \"maximumValue\": 10000,\n      \"uniqueByUserId\": false\n    },\n    {\n      \"name\": \"category-0005\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": true\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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.updateCurrentRankingMaster(
        new Gs2Ranking.UpdateCurrentRankingMasterRequest()
            .withNamespaceName("namespace1")
            .withSettings("{\n  \"version\": \"2019-09-17\",\n  \"categories\": [\n    {\n      \"name\": \"category-0001\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": true\n    },\n    {\n      \"name\": \"category-0002\",\n      \"orderDirection\": \"desc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": false\n    },\n    {\n      \"name\": \"category-0003\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"scoped\",\n      \"minimumValue\": 100,\n      \"maximumValue\": 10000,\n      \"uniqueByUserId\": true\n    },\n    {\n      \"name\": \"category-0004\",\n      \"orderDirection\": \"desc\",\n      \"scope\": \"scoped\",\n      \"minimumValue\": 100,\n      \"maximumValue\": 10000,\n      \"uniqueByUserId\": false\n    },\n    {\n      \"name\": \"category-0005\",\n      \"orderDirection\": \"asc\",\n      \"scope\": \"global\",\n      \"calculateIntervalMinutes\": 15,\n      \"uniqueByUserId\": true\n    }\n  ]\n}")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ranking

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

try:
    result = client.update_current_ranking_master(
        ranking.UpdateCurrentRankingMasterRequest()
            .with_namespace_name(self.hash1)
            .with_settings('{\n  "version": "2019-09-17",\n  "categories": [\n    {\n      "name": "category-0001",\n      "orderDirection": "asc",\n      "scope": "global",\n      "calculateIntervalMinutes": 15,\n      "uniqueByUserId": true\n    },\n    {\n      "name": "category-0002",\n      "orderDirection": "desc",\n      "scope": "global",\n      "calculateIntervalMinutes": 15,\n      "uniqueByUserId": false\n    },\n    {\n      "name": "category-0003",\n      "orderDirection": "asc",\n      "scope": "scoped",\n      "minimumValue": 100,\n      "maximumValue": 10000,\n      "uniqueByUserId": true\n    },\n    {\n      "name": "category-0004",\n      "orderDirection": "desc",\n      "scope": "scoped",\n      "minimumValue": 100,\n      "maximumValue": 10000,\n      "uniqueByUserId": false\n    },\n    {\n      "name": "category-0005",\n      "orderDirection": "asc",\n      "scope": "global",\n      "calculateIntervalMinutes": 15,\n      "uniqueByUserId": true\n    }\n  ]\n}')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('ranking')

api_result = client.update_current_ranking_master({
    namespaceName='namespace1',
    settings='{\n  "version": "2019-09-17",\n  "categories": [\n    {\n      "name": "category-0001",\n      "orderDirection": "asc",\n      "scope": "global",\n      "calculateIntervalMinutes": 15,\n      "uniqueByUserId": true\n    },\n    {\n      "name": "category-0002",\n      "orderDirection": "desc",\n      "scope": "global",\n      "calculateIntervalMinutes": 15,\n      "uniqueByUserId": false\n    },\n    {\n      "name": "category-0003",\n      "orderDirection": "asc",\n      "scope": "scoped",\n      "minimumValue": 100,\n      "maximumValue": 10000,\n      "uniqueByUserId": true\n    },\n    {\n      "name": "category-0004",\n      "orderDirection": "desc",\n      "scope": "scoped",\n      "minimumValue": 100,\n      "maximumValue": 10000,\n      "uniqueByUserId": false\n    },\n    {\n      "name": "category-0005",\n      "orderDirection": "asc",\n      "scope": "global",\n      "calculateIntervalMinutes": 15,\n      "uniqueByUserId": true\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 CurrentRankingMaster 更新した現在有効なランキング設定

updateCurrentRankingMasterFromGitHub

updateCurrentRankingMasterFromGitHub

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ranking"
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 := ranking.Gs2RankingRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentRankingMasterFromGitHub(
    &ranking.UpdateCurrentRankingMasterFromGitHubRequest {
        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\Ranking\Gs2RankingRestClient;
use Gs2\Ranking\Request\UpdateCurrentRankingMasterFromGitHubRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateCurrentRankingMasterFromGitHub(
        (new UpdateCurrentRankingMasterFromGitHubRequest())
            ->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.ranking.rest.Gs2RankingRestClient;
import io.gs2.ranking.request.UpdateCurrentRankingMasterFromGitHubRequest;
import io.gs2.ranking.result.UpdateCurrentRankingMasterFromGitHubResult;

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

try {
    UpdateCurrentRankingMasterFromGitHubResult result = client.updateCurrentRankingMasterFromGitHub(
        new UpdateCurrentRankingMasterFromGitHubRequest()
            .withNamespaceName("namespace1")
            .withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    );
    CurrentRankingMaster 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.Gs2Ranking.Gs2RankingRestClient;
using Gs2.Gs2Ranking.Request.UpdateCurrentRankingMasterFromGitHubRequest;
using Gs2.Gs2Ranking.Result.UpdateCurrentRankingMasterFromGitHubResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateCurrentRankingMasterFromGitHub(
    new UpdateCurrentRankingMasterFromGitHubRequest()
        .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 Gs2Ranking from '@/gs2/ranking';

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

try {
    const result = await client.updateCurrentRankingMasterFromGitHub(
        new Gs2Ranking.UpdateCurrentRankingMasterFromGitHubRequest()
            .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 ranking

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

try:
    result = client.update_current_ranking_master_from_git_hub(
        ranking.UpdateCurrentRankingMasterFromGitHubRequest()
            .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('ranking')

api_result = client.update_current_ranking_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 CurrentRankingMaster 更新した現在有効なランキング設定