GS2-Gateway
GS2 SDK Reference
GS2 SDK Reference
Models
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.
Type | Description | |
---|---|---|
namespaceId | string | Namespace GRN |
name | string | Namespace name |
description | string | description of Namespace |
firebaseSecret | string | Secret token used to send Firebase notifications |
logSetting | LogSetting | Log output settings |
createdAt | long | Datetime of creation |
updatedAt | long | Datetime of last update |
WebSocketSession
Type | Description | |
---|---|---|
webSocketSessionId | string | WebSocket Session GRN |
connectionId | string | connection ID |
namespaceName | string | Namespace name |
userId | string | User Id |
createdAt | long | Datetime of creation |
updatedAt | long | Datetime of last update |
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.
Type | Description | |
---|---|---|
firebaseTokenId | string | Firebase device token GRN |
userId | string | User Id |
token | string | Device Token for Firebase Cloud Messaging |
createdAt | long | Datetime of creation |
updatedAt | long | Datetime of last update |
LogSetting
Type | Description | |
---|---|---|
loggingNamespaceId | string | Namespace GRN |
Methods
describeNamespaces
describeNamespaces
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;
Get list of namespaces
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | ||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | Namespace[] | List of Namespace |
nextPageToken | string | Page token to retrieve the rest of the listing |
createNamespace
createNamespace
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;
Create a new namespace
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
name | string | ✓ | ~ 32 chars | Namespace name | |
description | string | ~ 1024 chars | description of Namespace | ||
firebaseSecret | string | ~ 1024 chars | Secret token used to send Firebase notifications | ||
logSetting | LogSetting | Log output settings |
Result
Type | Description | |
---|---|---|
item | Namespace | Namespace created |
getNamespaceStatus
getNamespaceStatus
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;
Get namespace status
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
status | string |
getNamespace
getNamespace
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;
Get namespace
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | Namespace | Namespace |
updateNamespace
updateNamespace
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;
Update namespace
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
description | string | ~ 1024 chars | description of Namespace | ||
firebaseSecret | string | ~ 1024 chars | Secret token used to send Firebase notifications | ||
logSetting | LogSetting | Log output settings |
Result
Type | Description | |
---|---|---|
item | Namespace | Updated namespace |
deleteNamespace
deleteNamespace
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;
Delete namespace
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | Namespace | Deleted namespace |
describeWebSocketSessions
describeWebSocketSessions
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;
Get list of Websocket sessions
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | ||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | WebSocketSession[] | List of Websocket Session |
nextPageToken | string | Page token to retrieve the rest of the listing |
describeWebSocketSessionsByUserId
describeWebSocketSessionsByUserId
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;
Get list of Websocket sessions by user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | ||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | WebSocketSession[] | List of Websocket Session |
nextPageToken | string | Page token to retrieve the rest of the listing |
setUserId
setUserId
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;
Set user ID for Websocket session
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
connectionId | string | ✓ | ~ 128 chars | connection ID | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
allowConcurrentAccess | bool | ✓ | true | Allow connections from different clients at the same time |
Result
Type | Description | |
---|---|---|
item | WebSocketSession | Updated Websocket session |
setUserIdByUserId
setUserIdByUserId
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;
Set user ID to Websocket session by specifying user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
connectionId | string | ✓ | ~ 128 chars | connection ID | |
userId | string | ✓ | ~ 128 chars | User Id | |
allowConcurrentAccess | bool | ✓ | true | Allow connections from different clients at the same time |
Result
Type | Description | |
---|---|---|
item | WebSocketSession | Updated Websocket session |
sendNotification
sendNotification
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;
Send Notification
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
issuer | string | ✓ | ~ 256 chars | Notification source service | |
subject | string | ✓ | ~ 128 chars | Subject | |
payload | string | ✓ | ~ 1024 chars | Payload | |
enableTransferMobileNotification | bool | ✓ | false | Forwarding to mobile push notifications when the user to be notified is offline | |
sound | string | {enableTransferMobileNotification} == true | ~ 256 chars | Name of audio file to be played |
Result
Type | Description | |
---|---|---|
protocol | string | Protocol used for notification |
disconnectByUserId
disconnectByUserId
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;
Disconnect Websocket session with user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
items | WebSocketSession[] | List of Disconnected Websocket session |
disconnectAll
disconnectAll
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
Disconnect all WebSockets
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description |
---|
setFirebaseToken
setFirebaseToken
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;
Set device token
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
token | string | ✓ | ~ 1024 chars | Device Token for Firebase Cloud Messaging |
Result
Type | Description | |
---|---|---|
item | FirebaseToken | Created Firebase device token |
setFirebaseTokenByUserId
setFirebaseTokenByUserId
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;
Set up a device token by specifying a user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
token | string | ✓ | ~ 1024 chars | Device Token for Firebase Cloud Messaging |
Result
Type | Description | |
---|---|---|
item | FirebaseToken | Created Firebase device token |
getFirebaseToken
getFirebaseToken
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;
Get Firebase device token
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | FirebaseToken | Firebase device token |
getFirebaseTokenByUserId
getFirebaseTokenByUserId
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;
Obtain Firebase device token by specifying user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | FirebaseToken | Firebase device token |
deleteFirebaseToken
deleteFirebaseToken
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;
Delete Firebase device token
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | FirebaseToken | Deleted Firebase device token |
deleteFirebaseTokenByUserId
deleteFirebaseTokenByUserId
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;
Delete Firebase device token with user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | FirebaseToken | Deleted Firebase device token |
sendMobileNotificationByUserId
sendMobileNotificationByUserId
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
Send mobile push notification
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
subject | string | ✓ | ~ 256 chars | Subject | |
payload | string | ✓ | ~ 1024 chars | Payload | |
sound | string | ~ 256 chars | Name of audio file to be played |
Result
Type | Description |
---|