API Reference of GS2-Gateway SDK

Model

Namespace

Namespace

Namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project. Basically, GS2 services have a layer called namespace, and different namespaces are treated as completely different data spaces, even for the same service.

Therefore, it is necessary to create a namespace before starting to use each service.

TypeConditionRequireDefaultLimitationDescription
namespaceIdstring~ 1024 charsNamespace GRN
namestring~ 32 charsNamespace name
descriptionstring~ 1024 charsdescription of Namespace
firebaseSecretstring~ 1024 charsSecret token used to send Firebase notifications
logSettingLogSettingLog output settings
createdAtlongDatetime of creation
updatedAtlongDatetime of last update
revisionlong0~ 9223372036854775805Revision

WebSocketSession

TypeConditionRequireDefaultLimitationDescription
webSocketSessionIdstring~ 1024 charsWebSocket Session GRN
connectionIdstring~ 128 charsconnection ID
namespaceNamestring~ 128 charsNamespace name
userIdstring~ 128 charsUser Id
createdAtlongDatetime of creation
updatedAtlongDatetime of last update
revisionlong0~ 9223372036854775805Revision

FirebaseToken

Firebase Device Token

A Firebase device token is required to use mobile push notifications.

GS2-Gateway provides in-game push notification functionality, allowing you to receive push notifications when matchmaking is completed or missions are accomplished, but Mobile push notifications can be forwarded to a mobile push notification if the player to whom the notification is directed is offline.

The Firebase device token is used to identify the device to be notified. As the name suggests, Firebase is an external service, so please refer to the Firebase documentation for detailed information on how to obtain the token.

TypeConditionRequireDefaultLimitationDescription
firebaseTokenIdstring~ 1024 charsFirebase device token GRN
userIdstring~ 128 charsUser Id
tokenstring~ 1024 charsDevice Token for Firebase Cloud Messaging
createdAtlongDatetime of creation
updatedAtlongDatetime of last update
revisionlong0~ 9223372036854775805Revision

LogSetting

TypeConditionRequireDefaultLimitationDescription
loggingNamespaceIdstring~ 1024 charsNamespace GRN

Methods

describeNamespaces

Get list of namespaces

Request

TypeConditionRequireDefaultLimitationDescription
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data acquired

Result

TypeDescription
itemsList<Namespace>List of Namespace
nextPageTokenstringPage token to retrieve the rest of the listing

Implementation Example

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

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

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

AsyncResult<Gs2.Gs2Gateway.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
    new Gs2.Gs2Gateway.Request.DescribeNamespacesRequest()
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Gateway from '@/gs2/gateway';

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

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

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

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

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

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

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

createNamespace

Create a new namespace

Request

TypeConditionRequireDefaultLimitationDescription
namestring~ 32 charsNamespace name
descriptionstring~ 1024 charsdescription of Namespace
firebaseSecretstring~ 1024 charsSecret token used to send Firebase notifications
logSettingLogSettingLog output settings

Result

TypeDescription
itemNamespaceNamespace created

Implementation Example

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

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

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

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

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

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

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

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

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

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

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

result = api_result.result
item = result.item;

getNamespaceStatus

Get namespace status

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name

Result

TypeDescription
statusstring

Implementation Example

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

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

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

AsyncResult<Gs2.Gs2Gateway.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
    new Gs2.Gs2Gateway.Request.GetNamespaceStatusRequest()
        .WithNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as Gs2Gateway from '@/gs2/gateway';

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

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

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

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

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

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

result = api_result.result
status = result.status;

getNamespace

Get namespace

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name

Result

TypeDescription
itemNamespaceNamespace

Implementation Example

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

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

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

AsyncResult<Gs2.Gs2Gateway.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
    new Gs2.Gs2Gateway.Request.GetNamespaceRequest()
        .WithNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Gateway from '@/gs2/gateway';

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

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

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

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

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

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

result = api_result.result
item = result.item;

updateNamespace

Update namespace

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
descriptionstring~ 1024 charsdescription of Namespace
firebaseSecretstring~ 1024 charsSecret token used to send Firebase notifications
logSettingLogSettingLog output settings

Result

TypeDescription
itemNamespaceUpdated namespace

Implementation Example

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

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

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withFirebaseSecret("firebase-secret2")
            .withLogSetting(new io.gs2.gateway.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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.UpdateNamespaceRequest;
using Gs2.Gs2Gateway.Result.UpdateNamespaceResult;

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

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

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

try {
    const result = await client.updateNamespace(
        new Gs2Gateway.UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withFirebaseSecret("firebase-secret2")
            .withLogSetting(new Gs2Gateway.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 gateway

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

try:
    result = client.update_namespace(
        gateway.UpdateNamespaceRequest()
            .with_namespace_name(self.hash1)
            .with_description('description1')
            .with_firebase_secret('firebase-secret2')
            .with_log_setting(
                gateway.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('gateway')

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

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

result = api_result.result
item = result.item;

deleteNamespace

Delete namespace

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name

Result

TypeDescription
itemNamespaceDeleted namespace

Implementation Example

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

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

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

AsyncResult<Gs2.Gs2Gateway.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
    new Gs2.Gs2Gateway.Request.DeleteNamespaceRequest()
        .WithNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Gateway from '@/gs2/gateway';

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

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

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

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

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

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

result = api_result.result
item = result.item;

dumpUserDataByUserId

Get dump data of the data associated with the specified user ID

Request

TypeConditionRequireDefaultLimitationDescription
userIdstring~ 128 charsUser Id

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.DumpUserDataByUserId(
    &gateway.DumpUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\DumpUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->dumpUserDataByUserId(
        (new DumpUserDataByUserIdRequest())
            ->withUserId("user-0001")
    );
} 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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.DumpUserDataByUserIdRequest;
import io.gs2.gateway.result.DumpUserDataByUserIdResult;

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

try {
    DumpUserDataByUserIdResult result = client.dumpUserDataByUserId(
        new DumpUserDataByUserIdRequest()
            .withUserId("user-0001")
    );
} 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.DumpUserDataByUserIdRequest;
using Gs2.Gs2Gateway.Result.DumpUserDataByUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
    new Gs2.Gs2Gateway.Request.DumpUserDataByUserIdRequest()
        .WithUserId("user-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.dumpUserDataByUserId(
        new Gs2Gateway.DumpUserDataByUserIdRequest()
            .withUserId("user-0001")
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.dump_user_data_by_user_id(
        gateway.DumpUserDataByUserIdRequest()
            .with_user_id('user-0001')
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.dump_user_data_by_user_id({
    userId='user-0001',
})

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

result = api_result.result

checkDumpUserDataByUserId

Check if the dump of the data associated with the specified user ID is complete

Request

TypeConditionRequireDefaultLimitationDescription
userIdstring~ 128 charsUser Id

Result

TypeDescription
urlstringURL of output data

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
    &gateway.CheckDumpUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
url := result.Url
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\CheckDumpUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->checkDumpUserDataByUserId(
        (new CheckDumpUserDataByUserIdRequest())
            ->withUserId("user-0001")
    );
    $url = $result->getUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.gateway.result.CheckDumpUserDataByUserIdResult;

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

try {
    CheckDumpUserDataByUserIdResult result = client.checkDumpUserDataByUserId(
        new CheckDumpUserDataByUserIdRequest()
            .withUserId("user-0001")
    );
    String url = result.getUrl();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.CheckDumpUserDataByUserIdRequest;
using Gs2.Gs2Gateway.Result.CheckDumpUserDataByUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
    new Gs2.Gs2Gateway.Request.CheckDumpUserDataByUserIdRequest()
        .WithUserId("user-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;
import Gs2Core from '@/gs2/core';
import * as Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.checkDumpUserDataByUserId(
        new Gs2Gateway.CheckDumpUserDataByUserIdRequest()
            .withUserId("user-0001")
    );
    const url = result.getUrl();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.check_dump_user_data_by_user_id(
        gateway.CheckDumpUserDataByUserIdRequest()
            .with_user_id('user-0001')
    )
    url = result.url
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.check_dump_user_data_by_user_id({
    userId='user-0001',
})

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

result = api_result.result
url = result.url;

cleanUserDataByUserId

Get clean data of the data associated with the specified user ID

Request

TypeConditionRequireDefaultLimitationDescription
userIdstring~ 128 charsUser Id

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.CleanUserDataByUserId(
    &gateway.CleanUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\CleanUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->cleanUserDataByUserId(
        (new CleanUserDataByUserIdRequest())
            ->withUserId("user-0001")
    );
} 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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.CleanUserDataByUserIdRequest;
import io.gs2.gateway.result.CleanUserDataByUserIdResult;

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

try {
    CleanUserDataByUserIdResult result = client.cleanUserDataByUserId(
        new CleanUserDataByUserIdRequest()
            .withUserId("user-0001")
    );
} 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.CleanUserDataByUserIdRequest;
using Gs2.Gs2Gateway.Result.CleanUserDataByUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
    new Gs2.Gs2Gateway.Request.CleanUserDataByUserIdRequest()
        .WithUserId("user-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.cleanUserDataByUserId(
        new Gs2Gateway.CleanUserDataByUserIdRequest()
            .withUserId("user-0001")
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.clean_user_data_by_user_id(
        gateway.CleanUserDataByUserIdRequest()
            .with_user_id('user-0001')
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.clean_user_data_by_user_id({
    userId='user-0001',
})

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

result = api_result.result

checkCleanUserDataByUserId

Check if the clean of the data associated with the specified user ID is complete

Request

TypeConditionRequireDefaultLimitationDescription
userIdstring~ 128 charsUser Id

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
    &gateway.CheckCleanUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\CheckCleanUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->checkCleanUserDataByUserId(
        (new CheckCleanUserDataByUserIdRequest())
            ->withUserId("user-0001")
    );
} 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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.gateway.result.CheckCleanUserDataByUserIdResult;

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

try {
    CheckCleanUserDataByUserIdResult result = client.checkCleanUserDataByUserId(
        new CheckCleanUserDataByUserIdRequest()
            .withUserId("user-0001")
    );
} 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.CheckCleanUserDataByUserIdRequest;
using Gs2.Gs2Gateway.Result.CheckCleanUserDataByUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
    new Gs2.Gs2Gateway.Request.CheckCleanUserDataByUserIdRequest()
        .WithUserId("user-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.checkCleanUserDataByUserId(
        new Gs2Gateway.CheckCleanUserDataByUserIdRequest()
            .withUserId("user-0001")
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.check_clean_user_data_by_user_id(
        gateway.CheckCleanUserDataByUserIdRequest()
            .with_user_id('user-0001')
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.check_clean_user_data_by_user_id({
    userId='user-0001',
})

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

result = api_result.result

prepareImportUserDataByUserId

Start importing data associated with the specified user ID

Request

TypeConditionRequireDefaultLimitationDescription
userIdstring~ 128 charsUser Id

Result

TypeDescription
uploadTokenstringToken used to reflect results after upload
uploadUrlstringURL used to upload user data

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
    &gateway.PrepareImportUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\PrepareImportUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->prepareImportUserDataByUserId(
        (new PrepareImportUserDataByUserIdRequest())
            ->withUserId("user-0001")
    );
    $uploadToken = $result->getUploadToken();
    $uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.gateway.result.PrepareImportUserDataByUserIdResult;

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

try {
    PrepareImportUserDataByUserIdResult result = client.prepareImportUserDataByUserId(
        new PrepareImportUserDataByUserIdRequest()
            .withUserId("user-0001")
    );
    String uploadToken = result.getUploadToken();
    String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.PrepareImportUserDataByUserIdRequest;
using Gs2.Gs2Gateway.Result.PrepareImportUserDataByUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
    new Gs2.Gs2Gateway.Request.PrepareImportUserDataByUserIdRequest()
        .WithUserId("user-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;
import Gs2Core from '@/gs2/core';
import * as Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.prepareImportUserDataByUserId(
        new Gs2Gateway.PrepareImportUserDataByUserIdRequest()
            .withUserId("user-0001")
    );
    const uploadToken = result.getUploadToken();
    const uploadUrl = result.getUploadUrl();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.prepare_import_user_data_by_user_id(
        gateway.PrepareImportUserDataByUserIdRequest()
            .with_user_id('user-0001')
    )
    upload_token = result.upload_token
    upload_url = result.upload_url
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.prepare_import_user_data_by_user_id({
    userId='user-0001',
})

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

result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;

importUserDataByUserId

Start importing data associated with the specified user ID

Request

TypeConditionRequireDefaultLimitationDescription
userIdstring~ 128 charsUser Id
uploadTokenstring~ 1024 charsToken received in preparation for upload

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.ImportUserDataByUserId(
    &gateway.ImportUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        UploadToken: pointy.String("upload-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\ImportUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->importUserDataByUserId(
        (new ImportUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withUploadToken("upload-0001")
    );
} 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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.ImportUserDataByUserIdRequest;
import io.gs2.gateway.result.ImportUserDataByUserIdResult;

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

try {
    ImportUserDataByUserIdResult result = client.importUserDataByUserId(
        new ImportUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withUploadToken("upload-0001")
    );
} 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.ImportUserDataByUserIdRequest;
using Gs2.Gs2Gateway.Result.ImportUserDataByUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
    new Gs2.Gs2Gateway.Request.ImportUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithUploadToken("upload-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.importUserDataByUserId(
        new Gs2Gateway.ImportUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withUploadToken("upload-0001")
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.import_user_data_by_user_id(
        gateway.ImportUserDataByUserIdRequest()
            .with_user_id('user-0001')
            .with_upload_token('upload-0001')
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.import_user_data_by_user_id({
    userId='user-0001',
    uploadToken='upload-0001',
})

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

result = api_result.result

checkImportUserDataByUserId

Check if the import of the data associated with the specified user ID is complete

Request

TypeConditionRequireDefaultLimitationDescription
userIdstring~ 128 charsUser Id
uploadTokenstring~ 1024 charsToken received in preparation for upload

Result

TypeDescription
urlstringURL of log data

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
    &gateway.CheckImportUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        UploadToken: pointy.String("upload-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
url := result.Url
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\CheckImportUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->checkImportUserDataByUserId(
        (new CheckImportUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withUploadToken("upload-0001")
    );
    $url = $result->getUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.CheckImportUserDataByUserIdRequest;
import io.gs2.gateway.result.CheckImportUserDataByUserIdResult;

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

try {
    CheckImportUserDataByUserIdResult result = client.checkImportUserDataByUserId(
        new CheckImportUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withUploadToken("upload-0001")
    );
    String url = result.getUrl();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.CheckImportUserDataByUserIdRequest;
using Gs2.Gs2Gateway.Result.CheckImportUserDataByUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
    new Gs2.Gs2Gateway.Request.CheckImportUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithUploadToken("upload-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;
import Gs2Core from '@/gs2/core';
import * as Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.checkImportUserDataByUserId(
        new Gs2Gateway.CheckImportUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withUploadToken("upload-0001")
    );
    const url = result.getUrl();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.check_import_user_data_by_user_id(
        gateway.CheckImportUserDataByUserIdRequest()
            .with_user_id('user-0001')
            .with_upload_token('upload-0001')
    )
    url = result.url
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.check_import_user_data_by_user_id({
    userId='user-0001',
    uploadToken='upload-0001',
})

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

result = api_result.result
url = result.url;

describeWebSocketSessions

Get list of Websocket sessions

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
accessTokenstring~ 128 charsUser Id
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data acquired

Result

TypeDescription
itemsList<WebSocketSession>List of Websocket Session
nextPageTokenstringPage token to retrieve the rest of the listing

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.DescribeWebSocketSessions(
    &gateway.DescribeWebSocketSessionsRequest {
        NamespaceName: pointy.String("namespace1"),
        AccessToken: pointy.String("$access_token_0001"),
        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\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\DescribeWebSocketSessionsRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeWebSocketSessions(
        (new DescribeWebSocketSessionsRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.DescribeWebSocketSessionsRequest;
import io.gs2.gateway.result.DescribeWebSocketSessionsResult;

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

try {
    DescribeWebSocketSessionsResult result = client.describeWebSocketSessions(
        new DescribeWebSocketSessionsRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<WebSocketSession> 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.DescribeWebSocketSessionsRequest;
using Gs2.Gs2Gateway.Result.DescribeWebSocketSessionsResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.DescribeWebSocketSessionsResult> asyncResult = null;
yield return client.DescribeWebSocketSessions(
    new Gs2.Gs2Gateway.Request.DescribeWebSocketSessionsRequest()
        .WithNamespaceName("namespace1")
        .WithAccessToken("$access_token_0001")
        .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 Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.describeWebSocketSessions(
        new Gs2Gateway.DescribeWebSocketSessionsRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.describe_web_socket_sessions(
        gateway.DescribeWebSocketSessionsRequest()
            .with_namespace_name(self.hash1)
            .with_access_token(self.access_token_0001)
            .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('gateway')

api_result = client.describe_web_socket_sessions({
    namespaceName='namespace1',
    accessToken='$access_token_0001',
    pageToken=nil,
    limit=nil,
})

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

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

describeWebSocketSessionsByUserId

Get list of Websocket sessions by user ID

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
userIdstring~ 128 charsUser Id
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data acquired

Result

TypeDescription
itemsList<WebSocketSession>List of Websocket Session
nextPageTokenstringPage token to retrieve the rest of the listing

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.DescribeWebSocketSessionsByUserId(
    &gateway.DescribeWebSocketSessionsByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        UserId: pointy.String("user-0001"),
        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\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\DescribeWebSocketSessionsByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeWebSocketSessionsByUserId(
        (new DescribeWebSocketSessionsByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId("user-0001")
            ->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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.DescribeWebSocketSessionsByUserIdRequest;
import io.gs2.gateway.result.DescribeWebSocketSessionsByUserIdResult;

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

try {
    DescribeWebSocketSessionsByUserIdResult result = client.describeWebSocketSessionsByUserId(
        new DescribeWebSocketSessionsByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<WebSocketSession> 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.DescribeWebSocketSessionsByUserIdRequest;
using Gs2.Gs2Gateway.Result.DescribeWebSocketSessionsByUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.DescribeWebSocketSessionsByUserIdResult> asyncResult = null;
yield return client.DescribeWebSocketSessionsByUserId(
    new Gs2.Gs2Gateway.Request.DescribeWebSocketSessionsByUserIdRequest()
        .WithNamespaceName("namespace1")
        .WithUserId("user-0001")
        .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 Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.describeWebSocketSessionsByUserId(
        new Gs2Gateway.DescribeWebSocketSessionsByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.describe_web_socket_sessions_by_user_id(
        gateway.DescribeWebSocketSessionsByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .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('gateway')

api_result = client.describe_web_socket_sessions_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
    pageToken=nil,
    limit=nil,
})

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

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

setUserId

Set user ID for Websocket session

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
connectionIdstring~ 128 charsconnection ID
accessTokenstring~ 128 charsUser Id
allowConcurrentAccessbooltrueAllow connections from different clients at the same time

Result

TypeDescription
itemWebSocketSessionUpdated Websocket session

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.SetUserId(
    &gateway.SetUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        AccessToken: pointy.String("$access_token_0001"),
        AllowConcurrentAccess: 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\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\SetUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->setUserId(
        (new SetUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->withAllowConcurrentAccess(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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.SetUserIdRequest;
import io.gs2.gateway.result.SetUserIdResult;

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

try {
    SetUserIdResult result = client.setUserId(
        new SetUserIdRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
            .withAllowConcurrentAccess(null)
    );
    WebSocketSession 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.SetUserIdRequest;
using Gs2.Gs2Gateway.Result.SetUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.SetUserIdResult> asyncResult = null;
yield return client.SetUserId(
    new Gs2.Gs2Gateway.Request.SetUserIdRequest()
        .WithNamespaceName("namespace1")
        .WithAccessToken("$access_token_0001")
        .WithAllowConcurrentAccess(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 Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.setUserId(
        new Gs2Gateway.SetUserIdRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
            .withAllowConcurrentAccess(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.set_user_id(
        gateway.SetUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_access_token(self.access_token_0001)
            .with_allow_concurrent_access(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.set_user_id({
    namespaceName='namespace1',
    accessToken='$access_token_0001',
    allowConcurrentAccess=nil,
})

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

result = api_result.result
item = result.item;

setUserIdByUserId

Set user ID to Websocket session by specifying user ID

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
connectionIdstring~ 128 charsconnection ID
userIdstring~ 128 charsUser Id
allowConcurrentAccessbooltrueAllow connections from different clients at the same time

Result

TypeDescription
itemWebSocketSessionUpdated Websocket session

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.SetUserIdByUserId(
    &gateway.SetUserIdByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        UserId: pointy.String("user-0001"),
        AllowConcurrentAccess: pointy.Bool(true),
    }
)
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\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\SetUserIdByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->setUserIdByUserId(
        (new SetUserIdByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId("user-0001")
            ->withAllowConcurrentAccess(True)
    );
    $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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.SetUserIdByUserIdRequest;
import io.gs2.gateway.result.SetUserIdByUserIdResult;

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

try {
    SetUserIdByUserIdResult result = client.setUserIdByUserId(
        new SetUserIdByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withAllowConcurrentAccess(true)
    );
    WebSocketSession 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.SetUserIdByUserIdRequest;
using Gs2.Gs2Gateway.Result.SetUserIdByUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.SetUserIdByUserIdResult> asyncResult = null;
yield return client.SetUserIdByUserId(
    new Gs2.Gs2Gateway.Request.SetUserIdByUserIdRequest()
        .WithNamespaceName("namespace1")
        .WithUserId("user-0001")
        .WithAllowConcurrentAccess(true),
    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 Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.setUserIdByUserId(
        new Gs2Gateway.SetUserIdByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withAllowConcurrentAccess(true)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.set_user_id_by_user_id(
        gateway.SetUserIdByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_allow_concurrent_access(True)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.set_user_id_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
    allowConcurrentAccess=true,
})

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

result = api_result.result
item = result.item;

sendNotification

Send Notification

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
userIdstring~ 128 charsUser Id
subjectstring~ 128 charsSubject
payloadstring~ 1024 charsPayload
enableTransferMobileNotificationboolfalseForwarding to mobile push notifications when the user to be notified is offline
soundstring{enableTransferMobileNotification} == true~ 256 charsName of audio file to be played

Result

TypeDescription
protocolstringProtocol used for notification

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.SendNotification(
    &gateway.SendNotificationRequest {
        NamespaceName: pointy.String("namespace1"),
        UserId: pointy.String("user-0001"),
        Subject: pointy.String("subject"),
        Payload: pointy.String("payload"),
        EnableTransferMobileNotification: pointy.Bool(true),
        Sound: pointy.String("sound.wav"),
    }
)
if err != nil {
    panic("error occurred")
}
protocol := result.Protocol
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\SendNotificationRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->sendNotification(
        (new SendNotificationRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId("user-0001")
            ->withSubject("subject")
            ->withPayload("payload")
            ->withEnableTransferMobileNotification(True)
            ->withSound("sound.wav")
    );
    $protocol = $result->getProtocol();
} 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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.SendNotificationRequest;
import io.gs2.gateway.result.SendNotificationResult;

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

try {
    SendNotificationResult result = client.sendNotification(
        new SendNotificationRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withSubject("subject")
            .withPayload("payload")
            .withEnableTransferMobileNotification(true)
            .withSound("sound.wav")
    );
    String protocol = result.getProtocol();
} 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.SendNotificationRequest;
using Gs2.Gs2Gateway.Result.SendNotificationResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.SendNotificationResult> asyncResult = null;
yield return client.SendNotification(
    new Gs2.Gs2Gateway.Request.SendNotificationRequest()
        .WithNamespaceName("namespace1")
        .WithUserId("user-0001")
        .WithSubject("subject")
        .WithPayload("payload")
        .WithEnableTransferMobileNotification(true)
        .WithSound("sound.wav"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var protocol = result.Protocol;
import Gs2Core from '@/gs2/core';
import * as Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.sendNotification(
        new Gs2Gateway.SendNotificationRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withSubject("subject")
            .withPayload("payload")
            .withEnableTransferMobileNotification(true)
            .withSound("sound.wav")
    );
    const protocol = result.getProtocol();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.send_notification(
        gateway.SendNotificationRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_subject('subject')
            .with_payload('payload')
            .with_enable_transfer_mobile_notification(True)
            .with_sound('sound.wav')
    )
    protocol = result.protocol
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.send_notification({
    namespaceName='namespace1',
    userId='user-0001',
    subject='subject',
    payload='payload',
    enableTransferMobileNotification=true,
    sound='sound.wav',
})

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

result = api_result.result
protocol = result.protocol;

disconnectByUserId

Disconnect Websocket session with user ID

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
userIdstring~ 128 charsUser Id

Result

TypeDescription
itemsList<WebSocketSession>List of Disconnected Websocket session

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.DisconnectByUserId(
    &gateway.DisconnectByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        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\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\DisconnectByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->disconnectByUserId(
        (new DisconnectByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.DisconnectByUserIdRequest;
import io.gs2.gateway.result.DisconnectByUserIdResult;

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

try {
    DisconnectByUserIdResult result = client.disconnectByUserId(
        new DisconnectByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
    );
    List<WebSocketSession> 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.DisconnectByUserIdRequest;
using Gs2.Gs2Gateway.Result.DisconnectByUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.DisconnectByUserIdResult> asyncResult = null;
yield return client.DisconnectByUserId(
    new Gs2.Gs2Gateway.Request.DisconnectByUserIdRequest()
        .WithNamespaceName("namespace1")
        .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 Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.disconnectByUserId(
        new Gs2Gateway.DisconnectByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.disconnect_by_user_id(
        gateway.DisconnectByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.disconnect_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
})

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

result = api_result.result
items = result.items;

disconnectAll

Disconnect all WebSockets

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name

Result

TypeDescription

Implementation Example

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

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->disconnectAll(
        (new DisconnectAllRequest())
            ->withNamespaceName(self::namespace1)
    );
} 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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.DisconnectAllRequest;
import io.gs2.gateway.result.DisconnectAllResult;

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

try {
    DisconnectAllResult result = client.disconnectAll(
        new DisconnectAllRequest()
            .withNamespaceName("namespace1")
    );
} 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.DisconnectAllRequest;
using Gs2.Gs2Gateway.Result.DisconnectAllResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.DisconnectAllResult> asyncResult = null;
yield return client.DisconnectAll(
    new Gs2.Gs2Gateway.Request.DisconnectAllRequest()
        .WithNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.disconnectAll(
        new Gs2Gateway.DisconnectAllRequest()
            .withNamespaceName("namespace1")
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.disconnect_all(
        gateway.DisconnectAllRequest()
            .with_namespace_name(self.hash1)
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

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

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

result = api_result.result

setFirebaseToken

Set device token

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
accessTokenstring~ 128 charsUser Id
tokenstring~ 1024 charsDevice Token for Firebase Cloud Messaging

Result

TypeDescription
itemFirebaseTokenCreated Firebase device token

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.SetFirebaseToken(
    &gateway.SetFirebaseTokenRequest {
        NamespaceName: pointy.String("namespace1"),
        AccessToken: pointy.String("$access_token_0001"),
        Token: pointy.String("firebase-token-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\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\SetFirebaseTokenRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->setFirebaseToken(
        (new SetFirebaseTokenRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->withToken("firebase-token-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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.SetFirebaseTokenRequest;
import io.gs2.gateway.result.SetFirebaseTokenResult;

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

try {
    SetFirebaseTokenResult result = client.setFirebaseToken(
        new SetFirebaseTokenRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
            .withToken("firebase-token-0001")
    );
    FirebaseToken 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.SetFirebaseTokenRequest;
using Gs2.Gs2Gateway.Result.SetFirebaseTokenResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.SetFirebaseTokenResult> asyncResult = null;
yield return client.SetFirebaseToken(
    new Gs2.Gs2Gateway.Request.SetFirebaseTokenRequest()
        .WithNamespaceName("namespace1")
        .WithAccessToken("$access_token_0001")
        .WithToken("firebase-token-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 Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.setFirebaseToken(
        new Gs2Gateway.SetFirebaseTokenRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
            .withToken("firebase-token-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.set_firebase_token(
        gateway.SetFirebaseTokenRequest()
            .with_namespace_name(self.hash1)
            .with_access_token(self.access_token_0001)
            .with_token('firebase-token-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.set_firebase_token({
    namespaceName='namespace1',
    accessToken='$access_token_0001',
    token='firebase-token-0001',
})

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

result = api_result.result
item = result.item;

setFirebaseTokenByUserId

Set up a device token by specifying a user ID

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
userIdstring~ 128 charsUser Id
tokenstring~ 1024 charsDevice Token for Firebase Cloud Messaging

Result

TypeDescription
itemFirebaseTokenCreated Firebase device token

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.SetFirebaseTokenByUserId(
    &gateway.SetFirebaseTokenByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        UserId: pointy.String("user-0001"),
        Token: pointy.String("firebase-token-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\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\SetFirebaseTokenByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->setFirebaseTokenByUserId(
        (new SetFirebaseTokenByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId("user-0001")
            ->withToken("firebase-token-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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.SetFirebaseTokenByUserIdRequest;
import io.gs2.gateway.result.SetFirebaseTokenByUserIdResult;

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

try {
    SetFirebaseTokenByUserIdResult result = client.setFirebaseTokenByUserId(
        new SetFirebaseTokenByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withToken("firebase-token-0001")
    );
    FirebaseToken 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.SetFirebaseTokenByUserIdRequest;
using Gs2.Gs2Gateway.Result.SetFirebaseTokenByUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.SetFirebaseTokenByUserIdResult> asyncResult = null;
yield return client.SetFirebaseTokenByUserId(
    new Gs2.Gs2Gateway.Request.SetFirebaseTokenByUserIdRequest()
        .WithNamespaceName("namespace1")
        .WithUserId("user-0001")
        .WithToken("firebase-token-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 Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.setFirebaseTokenByUserId(
        new Gs2Gateway.SetFirebaseTokenByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withToken("firebase-token-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.set_firebase_token_by_user_id(
        gateway.SetFirebaseTokenByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_token('firebase-token-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.set_firebase_token_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
    token='firebase-token-0001',
})

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

result = api_result.result
item = result.item;

getFirebaseToken

Get Firebase device token

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
accessTokenstring~ 128 charsUser Id

Result

TypeDescription
itemFirebaseTokenFirebase device token

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.GetFirebaseToken(
    &gateway.GetFirebaseTokenRequest {
        NamespaceName: pointy.String("namespace1"),
        AccessToken: pointy.String("$access_token_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\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\GetFirebaseTokenRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getFirebaseToken(
        (new GetFirebaseTokenRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
    );
    $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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.GetFirebaseTokenRequest;
import io.gs2.gateway.result.GetFirebaseTokenResult;

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

try {
    GetFirebaseTokenResult result = client.getFirebaseToken(
        new GetFirebaseTokenRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
    );
    FirebaseToken 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.GetFirebaseTokenRequest;
using Gs2.Gs2Gateway.Result.GetFirebaseTokenResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.GetFirebaseTokenResult> asyncResult = null;
yield return client.GetFirebaseToken(
    new Gs2.Gs2Gateway.Request.GetFirebaseTokenRequest()
        .WithNamespaceName("namespace1")
        .WithAccessToken("$access_token_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 Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.getFirebaseToken(
        new Gs2Gateway.GetFirebaseTokenRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.get_firebase_token(
        gateway.GetFirebaseTokenRequest()
            .with_namespace_name(self.hash1)
            .with_access_token(self.access_token_0001)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.get_firebase_token({
    namespaceName='namespace1',
    accessToken='$access_token_0001',
})

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

result = api_result.result
item = result.item;

getFirebaseTokenByUserId

Obtain Firebase device token by specifying user ID

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
userIdstring~ 128 charsUser Id

Result

TypeDescription
itemFirebaseTokenFirebase device token

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.GetFirebaseTokenByUserId(
    &gateway.GetFirebaseTokenByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        UserId: pointy.String("user-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\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\GetFirebaseTokenByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getFirebaseTokenByUserId(
        (new GetFirebaseTokenByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId("user-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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.GetFirebaseTokenByUserIdRequest;
import io.gs2.gateway.result.GetFirebaseTokenByUserIdResult;

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

try {
    GetFirebaseTokenByUserIdResult result = client.getFirebaseTokenByUserId(
        new GetFirebaseTokenByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
    );
    FirebaseToken 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.GetFirebaseTokenByUserIdRequest;
using Gs2.Gs2Gateway.Result.GetFirebaseTokenByUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.GetFirebaseTokenByUserIdResult> asyncResult = null;
yield return client.GetFirebaseTokenByUserId(
    new Gs2.Gs2Gateway.Request.GetFirebaseTokenByUserIdRequest()
        .WithNamespaceName("namespace1")
        .WithUserId("user-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 Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.getFirebaseTokenByUserId(
        new Gs2Gateway.GetFirebaseTokenByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.get_firebase_token_by_user_id(
        gateway.GetFirebaseTokenByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.get_firebase_token_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
})

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

result = api_result.result
item = result.item;

deleteFirebaseToken

Delete Firebase device token

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
accessTokenstring~ 128 charsUser Id

Result

TypeDescription
itemFirebaseTokenDeleted Firebase device token

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.DeleteFirebaseToken(
    &gateway.DeleteFirebaseTokenRequest {
        NamespaceName: pointy.String("namespace1"),
        AccessToken: pointy.String("$access_token_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\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\DeleteFirebaseTokenRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteFirebaseToken(
        (new DeleteFirebaseTokenRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
    );
    $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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.DeleteFirebaseTokenRequest;
import io.gs2.gateway.result.DeleteFirebaseTokenResult;

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

try {
    DeleteFirebaseTokenResult result = client.deleteFirebaseToken(
        new DeleteFirebaseTokenRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
    );
    FirebaseToken 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.DeleteFirebaseTokenRequest;
using Gs2.Gs2Gateway.Result.DeleteFirebaseTokenResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.DeleteFirebaseTokenResult> asyncResult = null;
yield return client.DeleteFirebaseToken(
    new Gs2.Gs2Gateway.Request.DeleteFirebaseTokenRequest()
        .WithNamespaceName("namespace1")
        .WithAccessToken("$access_token_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 Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.deleteFirebaseToken(
        new Gs2Gateway.DeleteFirebaseTokenRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.delete_firebase_token(
        gateway.DeleteFirebaseTokenRequest()
            .with_namespace_name(self.hash1)
            .with_access_token(self.access_token_0001)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.delete_firebase_token({
    namespaceName='namespace1',
    accessToken='$access_token_0001',
})

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

result = api_result.result
item = result.item;

deleteFirebaseTokenByUserId

Delete Firebase device token with user ID

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
userIdstring~ 128 charsUser Id

Result

TypeDescription
itemFirebaseTokenDeleted Firebase device token

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.DeleteFirebaseTokenByUserId(
    &gateway.DeleteFirebaseTokenByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        UserId: pointy.String("user-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\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\DeleteFirebaseTokenByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteFirebaseTokenByUserId(
        (new DeleteFirebaseTokenByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId("user-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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.DeleteFirebaseTokenByUserIdRequest;
import io.gs2.gateway.result.DeleteFirebaseTokenByUserIdResult;

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

try {
    DeleteFirebaseTokenByUserIdResult result = client.deleteFirebaseTokenByUserId(
        new DeleteFirebaseTokenByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
    );
    FirebaseToken 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.DeleteFirebaseTokenByUserIdRequest;
using Gs2.Gs2Gateway.Result.DeleteFirebaseTokenByUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.DeleteFirebaseTokenByUserIdResult> asyncResult = null;
yield return client.DeleteFirebaseTokenByUserId(
    new Gs2.Gs2Gateway.Request.DeleteFirebaseTokenByUserIdRequest()
        .WithNamespaceName("namespace1")
        .WithUserId("user-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 Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.deleteFirebaseTokenByUserId(
        new Gs2Gateway.DeleteFirebaseTokenByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.delete_firebase_token_by_user_id(
        gateway.DeleteFirebaseTokenByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.delete_firebase_token_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
})

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

result = api_result.result
item = result.item;

sendMobileNotificationByUserId

Send mobile push notification

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
userIdstring~ 128 charsUser Id
subjectstring~ 256 charsSubject
payloadstring~ 1024 charsPayload
soundstring~ 256 charsName of audio file to be played

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/gateway"
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 := gateway.Gs2GatewayRestClient{
    Session: &session,
}
result, err := client.SendMobileNotificationByUserId(
    &gateway.SendMobileNotificationByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        UserId: pointy.String("user-0001"),
        Subject: pointy.String("subject"),
        Payload: pointy.String("payload"),
        Sound: pointy.String("sound.wav"),
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Gateway\Gs2GatewayRestClient;
use Gs2\Gateway\Request\SendMobileNotificationByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->sendMobileNotificationByUserId(
        (new SendMobileNotificationByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId("user-0001")
            ->withSubject("subject")
            ->withPayload("payload")
            ->withSound("sound.wav")
    );
} 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.gateway.rest.Gs2GatewayRestClient;
import io.gs2.gateway.request.SendMobileNotificationByUserIdRequest;
import io.gs2.gateway.result.SendMobileNotificationByUserIdResult;

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

try {
    SendMobileNotificationByUserIdResult result = client.sendMobileNotificationByUserId(
        new SendMobileNotificationByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withSubject("subject")
            .withPayload("payload")
            .withSound("sound.wav")
    );
} 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.Gs2Gateway.Gs2GatewayRestClient;
using Gs2.Gs2Gateway.Request.SendMobileNotificationByUserIdRequest;
using Gs2.Gs2Gateway.Result.SendMobileNotificationByUserIdResult;

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

AsyncResult<Gs2.Gs2Gateway.Result.SendMobileNotificationByUserIdResult> asyncResult = null;
yield return client.SendMobileNotificationByUserId(
    new Gs2.Gs2Gateway.Request.SendMobileNotificationByUserIdRequest()
        .WithNamespaceName("namespace1")
        .WithUserId("user-0001")
        .WithSubject("subject")
        .WithPayload("payload")
        .WithSound("sound.wav"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Gateway from '@/gs2/gateway';

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

try {
    const result = await client.sendMobileNotificationByUserId(
        new Gs2Gateway.SendMobileNotificationByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withSubject("subject")
            .withPayload("payload")
            .withSound("sound.wav")
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import gateway

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

try:
    result = client.send_mobile_notification_by_user_id(
        gateway.SendMobileNotificationByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_subject('subject')
            .with_payload('payload')
            .with_sound('sound.wav')
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('gateway')

api_result = client.send_mobile_notification_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
    subject='subject',
    payload='payload',
    sound='sound.wav',
})

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

result = api_result.result