API Reference of GS2-Inbox SDK
Model
Namespace
Namespace
Namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project.
Basically, GS2 services have a layer called namespace, and different namespaces are treated as completely different data spaces, even for the same service.
Therefore, it is necessary to create a namespace before starting to use each service.
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceId | string | | ✓ | | ~ 1024 chars | Namespace GRN |
name | string | | ✓ | | ~ 32 chars | Namespace name |
description | string | | | | ~ 1024 chars | description of Namespace |
isAutomaticDeletingEnabled | bool? | | | | | Automatically delete opened messages |
transactionSetting | TransactionSetting | | | | | Transaction settings |
receiveMessageScript | ScriptSetting | | | | | Script to run when a message is received |
readMessageScript | ScriptSetting | | | | | Script to run when a message is opened |
deleteMessageScript | ScriptSetting | | | | | Script to run when a message is deleted |
receiveNotification | NotificationSetting | | | | | Push notifications when messages are received |
logSetting | LogSetting | | | | | Log output settings |
createdAt | long | | ✓ | | | Datetime of creation |
updatedAt | long | | ✓ | | | Datetime of last update |
queueNamespaceId | string | | | | ~ 1024 chars | Namespace in GS2-JobQueue used to run the stamp sheet |
keyId | string | | | | ~ 1024 chars | GS2-Key namespace used to issue stamp sheets |
revision | long | | | 0 | ~ 9223372036854775805 | Revision |
Message
Message
Message data delivered to a message box prepared for each game player.
Messages have an open status and can also have a stamp sheet attached.
Messages can have an expiration date, and messages that expire are automatically deleted.
| Type | Condition | Require | Default | Limitation | Description |
---|
messageId | string | | ✓ | | ~ 1024 chars | Message GRN |
name | string | | ✓ | UUID | ~ 36 chars | Message Name |
userId | string | | ✓ | | ~ 128 chars | User Id |
metadata | string | | ✓ | | ~ 4096 chars | Metadata corresponding to the content of the message |
isRead | bool | | ✓ | false | | Read |
readAcquireActions | List<AcquireAction> | | | [] | | Obtain actions to be performed upon opening |
receivedAt | long | | ✓ | | | Datetime of creation |
readAt | long | | ✓ | 0 | | Read date and time |
expiresAt | long | | | | | Datetime of ttl |
revision | long | | | 0 | ~ 9223372036854775805 | Revision |
CurrentMessageMaster
Currently available master data
GS2 uses JSON format files for master data management.
By uploading the file, you can actually reflect the settings on the server.
We provide a master data editor on the management console as a way to create JSON files, but you can also create JSON files using the
The service can also be used by creating a tool more appropriate for game management and exporting a JSON file in the appropriate format.
Please refer to the documentation for the format of the JSON file.
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceId | string | | ✓ | | ~ 1024 chars | Currently available global message setting GRN |
settings | string | | ✓ | | ~ 5242880 chars | Master data |
GlobalMessageMaster
Global Message Master
Global messaging is a mechanism for delivering messages to all game players.
Global messages can have an expiration date, and each game player can receive a global message by executing the process of receiving a global message.
Unreceived global messages within the validity period are copied to your message box.
| Type | Condition | Require | Default | Limitation | Description |
---|
globalMessageId | string | | ✓ | | ~ 1024 chars | Message GRN to all users |
name | string | | ✓ | UUID | ~ 64 chars | Name of message for all users |
metadata | string | | ✓ | | ~ 4096 chars | Metadata corresponding to the content of the message to all users |
readAcquireActions | List<AcquireAction> | | | [] | | Obtain actions to be performed upon opening |
expiresTimeSpan | TimeSpan | | | | | Acquisition actions to be performed upon opening |
createdAt | long | | ✓ | | | Datetime of creation |
expiresAt | long | | | | | Message expiration date for all users |
revision | long | | | 0 | ~ 9223372036854775805 | Revision |
GlobalMessage
Global Messages
Global messages are a mechanism for delivering messages to all game players.
Global messages can have an expiration date, and each game player can receive a global message by executing the process of receiving a global message.
Unreceived global messages within the validity period are copied to your message box.
| Type | Condition | Require | Default | Limitation | Description |
---|
globalMessageId | string | | ✓ | | ~ 1024 chars | Message GRN to all users |
name | string | | ✓ | | ~ 128 chars | Name of message for all users |
metadata | string | | ✓ | | ~ 4096 chars | Metadata corresponding to the content of the message to all users |
readAcquireActions | List<AcquireAction> | | | [] | | Acquisition actions to be performed upon opening |
expiresTimeSpan | TimeSpan | | | | | The period of time between receipt of a message and deletion of the message |
expiresAt | long | | | | | Message expiration date for all users |
Received
Global messages you have received
Global messages listed here will no longer be received.
| Type | Condition | Require | Default | Limitation | Description |
---|
receivedId | string | | ✓ | | ~ 1024 chars | Received global message name GRN |
userId | string | | ✓ | | ~ 128 chars | User Id |
receivedGlobalMessageNames | List<string> | | | [] | | Global message name received |
createdAt | long | | ✓ | | | Datetime of creation |
updatedAt | long | | ✓ | | | Datetime of last update |
revision | long | | | 0 | ~ 9223372036854775805 | Revision |
TimeSpan
| Type | Condition | Require | Default | Limitation | Description |
---|
days | int | | ✓ | 0 | ~ 365 | Number of days from current time |
hours | int | | ✓ | 0 | ~ 24 | Hours from current time |
minutes | int | | ✓ | 0 | ~ 60 | Minutes from current time |
AcquireAction
| Type | Condition | Require | Default | Limitation | Description |
---|
action | enum [] | | ✓ | | ~ 128 chars | Types of actions to be performed in the stamp sheet |
request | string | | ✓ | | ~ 1048576 chars | JSON of request |
Config
| Type | Condition | Require | Default | Limitation | Description |
---|
key | string | | ✓ | | ~ 64 chars | Name |
value | string | | | | ~ 51200 chars | Value |
ScriptSetting
| Type | Condition | Require | Default | Limitation | Description |
---|
triggerScriptId | string | | | | ~ 1024 chars | Script GRN |
doneTriggerTargetType | enum [’none’, ‘gs2_script’, ‘aws’] | | ✓ | “none” | ~ 128 chars | Notification of Completion |
doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | | | ~ 1024 chars | Script GRN |
doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | | | ~ 1024 chars | Namespace GRN |
NotificationSetting
| Type | Condition | Require | Default | Limitation | Description |
---|
gatewayNamespaceId | string | | ✓ | | ~ 1024 chars | Namespace GRN |
enableTransferMobileNotification | bool? | | | | | Forwarding to mobile push notification |
sound | string | | | | ~ 1024 chars | Sound file name to be used for mobile push notifications |
GitHubCheckoutSetting
| Type | Condition | Require | Default | Limitation | Description |
---|
apiKeyId | string | | ✓ | | ~ 1024 chars | GitHub API key GRN |
repositoryName | string | | ✓ | | ~ 1024 chars | Repository Name |
sourcePath | string | | ✓ | | ~ 1024 chars | Source code file path |
referenceType | enum [‘commit_hash’, ‘branch’, ’tag’] | | ✓ | | ~ 128 chars | Source of code |
commitHash | string | {referenceType} == “commit_hash” | ✓ | | ~ 1024 chars | Commit hash |
branchName | string | {referenceType} == “branch” | ✓ | | ~ 1024 chars | Branch Name |
tagName | string | {referenceType} == “tag” | ✓ | | ~ 1024 chars | Tag Name |
LogSetting
| Type | Condition | Require | Default | Limitation | Description |
---|
loggingNamespaceId | string | | ✓ | | ~ 1024 chars | Namespace GRN |
TransactionSetting
| Type | Condition | Require | Default | Limitation | Description |
---|
enableAutoRun | bool | | ✓ | false | | Automatically run issued stamp sheets on the server side, or |
distributorNamespaceId | string | {enableAutoRun} | ✓ | | ~ 1024 chars | GS2-Distributor namespace used for stamp sheet execution |
keyId | string | !{enableAutoRun} | | | ~ 1024 chars | GS2-Key encryption key used to sign the stamp sheet |
queueNamespaceId | string | | | | ~ 1024 chars | Namespace in GS2-JobQueue used to run the stamp sheet |
Methods
describeNamespaces
Get list of namespaces
Request
| Type | Condition | 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 | List<Namespace> | List of Namespace |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&inbox.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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.DescribeNamespacesRequest;
import io.gs2.inbox.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.DescribeNamespacesRequest;
using Gs2.Gs2Inbox.Result.DescribeNamespacesResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Inbox.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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2Inbox.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 inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.describe_namespaces(
inbox.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('inbox')
api_result = client.describe_namespaces({
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
createNamespace
Create a new namespace
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
name | string | | ✓ | | ~ 32 chars | Namespace name |
description | string | | | | ~ 1024 chars | description of Namespace |
isAutomaticDeletingEnabled | bool? | | | | | Automatically delete opened messages |
transactionSetting | TransactionSetting | | | | | Transaction settings |
receiveMessageScript | ScriptSetting | | | | | Script to run when a message is received |
readMessageScript | ScriptSetting | | | | | Script to run when a message is opened |
deleteMessageScript | ScriptSetting | | | | | Script to run when a message is deleted |
receiveNotification | NotificationSetting | | | | | Push notifications when messages are received |
logSetting | LogSetting | | | | | Log output settings |
queueNamespaceId | string | | | | ~ 1024 chars | Namespace in GS2-JobQueue used to run the stamp sheet |
keyId | string | | | | ~ 1024 chars | GS2-Key namespace used to issue stamp sheets |
Result
| Type | Description |
---|
item | Namespace | Namespace created |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&inbox.CreateNamespaceRequest {
Name: pointy.String("namespace1"),
Description: nil,
IsAutomaticDeletingEnabled: nil,
TransactionSetting: &inbox.TransactionSetting{
EnableAutoRun: pointy.Bool(false),
QueueNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"),
KeyId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001"),
},
ReceiveMessageScript: nil,
ReadMessageScript: nil,
DeleteMessageScript: nil,
ReceiveNotification: nil,
LogSetting: &inbox.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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\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)
->withIsAutomaticDeletingEnabled(null)
->withTransactionSetting((new \Gs2\Inbox\Model\TransactionSetting())
->withEnableAutoRun(False)
->withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
->withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:\namespace1:key:key-0001"))
->withReceiveMessageScript(null)
->withReadMessageScript(null)
->withDeleteMessageScript(null)
->withReceiveNotification(null)
->withLogSetting((new \Gs2\Inbox\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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.CreateNamespaceRequest;
import io.gs2.inbox.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withIsAutomaticDeletingEnabled(null)
.withTransactionSetting(new io.gs2.inbox.model.TransactionSetting()
.withEnableAutoRun(false)
.withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
.withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001"))
.withReceiveMessageScript(null)
.withReadMessageScript(null)
.withDeleteMessageScript(null)
.withReceiveNotification(null)
.withLogSetting(new io.gs2.inbox.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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.CreateNamespaceRequest;
using Gs2.Gs2Inbox.Result.CreateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Inbox.Request.CreateNamespaceRequest()
.WithName("namespace1")
.WithDescription(null)
.WithIsAutomaticDeletingEnabled(null)
.WithTransactionSetting(new Gs2.Gs2Inbox.Model.TransactionSetting()
.WithEnableAutoRun(false)
.WithQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
.WithKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001"))
.WithReceiveMessageScript(null)
.WithReadMessageScript(null)
.WithDeleteMessageScript(null)
.WithReceiveNotification(null)
.WithLogSetting(new Gs2.Gs2Inbox.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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.createNamespace(
new Gs2Inbox.CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withIsAutomaticDeletingEnabled(null)
.withTransactionSetting(new Gs2Inbox.model.TransactionSetting()
.withEnableAutoRun(false)
.withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
.withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001"))
.withReceiveMessageScript(null)
.withReadMessageScript(null)
.withDeleteMessageScript(null)
.withReceiveNotification(null)
.withLogSetting(new Gs2Inbox.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 inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.create_namespace(
inbox.CreateNamespaceRequest()
.with_name(self.hash1)
.with_description(None)
.with_is_automatic_deleting_enabled(None)
.with_transaction_setting(
inbox.TransactionSetting()
.with_enable_auto_run(False)
.with_queue_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001')
.with_key_id('grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001'))
.with_receive_message_script(None)
.with_read_message_script(None)
.with_delete_message_script(None)
.with_receive_notification(None)
.with_log_setting(
inbox.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('inbox')
api_result = client.create_namespace({
name='namespace1',
description=nil,
isAutomaticDeletingEnabled=nil,
transactionSetting={
enableAutoRun=false,
queueNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001',
keyId='grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0001',
},
receiveMessageScript=nil,
readMessageScript=nil,
deleteMessageScript=nil,
receiveNotification=nil,
logSetting={
loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getNamespaceStatus
Get namespace status
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
Result
| Type | Description |
---|
status | string | |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&inbox.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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.GetNamespaceStatusRequest;
import io.gs2.inbox.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Inbox.Result.GetNamespaceStatusResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Inbox.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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2Inbox.GetNamespaceStatusRequest()
.withNamespaceName("namespace1")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.get_namespace_status(
inbox.GetNamespaceStatusRequest()
.with_namespace_name(self.hash1)
)
status = result.status
except core.Gs2Exception as e:
exit(1)
client = gs2('inbox')
api_result = client.get_namespace_status({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
status = result.status;
getNamespace
Get namespace
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&inbox.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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.GetNamespaceRequest;
import io.gs2.inbox.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.GetNamespaceRequest;
using Gs2.Gs2Inbox.Result.GetNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Inbox.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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.getNamespace(
new Gs2Inbox.GetNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.get_namespace(
inbox.GetNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inbox')
api_result = client.get_namespace({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateNamespace
Update namespace
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
description | string | | | | ~ 1024 chars | description of Namespace |
isAutomaticDeletingEnabled | bool? | | | | | Automatically delete opened messages |
transactionSetting | TransactionSetting | | | | | Transaction settings |
receiveMessageScript | ScriptSetting | | | | | Script to run when a message is received |
readMessageScript | ScriptSetting | | | | | Script to run when a message is opened |
deleteMessageScript | ScriptSetting | | | | | Script to run when a message is deleted |
receiveNotification | NotificationSetting | | | | | Push notifications when messages are received |
logSetting | LogSetting | | | | | Log output settings |
queueNamespaceId | string | | | | ~ 1024 chars | Namespace in GS2-JobQueue used to run the stamp sheet |
keyId | string | | | | ~ 1024 chars | GS2-Key namespace used to issue stamp sheets |
Result
| Type | Description |
---|
item | Namespace | Updated namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&inbox.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
Description: pointy.String("description1"),
IsAutomaticDeletingEnabled: pointy.Bool(false),
TransactionSetting: &inbox.TransactionSetting{
EnableAutoRun: pointy.Bool(false),
QueueNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002"),
KeyId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002"),
},
ReceiveMessageScript: &inbox.ScriptSetting{
TriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1001"),
DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002"),
},
ReadMessageScript: &inbox.ScriptSetting{
TriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003"),
DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1004"),
},
DeleteMessageScript: &inbox.ScriptSetting{
TriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1005"),
DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1006"),
},
ReceiveNotification: nil,
LogSetting: &inbox.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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\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")
->withIsAutomaticDeletingEnabled(False)
->withTransactionSetting((new \Gs2\Inbox\Model\TransactionSetting())
->withEnableAutoRun(False)
->withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
->withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:\namespace1:key:key-0002"))
->withReceiveMessageScript((new \Gs2\Inbox\Model\ScriptSetting())
->withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:\namespace1:script:script-1001")
->withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:\namespace1:script:script-1002"))
->withReadMessageScript((new \Gs2\Inbox\Model\ScriptSetting())
->withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:\namespace1:script:script-1003")
->withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:\namespace1:script:script-1004"))
->withDeleteMessageScript((new \Gs2\Inbox\Model\ScriptSetting())
->withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:\namespace1:script:script-1005")
->withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:\namespace1:script:script-1006"))
->withReceiveNotification(null)
->withLogSetting((new \Gs2\Inbox\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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.UpdateNamespaceRequest;
import io.gs2.inbox.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withIsAutomaticDeletingEnabled(false)
.withTransactionSetting(new io.gs2.inbox.model.TransactionSetting()
.withEnableAutoRun(false)
.withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
.withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002"))
.withReceiveMessageScript(new io.gs2.inbox.model.ScriptSetting()
.withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1001")
.withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002"))
.withReadMessageScript(new io.gs2.inbox.model.ScriptSetting()
.withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003")
.withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1004"))
.withDeleteMessageScript(new io.gs2.inbox.model.ScriptSetting()
.withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1005")
.withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1006"))
.withReceiveNotification(null)
.withLogSetting(new io.gs2.inbox.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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.UpdateNamespaceRequest;
using Gs2.Gs2Inbox.Result.UpdateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Inbox.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace1")
.WithDescription("description1")
.WithIsAutomaticDeletingEnabled(false)
.WithTransactionSetting(new Gs2.Gs2Inbox.Model.TransactionSetting()
.WithEnableAutoRun(false)
.WithQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
.WithKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002"))
.WithReceiveMessageScript(new Gs2.Gs2Inbox.Model.ScriptSetting()
.WithTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1001")
.WithDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002"))
.WithReadMessageScript(new Gs2.Gs2Inbox.Model.ScriptSetting()
.WithTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003")
.WithDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1004"))
.WithDeleteMessageScript(new Gs2.Gs2Inbox.Model.ScriptSetting()
.WithTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1005")
.WithDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1006"))
.WithReceiveNotification(null)
.WithLogSetting(new Gs2.Gs2Inbox.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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2Inbox.UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withIsAutomaticDeletingEnabled(false)
.withTransactionSetting(new Gs2Inbox.model.TransactionSetting()
.withEnableAutoRun(false)
.withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002")
.withKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002"))
.withReceiveMessageScript(new Gs2Inbox.model.ScriptSetting()
.withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1001")
.withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002"))
.withReadMessageScript(new Gs2Inbox.model.ScriptSetting()
.withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003")
.withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1004"))
.withDeleteMessageScript(new Gs2Inbox.model.ScriptSetting()
.withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1005")
.withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1006"))
.withReceiveNotification(null)
.withLogSetting(new Gs2Inbox.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 inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.update_namespace(
inbox.UpdateNamespaceRequest()
.with_namespace_name(self.hash1)
.with_description('description1')
.with_is_automatic_deleting_enabled(False)
.with_transaction_setting(
inbox.TransactionSetting()
.with_enable_auto_run(False)
.with_queue_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002')
.with_key_id('grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002'))
.with_receive_message_script(
inbox.ScriptSetting()
.with_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1001')
.with_done_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002'))
.with_read_message_script(
inbox.ScriptSetting()
.with_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003')
.with_done_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1004'))
.with_delete_message_script(
inbox.ScriptSetting()
.with_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1005')
.with_done_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1006'))
.with_receive_notification(None)
.with_log_setting(
inbox.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('inbox')
api_result = client.update_namespace({
namespaceName='namespace1',
description='description1',
isAutomaticDeletingEnabled=false,
transactionSetting={
enableAutoRun=false,
queueNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002',
keyId='grn:gs2:ap-northeast-1:YourOwnerId:key:namespace1:key:key-0002',
},
receiveMessageScript={
triggerScriptId='grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1001',
doneTriggerScriptId='grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002',
},
readMessageScript={
triggerScriptId='grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003',
doneTriggerScriptId='grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1004',
},
deleteMessageScript={
triggerScriptId='grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1005',
doneTriggerScriptId='grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1006',
},
receiveNotification=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;
deleteNamespace
Delete namespace
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
Result
| Type | Description |
---|
item | Namespace | Deleted namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&inbox.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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.DeleteNamespaceRequest;
import io.gs2.inbox.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.DeleteNamespaceRequest;
using Gs2.Gs2Inbox.Result.DeleteNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Inbox.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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2Inbox.DeleteNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.delete_namespace(
inbox.DeleteNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inbox')
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;
describeMessages
Get list of messages
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | | ✓ | | ~ 128 chars | User Id |
isRead | bool? | | | | | Read |
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 | List<Message> | List of Message |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.DescribeMessages(
&inbox.DescribeMessagesRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("$access_token_0001"),
IsRead: nil,
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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\Request\DescribeMessagesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeMessages(
(new DescribeMessagesRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withIsRead(null)
->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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.DescribeMessagesRequest;
import io.gs2.inbox.result.DescribeMessagesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(session);
try {
DescribeMessagesResult result = client.describeMessages(
new DescribeMessagesRequest()
.withNamespaceName("namespace1")
.withAccessToken("$access_token_0001")
.withIsRead(null)
.withPageToken(null)
.withLimit(null)
);
List<Message> 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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.DescribeMessagesRequest;
using Gs2.Gs2Inbox.Result.DescribeMessagesResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.DescribeMessagesResult> asyncResult = null;
yield return client.DescribeMessages(
new Gs2.Gs2Inbox.Request.DescribeMessagesRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("$access_token_0001")
.WithIsRead(null)
.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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.describeMessages(
new Gs2Inbox.DescribeMessagesRequest()
.withNamespaceName("namespace1")
.withAccessToken("$access_token_0001")
.withIsRead(null)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.describe_messages(
inbox.DescribeMessagesRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_is_read(None)
.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('inbox')
api_result = client.describe_messages({
namespaceName='namespace1',
accessToken='$access_token_0001',
isRead=nil,
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;
describeMessagesByUserId
Get list of messages by specifying user ID
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
userId | string | | ✓ | | ~ 128 chars | User Id |
isRead | bool? | | | | | Read |
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 | List<Message> | List of Message |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.DescribeMessagesByUserId(
&inbox.DescribeMessagesByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
IsRead: nil,
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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\Request\DescribeMessagesByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeMessagesByUserId(
(new DescribeMessagesByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withIsRead(null)
->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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.DescribeMessagesByUserIdRequest;
import io.gs2.inbox.result.DescribeMessagesByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(session);
try {
DescribeMessagesByUserIdResult result = client.describeMessagesByUserId(
new DescribeMessagesByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withIsRead(null)
.withPageToken(null)
.withLimit(null)
);
List<Message> 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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.DescribeMessagesByUserIdRequest;
using Gs2.Gs2Inbox.Result.DescribeMessagesByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.DescribeMessagesByUserIdResult> asyncResult = null;
yield return client.DescribeMessagesByUserId(
new Gs2.Gs2Inbox.Request.DescribeMessagesByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithIsRead(null)
.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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.describeMessagesByUserId(
new Gs2Inbox.DescribeMessagesByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withIsRead(null)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.describe_messages_by_user_id(
inbox.DescribeMessagesByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_is_read(None)
.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('inbox')
api_result = client.describe_messages_by_user_id({
namespaceName='namespace1',
userId='user-0001',
isRead=nil,
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;
sendMessageByUserId
Create a new message
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
userId | string | | ✓ | | ~ 128 chars | User Id |
metadata | string | | ✓ | | ~ 4096 chars | Metadata corresponding to the content of the message |
readAcquireActions | List<AcquireAction> | | | [] | | Obtain actions to be performed upon opening |
expiresAt | long | | | | | Datetime of ttl |
expiresTimeSpan | TimeSpan | | | | | Difference up to the expiration date of the message |
Result
| Type | Description |
---|
item | Message | Created Message |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.SendMessageByUserId(
&inbox.SendMessageByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
Metadata: pointy.String("{\"type\": \"message\", \"body\": \"hello\"}"),
ReadAcquireActions: nil,
ExpiresAt: nil,
ExpiresTimeSpan: 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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\Request\SendMessageByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->sendMessageByUserId(
(new SendMessageByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withMetadata("{\"type\": \"message\", \"body\": \"hello\"}")
->withReadAcquireActions(null)
->withExpiresAt(null)
->withExpiresTimeSpan(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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.SendMessageByUserIdRequest;
import io.gs2.inbox.result.SendMessageByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(session);
try {
SendMessageByUserIdResult result = client.sendMessageByUserId(
new SendMessageByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withMetadata("{\"type\": \"message\", \"body\": \"hello\"}")
.withReadAcquireActions(null)
.withExpiresAt(null)
.withExpiresTimeSpan(null)
);
Message 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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.SendMessageByUserIdRequest;
using Gs2.Gs2Inbox.Result.SendMessageByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.SendMessageByUserIdResult> asyncResult = null;
yield return client.SendMessageByUserId(
new Gs2.Gs2Inbox.Request.SendMessageByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithMetadata("{\"type\": \"message\", \"body\": \"hello\"}")
.WithReadAcquireActions(null)
.WithExpiresAt(null)
.WithExpiresTimeSpan(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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.sendMessageByUserId(
new Gs2Inbox.SendMessageByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withMetadata("{\"type\": \"message\", \"body\": \"hello\"}")
.withReadAcquireActions(null)
.withExpiresAt(null)
.withExpiresTimeSpan(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.send_message_by_user_id(
inbox.SendMessageByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_metadata('{"type": "message", "body": "hello"}')
.with_read_acquire_actions(None)
.with_expires_at(None)
.with_expires_time_span(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inbox')
api_result = client.send_message_by_user_id({
namespaceName='namespace1',
userId='user-0001',
metadata='{"type": "message", "body": "hello"}',
readAcquireActions=nil,
expiresAt=nil,
expiresTimeSpan=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getMessage
Get Message
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | | ✓ | | ~ 128 chars | User Id |
messageName | string | | ✓ | UUID | ~ 36 chars | Message Name |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.GetMessage(
&inbox.GetMessageRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("$access_token_0001"),
MessageName: pointy.String("$message1.name"),
}
)
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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\Request\GetMessageRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getMessage(
(new GetMessageRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withMessageName(self::$message1.name)
);
$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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.GetMessageRequest;
import io.gs2.inbox.result.GetMessageResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(session);
try {
GetMessageResult result = client.getMessage(
new GetMessageRequest()
.withNamespaceName("namespace1")
.withAccessToken("$access_token_0001")
.withMessageName("$message1.name")
);
Message 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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.GetMessageRequest;
using Gs2.Gs2Inbox.Result.GetMessageResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.GetMessageResult> asyncResult = null;
yield return client.GetMessage(
new Gs2.Gs2Inbox.Request.GetMessageRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("$access_token_0001")
.WithMessageName("$message1.name"),
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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.getMessage(
new Gs2Inbox.GetMessageRequest()
.withNamespaceName("namespace1")
.withAccessToken("$access_token_0001")
.withMessageName("$message1.name")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.get_message(
inbox.GetMessageRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_message_name(self.message1.name)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inbox')
api_result = client.get_message({
namespaceName='namespace1',
accessToken='$access_token_0001',
messageName='$message1.name',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getMessageByUserId
Get message by specifying user ID
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
userId | string | | ✓ | | ~ 128 chars | User Id |
messageName | string | | ✓ | UUID | ~ 36 chars | Message Name |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.GetMessageByUserId(
&inbox.GetMessageByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
MessageName: pointy.String("message-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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\Request\GetMessageByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getMessageByUserId(
(new GetMessageByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withMessageName("message-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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.GetMessageByUserIdRequest;
import io.gs2.inbox.result.GetMessageByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(session);
try {
GetMessageByUserIdResult result = client.getMessageByUserId(
new GetMessageByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withMessageName("message-0001")
);
Message 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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.GetMessageByUserIdRequest;
using Gs2.Gs2Inbox.Result.GetMessageByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.GetMessageByUserIdResult> asyncResult = null;
yield return client.GetMessageByUserId(
new Gs2.Gs2Inbox.Request.GetMessageByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithMessageName("message-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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.getMessageByUserId(
new Gs2Inbox.GetMessageByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withMessageName("message-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.get_message_by_user_id(
inbox.GetMessageByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_message_name('message-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inbox')
api_result = client.get_message_by_user_id({
namespaceName='namespace1',
userId='user-0001',
messageName='message-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
receiveGlobalMessage
Receive global messages that have not yet been received
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | | ✓ | | ~ 128 chars | User Id |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.ReceiveGlobalMessage(
&inbox.ReceiveGlobalMessageRequest {
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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\Request\ReceiveGlobalMessageRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->receiveGlobalMessage(
(new ReceiveGlobalMessageRequest())
->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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.ReceiveGlobalMessageRequest;
import io.gs2.inbox.result.ReceiveGlobalMessageResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(session);
try {
ReceiveGlobalMessageResult result = client.receiveGlobalMessage(
new ReceiveGlobalMessageRequest()
.withNamespaceName("namespace1")
.withAccessToken("$access_token_0001")
);
List<Message> 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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.ReceiveGlobalMessageRequest;
using Gs2.Gs2Inbox.Result.ReceiveGlobalMessageResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.ReceiveGlobalMessageResult> asyncResult = null;
yield return client.ReceiveGlobalMessage(
new Gs2.Gs2Inbox.Request.ReceiveGlobalMessageRequest()
.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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.receiveGlobalMessage(
new Gs2Inbox.ReceiveGlobalMessageRequest()
.withNamespaceName("namespace1")
.withAccessToken("$access_token_0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.receive_global_message(
inbox.ReceiveGlobalMessageRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inbox')
api_result = client.receive_global_message({
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;
receiveGlobalMessageByUserId
Receive global messages that have not yet been received by specifying the user ID
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
userId | string | | ✓ | | ~ 128 chars | User Id |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.ReceiveGlobalMessageByUserId(
&inbox.ReceiveGlobalMessageByUserIdRequest {
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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\Request\ReceiveGlobalMessageByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->receiveGlobalMessageByUserId(
(new ReceiveGlobalMessageByUserIdRequest())
->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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.ReceiveGlobalMessageByUserIdRequest;
import io.gs2.inbox.result.ReceiveGlobalMessageByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(session);
try {
ReceiveGlobalMessageByUserIdResult result = client.receiveGlobalMessageByUserId(
new ReceiveGlobalMessageByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
);
List<Message> 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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.ReceiveGlobalMessageByUserIdRequest;
using Gs2.Gs2Inbox.Result.ReceiveGlobalMessageByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.ReceiveGlobalMessageByUserIdResult> asyncResult = null;
yield return client.ReceiveGlobalMessageByUserId(
new Gs2.Gs2Inbox.Request.ReceiveGlobalMessageByUserIdRequest()
.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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.receiveGlobalMessageByUserId(
new Gs2Inbox.ReceiveGlobalMessageByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.receive_global_message_by_user_id(
inbox.ReceiveGlobalMessageByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inbox')
api_result = client.receive_global_message_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;
openMessage
Marking messages as opened
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | | ✓ | | ~ 128 chars | User Id |
messageName | string | | ✓ | UUID | ~ 36 chars | Message Name |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.OpenMessage(
&inbox.OpenMessageRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("$access_token_0001"),
MessageName: pointy.String("message-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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\Request\OpenMessageRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->openMessage(
(new OpenMessageRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withMessageName("message-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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.OpenMessageRequest;
import io.gs2.inbox.result.OpenMessageResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(session);
try {
OpenMessageResult result = client.openMessage(
new OpenMessageRequest()
.withNamespaceName("namespace1")
.withAccessToken("$access_token_0001")
.withMessageName("message-0001")
);
Message 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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.OpenMessageRequest;
using Gs2.Gs2Inbox.Result.OpenMessageResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.OpenMessageResult> asyncResult = null;
yield return client.OpenMessage(
new Gs2.Gs2Inbox.Request.OpenMessageRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("$access_token_0001")
.WithMessageName("message-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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.openMessage(
new Gs2Inbox.OpenMessageRequest()
.withNamespaceName("namespace1")
.withAccessToken("$access_token_0001")
.withMessageName("message-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.open_message(
inbox.OpenMessageRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_message_name('message-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inbox')
api_result = client.open_message({
namespaceName='namespace1',
accessToken='$access_token_0001',
messageName='message-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
openMessageByUserId
Open message with user ID
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
userId | string | | ✓ | | ~ 128 chars | User Id |
messageName | string | | ✓ | UUID | ~ 36 chars | Message Name |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.OpenMessageByUserId(
&inbox.OpenMessageByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
MessageName: pointy.String("$message1.name"),
}
)
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\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\Request\OpenMessageByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->openMessageByUserId(
(new OpenMessageByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withMessageName(self::$message1.name)
);
$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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.OpenMessageByUserIdRequest;
import io.gs2.inbox.result.OpenMessageByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(session);
try {
OpenMessageByUserIdResult result = client.openMessageByUserId(
new OpenMessageByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withMessageName("$message1.name")
);
Message 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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.OpenMessageByUserIdRequest;
using Gs2.Gs2Inbox.Result.OpenMessageByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.OpenMessageByUserIdResult> asyncResult = null;
yield return client.OpenMessageByUserId(
new Gs2.Gs2Inbox.Request.OpenMessageByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithMessageName("$message1.name"),
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 Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.openMessageByUserId(
new Gs2Inbox.OpenMessageByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withMessageName("$message1.name")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.open_message_by_user_id(
inbox.OpenMessageByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_message_name(self.message1.name)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('inbox')
api_result = client.open_message_by_user_id({
namespaceName='namespace1',
userId='user-0001',
messageName='$message1.name',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
readMessage
Read message
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | | ✓ | | ~ 128 chars | User Id |
messageName | string | | ✓ | UUID | ~ 36 chars | Message Name |
config | List<Config> | | | [] | | Set values to be applied to stamp sheet variables |
Result
| Type | Description |
---|
item | Message | Message |
transactionId | string | Transaction ID of the stamp sheet issued |
stampSheet | string | Stamp sheet |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool? | Is stamp sheet auto-execution enabled? |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.ReadMessage(
&inbox.ReadMessageRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("$access_token_0001"),
MessageName: pointy.String("message-0001"),
Config: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\Request\ReadMessageRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->readMessage(
(new ReadMessageRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withMessageName("message-0001")
->withConfig(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
} 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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.ReadMessageRequest;
import io.gs2.inbox.result.ReadMessageResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2InboxRestClient client = new Gs2InboxRestClient(session);
try {
ReadMessageResult result = client.readMessage(
new ReadMessageRequest()
.withNamespaceName("namespace1")
.withAccessToken("$access_token_0001")
.withMessageName("message-0001")
.withConfig(null)
);
Message item = result.getItem();
String transactionId = result.getTransactionId();
String stampSheet = result.getStampSheet();
String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
boolean autoRunStampSheet = result.getAutoRunStampSheet();
} 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.Gs2Inbox.Gs2InboxRestClient;
using Gs2.Gs2Inbox.Request.ReadMessageRequest;
using Gs2.Gs2Inbox.Result.ReadMessageResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2InboxRestClient(session);
AsyncResult<Gs2.Gs2Inbox.Result.ReadMessageResult> asyncResult = null;
yield return client.ReadMessage(
new Gs2.Gs2Inbox.Request.ReadMessageRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("$access_token_0001")
.WithMessageName("message-0001")
.WithConfig(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var transactionId = result.TransactionId;
var stampSheet = result.StampSheet;
var stampSheetEncryptionKeyId = result.StampSheetEncryptionKeyId;
var autoRunStampSheet = result.AutoRunStampSheet;
import Gs2Core from '@/gs2/core';
import * as Gs2Inbox from '@/gs2/inbox';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Inbox.Gs2InboxRestClient(session);
try {
const result = await client.readMessage(
new Gs2Inbox.ReadMessageRequest()
.withNamespaceName("namespace1")
.withAccessToken("$access_token_0001")
.withMessageName("message-0001")
.withConfig(null)
);
const item = result.getItem();
const transactionId = result.getTransactionId();
const stampSheet = result.getStampSheet();
const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
const autoRunStampSheet = result.getAutoRunStampSheet();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import inbox
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = inbox.Gs2InboxRestClient(session)
try:
result = client.read_message(
inbox.ReadMessageRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_message_name('message-0001')
.with_config(None)
)
item = result.item
transaction_id = result.transaction_id
stamp_sheet = result.stamp_sheet
stamp_sheet_encryption_key_id = result.stamp_sheet_encryption_key_id
auto_run_stamp_sheet = result.auto_run_stamp_sheet
except core.Gs2Exception as e:
exit(1)
client = gs2('inbox')
api_result = client.read_message({
namespaceName='namespace1',
accessToken='$access_token_0001',
messageName='message-0001',
config=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
readMessageByUserId
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
userId | string | | ✓ | | ~ 128 chars | User Id |
messageName | string | | ✓ | UUID | ~ 36 chars | Message Name |
config | List<Config> | | | [] | | Set values to be applied to stamp sheet variables |
Result
| Type | Description |
---|
item | Message | Message |
transactionId | string | Transaction ID of the stamp sheet issued |
stampSheet | string | Stamp sheet |
stampSheetEncryptionKeyId | string | Cryptographic key GRN used for stamp sheet signature calculations |
autoRunStampSheet | bool? | Is stamp sheet auto-execution enabled? |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
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 := inbox.Gs2InboxRestClient{
Session: &session,
}
result, err := client.ReadMessageByUserId(
&inbox.ReadMessageByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
MessageName: pointy.String("message-0001"),
Config: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\Request\ReadMessageByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->readMessageByUserId(
(new ReadMessageByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withMessageName("message-0001")
->withConfig(null)
);
$item = $result->getItem();
$transactionId = $result->getTransactionId();
$stampSheet = $result->getStampSheet();
$stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
$autoRunStampSheet = $result->getAutoRunStampSheet();
} 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.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.ReadMessageByUserIdRequest;
import io.gs2.inbox.result.ReadMessageByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Cr