GS2-Inbox SDK API リファレンス モデル Namespace ネームスペース
ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。 GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
型 有効化条件 必須 デフォルト 値の制限 説明 namespaceId string ✓ ~ 1024文字 ネームスペースGRN name string ✓ ~ 128文字 ネームスペース名 description string ~ 1024文字 説明文 isAutomaticDeletingEnabled bool ✓ false 開封したメッセージを自動的に削除するか transactionSetting TransactionSetting トランザクション設定 receiveMessageScript ScriptSetting メッセージ受信したときに実行するスクリプト readMessageScript ScriptSetting メッセージ開封したときに実行するスクリプト deleteMessageScript ScriptSetting メッセージ削除したときに実行するスクリプト receiveNotification NotificationSetting メッセージを受信したときのプッシュ通知 logSetting LogSetting ログの出力設定 createdAt long ✓ 現在時刻 作成日時 (UNIX時間 単位:ミリ秒) updatedAt long ✓ 現在時刻 最終更新日時 (UNIX時間 単位:ミリ秒) revision long 0 ~ 9223372036854775805 リビジョン
Message メッセージ
ゲームプレイヤー毎に用意されるメッセージボックスに届けられたメッセージデータ。
メッセージには開封状態がある他、開封時に実行する入手アクションを設定することができます。 メッセージには有効期限を設定でき、有効期限が切れたメッセージは、未読状態、開封後の既読状態にかかわらず、自動的に削除されます。 添付された報酬を受け取っていない場合でも削除されます。
型 有効化条件 必須 デフォルト 値の制限 説明 messageId string ✓ ~ 1024文字 メッセージGRN name string ✓ UUID ~ 36文字 メッセージ名 userId string ✓ ~ 128文字 ユーザーID metadata string ✓ ~ 4096文字 メッセージの内容に相当するメタデータ isRead bool ✓ false 既読状態 readAcquireActions List<AcquireAction> [] ~ 100 items 開封時に実行する入手アクション receivedAt long ✓ 現在時刻 作成日時 (UNIX時間 単位:ミリ秒) readAt long ✓ 0 開封日時 (UNIX時間 単位:ミリ秒) expiresAt long 有効期限日時 (UNIX時間 単位:ミリ秒) revision long 0 ~ 9223372036854775805 リビジョン
CurrentMessageMaster 現在有効なマスターデータ
GS2ではマスターデータの管理にJSON形式のファイルを使用します。 ファイルをアップロードすることで、実際にサーバーに設定を反映することができます。
JSONファイルを作成する方法として、マネージメントコンソール上でのマスターデータエディタを提供していますが よりゲームの運営に相応しいツールを作成し、適切なフォーマットのJSONファイルを書き出すことでもサービスを利用可能です。
型 有効化条件 必須 デフォルト 値の制限 説明 namespaceId string ✓ ~ 1024文字 現在有効なグローバルメッセージ設定GRN settings string ✓ ~ 5242880文字 マスターデータ
GlobalMessageMaster グローバルメッセージマスター
グローバルメッセージはゲームプレイヤー全体にメッセージを届ける仕組みです。
グローバルメッセージには有効期間を設定でき、各ゲームプレイヤーはグローバルメッセージを受信する処理を実行することで 有効期間内のグローバルメッセージの中で未受信のメッセージを自分のメッセージボックスにコピーします。
型 有効化条件 必須 デフォルト 値の制限 説明 globalMessageId string ✓ ~ 1024文字 全ユーザに向けたメッセージGRN name string ✓ UUID ~ 64文字 全ユーザに向けたメッセージ名 metadata string ✓ ~ 4096文字 全ユーザに向けたメッセージの内容に相当するメタデータ readAcquireActions List<AcquireAction> [] ~ 100 items 開封時に実行する入手アクション expiresTimeSpan TimeSpan メッセージを受信したあとメッセージが削除されるまでの期間 messageReceptionPeriodEventId string ~ 1024文字 メッセージを受信可能な期間を設定した GS2-Schedule イベントGRN createdAt long ✓ 現在時刻 作成日時 (UNIX時間 単位:ミリ秒) revision long 0 ~ 9223372036854775805 リビジョン
GlobalMessage グローバルメッセージ
グローバルメッセージはゲームプレイヤー全体にメッセージを届ける仕組みです。
グローバルメッセージには有効期間を設定でき、各ゲームプレイヤーはグローバルメッセージを受信する処理を実行することで 有効期間内のグローバルメッセージの中で未受信のメッセージを自分のメッセージボックスにコピーします。
型 有効化条件 必須 デフォルト 値の制限 説明 globalMessageId string ✓ ~ 1024文字 全ユーザに向けたメッセージGRN name string ✓ ~ 128文字 全ユーザに向けたメッセージ名 metadata string ✓ ~ 4096文字 全ユーザに向けたメッセージの内容に相当するメタデータ readAcquireActions List<AcquireAction> [] ~ 100 items 開封時に実行する入手アクション expiresTimeSpan TimeSpan メッセージを受信したあとメッセージが削除されるまでの期間 messageReceptionPeriodEventId string ~ 1024文字 メッセージを受信可能な期間を設定した GS2-Schedule イベントGRN
Received 受信したことのあるグローバルメッセージ
ここに記載されているグローバルメッセージは受信できなくなります。
型 有効化条件 必須 デフォルト 値の制限 説明 receivedId string ✓ ~ 1024文字 受信済みグローバルメッセージ名GRN userId string ✓ ~ 128文字 ユーザーID receivedGlobalMessageNames List<string> [] ~ 100 items 受信したグローバルメッセージ名 createdAt long ✓ 現在時刻 作成日時 (UNIX時間 単位:ミリ秒) updatedAt long ✓ 現在時刻 最終更新日時 (UNIX時間 単位:ミリ秒) revision long 0 ~ 9223372036854775805 リビジョン
TimeSpan 時間間隔
型 有効化条件 必須 デフォルト 値の制限 説明 days int ✓ 0 ~ 365 現在時刻からの日数 hours int ✓ 0 ~ 24 現在時刻からの時間 minutes int ✓ 0 ~ 60 現在時刻からの分
AcquireAction 入手アクション
型 有効化条件 必須 デフォルト 値の制限 説明 action enum {"Gs2AdReward:AcquirePointByUserId" ,"Gs2Dictionary:AddEntriesByUserId" ,"Gs2Enchant:ReDrawBalanceParameterStatusByUserId" ,"Gs2Enchant:SetBalanceParameterStatusByUserId" ,"Gs2Enchant:ReDrawRarityParameterStatusByUserId" ,"Gs2Enchant:AddRarityParameterStatusByUserId" ,"Gs2Enchant:SetRarityParameterStatusByUserId" ,"Gs2Enhance:DirectEnhanceByUserId" ,"Gs2Enhance:UnleashByUserId" ,"Gs2Enhance:CreateProgressByUserId" ,"Gs2Exchange:ExchangeByUserId" ,"Gs2Exchange:IncrementalExchangeByUserId" ,"Gs2Exchange:CreateAwaitByUserId" ,"Gs2Exchange:AcquireForceByUserId" ,"Gs2Exchange:SkipByUserId" ,"Gs2Experience:AddExperienceByUserId" ,"Gs2Experience:SetExperienceByUserId" ,"Gs2Experience:AddRankCapByUserId" ,"Gs2Experience:SetRankCapByUserId" ,"Gs2Experience:MultiplyAcquireActionsByUserId" ,"Gs2Formation:AddMoldCapacityByUserId" ,"Gs2Formation:SetMoldCapacityByUserId" ,"Gs2Formation:AcquireActionsToFormProperties" ,"Gs2Formation:SetFormByUserId" ,"Gs2Formation:AcquireActionsToPropertyFormProperties" ,"Gs2Friend:UpdateProfileByUserId" ,"Gs2Grade:AddGradeByUserId" ,"Gs2Grade:ApplyRankCapByUserId" ,"Gs2Grade:MultiplyAcquireActionsByUserId" ,"Gs2Guild:IncreaseMaximumCurrentMaximumMemberCountByGuildName" ,"Gs2Guild:SetMaximumCurrentMaximumMemberCountByGuildName" ,"Gs2Idle:IncreaseMaximumIdleMinutesByUserId" ,"Gs2Idle:SetMaximumIdleMinutesByUserId" ,"Gs2Idle:ReceiveByUserId" ,"Gs2Inbox:SendMessageByUserId" ,"Gs2Inventory:AddCapacityByUserId" ,"Gs2Inventory:SetCapacityByUserId" ,"Gs2Inventory:AcquireItemSetByUserId" ,"Gs2Inventory:AcquireItemSetWithGradeByUserId" ,"Gs2Inventory:AddReferenceOfByUserId" ,"Gs2Inventory:DeleteReferenceOfByUserId" ,"Gs2Inventory:AcquireSimpleItemsByUserId" ,"Gs2Inventory:SetSimpleItemsByUserId" ,"Gs2Inventory:AcquireBigItemByUserId" ,"Gs2Inventory:SetBigItemByUserId" ,"Gs2JobQueue:PushByUserId" ,"Gs2Limit:CountDownByUserId" ,"Gs2Limit:DeleteCounterByUserId" ,"Gs2LoginReward:DeleteReceiveStatusByUserId" ,"Gs2LoginReward:UnmarkReceivedByUserId" ,"Gs2Lottery:DrawByUserId" ,"Gs2Lottery:ResetBoxByUserId" ,"Gs2Mission:RevertReceiveByUserId" ,"Gs2Mission:IncreaseCounterByUserId" ,"Gs2Mission:SetCounterByUserId" ,"Gs2Money:DepositByUserId" ,"Gs2Money:RevertRecordReceipt" ,"Gs2Money2:DepositByUserId" ,"Gs2Quest:CreateProgressByUserId" ,"Gs2Schedule:TriggerByUserId" ,"Gs2Script:InvokeScript" ,"Gs2SerialKey:RevertUseByUserId" ,"Gs2SerialKey:IssueOnce" ,"Gs2Showcase:DecrementPurchaseCountByUserId" ,"Gs2Showcase:ForceReDrawByUserId" ,"Gs2SkillTree:MarkReleaseByUserId" ,"Gs2Stamina:RecoverStaminaByUserId" ,"Gs2Stamina:RaiseMaxValueByUserId" ,"Gs2Stamina:SetMaxValueByUserId" ,"Gs2Stamina:SetRecoverIntervalByUserId" ,"Gs2Stamina:SetRecoverValueByUserId" ,"Gs2StateMachine:StartStateMachineByUserId" , } ✓ ~ 128文字 入手アクションで実行するアクションの種類 request string ✓ ~ 1048576文字 リクエストのJSON
Config コンフィグ設定
トランザクションの変数に適用する設定値
型 有効化条件 必須 デフォルト 値の制限 説明 key string ✓ ~ 64文字 名前 value string ~ 51200文字 値
VerifyActionResult 検証アクションの実行結果
型 有効化条件 必須 デフォルト 値の制限 説明 action enum { } ✓ ~ 128文字 検証アクションで実行するアクションの種類 verifyRequest string ✓ ~ 1048576文字 リクエストのJSON statusCode int ~ 999 ステータスコード verifyResult string ~ 1048576文字 結果内容
action に指定する列挙型の定義 ConsumeActionResult 消費アクションの実行結果
型 有効化条件 必須 デフォルト 値の制限 説明 action enum { } ✓ ~ 128文字 消費アクションで実行するアクションの種類 consumeRequest string ✓ ~ 1048576文字 リクエストのJSON statusCode int ~ 999 ステータスコード consumeResult string ~ 1048576文字 結果内容
action に指定する列挙型の定義 AcquireActionResult 入手アクションの実行結果
型 有効化条件 必須 デフォルト 値の制限 説明 action enum { } ✓ ~ 128文字 入手アクションで実行するアクションの種類 acquireRequest string ✓ ~ 1048576文字 リクエストのJSON statusCode int ~ 999 ステータスコード acquireResult string ~ 1048576文字 結果内容
action に指定する列挙型の定義 TransactionResult トランザクション実行結果
サーバーサイドでのトランザクションの自動実行機能を利用して実行されたトランザクションの実行結果
ScriptSetting スクリプト設定
GS2 ではマイクロサービスのイベントに関連づけて、カスタムスクリプトを実行することができます。 このモデルは、スクリプトの実行をトリガーするための設定を保持します。
スクリプトの実行方式は大きく2種類あり、それは「同期実行」と「非同期実行」です。 同期実行は、スクリプトの実行が完了するまで処理がブロックされます。 かわりに、スクリプトの実行結果を使ってAPIの実行を止めたり、APIの結果を改ざんすることができます。
一方、非同期実行は、スクリプトの実行が完了するまで処理がブロックされません。 かわりに、スクリプトの実行結果を使ってAPIの実行を止めたり、APIの結果を改ざんすることはできません。 しかし、非同期実行は、スクリプトの実行が完了するまで処理がブロックされないため、APIの応答に影響を与えないため、原則非同期実行を使用することをおすすめします。
非同期実行には実行方式が2種類あり、GS2-Script と Amazon EventBridge があります。 Amazon EventBridge を使用することで、Lua 以外の言語で処理を記述することができます。
型 有効化条件 必須 デフォルト 値の制限 説明 triggerScriptId string ~ 1024文字 スクリプトGRN doneTriggerTargetType enum { “none”, “gs2_script”, “aws” } ✓ “none” ~ 128文字 完了通知の通知先 doneTriggerScriptId string {doneTriggerTargetType} == “gs2_script” ~ 1024文字 スクリプトGRN doneTriggerQueueNamespaceId string {doneTriggerTargetType} == “gs2_script” ~ 1024文字 ネームスペースGRN
doneTriggerTargetType に指定する列挙型の定義 定義 説明 none なし gs2_script GS2-Script aws Amazon EventBridge
NotificationSetting プッシュ通知に関する設定
GS2 のマイクロサービス内で何らかのイベントが発生した際に、プッシュ通知を送信するための設定です。 ここでいうプッシュ通知は GS2-Gateway の提供する WebSocket インターフェースを経由した処理であり、スマートフォンのプッシュ通知とは性質が異なります。 たとえば、マッチメイキングが完了した時やフレンドリクエストが届いた時など、ゲームクライアントの操作とは関係なく状態が変化した際に GS2-Gateway を経由してプッシュ通知をすることで、ゲームクライアントは状態の変化を検知することができます。
GS2-Gateway のプッシュ通知は通知先のデバイスがオフラインだった時に追加の処理としてモバイルプッシュ通知を送信できます。 モバイルプッシュ通知をうまく利用すれば、マッチメイキング中にゲームを終了しても、モバイルプッシュ通知を使用してプレイヤーに通知し、ゲームに戻ってくるフローを実現できる可能性があります。
型 有効化条件 必須 デフォルト 値の制限 説明 gatewayNamespaceId string ✓ “grn:gs2:{region}:{ownerId}:gateway:default” ~ 1024文字 プッシュ通知に使用する GS2-Gateway のネームスペース enableTransferMobileNotification bool? false モバイルプッシュ通知へ転送するか sound string {enableTransferMobileNotification} == true ~ 1024文字 モバイルプッシュ通知で使用するサウンドファイル名
GitHubCheckoutSetting GitHubからマスターデータをチェックアウトする設定
型 有効化条件 必須 デフォルト 値の制限 説明 apiKeyId string ✓ ~ 1024文字 GitHub のAPIキーGRN repositoryName string ✓ ~ 1024文字 リポジトリ名 sourcePath string ✓ ~ 1024文字 ソースコードのファイルパス referenceType enum { “commit_hash”, “branch”, “tag” } ✓ ~ 128文字 コードの取得元 commitHash string {referenceType} == “commit_hash” ✓ ~ 1024文字 コミットハッシュ branchName string {referenceType} == “branch” ✓ ~ 1024文字 ブランチ名 tagName string {referenceType} == “tag” ✓ ~ 1024文字 タグ名
referenceType に指定する列挙型の定義 定義 説明 commit_hash コミットハッシュ branch ブランチ tag タグ
LogSetting ログの書き出し設定
ログデータの書き出し設定を管理します。この型は、ログデータを書き出すために使用されるログ名前空間の識別子(Namespace ID)を保持します。 ログ名前空間IDは、ログデータを集約し、保存する対象の GS2-Log の名前空間を指定します。 この設定を通じて、この名前空間以下のAPIリクエスト・レスポンスログデータが対象の GS2-Log へ出力されるようになります。 GS2-Log にはリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。
型 有効化条件 必須 デフォルト 値の制限 説明 loggingNamespaceId string ✓ ~ 1024文字 ネームスペースGRN
TransactionSetting トランザクション設定
型 有効化条件 必須 デフォルト 値の制限 説明 enableAutoRun bool ✓ false 発行したトランザクションをサーバーサイドで自動的に実行するか enableAtomicCommit bool {enableAutoRun} == true ✓ false トランザクションの実行をアトミックにコミットするか transactionUseDistributor bool {enableAtomicCommit} == true ✓ false トランザクションを非同期処理で実行する acquireActionUseJobQueue bool {enableAtomicCommit} == true ✓ false 入手アクションを実行する際に GS2-JobQueue を使用するか distributorNamespaceId string ✓ “grn:gs2:{region}:{ownerId}:distributor:default” ~ 1024文字 トランザクションの実行に使用する GS2-Distributor ネームスペース queueNamespaceId string ✓ “grn:gs2:{region}:{ownerId}:queue:default” ~ 1024文字 トランザクションの実行に使用する GS2-JobQueue のネームスペース
メソッド describeNamespaces ネームスペースの一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン limit int ✓ 30 1 ~ 1000 データの取得件数
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ;
client = gs2 ( 'inbox' )
api_result_handler = client.describe_namespaces_async ({
pageToken = nil ,
limit = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
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 ネームスペースを新規作成
Request 型 有効化条件 必須 デフォルト 値の制限 説明 name string ✓ ~ 128文字 ネームスペース名 description string ~ 1024文字 説明文 isAutomaticDeletingEnabled bool ✓ false 開封したメッセージを自動的に削除するか transactionSetting TransactionSetting トランザクション設定 receiveMessageScript ScriptSetting メッセージ受信したときに実行するスクリプト readMessageScript ScriptSetting メッセージ開封したときに実行するスクリプト deleteMessageScript ScriptSetting メッセージ削除したときに実行するスクリプト receiveNotification NotificationSetting メッセージを受信したときのプッシュ通知 logSetting LogSetting ログの出力設定 queueNamespaceId string ~ 1024文字 トランザクションの実行に使用する GS2-JobQueue のネームスペース keyId string ~ 1024文字 スタンプシートの発行に使用する GS2-Key のネームスペース
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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: \n amespace1: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: \n amespace1" ))
);
$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 ;
client = gs2 ( 'inbox' )
api_result_handler = client.create_namespace_async ({
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" ,
},
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
getNamespaceStatus ネームスペースの状態を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ;
client = gs2 ( 'inbox' )
api_result_handler = client.get_namespace_status_async ({
namespaceName = "namespace1" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
status = result.status ;
getNamespace ネームスペースを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ;
client = gs2 ( 'inbox' )
api_result_handler = client.get_namespace_async ({
namespaceName = "namespace1" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
updateNamespace ネームスペースを更新
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 description string ~ 1024文字 説明文 isAutomaticDeletingEnabled bool ✓ false 開封したメッセージを自動的に削除するか transactionSetting TransactionSetting トランザクション設定 receiveMessageScript ScriptSetting メッセージ受信したときに実行するスクリプト readMessageScript ScriptSetting メッセージ開封したときに実行するスクリプト deleteMessageScript ScriptSetting メッセージ削除したときに実行するスクリプト receiveNotification NotificationSetting メッセージを受信したときのプッシュ通知 logSetting LogSetting ログの出力設定 queueNamespaceId string ~ 1024文字 トランザクションの実行に使用する GS2-JobQueue のネームスペース keyId string ~ 1024文字 スタンプシートの発行に使用する GS2-Key のネームスペース
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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: \n amespace1:key:key-0002" ))
-> withReceiveMessageScript (( new \Gs2\Inbox\Model\ScriptSetting ())
-> withTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script: \n amespace1:script:script-1001" )
-> withDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script: \n amespace1:script:script-1002" ))
-> withReadMessageScript (( new \Gs2\Inbox\Model\ScriptSetting ())
-> withTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script: \n amespace1:script:script-1003" )
-> withDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script: \n amespace1:script:script-1004" ))
-> withDeleteMessageScript (( new \Gs2\Inbox\Model\ScriptSetting ())
-> withTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script: \n amespace1:script:script-1005" )
-> withDoneTriggerScriptId ( "grn:gs2:ap-northeast-1:YourOwnerId:script: \n amespace1:script:script-1006" ))
-> withReceiveNotification ( null )
-> withLogSetting (( new \Gs2\Inbox\Model\LogSetting ())
-> withLoggingNamespaceId ( "grn:gs2:ap-northeast-1:YourOwnerId:log: \n amespace1" ))
);
$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 ;
client = gs2 ( 'inbox' )
api_result_handler = client.update_namespace_async ({
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" ,
},
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
deleteNamespace ネームスペースを削除
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ;
client = gs2 ( 'inbox' )
api_result_handler = client.delete_namespace_async ({
namespaceName = "namespace1" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
dumpUserDataByUserId 指定したユーザーIDに紐づくデータのダンプを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . DumpUserDataByUserId (
& inbox . DumpUserDataByUserIdRequest {
UserId : pointy . String ( "user-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Inbox\Gs2InboxRestClient ;
use Gs2\Inbox\Request\DumpUserDataByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> dumpUserDataByUserId (
( new DumpUserDataByUserIdRequest ())
-> withUserId ( "user-0001" )
-> withTimeOffsetToken ( null )
);
} 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.DumpUserDataByUserIdRequest ;
import io.gs2.inbox.result.DumpUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
DumpUserDataByUserIdResult result = client . dumpUserDataByUserId (
new DumpUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} 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.DumpUserDataByUserIdRequest ;
using Gs2.Gs2Inbox.Result.DumpUserDataByUserIdResult ;
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 . DumpUserDataByUserIdResult > asyncResult = null ;
yield return client . DumpUserDataByUserId (
new Gs2 . Gs2Inbox . Request . DumpUserDataByUserIdRequest ()
. WithUserId ( "user-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
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 . dumpUserDataByUserId (
new Gs2Inbox . DumpUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} 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 . dump_user_data_by_user_id (
inbox . DumpUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.dump_user_data_by_user_id ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
client = gs2 ( 'inbox' )
api_result_handler = client.dump_user_data_by_user_id_async ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
checkDumpUserDataByUserId 指定したユーザーIDに紐づくデータのダンプが完了しているか確認
Request 型 有効化条件 必須 デフォルト 値の制限 説明 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . CheckDumpUserDataByUserId (
& inbox . CheckDumpUserDataByUserIdRequest {
UserId : pointy . String ( "user-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
url := result . Url
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Inbox\Gs2InboxRestClient ;
use Gs2\Inbox\Request\CheckDumpUserDataByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> checkDumpUserDataByUserId (
( new CheckDumpUserDataByUserIdRequest ())
-> withUserId ( "user-0001" )
-> withTimeOffsetToken ( null )
);
$url = $result -> getUrl ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.inbox.rest.Gs2InboxRestClient ;
import io.gs2.inbox.request.CheckDumpUserDataByUserIdRequest ;
import io.gs2.inbox.result.CheckDumpUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
CheckDumpUserDataByUserIdResult result = client . checkDumpUserDataByUserId (
new CheckDumpUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
String url = result . getUrl ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2Inbox.Gs2InboxRestClient ;
using Gs2.Gs2Inbox.Request.CheckDumpUserDataByUserIdRequest ;
using Gs2.Gs2Inbox.Result.CheckDumpUserDataByUserIdResult ;
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 . CheckDumpUserDataByUserIdResult > asyncResult = null ;
yield return client . CheckDumpUserDataByUserId (
new Gs2 . Gs2Inbox . Request . CheckDumpUserDataByUserIdRequest ()
. WithUserId ( "user-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var url = result . Url ;
import Gs2Core from '@/gs2/core' ;
import * as 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 . checkDumpUserDataByUserId (
new Gs2Inbox . CheckDumpUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
const url = result . getUrl ();
} 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 . check_dump_user_data_by_user_id (
inbox . CheckDumpUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
url = result . url
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.check_dump_user_data_by_user_id ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
url = result.url ;
client = gs2 ( 'inbox' )
api_result_handler = client.check_dump_user_data_by_user_id_async ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
url = result.url ;
cleanUserDataByUserId 指定したユーザーIDに紐づくデータのダンプを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . CleanUserDataByUserId (
& inbox . CleanUserDataByUserIdRequest {
UserId : pointy . String ( "user-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Inbox\Gs2InboxRestClient ;
use Gs2\Inbox\Request\CleanUserDataByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> cleanUserDataByUserId (
( new CleanUserDataByUserIdRequest ())
-> withUserId ( "user-0001" )
-> withTimeOffsetToken ( null )
);
} 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.CleanUserDataByUserIdRequest ;
import io.gs2.inbox.result.CleanUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
CleanUserDataByUserIdResult result = client . cleanUserDataByUserId (
new CleanUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} 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.CleanUserDataByUserIdRequest ;
using Gs2.Gs2Inbox.Result.CleanUserDataByUserIdResult ;
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 . CleanUserDataByUserIdResult > asyncResult = null ;
yield return client . CleanUserDataByUserId (
new Gs2 . Gs2Inbox . Request . CleanUserDataByUserIdRequest ()
. WithUserId ( "user-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
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 . cleanUserDataByUserId (
new Gs2Inbox . CleanUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} 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 . clean_user_data_by_user_id (
inbox . CleanUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.clean_user_data_by_user_id ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
client = gs2 ( 'inbox' )
api_result_handler = client.clean_user_data_by_user_id_async ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
checkCleanUserDataByUserId 指定したユーザーIDに紐づくデータのダンプが完了しているか確認
Request 型 有効化条件 必須 デフォルト 値の制限 説明 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . CheckCleanUserDataByUserId (
& inbox . CheckCleanUserDataByUserIdRequest {
UserId : pointy . String ( "user-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Inbox\Gs2InboxRestClient ;
use Gs2\Inbox\Request\CheckCleanUserDataByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> checkCleanUserDataByUserId (
( new CheckCleanUserDataByUserIdRequest ())
-> withUserId ( "user-0001" )
-> withTimeOffsetToken ( null )
);
} 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.CheckCleanUserDataByUserIdRequest ;
import io.gs2.inbox.result.CheckCleanUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
CheckCleanUserDataByUserIdResult result = client . checkCleanUserDataByUserId (
new CheckCleanUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} 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.CheckCleanUserDataByUserIdRequest ;
using Gs2.Gs2Inbox.Result.CheckCleanUserDataByUserIdResult ;
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 . CheckCleanUserDataByUserIdResult > asyncResult = null ;
yield return client . CheckCleanUserDataByUserId (
new Gs2 . Gs2Inbox . Request . CheckCleanUserDataByUserIdRequest ()
. WithUserId ( "user-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
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 . checkCleanUserDataByUserId (
new Gs2Inbox . CheckCleanUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
} 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 . check_clean_user_data_by_user_id (
inbox . CheckCleanUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.check_clean_user_data_by_user_id ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
client = gs2 ( 'inbox' )
api_result_handler = client.check_clean_user_data_by_user_id_async ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
prepareImportUserDataByUserId 指定したユーザーIDに紐づくデータのインポートを開始
Request 型 有効化条件 必須 デフォルト 値の制限 説明 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 型 説明 uploadToken string アップロード後に結果を反映する際に使用するトークン uploadUrl string ユーザーデータアップロード処理の実行に使用するURL
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . PrepareImportUserDataByUserId (
& inbox . PrepareImportUserDataByUserIdRequest {
UserId : pointy . String ( "user-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
uploadToken := result . UploadToken
uploadUrl := result . UploadUrl
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Inbox\Gs2InboxRestClient ;
use Gs2\Inbox\Request\PrepareImportUserDataByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> prepareImportUserDataByUserId (
( new PrepareImportUserDataByUserIdRequest ())
-> withUserId ( "user-0001" )
-> withTimeOffsetToken ( null )
);
$uploadToken = $result -> getUploadToken ();
$uploadUrl = $result -> getUploadUrl ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.inbox.rest.Gs2InboxRestClient ;
import io.gs2.inbox.request.PrepareImportUserDataByUserIdRequest ;
import io.gs2.inbox.result.PrepareImportUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
PrepareImportUserDataByUserIdResult result = client . prepareImportUserDataByUserId (
new PrepareImportUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
String uploadToken = result . getUploadToken ();
String uploadUrl = result . getUploadUrl ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2Inbox.Gs2InboxRestClient ;
using Gs2.Gs2Inbox.Request.PrepareImportUserDataByUserIdRequest ;
using Gs2.Gs2Inbox.Result.PrepareImportUserDataByUserIdResult ;
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 . PrepareImportUserDataByUserIdResult > asyncResult = null ;
yield return client . PrepareImportUserDataByUserId (
new Gs2 . Gs2Inbox . Request . PrepareImportUserDataByUserIdRequest ()
. WithUserId ( "user-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var uploadToken = result . UploadToken ;
var uploadUrl = result . UploadUrl ;
import Gs2Core from '@/gs2/core' ;
import * as 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 . prepareImportUserDataByUserId (
new Gs2Inbox . PrepareImportUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
const uploadToken = result . getUploadToken ();
const uploadUrl = result . getUploadUrl ();
} 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 . prepare_import_user_data_by_user_id (
inbox . PrepareImportUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
upload_token = result . upload_token
upload_url = result . upload_url
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.prepare_import_user_data_by_user_id ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
uploadToken = result.uploadToken ;
uploadUrl = result.uploadUrl ;
client = gs2 ( 'inbox' )
api_result_handler = client.prepare_import_user_data_by_user_id_async ({
userId = "user-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
uploadToken = result.uploadToken ;
uploadUrl = result.uploadUrl ;
importUserDataByUserId 指定したユーザーIDに紐づくデータのインポートを開始
Request 型 有効化条件 必須 デフォルト 値の制限 説明 userId string ✓ ~ 128文字 ユーザーID uploadToken string ✓ ~ 1024文字 アップロード準備で受け取ったトークン timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . ImportUserDataByUserId (
& inbox . ImportUserDataByUserIdRequest {
UserId : pointy . String ( "user-0001" ),
UploadToken : pointy . String ( "upload-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Inbox\Gs2InboxRestClient ;
use Gs2\Inbox\Request\ImportUserDataByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> importUserDataByUserId (
( new ImportUserDataByUserIdRequest ())
-> withUserId ( "user-0001" )
-> withUploadToken ( "upload-0001" )
-> withTimeOffsetToken ( null )
);
} 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.ImportUserDataByUserIdRequest ;
import io.gs2.inbox.result.ImportUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
ImportUserDataByUserIdResult result = client . importUserDataByUserId (
new ImportUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withUploadToken ( "upload-0001" )
. withTimeOffsetToken ( null )
);
} 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.ImportUserDataByUserIdRequest ;
using Gs2.Gs2Inbox.Result.ImportUserDataByUserIdResult ;
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 . ImportUserDataByUserIdResult > asyncResult = null ;
yield return client . ImportUserDataByUserId (
new Gs2 . Gs2Inbox . Request . ImportUserDataByUserIdRequest ()
. WithUserId ( "user-0001" )
. WithUploadToken ( "upload-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
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 . importUserDataByUserId (
new Gs2Inbox . ImportUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withUploadToken ( "upload-0001" )
. withTimeOffsetToken ( null )
);
} 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 . import_user_data_by_user_id (
inbox . ImportUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_upload_token ( 'upload-0001' )
. with_time_offset_token ( None )
)
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.import_user_data_by_user_id ({
userId = "user-0001" ,
uploadToken = "upload-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
client = gs2 ( 'inbox' )
api_result_handler = client.import_user_data_by_user_id_async ({
userId = "user-0001" ,
uploadToken = "upload-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
checkImportUserDataByUserId 指定したユーザーIDに紐づくデータのインポートが完了しているか確認
Request 型 有効化条件 必須 デフォルト 値の制限 説明 userId string ✓ ~ 128文字 ユーザーID uploadToken string ✓ ~ 1024文字 アップロード準備で受け取ったトークン timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . CheckImportUserDataByUserId (
& inbox . CheckImportUserDataByUserIdRequest {
UserId : pointy . String ( "user-0001" ),
UploadToken : pointy . String ( "upload-0001" ),
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
url := result . Url
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Inbox\Gs2InboxRestClient ;
use Gs2\Inbox\Request\CheckImportUserDataByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> checkImportUserDataByUserId (
( new CheckImportUserDataByUserIdRequest ())
-> withUserId ( "user-0001" )
-> withUploadToken ( "upload-0001" )
-> withTimeOffsetToken ( null )
);
$url = $result -> getUrl ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.inbox.rest.Gs2InboxRestClient ;
import io.gs2.inbox.request.CheckImportUserDataByUserIdRequest ;
import io.gs2.inbox.result.CheckImportUserDataByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
CheckImportUserDataByUserIdResult result = client . checkImportUserDataByUserId (
new CheckImportUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withUploadToken ( "upload-0001" )
. withTimeOffsetToken ( null )
);
String url = result . getUrl ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2Inbox.Gs2InboxRestClient ;
using Gs2.Gs2Inbox.Request.CheckImportUserDataByUserIdRequest ;
using Gs2.Gs2Inbox.Result.CheckImportUserDataByUserIdResult ;
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 . CheckImportUserDataByUserIdResult > asyncResult = null ;
yield return client . CheckImportUserDataByUserId (
new Gs2 . Gs2Inbox . Request . CheckImportUserDataByUserIdRequest ()
. WithUserId ( "user-0001" )
. WithUploadToken ( "upload-0001" )
. WithTimeOffsetToken ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var url = result . Url ;
import Gs2Core from '@/gs2/core' ;
import * as 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 . checkImportUserDataByUserId (
new Gs2Inbox . CheckImportUserDataByUserIdRequest ()
. withUserId ( "user-0001" )
. withUploadToken ( "upload-0001" )
. withTimeOffsetToken ( null )
);
const url = result . getUrl ();
} 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 . check_import_user_data_by_user_id (
inbox . CheckImportUserDataByUserIdRequest ()
. with_user_id ( 'user-0001' )
. with_upload_token ( 'upload-0001' )
. with_time_offset_token ( None )
)
url = result . url
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.check_import_user_data_by_user_id ({
userId = "user-0001" ,
uploadToken = "upload-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
url = result.url ;
client = gs2 ( 'inbox' )
api_result_handler = client.check_import_user_data_by_user_id_async ({
userId = "user-0001" ,
uploadToken = "upload-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
url = result.url ;
describeMessages メッセージの一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 accessToken string ✓ ~ 128文字 ユーザーID isRead bool? 既読状態 pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン limit int ✓ 30 1 ~ 1000 データの取得件数
Result 型 説明 items List<Message> メッセージのリスト nextPageToken string リストの続きを取得するためのページトークン
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "accessToken-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 ( "accessToken-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 ( "accessToken-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 ( "accessToken-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 = "accessToken-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 ;
client = gs2 ( 'inbox' )
api_result_handler = client.describe_messages_async ({
namespaceName = "namespace1" ,
accessToken = "accessToken-0001" ,
isRead = nil ,
pageToken = nil ,
limit = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
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 ユーザーIDを指定してメッセージの一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 userId string ✓ ~ 128文字 ユーザーID isRead bool? 既読状態 pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン limit int ✓ 30 1 ~ 1000 データの取得件数 timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 型 説明 items List<Message> メッセージのリスト nextPageToken string リストの続きを取得するためのページトークン
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ,
TimeOffsetToken : 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 )
-> withTimeOffsetToken ( 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 )
. withTimeOffsetToken ( 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 )
. WithTimeOffsetToken ( 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 )
. withTimeOffsetToken ( 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 )
. with_time_offset_token ( 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 ,
timeOffsetToken = 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 ;
client = gs2 ( 'inbox' )
api_result_handler = client.describe_messages_by_user_id_async ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
isRead = nil ,
pageToken = nil ,
limit = nil ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
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 ユーザーIDを指定してメッセージの送信
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 userId string ✓ ~ 128文字 ユーザーID metadata string ✓ ~ 4096文字 メッセージの内容に相当するメタデータ readAcquireActions List<AcquireAction> [] ~ 100 items 開封時に実行する入手アクション expiresAt long 有効期限日時 (UNIX時間 単位:ミリ秒) expiresTimeSpan TimeSpan メッセージの有効期限までの差分 timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ,
TimeOffsetToken : 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 )
-> withTimeOffsetToken ( 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 )
. withTimeOffsetToken ( 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 )
. WithTimeOffsetToken ( 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 )
. withTimeOffsetToken ( 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 )
. with_time_offset_token ( 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 ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.send_message_by_user_id_async ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
metadata = "{ \" type \" : \" message \" , \" body \" : \" hello \" }" ,
readAcquireActions = nil ,
expiresAt = nil ,
expiresTimeSpan = nil ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
getMessage メッセージを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 accessToken string ✓ ~ 128文字 ユーザーID messageName string ✓ UUID ~ 36文字 メッセージ名
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "accessToken-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\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 :: 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.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 ( "accessToken-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.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 ( "accessToken-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 . getMessage (
new Gs2Inbox . GetMessageRequest ()
. withNamespaceName ( "namespace1" )
. withAccessToken ( "accessToken-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 (
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 = "accessToken-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 ;
client = gs2 ( 'inbox' )
api_result_handler = client.get_message_async ({
namespaceName = "namespace1" ,
accessToken = "accessToken-0001" ,
messageName = "message-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
getMessageByUserId ユーザーIDを指定してメッセージを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 userId string ✓ ~ 128文字 ユーザーID messageName string ✓ UUID ~ 36文字 メッセージ名 timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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" ),
TimeOffsetToken : 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\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" )
-> withTimeOffsetToken ( 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.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" )
. withTimeOffsetToken ( 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.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" )
. WithTimeOffsetToken ( 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 . getMessageByUserId (
new Gs2Inbox . GetMessageByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withMessageName ( "message-0001" )
. withTimeOffsetToken ( 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 . get_message_by_user_id (
inbox . GetMessageByUserIdRequest ()
. with_namespace_name ( self . hash1 )
. with_user_id ( 'user-0001' )
. with_message_name ( 'message-0001' )
. with_time_offset_token ( None )
)
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" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.get_message_by_user_id_async ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
messageName = "message-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
receiveGlobalMessage グローバルメッセージのうちまだ受け取っていないメッセージを受信
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 accessToken string ✓ ~ 128文字 ユーザーID
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "accessToken-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 ( "accessToken-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 ( "accessToken-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 ( "accessToken-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 = "accessToken-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.receive_global_message_async ({
namespaceName = "namespace1" ,
accessToken = "accessToken-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
receiveGlobalMessageByUserId ユーザーIDを指定してグローバルメッセージのうちまだ受け取っていないメッセージを受信
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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" ),
TimeOffsetToken : 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\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" )
-> withTimeOffsetToken ( 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.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" )
. withTimeOffsetToken ( null )
);
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" )
. WithTimeOffsetToken ( 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 . receiveGlobalMessageByUserId (
new Gs2Inbox . ReceiveGlobalMessageByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withTimeOffsetToken ( 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 . receive_global_message_by_user_id (
inbox . ReceiveGlobalMessageByUserIdRequest ()
. with_namespace_name ( self . hash1 )
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
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" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.receive_global_message_by_user_id_async ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
openMessage メッセージを開封済み化
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 accessToken string ✓ ~ 128文字 ユーザーID messageName string ✓ UUID ~ 36文字 メッセージ名
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "accessToken-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 ( "accessToken-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 ( "accessToken-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 ( "accessToken-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 = "accessToken-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 ;
client = gs2 ( 'inbox' )
api_result_handler = client.open_message_async ({
namespaceName = "namespace1" ,
accessToken = "accessToken-0001" ,
messageName = "message-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
openMessageByUserId ユーザーIDを指定してメッセージを開封済み化
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 userId string ✓ ~ 128文字 ユーザーID messageName string ✓ UUID ~ 36文字 メッセージ名 timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "message-0001" ),
TimeOffsetToken : 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\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 :: message - 0001 )
-> withTimeOffsetToken ( 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.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 ( "message-0001" )
. withTimeOffsetToken ( 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.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 ( "message-0001" )
. WithTimeOffsetToken ( 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 . openMessageByUserId (
new Gs2Inbox . OpenMessageByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withMessageName ( "message-0001" )
. withTimeOffsetToken ( 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 . open_message_by_user_id (
inbox . OpenMessageByUserIdRequest ()
. with_namespace_name ( self . hash1 )
. with_user_id ( 'user-0001' )
. with_message_name ( self . message1 . name )
. with_time_offset_token ( None )
)
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 = "message-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.open_message_by_user_id_async ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
messageName = "message-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
readMessage メッセージを開封
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 accessToken string ✓ ~ 128文字 ユーザーID messageName string ✓ UUID ~ 36文字 メッセージ名 config List<Config> [] ~ 32 items トランザクションの変数に適用する設定値
Result 型 説明 item Message メッセージ transactionId string 発行されたトランザクションID stampSheet string スタンプシート stampSheetEncryptionKeyId string スタンプシートの署名計算に使用した暗号鍵GRN autoRunStampSheet bool? トランザクションの自動実行が有効か atomicCommit bool? トランザクションをアトミックにコミットするか transaction string 発行されたトランザクション transactionResult TransactionResult トランザクション実行結果
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ( "accessToken-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
atomicCommit := result . AtomicCommit
transaction := result . Transaction
transactionResult := result . TransactionResult
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 ();
$atomicCommit = $result -> getAtomicCommit ();
$transaction = $result -> getTransaction ();
$transactionResult = $result -> getTransactionResult ();
} 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 ( "accessToken-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 ();
boolean atomicCommit = result . getAtomicCommit ();
String transaction = result . getTransaction ();
TransactionResult transactionResult = result . getTransactionResult ();
} 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 ( "accessToken-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 ;
var atomicCommit = result . AtomicCommit ;
var transaction = result . Transaction ;
var transactionResult = result . TransactionResult ;
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 ( "accessToken-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 ();
const atomicCommit = result . getAtomicCommit ();
const transaction = result . getTransaction ();
const transactionResult = result . getTransactionResult ();
} 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
atomic_commit = result . atomic_commit
transaction = result . transaction
transaction_result = result . transaction_result
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.read_message ({
namespaceName = "namespace1" ,
accessToken = "accessToken-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 ;
atomicCommit = result.atomicCommit ;
transaction = result.transaction ;
transactionResult = result.transactionResult ;
client = gs2 ( 'inbox' )
api_result_handler = client.read_message_async ({
namespaceName = "namespace1" ,
accessToken = "accessToken-0001" ,
messageName = "message-0001" ,
config = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
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 ;
atomicCommit = result.atomicCommit ;
transaction = result.transaction ;
transactionResult = result.transactionResult ;
readMessageByUserId ユーザーIDを指定してメッセージを開封
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 userId string ✓ ~ 128文字 ユーザーID messageName string ✓ UUID ~ 36文字 メッセージ名 config List<Config> [] ~ 32 items トランザクションの変数に適用する設定値 timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 型 説明 item Message メッセージ transactionId string 発行されたトランザクションID stampSheet string スタンプシート stampSheetEncryptionKeyId string スタンプシートの署名計算に使用した暗号鍵GRN autoRunStampSheet bool? トランザクションの自動実行が有効か atomicCommit bool? トランザクションをアトミックにコミットするか transaction string 発行されたトランザクション transactionResult TransactionResult トランザクション実行結果
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 ,
TimeOffsetToken : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
transactionId := result . TransactionId
stampSheet := result . StampSheet
stampSheetEncryptionKeyId := result . StampSheetEncryptionKeyId
autoRunStampSheet := result . AutoRunStampSheet
atomicCommit := result . AtomicCommit
transaction := result . Transaction
transactionResult := result . TransactionResult
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 )
-> withTimeOffsetToken ( null )
);
$item = $result -> getItem ();
$transactionId = $result -> getTransactionId ();
$stampSheet = $result -> getStampSheet ();
$stampSheetEncryptionKeyId = $result -> getStampSheetEncryptionKeyId ();
$autoRunStampSheet = $result -> getAutoRunStampSheet ();
$atomicCommit = $result -> getAtomicCommit ();
$transaction = $result -> getTransaction ();
$transactionResult = $result -> getTransactionResult ();
} 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 BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
ReadMessageByUserIdResult result = client . readMessageByUserId (
new ReadMessageByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withMessageName ( "message-0001" )
. withConfig ( null )
. withTimeOffsetToken ( null )
);
Message item = result . getItem ();
String transactionId = result . getTransactionId ();
String stampSheet = result . getStampSheet ();
String stampSheetEncryptionKeyId = result . getStampSheetEncryptionKeyId ();
boolean autoRunStampSheet = result . getAutoRunStampSheet ();
boolean atomicCommit = result . getAtomicCommit ();
String transaction = result . getTransaction ();
TransactionResult transactionResult = result . getTransactionResult ();
} 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.ReadMessageByUserIdRequest ;
using Gs2.Gs2Inbox.Result.ReadMessageByUserIdResult ;
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 . ReadMessageByUserIdResult > asyncResult = null ;
yield return client . ReadMessageByUserId (
new Gs2 . Gs2Inbox . Request . ReadMessageByUserIdRequest ()
. WithNamespaceName ( "namespace1" )
. WithUserId ( "user-0001" )
. WithMessageName ( "message-0001" )
. WithConfig ( null )
. WithTimeOffsetToken ( 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 ;
var atomicCommit = result . AtomicCommit ;
var transaction = result . Transaction ;
var transactionResult = result . TransactionResult ;
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 . readMessageByUserId (
new Gs2Inbox . ReadMessageByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withMessageName ( "message-0001" )
. withConfig ( null )
. withTimeOffsetToken ( null )
);
const item = result . getItem ();
const transactionId = result . getTransactionId ();
const stampSheet = result . getStampSheet ();
const stampSheetEncryptionKeyId = result . getStampSheetEncryptionKeyId ();
const autoRunStampSheet = result . getAutoRunStampSheet ();
const atomicCommit = result . getAtomicCommit ();
const transaction = result . getTransaction ();
const transactionResult = result . getTransactionResult ();
} 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_by_user_id (
inbox . ReadMessageByUserIdRequest ()
. with_namespace_name ( self . hash1 )
. with_user_id ( 'user-0001' )
. with_message_name ( 'message-0001' )
. with_config ( None )
. with_time_offset_token ( 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
atomic_commit = result . atomic_commit
transaction = result . transaction
transaction_result = result . transaction_result
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.read_message_by_user_id ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
messageName = "message-0001" ,
config = nil ,
timeOffsetToken = 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 ;
atomicCommit = result.atomicCommit ;
transaction = result.transaction ;
transactionResult = result.transactionResult ;
client = gs2 ( 'inbox' )
api_result_handler = client.read_message_by_user_id_async ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
messageName = "message-0001" ,
config = nil ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
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 ;
atomicCommit = result.atomicCommit ;
transaction = result.transaction ;
transactionResult = result.transactionResult ;
deleteMessage メッセージを削除
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 accessToken string ✓ ~ 128文字 ユーザーID messageName string ✓ UUID ~ 36文字 メッセージ名
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . DeleteMessage (
& inbox . DeleteMessageRequest {
NamespaceName : pointy . String ( "namespace1" ),
AccessToken : pointy . String ( "accessToken-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\DeleteMessageRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> deleteMessage (
( new DeleteMessageRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withAccessToken ( self :: $accessToken0001 )
-> withMessageName ( self :: 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.DeleteMessageRequest ;
import io.gs2.inbox.result.DeleteMessageResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
DeleteMessageResult result = client . deleteMessage (
new DeleteMessageRequest ()
. withNamespaceName ( "namespace1" )
. withAccessToken ( "accessToken-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.DeleteMessageRequest ;
using Gs2.Gs2Inbox.Result.DeleteMessageResult ;
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 . DeleteMessageResult > asyncResult = null ;
yield return client . DeleteMessage (
new Gs2 . Gs2Inbox . Request . DeleteMessageRequest ()
. WithNamespaceName ( "namespace1" )
. WithAccessToken ( "accessToken-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 . deleteMessage (
new Gs2Inbox . DeleteMessageRequest ()
. withNamespaceName ( "namespace1" )
. withAccessToken ( "accessToken-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 . delete_message (
inbox . DeleteMessageRequest ()
. 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.delete_message ({
namespaceName = "namespace1" ,
accessToken = "accessToken-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 ;
client = gs2 ( 'inbox' )
api_result_handler = client.delete_message_async ({
namespaceName = "namespace1" ,
accessToken = "accessToken-0001" ,
messageName = "message-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
deleteMessageByUserId ユーザーIDを指定してメッセージを削除
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 userId string ✓ ~ 128文字 ユーザーID messageName string ✓ UUID ~ 36文字 メッセージ名 timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . DeleteMessageByUserId (
& inbox . DeleteMessageByUserIdRequest {
NamespaceName : pointy . String ( "namespace1" ),
UserId : pointy . String ( "user-0001" ),
MessageName : pointy . String ( "message-0001" ),
TimeOffsetToken : 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\DeleteMessageByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> deleteMessageByUserId (
( new DeleteMessageByUserIdRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withUserId ( "user-0001" )
-> withMessageName ( "message-0001" )
-> withTimeOffsetToken ( 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.DeleteMessageByUserIdRequest ;
import io.gs2.inbox.result.DeleteMessageByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
DeleteMessageByUserIdResult result = client . deleteMessageByUserId (
new DeleteMessageByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withMessageName ( "message-0001" )
. withTimeOffsetToken ( 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.DeleteMessageByUserIdRequest ;
using Gs2.Gs2Inbox.Result.DeleteMessageByUserIdResult ;
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 . DeleteMessageByUserIdResult > asyncResult = null ;
yield return client . DeleteMessageByUserId (
new Gs2 . Gs2Inbox . Request . DeleteMessageByUserIdRequest ()
. WithNamespaceName ( "namespace1" )
. WithUserId ( "user-0001" )
. WithMessageName ( "message-0001" )
. WithTimeOffsetToken ( 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 . deleteMessageByUserId (
new Gs2Inbox . DeleteMessageByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withMessageName ( "message-0001" )
. withTimeOffsetToken ( 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 . delete_message_by_user_id (
inbox . DeleteMessageByUserIdRequest ()
. with_namespace_name ( self . hash1 )
. with_user_id ( 'user-0001' )
. with_message_name ( 'message-0001' )
. with_time_offset_token ( None )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.delete_message_by_user_id ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
messageName = "message-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.delete_message_by_user_id_async ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
messageName = "message-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
sendByStampSheet 入手アクションとしてメッセージの送信を実行
Request 型 有効化条件 必須 デフォルト 値の制限 説明 stampSheet string ✓ ~ 5242880文字 トランザクション keyId string ✓ ~ 1024文字 暗号鍵GRN
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . SendByStampSheet (
& inbox . SendByStampSheetRequest {
StampSheet : pointy . String ( "stampSheet" ),
KeyId : pointy . String ( "key-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\SendByStampSheetRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> sendByStampSheet (
( new SendByStampSheetRequest ())
-> withStampSheet ( self :: stampSheet )
-> withKeyId ( self :: key - 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.SendByStampSheetRequest ;
import io.gs2.inbox.result.SendByStampSheetResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
SendByStampSheetResult result = client . sendByStampSheet (
new SendByStampSheetRequest ()
. withStampSheet ( "stampSheet" )
. withKeyId ( "key-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.SendByStampSheetRequest ;
using Gs2.Gs2Inbox.Result.SendByStampSheetResult ;
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 . SendByStampSheetResult > asyncResult = null ;
yield return client . SendByStampSheet (
new Gs2 . Gs2Inbox . Request . SendByStampSheetRequest ()
. WithStampSheet ( "stampSheet" )
. WithKeyId ( "key-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 . sendByStampSheet (
new Gs2Inbox . SendByStampSheetRequest ()
. withStampSheet ( "stampSheet" )
. withKeyId ( "key-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 . send_by_stamp_sheet (
inbox . SendByStampSheetRequest ()
. with_stamp_sheet ( self . stamp_sheet )
. with_key_id ( self . key1 . key_id )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.send_by_stamp_sheet ({
stampSheet = "stampSheet" ,
keyId = "key-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.send_by_stamp_sheet_async ({
stampSheet = "stampSheet" ,
keyId = "key-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
openByStampTask 消費アクションとしてメッセージを開封済み化を実行
Request 型 有効化条件 必須 デフォルト 値の制限 説明 stampTask string ✓ ~ 5242880文字 消費アクション keyId string ✓ ~ 1024文字 暗号鍵GRN
Result 型 説明 item Message メッセージ newContextStack string 消費アクションの実行結果を記録したコンテキスト
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . OpenByStampTask (
& inbox . OpenByStampTaskRequest {
StampTask : pointy . String ( "stampTask" ),
KeyId : pointy . String ( "key-0001" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
newContextStack := result . NewContextStack
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\OpenByStampTaskRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> openByStampTask (
( new OpenByStampTaskRequest ())
-> withStampTask ( self :: stampTask )
-> withKeyId ( self :: key - 0001 )
);
$item = $result -> getItem ();
$newContextStack = $result -> getNewContextStack ();
} 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.OpenByStampTaskRequest ;
import io.gs2.inbox.result.OpenByStampTaskResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
OpenByStampTaskResult result = client . openByStampTask (
new OpenByStampTaskRequest ()
. withStampTask ( "stampTask" )
. withKeyId ( "key-0001" )
);
Message item = result . getItem ();
String newContextStack = result . getNewContextStack ();
} 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.OpenByStampTaskRequest ;
using Gs2.Gs2Inbox.Result.OpenByStampTaskResult ;
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 . OpenByStampTaskResult > asyncResult = null ;
yield return client . OpenByStampTask (
new Gs2 . Gs2Inbox . Request . OpenByStampTaskRequest ()
. WithStampTask ( "stampTask" )
. WithKeyId ( "key-0001" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var newContextStack = result . NewContextStack ;
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 . openByStampTask (
new Gs2Inbox . OpenByStampTaskRequest ()
. withStampTask ( "stampTask" )
. withKeyId ( "key-0001" )
);
const item = result . getItem ();
const newContextStack = result . getNewContextStack ();
} 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_by_stamp_task (
inbox . OpenByStampTaskRequest ()
. with_stamp_task ( self . stamp_task )
. with_key_id ( self . key1 . key_id )
)
item = result . item
new_context_stack = result . new_context_stack
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.open_by_stamp_task ({
stampTask = "stampTask" ,
keyId = "key-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
newContextStack = result.newContextStack ;
client = gs2 ( 'inbox' )
api_result_handler = client.open_by_stamp_task_async ({
stampTask = "stampTask" ,
keyId = "key-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
newContextStack = result.newContextStack ;
deleteMessageByStampTask 消費アクションとしてメッセージの削除を実行
Request 型 有効化条件 必須 デフォルト 値の制限 説明 stampTask string ✓ ~ 5242880文字 消費アクション keyId string ✓ ~ 1024文字 暗号鍵GRN
Result 型 説明 item Message メッセージ newContextStack string 消費アクションの実行結果を記録したコンテキスト
実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . DeleteMessageByStampTask (
& inbox . DeleteMessageByStampTaskRequest {
StampTask : pointy . String ( "stampTask" ),
KeyId : pointy . String ( "key-0001" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
newContextStack := result . NewContextStack
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\DeleteMessageByStampTaskRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> deleteMessageByStampTask (
( new DeleteMessageByStampTaskRequest ())
-> withStampTask ( self :: stampTask )
-> withKeyId ( self :: key - 0001 )
);
$item = $result -> getItem ();
$newContextStack = $result -> getNewContextStack ();
} 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.DeleteMessageByStampTaskRequest ;
import io.gs2.inbox.result.DeleteMessageByStampTaskResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
DeleteMessageByStampTaskResult result = client . deleteMessageByStampTask (
new DeleteMessageByStampTaskRequest ()
. withStampTask ( "stampTask" )
. withKeyId ( "key-0001" )
);
Message item = result . getItem ();
String newContextStack = result . getNewContextStack ();
} 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.DeleteMessageByStampTaskRequest ;
using Gs2.Gs2Inbox.Result.DeleteMessageByStampTaskResult ;
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 . DeleteMessageByStampTaskResult > asyncResult = null ;
yield return client . DeleteMessageByStampTask (
new Gs2 . Gs2Inbox . Request . DeleteMessageByStampTaskRequest ()
. WithStampTask ( "stampTask" )
. WithKeyId ( "key-0001" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
var newContextStack = result . NewContextStack ;
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 . deleteMessageByStampTask (
new Gs2Inbox . DeleteMessageByStampTaskRequest ()
. withStampTask ( "stampTask" )
. withKeyId ( "key-0001" )
);
const item = result . getItem ();
const newContextStack = result . getNewContextStack ();
} 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_message_by_stamp_task (
inbox . DeleteMessageByStampTaskRequest ()
. with_stamp_task ( self . stamp_task )
. with_key_id ( self . key1 . key_id )
)
item = result . item
new_context_stack = result . new_context_stack
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.delete_message_by_stamp_task ({
stampTask = "stampTask" ,
keyId = "key-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
newContextStack = result.newContextStack ;
client = gs2 ( 'inbox' )
api_result_handler = client.delete_message_by_stamp_task_async ({
stampTask = "stampTask" ,
keyId = "key-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
newContextStack = result.newContextStack ;
exportMaster 現在有効なグローバルメッセージ設定のマスターデータをエクスポート
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . ExportMaster (
& inbox . ExportMasterRequest {
NamespaceName : pointy . String ( "namespace1" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Inbox\Gs2InboxRestClient ;
use Gs2\Inbox\Request\ExportMasterRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> exportMaster (
( new ExportMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.inbox.rest.Gs2InboxRestClient ;
import io.gs2.inbox.request.ExportMasterRequest ;
import io.gs2.inbox.result.ExportMasterResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
ExportMasterResult result = client . exportMaster (
new ExportMasterRequest ()
. withNamespaceName ( "namespace1" )
);
CurrentMessageMaster 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.ExportMasterRequest ;
using Gs2.Gs2Inbox.Result.ExportMasterResult ;
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 . ExportMasterResult > asyncResult = null ;
yield return client . ExportMaster (
new Gs2 . Gs2Inbox . Request . ExportMasterRequest ()
. WithNamespaceName ( "namespace1" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as 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 . exportMaster (
new Gs2Inbox . ExportMasterRequest ()
. 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 . export_master (
inbox . ExportMasterRequest ()
. with_namespace_name ( self . hash1 )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.export_master ({
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 ;
client = gs2 ( 'inbox' )
api_result_handler = client.export_master_async ({
namespaceName = "namespace1" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
getCurrentMessageMaster 現在有効なグローバルメッセージ設定を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . GetCurrentMessageMaster (
& inbox . GetCurrentMessageMasterRequest {
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\GetCurrentMessageMasterRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getCurrentMessageMaster (
( new GetCurrentMessageMasterRequest ())
-> 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.GetCurrentMessageMasterRequest ;
import io.gs2.inbox.result.GetCurrentMessageMasterResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
GetCurrentMessageMasterResult result = client . getCurrentMessageMaster (
new GetCurrentMessageMasterRequest ()
. withNamespaceName ( "namespace1" )
);
CurrentMessageMaster 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.GetCurrentMessageMasterRequest ;
using Gs2.Gs2Inbox.Result.GetCurrentMessageMasterResult ;
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 . GetCurrentMessageMasterResult > asyncResult = null ;
yield return client . GetCurrentMessageMaster (
new Gs2 . Gs2Inbox . Request . GetCurrentMessageMasterRequest ()
. 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 . getCurrentMessageMaster (
new Gs2Inbox . GetCurrentMessageMasterRequest ()
. 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_current_message_master (
inbox . GetCurrentMessageMasterRequest ()
. with_namespace_name ( self . hash1 )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.get_current_message_master ({
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 ;
client = gs2 ( 'inbox' )
api_result_handler = client.get_current_message_master_async ({
namespaceName = "namespace1" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
updateCurrentMessageMaster 現在有効なグローバルメッセージ設定を更新
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 settings string ✓ ~ 5242880文字 マスターデータ
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . UpdateCurrentMessageMaster (
& inbox . UpdateCurrentMessageMasterRequest {
NamespaceName : pointy . String ( "namespace1" ),
Settings : pointy . String ( "{\n \"version\": \"2020-03-12\",\n \"globalMessages\": [\n {\n \"name\": \"message-0001\",\n \"metadata\": \"hoge\"\n },\n {\n \"name\": \"message-0002\",\n \"metadata\": \"fuga\",\n \"readAcquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"Gs2Inventory:AcquireItemSetByUserId-request\"\n }\n ],\n \"expiresTimeSpan\": {\n \"days\": 1,\n \"hours\": 2,\n \"minutes\": 3\n }\n },\n {\n \"name\": \"message-0003\",\n \"metadata\": \"piyo\",\n \"expiresAt\": 1000\n }\n ]\n}" ),
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Inbox\Gs2InboxRestClient ;
use Gs2\Inbox\Request\UpdateCurrentMessageMasterRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> updateCurrentMessageMaster (
( new UpdateCurrentMessageMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withSettings ( "{ \n \" version \" : \" 2020-03-12 \" , \n \" globalMessages \" : [ \n { \n \" name \" : \" message-0001 \" , \n \" metadata \" : \" hoge \"\n }, \n { \n \" name \" : \" message-0002 \" , \n \" metadata \" : \" fuga \" , \n \" readAcquireActions \" : [ \n { \n \" action \" : \" Gs2Inventory:AcquireItemSetByUserId \" , \n \" request \" : \" Gs2Inventory:AcquireItemSetByUserId-request \"\n } \n ], \n \" expiresTimeSpan \" : { \n \" days \" : 1, \n \" hours \" : 2, \n \" minutes \" : 3 \n } \n }, \n { \n \" name \" : \" message-0003 \" , \n \" metadata \" : \" piyo \" , \n \" expiresAt \" : 1000 \n } \n ] \n }" )
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.inbox.rest.Gs2InboxRestClient ;
import io.gs2.inbox.request.UpdateCurrentMessageMasterRequest ;
import io.gs2.inbox.result.UpdateCurrentMessageMasterResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
UpdateCurrentMessageMasterResult result = client . updateCurrentMessageMaster (
new UpdateCurrentMessageMasterRequest ()
. withNamespaceName ( "namespace1" )
. withSettings ( "{\n \"version\": \"2020-03-12\",\n \"globalMessages\": [\n {\n \"name\": \"message-0001\",\n \"metadata\": \"hoge\"\n },\n {\n \"name\": \"message-0002\",\n \"metadata\": \"fuga\",\n \"readAcquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"Gs2Inventory:AcquireItemSetByUserId-request\"\n }\n ],\n \"expiresTimeSpan\": {\n \"days\": 1,\n \"hours\": 2,\n \"minutes\": 3\n }\n },\n {\n \"name\": \"message-0003\",\n \"metadata\": \"piyo\",\n \"expiresAt\": 1000\n }\n ]\n}" )
);
CurrentMessageMaster 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.UpdateCurrentMessageMasterRequest ;
using Gs2.Gs2Inbox.Result.UpdateCurrentMessageMasterResult ;
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 . UpdateCurrentMessageMasterResult > asyncResult = null ;
yield return client . UpdateCurrentMessageMaster (
new Gs2 . Gs2Inbox . Request . UpdateCurrentMessageMasterRequest ()
. WithNamespaceName ( "namespace1" )
. WithSettings ( "{\n \"version\": \"2020-03-12\",\n \"globalMessages\": [\n {\n \"name\": \"message-0001\",\n \"metadata\": \"hoge\"\n },\n {\n \"name\": \"message-0002\",\n \"metadata\": \"fuga\",\n \"readAcquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"Gs2Inventory:AcquireItemSetByUserId-request\"\n }\n ],\n \"expiresTimeSpan\": {\n \"days\": 1,\n \"hours\": 2,\n \"minutes\": 3\n }\n },\n {\n \"name\": \"message-0003\",\n \"metadata\": \"piyo\",\n \"expiresAt\": 1000\n }\n ]\n}" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as 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 . updateCurrentMessageMaster (
new Gs2Inbox . UpdateCurrentMessageMasterRequest ()
. withNamespaceName ( "namespace1" )
. withSettings ( "{\n \"version\": \"2020-03-12\",\n \"globalMessages\": [\n {\n \"name\": \"message-0001\",\n \"metadata\": \"hoge\"\n },\n {\n \"name\": \"message-0002\",\n \"metadata\": \"fuga\",\n \"readAcquireActions\": [\n {\n \"action\": \"Gs2Inventory:AcquireItemSetByUserId\",\n \"request\": \"Gs2Inventory:AcquireItemSetByUserId-request\"\n }\n ],\n \"expiresTimeSpan\": {\n \"days\": 1,\n \"hours\": 2,\n \"minutes\": 3\n }\n },\n {\n \"name\": \"message-0003\",\n \"metadata\": \"piyo\",\n \"expiresAt\": 1000\n }\n ]\n}" )
);
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_current_message_master (
inbox . UpdateCurrentMessageMasterRequest ()
. with_namespace_name ( self . hash1 )
. with_settings ( '{ \n "version": "2020-03-12", \n "globalMessages": [ \n { \n "name": "message-0001", \n "metadata": "hoge" \n }, \n { \n "name": "message-0002", \n "metadata": "fuga", \n "readAcquireActions": [ \n { \n "action": "Gs2Inventory:AcquireItemSetByUserId", \n "request": "Gs2Inventory:AcquireItemSetByUserId-request" \n } \n ], \n "expiresTimeSpan": { \n "days": 1, \n "hours": 2, \n "minutes": 3 \n } \n }, \n { \n "name": "message-0003", \n "metadata": "piyo", \n "expiresAt": 1000 \n } \n ] \n }' )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.update_current_message_master ({
namespaceName = "namespace1" ,
settings = "{ \n " version ": " 2020 - 03 - 12 ", \n " globalMessages ": [ \n { \n " name ": " message - 0001 ", \n " metadata ": " hoge " \n }, \n { \n " name ": " message - 0002 ", \n " metadata ": " fuga ", \n " readAcquireActions ": [ \n { \n " action ": " Gs2Inventory : AcquireItemSetByUserId ", \n " request ": " Gs2Inventory : AcquireItemSetByUserId - request " \n } \n ], \n " expiresTimeSpan ": { \n " days ": 1, \n " hours ": 2, \n " minutes ": 3 \n } \n }, \n { \n " name ": " message - 0003 ", \n " metadata ": " piyo ", \n " expiresAt ": 1000 \n } \n ] \n }" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.update_current_message_master_async ({
namespaceName = "namespace1" ,
settings = "{ \n " version ": " 2020 - 03 - 12 ", \n " globalMessages ": [ \n { \n " name ": " message - 0001 ", \n " metadata ": " hoge " \n }, \n { \n " name ": " message - 0002 ", \n " metadata ": " fuga ", \n " readAcquireActions ": [ \n { \n " action ": " Gs2Inventory : AcquireItemSetByUserId ", \n " request ": " Gs2Inventory : AcquireItemSetByUserId - request " \n } \n ], \n " expiresTimeSpan ": { \n " days ": 1, \n " hours ": 2, \n " minutes ": 3 \n } \n }, \n { \n " name ": " message - 0003 ", \n " metadata ": " piyo ", \n " expiresAt ": 1000 \n } \n ] \n }" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
updateCurrentMessageMasterFromGitHub 現在有効なグローバルメッセージ設定を更新
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 checkoutSetting GitHubCheckoutSetting ✓ GitHubからマスターデータをチェックアウトしてくる設定
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . UpdateCurrentMessageMasterFromGitHub (
& inbox . UpdateCurrentMessageMasterFromGitHubRequest {
NamespaceName : pointy . String ( "namespace1" ),
CheckoutSetting : & inbox . GitHubCheckoutSetting {
ApiKeyId : pointy . String ( "$gitHubApiKey1.apiKeyId" ),
RepositoryName : pointy . String ( "gs2io/master-data" ),
SourcePath : pointy . String ( "path/to/file.json" ),
ReferenceType : pointy . String ( "branch" ),
BranchName : pointy . String ( "develop" ),
},
}
)
if err != nil {
panic ( "error occurred" )
}
item := result . Item
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Inbox\Gs2InboxRestClient ;
use Gs2\Inbox\Request\UpdateCurrentMessageMasterFromGitHubRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> updateCurrentMessageMasterFromGitHub (
( new UpdateCurrentMessageMasterFromGitHubRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withCheckoutSetting (( new GitHubCheckoutSetting ())
-> withApiKeyId ( self :: $gitHubApiKey1 . apiKeyId )
-> withRepositoryName ( "gs2io/master-data" )
-> withSourcePath ( "path/to/file.json" )
-> withReferenceType ( "branch" )
-> withBranchName ( "develop" )
)
);
$item = $result -> getItem ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.inbox.rest.Gs2InboxRestClient ;
import io.gs2.inbox.request.UpdateCurrentMessageMasterFromGitHubRequest ;
import io.gs2.inbox.result.UpdateCurrentMessageMasterFromGitHubResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
UpdateCurrentMessageMasterFromGitHubResult result = client . updateCurrentMessageMasterFromGitHub (
new UpdateCurrentMessageMasterFromGitHubRequest ()
. withNamespaceName ( "namespace1" )
. withCheckoutSetting ( new GitHubCheckoutSetting ()
. withApiKeyId ( "$gitHubApiKey1.apiKeyId" )
. withRepositoryName ( "gs2io/master-data" )
. withSourcePath ( "path/to/file.json" )
. withReferenceType ( "branch" )
. withBranchName ( "develop" )
)
);
CurrentMessageMaster 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.UpdateCurrentMessageMasterFromGitHubRequest ;
using Gs2.Gs2Inbox.Result.UpdateCurrentMessageMasterFromGitHubResult ;
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 . UpdateCurrentMessageMasterFromGitHubResult > asyncResult = null ;
yield return client . UpdateCurrentMessageMasterFromGitHub (
new Gs2 . Gs2Inbox . Request . UpdateCurrentMessageMasterFromGitHubRequest ()
. WithNamespaceName ( "namespace1" )
. WithCheckoutSetting ( new Gs2 . Gs2Inbox . Model . GitHubCheckoutSetting ()
. WithApiKeyId ( "$gitHubApiKey1.apiKeyId" )
. WithRepositoryName ( "gs2io/master-data" )
. WithSourcePath ( "path/to/file.json" )
. WithReferenceType ( "branch" )
. WithBranchName ( "develop" )
),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var item = result . Item ;
import Gs2Core from '@/gs2/core' ;
import * as 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 . updateCurrentMessageMasterFromGitHub (
new Gs2Inbox . UpdateCurrentMessageMasterFromGitHubRequest ()
. withNamespaceName ( "namespace1" )
. withCheckoutSetting ( new Gs2Inbox . model . GitHubCheckoutSetting ()
. withApiKeyId ( "$gitHubApiKey1.apiKeyId" )
. withRepositoryName ( "gs2io/master-data" )
. withSourcePath ( "path/to/file.json" )
. withReferenceType ( "branch" )
. withBranchName ( "develop" )
)
);
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_current_message_master_from_git_hub (
inbox . UpdateCurrentMessageMasterFromGitHubRequest ()
. with_namespace_name ( self . hash1 )
. with_checkout_setting ( inbox . GitHubCheckoutSetting ()
. with_api_key_id ( self . git_hub_api_key1 . api_key_id )
. with_repository_name ( 'gs2io/master-data' )
. with_source_path ( 'path/to/file.json' )
. with_reference_type ( 'branch' )
. with_branch_name ( 'develop' )
)
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.update_current_message_master_from_git_hub ({
namespaceName = "namespace1" ,
checkoutSetting = {
api_key_id = "$gitHubApiKey1.apiKeyId" ,
repository_name = "gs2io/master-data" ,
source_path = "path/to/file.json" ,
reference_type = "branch" ,
branch_name = "develop" ,
},
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.update_current_message_master_from_git_hub_async ({
namespaceName = "namespace1" ,
checkoutSetting = {
api_key_id = "$gitHubApiKey1.apiKeyId" ,
repository_name = "gs2io/master-data" ,
source_path = "path/to/file.json" ,
reference_type = "branch" ,
branch_name = "develop" ,
},
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
describeGlobalMessageMasters 全ユーザに向けたメッセージの一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン limit int ✓ 30 1 ~ 1000 データの取得件数
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . DescribeGlobalMessageMasters (
& inbox . DescribeGlobalMessageMastersRequest {
NamespaceName : pointy . String ( "namespace1" ),
PageToken : nil ,
Limit : nil ,
}
)
if err != nil {
panic ( "error occurred" )
}
items := result . Items
nextPageToken := result . NextPageToken
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Inbox\Gs2InboxRestClient ;
use Gs2\Inbox\Request\DescribeGlobalMessageMastersRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> describeGlobalMessageMasters (
( new DescribeGlobalMessageMastersRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withPageToken ( null )
-> withLimit ( null )
);
$items = $result -> getItems ();
$nextPageToken = $result -> getNextPageToken ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.inbox.rest.Gs2InboxRestClient ;
import io.gs2.inbox.request.DescribeGlobalMessageMastersRequest ;
import io.gs2.inbox.result.DescribeGlobalMessageMastersResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
DescribeGlobalMessageMastersResult result = client . describeGlobalMessageMasters (
new DescribeGlobalMessageMastersRequest ()
. withNamespaceName ( "namespace1" )
. withPageToken ( null )
. withLimit ( null )
);
List < GlobalMessageMaster > 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.DescribeGlobalMessageMastersRequest ;
using Gs2.Gs2Inbox.Result.DescribeGlobalMessageMastersResult ;
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 . DescribeGlobalMessageMastersResult > asyncResult = null ;
yield return client . DescribeGlobalMessageMasters (
new Gs2 . Gs2Inbox . Request . DescribeGlobalMessageMastersRequest ()
. WithNamespaceName ( "namespace1" )
. WithPageToken ( null )
. WithLimit ( null ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var items = result . Items ;
var nextPageToken = result . NextPageToken ;
import Gs2Core from '@/gs2/core' ;
import * as 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 . describeGlobalMessageMasters (
new Gs2Inbox . DescribeGlobalMessageMastersRequest ()
. withNamespaceName ( "namespace1" )
. withPageToken ( null )
. withLimit ( null )
);
const items = result . getItems ();
const nextPageToken = result . getNextPageToken ();
} catch ( e ) {
process . exit ( 1 );
}
from gs2 import core
from gs2 import 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_global_message_masters (
inbox . DescribeGlobalMessageMastersRequest ()
. with_namespace_name ( self . hash1 )
. with_page_token ( None )
. with_limit ( None )
)
items = result . items
next_page_token = result . next_page_token
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.describe_global_message_masters ({
namespaceName = "namespace1" ,
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 ;
client = gs2 ( 'inbox' )
api_result_handler = client.describe_global_message_masters_async ({
namespaceName = "namespace1" ,
pageToken = nil ,
limit = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
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 ;
createGlobalMessageMaster 全ユーザに向けたメッセージを新規作成
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 name string ✓ UUID ~ 64文字 全ユーザに向けたメッセージ名 metadata string ✓ ~ 4096文字 全ユーザに向けたメッセージの内容に相当するメタデータ readAcquireActions List<AcquireAction> [] ~ 100 items 開封時に実行する入手アクション expiresTimeSpan TimeSpan メッセージを受信したあとメッセージが削除されるまでの期間 expiresAt long 全ユーザに向けたメッセージの受信期限 (UNIX時間 単位:ミリ秒) messageReceptionPeriodEventId string ~ 1024文字 メッセージを受信可能な期間を設定した GS2-Schedule イベントGRN
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . CreateGlobalMessageMaster (
& inbox . CreateGlobalMessageMasterRequest {
NamespaceName : pointy . String ( "namespace1" ),
Name : pointy . String ( "globalMessageMaster-0001" ),
Metadata : pointy . String ( "{\"type\": \"globalMessageMaster\", \"body\": \"hello\"}" ),
ReadAcquireActions : [] inbox . AcquireAction {
inbox . AcquireAction {
Action : pointy . String ( "Gs2Inventory:AcquireItemSetByUserId" ),
Request : pointy . String ( "Gs2Inventory:AcquireItemSetByUserId-request" ),
},
},
ExpiresTimeSpan : nil ,
MessageReceptionPeriodEventId : 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\CreateGlobalMessageMasterRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> createGlobalMessageMaster (
( new CreateGlobalMessageMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withName ( "globalMessageMaster-0001" )
-> withMetadata ( "{ \" type \" : \" globalMessageMaster \" , \" body \" : \" hello \" }" )
-> withReadAcquireActions ([
( new \Gs2\Inbox\Model\AcquireAction ())
-> withAction ( "Gs2Inventory:AcquireItemSetByUserId" )
-> withRequest ( "Gs2Inventory:AcquireItemSetByUserId-request" ),
])
-> withExpiresTimeSpan ( null )
-> withMessageReceptionPeriodEventId ( 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.CreateGlobalMessageMasterRequest ;
import io.gs2.inbox.result.CreateGlobalMessageMasterResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
CreateGlobalMessageMasterResult result = client . createGlobalMessageMaster (
new CreateGlobalMessageMasterRequest ()
. withNamespaceName ( "namespace1" )
. withName ( "globalMessageMaster-0001" )
. withMetadata ( "{\"type\": \"globalMessageMaster\", \"body\": \"hello\"}" )
. withReadAcquireActions ( Arrays . asList (
new io . gs2 . inbox . model . AcquireAction ()
. withAction ( "Gs2Inventory:AcquireItemSetByUserId" )
. withRequest ( "Gs2Inventory:AcquireItemSetByUserId-request" )
))
. withExpiresTimeSpan ( null )
. withMessageReceptionPeriodEventId ( null )
);
GlobalMessageMaster 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.CreateGlobalMessageMasterRequest ;
using Gs2.Gs2Inbox.Result.CreateGlobalMessageMasterResult ;
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 . CreateGlobalMessageMasterResult > asyncResult = null ;
yield return client . CreateGlobalMessageMaster (
new Gs2 . Gs2Inbox . Request . CreateGlobalMessageMasterRequest ()
. WithNamespaceName ( "namespace1" )
. WithName ( "globalMessageMaster-0001" )
. WithMetadata ( "{\"type\": \"globalMessageMaster\", \"body\": \"hello\"}" )
. WithReadAcquireActions ( new Gs2 . Core . Model . AcquireAction [] {
new Gs2 . Core . Model . AcquireAction ()
. WithAction ( "Gs2Inventory:AcquireItemSetByUserId" )
. WithRequest ( "Gs2Inventory:AcquireItemSetByUserId-request" ),
})
. WithExpiresTimeSpan ( null )
. WithMessageReceptionPeriodEventId ( 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 . createGlobalMessageMaster (
new Gs2Inbox . CreateGlobalMessageMasterRequest ()
. withNamespaceName ( "namespace1" )
. withName ( "globalMessageMaster-0001" )
. withMetadata ( "{\"type\": \"globalMessageMaster\", \"body\": \"hello\"}" )
. withReadAcquireActions ([
new Gs2Inbox . model . AcquireAction ()
. withAction ( "Gs2Inventory:AcquireItemSetByUserId" )
. withRequest ( "Gs2Inventory:AcquireItemSetByUserId-request" ),
])
. withExpiresTimeSpan ( null )
. withMessageReceptionPeriodEventId ( 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 . create_global_message_master (
inbox . CreateGlobalMessageMasterRequest ()
. with_namespace_name ( self . hash1 )
. with_name ( 'globalMessageMaster-0001' )
. with_metadata ( '{"type": "globalMessageMaster", "body": "hello"}' )
. with_read_acquire_actions ([
inbox . AcquireAction ()
. with_action ( 'Gs2Inventory:AcquireItemSetByUserId' )
. with_request ( 'Gs2Inventory:AcquireItemSetByUserId-request' ),
])
. with_expires_time_span ( None )
. with_message_reception_period_event_id ( None )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.create_global_message_master ({
namespaceName = "namespace1" ,
name = "globalMessageMaster-0001" ,
metadata = "{ \" type \" : \" globalMessageMaster \" , \" body \" : \" hello \" }" ,
readAcquireActions = {
{
action = "Gs2Inventory:AcquireItemSetByUserId" ,
request = "Gs2Inventory:AcquireItemSetByUserId-request" ,
}
},
expiresTimeSpan = nil ,
messageReceptionPeriodEventId = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.create_global_message_master_async ({
namespaceName = "namespace1" ,
name = "globalMessageMaster-0001" ,
metadata = "{ \" type \" : \" globalMessageMaster \" , \" body \" : \" hello \" }" ,
readAcquireActions = {
{
action = "Gs2Inventory:AcquireItemSetByUserId" ,
request = "Gs2Inventory:AcquireItemSetByUserId-request" ,
}
},
expiresTimeSpan = nil ,
messageReceptionPeriodEventId = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
getGlobalMessageMaster 全ユーザに向けたメッセージを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 globalMessageName string ✓ UUID ~ 64文字 全ユーザに向けたメッセージ名
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . GetGlobalMessageMaster (
& inbox . GetGlobalMessageMasterRequest {
NamespaceName : pointy . String ( "namespace1" ),
GlobalMessageName : pointy . String ( "globalMessageMaster-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\GetGlobalMessageMasterRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getGlobalMessageMaster (
( new GetGlobalMessageMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withGlobalMessageName ( "globalMessageMaster-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.GetGlobalMessageMasterRequest ;
import io.gs2.inbox.result.GetGlobalMessageMasterResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
GetGlobalMessageMasterResult result = client . getGlobalMessageMaster (
new GetGlobalMessageMasterRequest ()
. withNamespaceName ( "namespace1" )
. withGlobalMessageName ( "globalMessageMaster-0001" )
);
GlobalMessageMaster 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.GetGlobalMessageMasterRequest ;
using Gs2.Gs2Inbox.Result.GetGlobalMessageMasterResult ;
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 . GetGlobalMessageMasterResult > asyncResult = null ;
yield return client . GetGlobalMessageMaster (
new Gs2 . Gs2Inbox . Request . GetGlobalMessageMasterRequest ()
. WithNamespaceName ( "namespace1" )
. WithGlobalMessageName ( "globalMessageMaster-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 . getGlobalMessageMaster (
new Gs2Inbox . GetGlobalMessageMasterRequest ()
. withNamespaceName ( "namespace1" )
. withGlobalMessageName ( "globalMessageMaster-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_global_message_master (
inbox . GetGlobalMessageMasterRequest ()
. with_namespace_name ( self . hash1 )
. with_global_message_name ( 'globalMessageMaster-0001' )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.get_global_message_master ({
namespaceName = "namespace1" ,
globalMessageName = "globalMessageMaster-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.get_global_message_master_async ({
namespaceName = "namespace1" ,
globalMessageName = "globalMessageMaster-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
updateGlobalMessageMaster 全ユーザに向けたメッセージを更新
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 globalMessageName string ✓ UUID ~ 64文字 全ユーザに向けたメッセージ名 metadata string ✓ ~ 4096文字 全ユーザに向けたメッセージの内容に相当するメタデータ readAcquireActions List<AcquireAction> [] ~ 100 items 開封時に実行する入手アクション expiresTimeSpan TimeSpan メッセージを受信したあとメッセージが削除されるまでの期間 expiresAt long 全ユーザに向けたメッセージの受信期限 (UNIX時間 単位:ミリ秒) messageReceptionPeriodEventId string ~ 1024文字 メッセージを受信可能な期間を設定した GS2-Schedule イベントGRN
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . UpdateGlobalMessageMaster (
& inbox . UpdateGlobalMessageMasterRequest {
NamespaceName : pointy . String ( "namespace1" ),
GlobalMessageName : pointy . String ( "globalMessageMaster-0001" ),
Metadata : pointy . String ( "{\"type\": \"globalMessageMaster2\", \"body\": \"hello2\"}" ),
ReadAcquireActions : [] inbox . AcquireAction {
inbox . AcquireAction {
Action : pointy . String ( "Gs2Inventory:AcquireItemSetByUserId2" ),
Request : pointy . String ( "Gs2Inventory:AcquireItemSetByUserId-request2" ),
},
},
ExpiresTimeSpan : & inbox . TimeSpan {
Days : pointy . Int32 ( 1 ),
Hours : pointy . Int32 ( 2 ),
Minutes : pointy . Int32 ( 3 ),
},
MessageReceptionPeriodEventId : 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\UpdateGlobalMessageMasterRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> updateGlobalMessageMaster (
( new UpdateGlobalMessageMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withGlobalMessageName ( "globalMessageMaster-0001" )
-> withMetadata ( "{ \" type \" : \" globalMessageMaster2 \" , \" body \" : \" hello2 \" }" )
-> withReadAcquireActions ([
( new \Gs2\Inbox\Model\AcquireAction ())
-> withAction ( "Gs2Inventory:AcquireItemSetByUserId2" )
-> withRequest ( "Gs2Inventory:AcquireItemSetByUserId-request2" ),
])
-> withExpiresTimeSpan (( new \Gs2\Inbox\Model\TimeSpan ())
-> withDays ( 1 )
-> withHours ( 2 )
-> withMinutes ( 3 ))
-> withMessageReceptionPeriodEventId ( 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.UpdateGlobalMessageMasterRequest ;
import io.gs2.inbox.result.UpdateGlobalMessageMasterResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
UpdateGlobalMessageMasterResult result = client . updateGlobalMessageMaster (
new UpdateGlobalMessageMasterRequest ()
. withNamespaceName ( "namespace1" )
. withGlobalMessageName ( "globalMessageMaster-0001" )
. withMetadata ( "{\"type\": \"globalMessageMaster2\", \"body\": \"hello2\"}" )
. withReadAcquireActions ( Arrays . asList (
new io . gs2 . inbox . model . AcquireAction ()
. withAction ( "Gs2Inventory:AcquireItemSetByUserId2" )
. withRequest ( "Gs2Inventory:AcquireItemSetByUserId-request2" )
))
. withExpiresTimeSpan ( new io . gs2 . inbox . model . TimeSpan ()
. withDays ( 1 )
. withHours ( 2 )
. withMinutes ( 3 ))
. withMessageReceptionPeriodEventId ( null )
);
GlobalMessageMaster 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.UpdateGlobalMessageMasterRequest ;
using Gs2.Gs2Inbox.Result.UpdateGlobalMessageMasterResult ;
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 . UpdateGlobalMessageMasterResult > asyncResult = null ;
yield return client . UpdateGlobalMessageMaster (
new Gs2 . Gs2Inbox . Request . UpdateGlobalMessageMasterRequest ()
. WithNamespaceName ( "namespace1" )
. WithGlobalMessageName ( "globalMessageMaster-0001" )
. WithMetadata ( "{\"type\": \"globalMessageMaster2\", \"body\": \"hello2\"}" )
. WithReadAcquireActions ( new Gs2 . Core . Model . AcquireAction [] {
new Gs2 . Core . Model . AcquireAction ()
. WithAction ( "Gs2Inventory:AcquireItemSetByUserId2" )
. WithRequest ( "Gs2Inventory:AcquireItemSetByUserId-request2" ),
})
. WithExpiresTimeSpan ( new Gs2 . Gs2Inbox . Model . TimeSpan_ ()
. WithDays ( 1 )
. WithHours ( 2 )
. WithMinutes ( 3 ))
. WithMessageReceptionPeriodEventId ( 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 . updateGlobalMessageMaster (
new Gs2Inbox . UpdateGlobalMessageMasterRequest ()
. withNamespaceName ( "namespace1" )
. withGlobalMessageName ( "globalMessageMaster-0001" )
. withMetadata ( "{\"type\": \"globalMessageMaster2\", \"body\": \"hello2\"}" )
. withReadAcquireActions ([
new Gs2Inbox . model . AcquireAction ()
. withAction ( "Gs2Inventory:AcquireItemSetByUserId2" )
. withRequest ( "Gs2Inventory:AcquireItemSetByUserId-request2" ),
])
. withExpiresTimeSpan ( new Gs2Inbox . model . TimeSpan ()
. withDays ( 1 )
. withHours ( 2 )
. withMinutes ( 3 ))
. withMessageReceptionPeriodEventId ( 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 . update_global_message_master (
inbox . UpdateGlobalMessageMasterRequest ()
. with_namespace_name ( self . hash1 )
. with_global_message_name ( 'globalMessageMaster-0001' )
. with_metadata ( '{"type": "globalMessageMaster2", "body": "hello2"}' )
. with_read_acquire_actions ([
inbox . AcquireAction ()
. with_action ( 'Gs2Inventory:AcquireItemSetByUserId2' )
. with_request ( 'Gs2Inventory:AcquireItemSetByUserId-request2' ),
])
. with_expires_time_span (
inbox . TimeSpan ()
. with_days ( 1 )
. with_hours ( 2 )
. with_minutes ( 3 ))
. with_message_reception_period_event_id ( None )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.update_global_message_master ({
namespaceName = "namespace1" ,
globalMessageName = "globalMessageMaster-0001" ,
metadata = "{ \" type \" : \" globalMessageMaster2 \" , \" body \" : \" hello2 \" }" ,
readAcquireActions = {
{
action = "Gs2Inventory:AcquireItemSetByUserId2" ,
request = "Gs2Inventory:AcquireItemSetByUserId-request2" ,
}
},
expiresTimeSpan = {
days = 1 ,
hours = 2 ,
minutes = 3 ,
},
messageReceptionPeriodEventId = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.update_global_message_master_async ({
namespaceName = "namespace1" ,
globalMessageName = "globalMessageMaster-0001" ,
metadata = "{ \" type \" : \" globalMessageMaster2 \" , \" body \" : \" hello2 \" }" ,
readAcquireActions = {
{
action = "Gs2Inventory:AcquireItemSetByUserId2" ,
request = "Gs2Inventory:AcquireItemSetByUserId-request2" ,
}
},
expiresTimeSpan = {
days = 1 ,
hours = 2 ,
minutes = 3 ,
},
messageReceptionPeriodEventId = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
deleteGlobalMessageMaster 全ユーザに向けたメッセージを削除
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 globalMessageName string ✓ UUID ~ 64文字 全ユーザに向けたメッセージ名
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . DeleteGlobalMessageMaster (
& inbox . DeleteGlobalMessageMasterRequest {
NamespaceName : pointy . String ( "namespace1" ),
GlobalMessageName : pointy . String ( "globalMessageMaster-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\DeleteGlobalMessageMasterRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> deleteGlobalMessageMaster (
( new DeleteGlobalMessageMasterRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withGlobalMessageName ( "globalMessageMaster-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.DeleteGlobalMessageMasterRequest ;
import io.gs2.inbox.result.DeleteGlobalMessageMasterResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
DeleteGlobalMessageMasterResult result = client . deleteGlobalMessageMaster (
new DeleteGlobalMessageMasterRequest ()
. withNamespaceName ( "namespace1" )
. withGlobalMessageName ( "globalMessageMaster-0001" )
);
GlobalMessageMaster 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.DeleteGlobalMessageMasterRequest ;
using Gs2.Gs2Inbox.Result.DeleteGlobalMessageMasterResult ;
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 . DeleteGlobalMessageMasterResult > asyncResult = null ;
yield return client . DeleteGlobalMessageMaster (
new Gs2 . Gs2Inbox . Request . DeleteGlobalMessageMasterRequest ()
. WithNamespaceName ( "namespace1" )
. WithGlobalMessageName ( "globalMessageMaster-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 . deleteGlobalMessageMaster (
new Gs2Inbox . DeleteGlobalMessageMasterRequest ()
. withNamespaceName ( "namespace1" )
. withGlobalMessageName ( "globalMessageMaster-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 . delete_global_message_master (
inbox . DeleteGlobalMessageMasterRequest ()
. with_namespace_name ( self . hash1 )
. with_global_message_name ( 'globalMessageMaster-0001' )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.delete_global_message_master ({
namespaceName = "namespace1" ,
globalMessageName = "globalMessageMaster-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.delete_global_message_master_async ({
namespaceName = "namespace1" ,
globalMessageName = "globalMessageMaster-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
describeGlobalMessages 全ユーザに向けたメッセージの一覧を取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . DescribeGlobalMessages (
& inbox . DescribeGlobalMessagesRequest {
NamespaceName : pointy . String ( "namespace1" ),
}
)
if err != nil {
panic ( "error occurred" )
}
items := result . Items
use Gs2\Core\Model\BasicGs2Credential ;
use Gs2\Core\Model\Region ;
use Gs2\Core\Net\Gs2RestSession ;
use Gs2\Core\Exception\Gs2Exception ;
use Gs2\Inbox\Gs2InboxRestClient ;
use Gs2\Inbox\Request\DescribeGlobalMessagesRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> describeGlobalMessages (
( new DescribeGlobalMessagesRequest ())
-> withNamespaceName ( self :: namespace1 )
);
$items = $result -> getItems ();
} catch ( Gs2Exception $e ) {
exit ( "error occurred" )
}
import io.gs2.core.model.Region ;
import io.gs2.core.model.BasicGs2Credential ;
import io.gs2.core.rest.Gs2RestSession ;
import io.gs2.core.exception.Gs2Exception ;
import io.gs2.inbox.rest.Gs2InboxRestClient ;
import io.gs2.inbox.request.DescribeGlobalMessagesRequest ;
import io.gs2.inbox.result.DescribeGlobalMessagesResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
DescribeGlobalMessagesResult result = client . describeGlobalMessages (
new DescribeGlobalMessagesRequest ()
. withNamespaceName ( "namespace1" )
);
List < GlobalMessage > items = result . getItems ();
} catch ( Gs2Exception e ) {
System . exit ( 1 );
}
using Gs2.Core.Model.Region ;
using Gs2.Core.Model.BasicGs2Credential ;
using Gs2.Core.Net.Gs2RestSession ;
using Gs2.Core.Exception.Gs2Exception ;
using Gs2.Core.AsyncResult ;
using Gs2.Gs2Inbox.Gs2InboxRestClient ;
using Gs2.Gs2Inbox.Request.DescribeGlobalMessagesRequest ;
using Gs2.Gs2Inbox.Result.DescribeGlobalMessagesResult ;
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 . DescribeGlobalMessagesResult > asyncResult = null ;
yield return client . DescribeGlobalMessages (
new Gs2 . Gs2Inbox . Request . DescribeGlobalMessagesRequest ()
. WithNamespaceName ( "namespace1" ),
r => asyncResult = r
);
if ( asyncResult . Error != null ) {
throw asyncResult . Error ;
}
var result = asyncResult . Result ;
var items = result . Items ;
import Gs2Core from '@/gs2/core' ;
import * as 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 . describeGlobalMessages (
new Gs2Inbox . DescribeGlobalMessagesRequest ()
. withNamespaceName ( "namespace1" )
);
const items = result . getItems ();
} 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_global_messages (
inbox . DescribeGlobalMessagesRequest ()
. with_namespace_name ( self . hash1 )
)
items = result . items
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.describe_global_messages ({
namespaceName = "namespace1" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
client = gs2 ( 'inbox' )
api_result_handler = client.describe_global_messages_async ({
namespaceName = "namespace1" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
items = result.items ;
getGlobalMessage 全ユーザに向けたメッセージを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 globalMessageName string ✓ ~ 128文字 全ユーザに向けたメッセージ名
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . GetGlobalMessage (
& inbox . GetGlobalMessageRequest {
NamespaceName : pointy . String ( "namespace1" ),
GlobalMessageName : pointy . String ( "globalMessage-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\GetGlobalMessageRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getGlobalMessage (
( new GetGlobalMessageRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withGlobalMessageName ( "globalMessage-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.GetGlobalMessageRequest ;
import io.gs2.inbox.result.GetGlobalMessageResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
GetGlobalMessageResult result = client . getGlobalMessage (
new GetGlobalMessageRequest ()
. withNamespaceName ( "namespace1" )
. withGlobalMessageName ( "globalMessage-0001" )
);
GlobalMessage 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.GetGlobalMessageRequest ;
using Gs2.Gs2Inbox.Result.GetGlobalMessageResult ;
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 . GetGlobalMessageResult > asyncResult = null ;
yield return client . GetGlobalMessage (
new Gs2 . Gs2Inbox . Request . GetGlobalMessageRequest ()
. WithNamespaceName ( "namespace1" )
. WithGlobalMessageName ( "globalMessage-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 . getGlobalMessage (
new Gs2Inbox . GetGlobalMessageRequest ()
. withNamespaceName ( "namespace1" )
. withGlobalMessageName ( "globalMessage-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_global_message (
inbox . GetGlobalMessageRequest ()
. with_namespace_name ( self . hash1 )
. with_global_message_name ( 'globalMessage-0001' )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.get_global_message ({
namespaceName = "namespace1" ,
globalMessageName = "globalMessage-0001" ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.get_global_message_async ({
namespaceName = "namespace1" ,
globalMessageName = "globalMessage-0001" ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
getReceivedByUserId ユーザーIDを指定して受信済みグローバルメッセージを取得
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . GetReceivedByUserId (
& inbox . GetReceivedByUserIdRequest {
NamespaceName : pointy . String ( "namespace1" ),
UserId : pointy . String ( "user-0001" ),
TimeOffsetToken : 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\GetReceivedByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> getReceivedByUserId (
( new GetReceivedByUserIdRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withUserId ( "user-0001" )
-> withTimeOffsetToken ( 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.GetReceivedByUserIdRequest ;
import io.gs2.inbox.result.GetReceivedByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
GetReceivedByUserIdResult result = client . getReceivedByUserId (
new GetReceivedByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
Received 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.GetReceivedByUserIdRequest ;
using Gs2.Gs2Inbox.Result.GetReceivedByUserIdResult ;
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 . GetReceivedByUserIdResult > asyncResult = null ;
yield return client . GetReceivedByUserId (
new Gs2 . Gs2Inbox . Request . GetReceivedByUserIdRequest ()
. WithNamespaceName ( "namespace1" )
. WithUserId ( "user-0001" )
. WithTimeOffsetToken ( 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 . getReceivedByUserId (
new Gs2Inbox . GetReceivedByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withTimeOffsetToken ( 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 . get_received_by_user_id (
inbox . GetReceivedByUserIdRequest ()
. with_namespace_name ( self . hash1 )
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.get_received_by_user_id ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.get_received_by_user_id_async ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
updateReceivedByUserId ユーザーIDを指定して受信済みグローバルメッセージを更新
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 userId string ✓ ~ 128文字 ユーザーID receivedGlobalMessageNames List<string> [] ~ 100 items 受信したグローバルメッセージ名 timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . UpdateReceivedByUserId (
& inbox . UpdateReceivedByUserIdRequest {
NamespaceName : pointy . String ( "namespace1" ),
UserId : pointy . String ( "user-0001" ),
ReceivedGlobalMessageNames : [] * string {
pointy . String ( "message-3001" ),
pointy . String ( "message-3002" ),
pointy . String ( "message-3003" ),
},
TimeOffsetToken : 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\UpdateReceivedByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> updateReceivedByUserId (
( new UpdateReceivedByUserIdRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withUserId ( "user-0001" )
-> withReceivedGlobalMessageNames ([
"message-3001" ,
"message-3002" ,
"message-3003" ,
])
-> withTimeOffsetToken ( 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.UpdateReceivedByUserIdRequest ;
import io.gs2.inbox.result.UpdateReceivedByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
UpdateReceivedByUserIdResult result = client . updateReceivedByUserId (
new UpdateReceivedByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withReceivedGlobalMessageNames ( Arrays . asList (
"message-3001" ,
"message-3002" ,
"message-3003"
))
. withTimeOffsetToken ( null )
);
Received 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.UpdateReceivedByUserIdRequest ;
using Gs2.Gs2Inbox.Result.UpdateReceivedByUserIdResult ;
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 . UpdateReceivedByUserIdResult > asyncResult = null ;
yield return client . UpdateReceivedByUserId (
new Gs2 . Gs2Inbox . Request . UpdateReceivedByUserIdRequest ()
. WithNamespaceName ( "namespace1" )
. WithUserId ( "user-0001" )
. WithReceivedGlobalMessageNames ( new string [] {
"message-3001" ,
"message-3002" ,
"message-3003" ,
})
. WithTimeOffsetToken ( 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 . updateReceivedByUserId (
new Gs2Inbox . UpdateReceivedByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withReceivedGlobalMessageNames ([
"message-3001" ,
"message-3002" ,
"message-3003" ,
])
. withTimeOffsetToken ( 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 . update_received_by_user_id (
inbox . UpdateReceivedByUserIdRequest ()
. with_namespace_name ( self . hash1 )
. with_user_id ( 'user-0001' )
. with_received_global_message_names ([
'message-3001' ,
'message-3002' ,
'message-3003' ,
])
. with_time_offset_token ( None )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.update_received_by_user_id ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
receivedGlobalMessageNames = {
"message-3001" ,
"message-3002" ,
"message-3003"
},
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.update_received_by_user_id_async ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
receivedGlobalMessageNames = {
"message-3001" ,
"message-3002" ,
"message-3003"
},
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
deleteReceivedByUserId ユーザーIDを指定して受信済みグローバルメッセージを削除
Request 型 有効化条件 必須 デフォルト 値の制限 説明 namespaceName string ✓ ~ 128文字 ネームスペース名 userId string ✓ ~ 128文字 ユーザーID timeOffsetToken string ~ 1024文字 タイムオフセットトークン
Result 実装例
Language:
Go
PHP
Java
C#
TypeScript
Python
GS2-Script
GS2-Script(Async) 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 . DeleteReceivedByUserId (
& inbox . DeleteReceivedByUserIdRequest {
NamespaceName : pointy . String ( "namespace1" ),
UserId : pointy . String ( "user-0001" ),
TimeOffsetToken : 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\DeleteReceivedByUserIdRequest ;
$session = new Gs2RestSession (
new BasicGs2Credential (
"your client id" ,
"your client secret"
),
Region :: AP_NORTHEAST_1
);
$session -> open ();
$client = new Gs2AccountRestClient (
$session
);
try {
$result = $client -> deleteReceivedByUserId (
( new DeleteReceivedByUserIdRequest ())
-> withNamespaceName ( self :: namespace1 )
-> withUserId ( "user-0001" )
-> withTimeOffsetToken ( 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.DeleteReceivedByUserIdRequest ;
import io.gs2.inbox.result.DeleteReceivedByUserIdResult ;
Gs2RestSession session = new Gs2RestSession (
Region . AP_NORTHEAST_1 ,
new BasicGs2Credential (
' your client id ' ,
' your client secret '
)
);
session . connect ();
Gs2InboxRestClient client = new Gs2InboxRestClient ( session );
try {
DeleteReceivedByUserIdResult result = client . deleteReceivedByUserId (
new DeleteReceivedByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withTimeOffsetToken ( null )
);
Received 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.DeleteReceivedByUserIdRequest ;
using Gs2.Gs2Inbox.Result.DeleteReceivedByUserIdResult ;
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 . DeleteReceivedByUserIdResult > asyncResult = null ;
yield return client . DeleteReceivedByUserId (
new Gs2 . Gs2Inbox . Request . DeleteReceivedByUserIdRequest ()
. WithNamespaceName ( "namespace1" )
. WithUserId ( "user-0001" )
. WithTimeOffsetToken ( 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 . deleteReceivedByUserId (
new Gs2Inbox . DeleteReceivedByUserIdRequest ()
. withNamespaceName ( "namespace1" )
. withUserId ( "user-0001" )
. withTimeOffsetToken ( 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 . delete_received_by_user_id (
inbox . DeleteReceivedByUserIdRequest ()
. with_namespace_name ( self . hash1 )
. with_user_id ( 'user-0001' )
. with_time_offset_token ( None )
)
item = result . item
except core . Gs2Exception as e :
exit ( 1 )
client = gs2 ( 'inbox' )
api_result = client.delete_received_by_user_id ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
timeOffsetToken = nil ,
})
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;
client = gs2 ( 'inbox' )
api_result_handler = client.delete_received_by_user_id_async ({
namespaceName = "namespace1" ,
userId = "user-0001" ,
timeOffsetToken = nil ,
})
api_result = api_result_handler () -- Call the handler to get the result
if ( api_result.isError ) then
-- When error occurs
fail ( api_result [ 'statusCode' ], api_result [ 'message' ])
end
result = api_result.result
item = result.item ;