NAV
go python java php typescript csharp GS2-Script

GS2-Realtime

GS2-SDK のリファレンス

モデル

Namespace

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

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

説明
namespaceId string ネームスペースGRN
name string ネームスペース名
description string 説明文
serverType string サーバの種類
serverSpec string サーバのスペック
createNotification NotificationSetting ルームの作成が終わったときのプッシュ通知
logSetting LogSetting ログの出力設定
createdAt long 作成日時
updatedAt long 最終更新日時

Room

リアルタイム対戦の通信処理を行う為のゲームサーバー。 作成後しばらくしてから IPアドレス・ポート・暗号鍵 がアサインされます。

説明
roomId string ルームGRN
name string ルーム名
ipAddress string IPアドレス
port int 待受ポート
encryptionKey string 暗号鍵
notificationUserIds string[] ルームの作成が終わったときに通知を受けるユーザIDリスト
createdAt long 作成日時
updatedAt long 最終更新日時

NotificationSetting

説明
gatewayNamespaceId string ネームスペースGRN
enableTransferMobileNotification bool モバイルプッシュ通知へ転送するか
sound string モバイルプッシュ通知で使用するサウンドファイル名

LogSetting

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

メソッド

describeNamespaces

describeNamespaces

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

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

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

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

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

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

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

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/realtime"
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 := realtime.Gs2RealtimeRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &realtime.CreateNamespaceRequest {
        Name: pointy.String("namespace1"),
        Description: nil,
        ServerType: pointy.String("relay"),
        ServerSpec: pointy.String("realtime1.nano"),
        CreateNotification: nil,
        LogSetting: &realtime.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\Realtime\Gs2RealtimeRestClient;
use Gs2\Realtime\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)
            ->withServerType("relay")
            ->withServerSpec("realtime1.nano")
            ->withCreateNotification(null)
            ->withLogSetting((new \Gs2\Realtime\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.realtime.rest.Gs2RealtimeRestClient;
import io.gs2.realtime.request.CreateNamespaceRequest;
import io.gs2.realtime.result.CreateNamespaceResult;

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

try {
    CreateNamespaceResult result = client.createNamespace(
        new CreateNamespaceRequest()
            .withName("namespace1")
            .withDescription(null)
            .withServerType("relay")
            .withServerSpec("realtime1.nano")
            .withCreateNotification(null)
            .withLogSetting(new io.gs2.realtime.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.Gs2Realtime.Gs2RealtimeRestClient;
using Gs2.Gs2Realtime.Request.CreateNamespaceRequest;
using Gs2.Gs2Realtime.Result.CreateNamespaceResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createNamespace(
    new CreateNamespaceRequest()
        .withName("namespace1")
        .withDescription(null)
        .withServerType("relay")
        .withServerSpec("realtime1.nano")
        .withCreateNotification(null)
        .withLogSetting(new Gs2.Gs2Realtime.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 Gs2Realtime from '@/gs2/realtime';

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

try {
    const result = await client.createNamespace(
        new Gs2Realtime.CreateNamespaceRequest()
            .withName("namespace1")
            .withDescription(null)
            .withServerType("relay")
            .withServerSpec("realtime1.nano")
            .withCreateNotification(null)
            .withLogSetting(new Gs2Realtime.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 realtime

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

try:
    result = client.create_namespace(
        realtime.CreateNamespaceRequest()
            .with_name(self.hash1)
            .with_description(None)
            .with_server_type('relay')
            .with_server_spec('realtime1.nano')
            .with_create_notification(None)
            .with_log_setting(
                realtime.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('realtime')

api_result = client.create_namespace({
    name='namespace1',
    description=nil,
    serverType='relay',
    serverSpec='realtime1.nano',
    createNotification=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文字 説明文
serverType string ~ 128文字 サーバの種類
serverSpec string ~ 128文字 サーバのスペック
createNotification NotificationSetting ルームの作成が終わったときのプッシュ通知
logSetting LogSetting ログの出力設定

Result

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

getNamespaceStatus

getNamespaceStatus

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

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

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

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

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

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

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

client = gs2('realtime')

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

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

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

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

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

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

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

client = gs2('realtime')

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/realtime"
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 := realtime.Gs2RealtimeRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &realtime.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace1"),
        Description: pointy.String("description1"),
        ServerType: pointy.String("relay"),
        ServerSpec: pointy.String("realtime1.nano"),
        CreateNotification: nil,
        LogSetting: &realtime.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\Realtime\Gs2RealtimeRestClient;
use Gs2\Realtime\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")
            ->withServerType("relay")
            ->withServerSpec("realtime1.nano")
            ->withCreateNotification(null)
            ->withLogSetting((new \Gs2\Realtime\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.realtime.rest.Gs2RealtimeRestClient;
import io.gs2.realtime.request.UpdateNamespaceRequest;
import io.gs2.realtime.result.UpdateNamespaceResult;

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

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withServerType("relay")
            .withServerSpec("realtime1.nano")
            .withCreateNotification(null)
            .withLogSetting(new io.gs2.realtime.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.Gs2Realtime.Gs2RealtimeRestClient;
using Gs2.Gs2Realtime.Request.UpdateNamespaceRequest;
using Gs2.Gs2Realtime.Result.UpdateNamespaceResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateNamespace(
    new UpdateNamespaceRequest()
        .withNamespaceName("namespace1")
        .withDescription("description1")
        .withServerType("relay")
        .withServerSpec("realtime1.nano")
        .withCreateNotification(null)
        .withLogSetting(new Gs2.Gs2Realtime.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 Gs2Realtime from '@/gs2/realtime';

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

try {
    const result = await client.updateNamespace(
        new Gs2Realtime.UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withServerType("relay")
            .withServerSpec("realtime1.nano")
            .withCreateNotification(null)
            .withLogSetting(new Gs2Realtime.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 realtime

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

try:
    result = client.update_namespace(
        realtime.UpdateNamespaceRequest()
            .with_namespace_name(self.hash1)
            .with_description('description1')
            .with_server_type('relay')
            .with_server_spec('realtime1.nano')
            .with_create_notification(None)
            .with_log_setting(
                realtime.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('realtime')

api_result = client.update_namespace({
    namespaceName='namespace1',
    description='description1',
    serverType='relay',
    serverSpec='realtime1.nano',
    createNotification=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

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
description string ~ 1024文字 説明文
serverType string ~ 128文字 サーバの種類
serverSpec string ~ 128文字 サーバのスペック
createNotification NotificationSetting ルームの作成が終わったときのプッシュ通知
logSetting LogSetting ログの出力設定

Result

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

deleteNamespace

deleteNamespace

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

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

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

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

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

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

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

client = gs2('realtime')

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

describeRooms

describeRooms

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/realtime"
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 := realtime.Gs2RealtimeRestClient{
    Session: &session,
}
result, err := client.DescribeRooms(
    &realtime.DescribeRoomsRequest {
        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\Realtime\Gs2RealtimeRestClient;
use Gs2\Realtime\Request\DescribeRoomsRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeRooms(
        (new DescribeRoomsRequest())
            ->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.realtime.rest.Gs2RealtimeRestClient;
import io.gs2.realtime.request.DescribeRoomsRequest;
import io.gs2.realtime.result.DescribeRoomsResult;

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

try {
    DescribeRoomsResult result = client.describeRooms(
        new DescribeRoomsRequest()
            .withNamespaceName("namespace1")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Room> 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.Gs2Realtime.Gs2RealtimeRestClient;
using Gs2.Gs2Realtime.Request.DescribeRoomsRequest;
using Gs2.Gs2Realtime.Result.DescribeRoomsResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeRooms(
    new DescribeRoomsRequest()
        .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 Gs2Realtime from '@/gs2/realtime';

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

try {
    const result = await client.describeRooms(
        new Gs2Realtime.DescribeRoomsRequest()
            .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 realtime

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

try:
    result = client.describe_rooms(
        realtime.DescribeRoomsRequest()
            .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('realtime')

api_result = client.describe_rooms({
    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 Room[] ルームのリスト
nextPageToken string リストの続きを取得するためのページトークン

wantRoom

wantRoom

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/realtime"
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 := realtime.Gs2RealtimeRestClient{
    Session: &session,
}
result, err := client.WantRoom(
    &realtime.WantRoomRequest {
        NamespaceName: pointy.String("namespace1"),
        Name: pointy.String("room-0001"),
        NotificationUserIds: []string{
            "user-0001",
        "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\Realtime\Gs2RealtimeRestClient;
use Gs2\Realtime\Request\WantRoomRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->wantRoom(
        (new WantRoomRequest())
            ->withNamespaceName(self::namespace1)
            ->withName("room-0001")
            ->withNotificationUserIds([    "user-0001",
            "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.realtime.rest.Gs2RealtimeRestClient;
import io.gs2.realtime.request.WantRoomRequest;
import io.gs2.realtime.result.WantRoomResult;

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

try {
    WantRoomResult result = client.wantRoom(
        new WantRoomRequest()
            .withNamespaceName("namespace1")
            .withName("room-0001")
            .withNotificationUserIds(Arrays.asList(
                "user-0001",
            "user-0002"
            ))
    );
    Room 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.Gs2Realtime.Gs2RealtimeRestClient;
using Gs2.Gs2Realtime.Request.WantRoomRequest;
using Gs2.Gs2Realtime.Result.WantRoomResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.wantRoom(
    new WantRoomRequest()
        .withNamespaceName("namespace1")
        .withName("room-0001")
        .withNotificationUserIds(new string[] {
            "user-0001",
        "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 Gs2Realtime from '@/gs2/realtime';

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

try {
    const result = await client.wantRoom(
        new Gs2Realtime.WantRoomRequest()
            .withNamespaceName("namespace1")
            .withName("room-0001")
            .withNotificationUserIds([
                "user-0001",
            "user-0002"
            ])
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import realtime

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

try:
    result = client.want_room(
        realtime.WantRoomRequest()
            .with_namespace_name(self.hash1)
            .with_name('room-0001')
            .with_notification_user_ids([    'user-0001',
            'user-0002',
            ])
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('realtime')

api_result = client.want_room({
    namespaceName='namespace1',
    name='room-0001',
    notificationUserIds={
        'user-0001',
    '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文字 ネームスペース名
name string ~ 128文字 ルーム名
notificationUserIds string[] [] ルームの作成が終わったときに通知を受けるユーザIDリスト

Result

説明
item Room ルーム

getRoom

getRoom

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/realtime"
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 := realtime.Gs2RealtimeRestClient{
    Session: &session,
}
result, err := client.GetRoom(
    &realtime.GetRoomRequest {
        NamespaceName: pointy.String("namespace1"),
        RoomName: pointy.String("room-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\Realtime\Gs2RealtimeRestClient;
use Gs2\Realtime\Request\GetRoomRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getRoom(
        (new GetRoomRequest())
            ->withNamespaceName(self::namespace1)
            ->withRoomName("room-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.realtime.rest.Gs2RealtimeRestClient;
import io.gs2.realtime.request.GetRoomRequest;
import io.gs2.realtime.result.GetRoomResult;

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

try {
    GetRoomResult result = client.getRoom(
        new GetRoomRequest()
            .withNamespaceName("namespace1")
            .withRoomName("room-0001")
    );
    Room 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.Gs2Realtime.Gs2RealtimeRestClient;
using Gs2.Gs2Realtime.Request.GetRoomRequest;
using Gs2.Gs2Realtime.Result.GetRoomResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getRoom(
    new GetRoomRequest()
        .withNamespaceName("namespace1")
        .withRoomName("room-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 Gs2Realtime from '@/gs2/realtime';

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

try {
    const result = await client.getRoom(
        new Gs2Realtime.GetRoomRequest()
            .withNamespaceName("namespace1")
            .withRoomName("room-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import realtime

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

try:
    result = client.get_room(
        realtime.GetRoomRequest()
            .with_namespace_name(self.hash1)
            .with_room_name('room-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('realtime')

api_result = client.get_room({
    namespaceName='namespace1',
    roomName='room-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文字 ネームスペース名
roomName string ~ 128文字 ルーム名

Result

説明
item Room ルーム

deleteRoom

deleteRoom

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/realtime"
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 := realtime.Gs2RealtimeRestClient{
    Session: &session,
}
result, err := client.DeleteRoom(
    &realtime.DeleteRoomRequest {
        NamespaceName: pointy.String("namespace1"),
        RoomName: pointy.String("room-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\Realtime\Gs2RealtimeRestClient;
use Gs2\Realtime\Request\DeleteRoomRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteRoom(
        (new DeleteRoomRequest())
            ->withNamespaceName(self::namespace1)
            ->withRoomName("room-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.realtime.rest.Gs2RealtimeRestClient;
import io.gs2.realtime.request.DeleteRoomRequest;
import io.gs2.realtime.result.DeleteRoomResult;

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

try {
    DeleteRoomResult result = client.deleteRoom(
        new DeleteRoomRequest()
            .withNamespaceName("namespace1")
            .withRoomName("room-0001")
    );
    Room 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.Gs2Realtime.Gs2RealtimeRestClient;
using Gs2.Gs2Realtime.Request.DeleteRoomRequest;
using Gs2.Gs2Realtime.Result.DeleteRoomResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteRoom(
    new DeleteRoomRequest()
        .withNamespaceName("namespace1")
        .withRoomName("room-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 Gs2Realtime from '@/gs2/realtime';

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

try {
    const result = await client.deleteRoom(
        new Gs2Realtime.DeleteRoomRequest()
            .withNamespaceName("namespace1")
            .withRoomName("room-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import realtime

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

try:
    result = client.delete_room(
        realtime.DeleteRoomRequest()
            .with_namespace_name(self.hash1)
            .with_room_name('room-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('realtime')

api_result = client.delete_room({
    namespaceName='namespace1',
    roomName='room-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文字 ネームスペース名
roomName string ~ 128文字 ルーム名

Result

説明
item Room ルーム