GS2-Inbox SDK API Reference

Specification of models and API references for GS2-Inbox SDK for various programming languages

Model

Namespace

Namespace

A Namespace allows multiple independent instances of the same service within a single project by separating data spaces and usage contexts. Each GS2 service is managed on a per-namespace basis. Even when using the same service, if the namespace differs, the data is treated as a completely independent data space.

Therefore, you must create a namespace before you can start using each service.

Details
TypeConditionRequiredDefaultValue LimitsDescription
namespaceIdstring
*
~ 1024 charsNamespace GRN
* Set automatically by the server
namestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
descriptionstring~ 1024 charsDescription
isAutomaticDeletingEnabledboolfalseAutomatic Deletion
When enabled, messages are automatically removed from the user’s message list after they are opened (read). This keeps the inbox clean by removing claimed messages without requiring an explicit delete operation from the client. When disabled, opened messages remain in the list until manually deleted.
transactionSettingTransactionSettingTransaction Setting
Configuration for distributed transaction processing (transactions) used when granting rewards attached to messages. When a message with readAcquireActions is opened, transactions are generated and executed to deliver the rewards. Supports auto-run, atomic commit, and asynchronous processing.
receiveMessageScriptScriptSettingScript to run when a message is received
Script Trigger Reference - receiveMessage
readMessageScriptScriptSettingScript to run when a message is opened
Script Trigger Reference - readMessage
deleteMessageScriptScriptSettingScript to run when a message is deleted
Script Trigger Reference - deleteMessage
receiveNotificationNotificationSettingReceive Notification
Push notification settings triggered when a new message is delivered to a user’s inbox. Uses GS2-Gateway to send real-time notifications to the game client, allowing the UI to display a new message indicator or refresh the inbox without polling.
logSettingLogSettingLog Output Setting
Specifies the GS2-Log namespace for outputting API request and response logs related to message operations. Useful for tracking message delivery, opening, reward claims, and deletion for auditing and debugging purposes.
createdAtlong
*
NowDatetime of creation
Unix time, milliseconds
* Set automatically by the server
updatedAtlong
*
NowDatetime of last update
Unix time, milliseconds
* Set automatically by the server
revisionlong00 ~ 9223372036854775805Revision

TransactionSetting

Transaction Setting

Transaction Setting controls how transactions are executed, including their consistency, asynchronous processing, and conflict avoidance mechanisms. Combining features like AutoRun, AtomicCommit, asynchronous execution using GS2-Distributor, batch application of script results, and asynchronous Acquire Actions via GS2-JobQueue enables robust transaction management tailored to game logic.

Details
TypeConditionRequiredDefaultValue LimitsDescription
enableAutoRunboolfalseWhether to automatically execute issued transactions on the server side
enableAtomicCommitbool{enableAutoRun} == truefalseWhether to commit the execution of transactions atomically
* Applicable only if enableAutoRun is true
transactionUseDistributorbool{enableAtomicCommit} == truefalseWhether to execute transactions asynchronously
* Applicable only if enableAtomicCommit is true
commitScriptResultInUseDistributorbool{transactionUseDistributor} == truefalseWhether to execute the commit processing of the script result asynchronously
* Applicable only if transactionUseDistributor is true
acquireActionUseJobQueuebool{enableAtomicCommit} == truefalseWhether to use GS2-JobQueue to execute the acquire action
* Applicable only if enableAtomicCommit is true
distributorNamespaceIdstring“grn:gs2:{region}:{ownerId}:distributor:default”~ 1024 charsGS2-Distributor Namespace GRN used to execute transactions
queueNamespaceIdstring“grn:gs2:{region}:{ownerId}:queue:default”~ 1024 charsGS2-JobQueue Namespace GRN used to execute transactions

ScriptSetting

Script Setting

In GS2, you can associate custom scripts with microservice events and execute them. This model holds the settings for triggering script execution.

There are two main ways to execute a script: synchronous execution and asynchronous execution. Synchronous execution blocks processing until the script has finished executing. Instead, you can use the script’s execution results to halt API execution or control the API’s response content.

In contrast, asynchronous execution does not block processing until the script has finished executing. However, because the script result cannot be used to stop the API execution or modify the API response, asynchronous execution does not affect the API response flow and is generally recommended.

There are two types of asynchronous execution methods: GS2-Script and Amazon EventBridge. By using Amazon EventBridge, you can write processing in languages other than Lua.

Details
TypeConditionRequiredDefaultValue LimitsDescription
triggerScriptIdstring~ 1024 charsGS2-Script script GRN executed synchronously when the API is executed
Must be specified in GRN format starting with “grn:gs2:”.
doneTriggerTargetTypeString Enum
enum {
  “none”,
  “gs2_script”,
  “aws”
}
“none”How to execute asynchronous scripts
Specifies the type of script to use for asynchronous execution.
You can choose from “Do not use asynchronous execution (none)”, “Use GS2-Script (gs2_script)”, and “Use Amazon EventBridge (aws)”.
DefinitionDescription
“none”None
“gs2_script”GS2-Script
“aws”Amazon EventBridge
doneTriggerScriptIdstring{doneTriggerTargetType} == “gs2_script”~ 1024 charsGS2-Script script GRN for asynchronous execution
Must be specified in GRN format starting with “grn:gs2:”.
* Applicable only if doneTriggerTargetType is “gs2_script”
doneTriggerQueueNamespaceIdstring{doneTriggerTargetType} == “gs2_script”~ 1024 charsGS2-JobQueue namespace GRN to execute asynchronous execution scripts
If you want to execute asynchronous execution scripts via GS2-JobQueue instead of executing them directly, specify the GS2-JobQueue namespace GRN.
There are not many cases where GS2-JobQueue is required, so you generally do not need to specify it unless you have a specific reason.
* Applicable only if doneTriggerTargetType is “gs2_script”

NotificationSetting

Push Notification Settings

This is a setting for sending push notifications when an event occurs in a GS2 microservice. The push notification here refers to the processing via the WebSocket interface provided by GS2-Gateway, and is different from the push notification of a smartphone. For example, when a matchmaking is completed or a friend request is received, the GS2-Gateway can send a push notification via the WebSocket interface, and the game client can detect the change of the state.

GS2-Gateway’s push notifications can be used to forward notifications to mobile push notification services when the destination device is offline. By properly utilizing mobile push notifications, you can implement a flow in which players are notified even if they exit the game during matchmaking and later return to it.

Details
TypeConditionRequiredDefaultValue LimitsDescription
gatewayNamespaceIdstring“grn:gs2:{region}:{ownerId}:gateway:default”~ 1024 charsGS2-Gateway namespace to use for push notifications
Specify the GS2-Gateway namespace ID in GRN format starting with “grn:gs2:”.
enableTransferMobileNotificationbool?falseWhether to forward the notification as a mobile push notification
When this notification is sent and the destination device is offline, specify whether to forward it as a mobile push notification.
soundstring{enableTransferMobileNotification} == true~ 1024 charsSound file name to be used for mobile push notifications
The sound file name specified here is used when sending mobile push notifications, and you can send notifications with a special sound.
* Applicable only if enableTransferMobileNotification is true
enableString Enum
enum {
  “Enabled”,
  “Disabled”
}
“Enabled”Whether to enable push notifications
DefinitionDescription
“Enabled”Enabled
“Disabled”Disabled

LogSetting

Log Output Setting

Log Output Setting defines how log data is exported. This type holds the GS2-Log namespace identifier (Namespace ID) used to export log data. Specify the GS2-Log namespace where log data is collected and stored in the GRN format for the Log Namespace ID (loggingNamespaceId). Configuring this setting ensures that log data for API requests and responses occurring within the specified namespace is output to the target GS2-Log namespace. GS2-Log provides real-time logs that can be used for system monitoring, analysis, debugging, and other operational purposes.

Details
TypeConditionRequiredDefaultValue LimitsDescription
loggingNamespaceIdstring
~ 1024 charsGS2-Log namespace GRN to output logs
Must be specified in GRN format starting with “grn:gs2:”.

GitHubCheckoutSetting

Setup to check out master data from GitHub

Details
TypeConditionRequiredDefaultValue LimitsDescription
apiKeyIdstring
~ 1024 charsGitHub API Key GRN
repositoryNamestring
~ 1024 charsRepository Name
sourcePathstring
~ 1024 charsMaster data (JSON) file path
referenceTypeString Enum
enum {
  “commit_hash”,
  “branch”,
  “tag”
}
Source of code
DefinitionDescription
“commit_hash”Commit hash
“branch”Branch
“tag”Tag
commitHashstring{referenceType} == “commit_hash”
✓*
~ 1024 charsCommit hash
* Required if referenceType is “commit_hash”
branchNamestring{referenceType} == “branch”
✓*
~ 1024 charsBranch Name
* Required if referenceType is “branch”
tagNamestring{referenceType} == “tag”
✓*
~ 1024 charsTag Name
* Required if referenceType is “tag”

Message

Message

Message data delivered to a message box prepared for each game player.

Messages have an open state, and you can set an Acquire Action to be executed when opened. Messages can be set to expire, and messages that expire are automatically deleted regardless of whether they are unread or read after opening. Messages will be deleted even if you have not received the attached reward.

Details
TypeConditionRequiredDefaultValue LimitsDescription
messageIdstring
*
~ 1024 charsMessage GRN
* Set automatically by the server
namestring
UUID~ 36 charsMessage Name
Maintains a unique name for each message.
Names are automatically generated in UUID (Universally Unique Identifier) format and used to identify each message.
userIdstring
~ 128 charsUser ID
metadatastring
~ 4096 charsMetadata
Arbitrary data representing the message content, such as a JSON string containing the message title, body text, sender information, and display parameters. GS2 does not interpret this value; it is passed through to the game client for rendering the message UI. Maximum 4096 characters.
isReadboolfalseRead Status
Indicates whether the message has been opened by the user. When a message is opened, this flag is set to true, the readAcquireActions are executed to deliver attached rewards, and the readAt timestamp is recorded. If isAutomaticDeletingEnabled is set on the namespace, the message is deleted after being read.
readAcquireActionsList<AcquireAction>[]0 ~ 100 itemsRead Acquire Actions
The list of acquire actions executed when the user opens this message. Used to attach rewards such as items, currency, or resources to messages. Multiple actions can be combined to grant different reward types simultaneously. Up to 100 actions per message.
receivedAtlong
*
NowDatetime of creation
Unix time, milliseconds
* Set automatically by the server
readAtlong0Datetime of read
Unix time, milliseconds
expiresAtlongDatetime of ttl
Unix time, milliseconds
revisionlong00 ~ 9223372036854775805Revision

GlobalMessage

Global Message

Global Message is a mechanism for delivering messages to all game players.

Global messages can have an expiration time, and each game player can receive a Global Message by executing the process of receiving a Global Message. Unreceived Global Messages within the validity period are copied to the player’s message box.

Details
TypeConditionRequiredDefaultValue LimitsDescription
globalMessageIdstring
*
~ 1024 charsMessage GRN to all users
* Set automatically by the server
namestring
~ 128 charsGlobal Message name
Global Message-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadatastring
~ 4096 charsMetadata
Arbitrary data representing the global message content, such as a JSON string containing the message title, body text, and display parameters. When a user receives this global message, the metadata is copied to the individual message in their inbox. GS2 does not interpret this value. Maximum 4096 characters.
readAcquireActionsList<AcquireAction>[]0 ~ 100 itemsRead Acquire Actions
The list of acquire actions to be executed when a user opens the message copied from this global message. These actions are copied along with the metadata to each user’s individual message. Up to 100 actions per global message.
expiresTimeSpanTimeSpanExpiration Time Span
The duration from the time a user receives (copies) this global message until the copied message expires and is automatically deleted from their inbox. Specified as a combination of days, hours, and minutes. Messages are deleted regardless of read status when the expiration is reached, including any unclaimed attached rewards.
messageReceptionPeriodEventIdstring~ 1024 charsMessage Reception Period Event ID
The GRN of a GS2-Schedule event that defines the time window during which this global message can be received (copied to users’ inboxes). Outside this period, the global message is not delivered even if a user triggers the receive global messages operation. Useful for time-limited event announcements or seasonal campaign rewards.

Received

Received Global Message

Tracks which global messages a user has already received to prevent duplicate delivery. When a user triggers the receive global messages operation, the system checks this record to skip already-received messages. Each user has one Received record that accumulates the names of all global messages they have copied to their inbox.

Details
TypeConditionRequiredDefaultValue LimitsDescription
receivedIdstring
*
~ 1024 charsReceived Global Message name GRN
* Set automatically by the server
userIdstring
~ 128 charsUser ID
receivedGlobalMessageNamesList<string>[]0 ~ 100 itemsReceived Global Message Names
The list of global message names that the user has already received. When the receive global messages operation is executed, messages whose names appear in this list are skipped.
createdAtlong
*
NowDatetime of creation
Unix time, milliseconds
* Set automatically by the server
updatedAtlong
*
NowDatetime of last update
Unix time, milliseconds
* Set automatically by the server
revisionlong00 ~ 9223372036854775805Revision

TimeSpan

Time Span

Represents a duration of time as a combination of days, hours, and minutes. Used to define the expiration period for messages relative to their reception time. For example, a TimeSpan of 7 days, 0 hours, 0 minutes means the message expires exactly one week after the user receives it.

Details
TypeConditionRequiredDefaultValue LimitsDescription
daysint00 ~ 365Days
The number of days in this time span. Combined with hours and minutes to calculate the total duration. Maximum 365 days.
hoursint00 ~ 24Hours
The number of hours in this time span. Combined with days and minutes to calculate the total duration. Maximum 24 hours.
minutesint00 ~ 60Minutes
The number of minutes in this time span. Combined with days and hours to calculate the total duration. Maximum 60 minutes.

AcquireAction

Acquire Action

Represents a single acquire action attached to a message as a reward. Consists of an action type (e.g., add items to inventory, increase currency) and its request parameters. When a message is opened, these actions are assembled into transactions and executed to deliver the rewards to the user.

Details
TypeConditionRequiredDefaultValue LimitsDescription
actionString Enum
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",
"Gs2Schedule:ExtendTriggerByUserId",
"Gs2Script:InvokeScript",
"Gs2SerialKey:RevertUseByUserId",
"Gs2SerialKey:IssueOnce",
"Gs2Showcase:DecrementPurchaseCountByUserId",
"Gs2Showcase:ForceReDrawByUserId",
"Gs2SkillTree:MarkReleaseByUserId",
"Gs2Stamina:RecoverStaminaByUserId",
"Gs2Stamina:RaiseMaxValueByUserId",
"Gs2Stamina:SetMaxValueByUserId",
"Gs2Stamina:SetRecoverIntervalByUserId",
"Gs2Stamina:SetRecoverValueByUserId",
"Gs2StateMachine:StartStateMachineByUserId",
}
Type of action to be executed in the Acquire Action
requeststring
~ 524288 charsJSON string of the request used when executing the action

Config

Configuration

Configuration values applied to transaction variables

Details
TypeConditionRequiredDefaultValue LimitsDescription
keystring
~ 64 charsName
valuestring~ 51200 charsValue

VerifyActionResult

Verify Action execution result

Details
TypeConditionRequiredDefaultValue LimitsDescription
actionString Enum
enum {
"Gs2Dictionary:VerifyEntryByUserId",
"Gs2Distributor:IfExpressionByUserId",
"Gs2Distributor:AndExpressionByUserId",
"Gs2Distributor:OrExpressionByUserId",
"Gs2Enchant:VerifyRarityParameterStatusByUserId",
"Gs2Experience:VerifyRankByUserId",
"Gs2Experience:VerifyRankCapByUserId",
"Gs2Grade:VerifyGradeByUserId",
"Gs2Grade:VerifyGradeUpMaterialByUserId",
"Gs2Guild:VerifyCurrentMaximumMemberCountByGuildName",
"Gs2Guild:VerifyIncludeMemberByUserId",
"Gs2Inventory:VerifyInventoryCurrentMaxCapacityByUserId",
"Gs2Inventory:VerifyItemSetByUserId",
"Gs2Inventory:VerifyReferenceOfByUserId",
"Gs2Inventory:VerifySimpleItemByUserId",
"Gs2Inventory:VerifyBigItemByUserId",
"Gs2Limit:VerifyCounterByUserId",
"Gs2Matchmaking:VerifyIncludeParticipantByUserId",
"Gs2Mission:VerifyCompleteByUserId",
"Gs2Mission:VerifyCounterValueByUserId",
"Gs2Ranking2:VerifyGlobalRankingScoreByUserId",
"Gs2Ranking2:VerifyClusterRankingScoreByUserId",
"Gs2Ranking2:VerifySubscribeRankingScoreByUserId",
"Gs2Schedule:VerifyTriggerByUserId",
"Gs2Schedule:VerifyEventByUserId",
"Gs2SerialKey:VerifyCodeByUserId",
"Gs2Stamina:VerifyStaminaValueByUserId",
"Gs2Stamina:VerifyStaminaMaxValueByUserId",
"Gs2Stamina:VerifyStaminaRecoverIntervalMinutesByUserId",
"Gs2Stamina:VerifyStaminaRecoverValueByUserId",
"Gs2Stamina:VerifyStaminaOverflowValueByUserId",
}
Type of action to be executed in the Verify Action
verifyRequeststring
~ 524288 charsJSON string of the request used when executing the action
statusCodeint0 ~ 999Status code
verifyResultstring~ 1048576 charsResult payload

ConsumeActionResult

Consume Action execution result

Details
TypeConditionRequiredDefaultValue LimitsDescription
actionString Enum
enum {
"Gs2AdReward:ConsumePointByUserId",
"Gs2Dictionary:DeleteEntriesByUserId",
"Gs2Enhance:DeleteProgressByUserId",
"Gs2Exchange:DeleteAwaitByUserId",
"Gs2Experience:SubExperienceByUserId",
"Gs2Experience:SubRankCapByUserId",
"Gs2Formation:SubMoldCapacityByUserId",
"Gs2Grade:SubGradeByUserId",
"Gs2Guild:DecreaseMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Idle:DecreaseMaximumIdleMinutesByUserId",
"Gs2Inbox:OpenMessageByUserId",
"Gs2Inbox:DeleteMessageByUserId",
"Gs2Inventory:ConsumeItemSetByUserId",
"Gs2Inventory:ConsumeSimpleItemsByUserId",
"Gs2Inventory:ConsumeBigItemByUserId",
"Gs2JobQueue:DeleteJobByUserId",
"Gs2Limit:CountUpByUserId",
"Gs2LoginReward:MarkReceivedByUserId",
"Gs2Mission:ReceiveByUserId",
"Gs2Mission:BatchReceiveByUserId",
"Gs2Mission:DecreaseCounterByUserId",
"Gs2Mission:ResetCounterByUserId",
"Gs2Money:WithdrawByUserId",
"Gs2Money:RecordReceipt",
"Gs2Money2:WithdrawByUserId",
"Gs2Money2:VerifyReceiptByUserId",
"Gs2Quest:DeleteProgressByUserId",
"Gs2Ranking2:CreateGlobalRankingReceivedRewardByUserId",
"Gs2Ranking2:CreateClusterRankingReceivedRewardByUserId",
"Gs2Schedule:DeleteTriggerByUserId",
"Gs2SerialKey:UseByUserId",
"Gs2Showcase:IncrementPurchaseCountByUserId",
"Gs2SkillTree:MarkRestrainByUserId",
"Gs2Stamina:DecreaseMaxValueByUserId",
"Gs2Stamina:ConsumeStaminaByUserId",
}
Type of action to be executed in the Consume Action
consumeRequeststring
~ 524288 charsJSON string of the request used when executing the action
statusCodeint0 ~ 999Status code
consumeResultstring~ 1048576 charsResult payload

AcquireActionResult

Acquire Action execution result

Details
TypeConditionRequiredDefaultValue LimitsDescription
actionString Enum
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",
"Gs2Schedule:ExtendTriggerByUserId",
"Gs2Script:InvokeScript",
"Gs2SerialKey:RevertUseByUserId",
"Gs2SerialKey:IssueOnce",
"Gs2Showcase:DecrementPurchaseCountByUserId",
"Gs2Showcase:ForceReDrawByUserId",
"Gs2SkillTree:MarkReleaseByUserId",
"Gs2Stamina:RecoverStaminaByUserId",
"Gs2Stamina:RaiseMaxValueByUserId",
"Gs2Stamina:SetMaxValueByUserId",
"Gs2Stamina:SetRecoverIntervalByUserId",
"Gs2Stamina:SetRecoverValueByUserId",
"Gs2StateMachine:StartStateMachineByUserId",
}
Type of action to be executed in the Acquire Action
acquireRequeststring
~ 524288 charsJSON string of the request used when executing the action
statusCodeint0 ~ 999Status code
acquireResultstring~ 1048576 charsResult payload

TransactionResult

Transaction execution results

Result of a transaction executed using the server-side automatic transaction execution feature

Details
TypeConditionRequiredDefaultValue LimitsDescription
transactionIdstring
36 ~ 36 charsTransaction ID
verifyResultsList<VerifyActionResult>0 ~ 10 itemsList of verify action execution results
consumeResultsList<ConsumeActionResult>[]0 ~ 10 itemsList of Consume Action execution results
acquireResultsList<AcquireActionResult>[]0 ~ 100 itemsList of Acquire Action execution results
hasErrorboolfalseWhether an error occurred during transaction execution

CurrentMessageMaster

Currently active Global Message master data

This master data describes the definitions of Global Messages currently active within the namespace. GS2 uses JSON format files for managing master data. By uploading these files, the master data settings are updated on the server.

To create JSON files, GS2 provides a master data editor within the management console. Additionally, you can create tools better suited for game operations and export JSON files in the appropriate format.

Details
TypeConditionRequiredDefaultValue LimitsDescription
namespaceIdstring
*
~ 1024 charsNamespace GRN
* Set automatically by the server
settingsstring
~ 5242880 bytes (5MB)Master Data

GlobalMessageMaster

Global Message Master

Global Message Master is data used to edit and manage Global Message within the game. It is temporarily stored in the Management Console’s Master Data Editor. By performing import and update processes, it is reflected as Global Message actually referenced by the game.

Global messaging is a mechanism for delivering messages to all game players.

Global Messages can have an expiration time, and each game player can receive a Global Message by executing the process of receiving a Global Message. Unreceived Global Messages within the validity period are copied to the player’s message box.

Details
TypeConditionRequiredDefaultValue LimitsDescription
globalMessageIdstring
*
~ 1024 charsMessage GRN to all users
* Set automatically by the server
namestring
UUID~ 64 charsGlobal Message Name
A unique identifier for this global message within the namespace. Used to track which global messages each user has already received, preventing duplicate delivery. Automatically generated as a UUID if not specified.
metadatastring
~ 4096 charsMetadata
Arbitrary data representing the global message content, such as a JSON string containing the message title, body text, and display parameters. When a user receives this global message, the metadata is copied to the individual message in their inbox. GS2 does not interpret this value. Maximum 4096 characters.
readAcquireActionsList<AcquireAction>[]0 ~ 100 itemsRead Acquire Actions
The list of acquire actions to be executed when a user opens the message copied from this global message. These actions are copied along with the metadata to each user’s individual message. Up to 100 actions per global message.
expiresTimeSpanTimeSpanExpiration Time Span
The duration from the time a user receives (copies) this global message until the copied message expires and is automatically deleted from their inbox. Specified as a combination of days, hours, and minutes. Messages are deleted regardless of read status when the expiration is reached, including any unclaimed attached rewards.
messageReceptionPeriodEventIdstring~ 1024 charsMessage Reception Period Event ID
The GRN of a GS2-Schedule event that defines the time window during which this global message can be received (copied to users’ inboxes). Outside this period, the global message is not delivered even if a user triggers the receive global messages operation. Useful for time-limited event announcements or seasonal campaign rewards.
createdAtlong
*
NowDatetime of creation
Unix time, milliseconds
* Set automatically by the server
revisionlong00 ~ 9223372036854775805Revision

Methods

describeNamespaces

Get a list of Namespaces

Retrieves a list of namespaces that have been created on a per-service basis within the project. You can use the optional page token to start acquiring data from a specific location in the list. You can also limit the number of namespaces to be acquired.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namePrefixstring~ 64 charsFilter by Namespace name prefix
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data items to retrieve

Result

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

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/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 {
        NamePrefix: 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\DescribeNamespacesRequest;

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

$session->open();

$client = new Gs2InboxRestClient(
    $session
);

try {
    $result = $client->describeNamespaces(
        (new DescribeNamespacesRequest())
            ->withNamePrefix(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.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()
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<Namespace> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
    new Gs2.Gs2Inbox.Request.DescribeNamespacesRequest()
        .WithNamePrefix(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.describeNamespaces(
        new Gs2Inbox.DescribeNamespacesRequest()
            .withNamePrefix(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_namespaces(
        inbox.DescribeNamespacesRequest()
            .with_name_prefix(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_namespaces({
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

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

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('inbox')

api_result_handler = client.describe_namespaces_async({
    namePrefix=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['errorMessage'])
end

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

createNamespace

Create a new Namespace

Creates a new namespace for the GS2-Inbox service. You can configure isAutomaticDeletingEnabled (whether read messages are automatically deleted), transaction settings, script callbacks (receiveMessageScript, readMessageScript, deleteMessageScript), receiveNotification (webhook for message events), and log settings. After creation, you can define global message masters and activate them through the master data update process.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
descriptionstring~ 1024 charsDescription
isAutomaticDeletingEnabledboolfalseAutomatic Deletion
When enabled, messages are automatically removed from the user’s message list after they are opened (read). This keeps the inbox clean by removing claimed messages without requiring an explicit delete operation from the client. When disabled, opened messages remain in the list until manually deleted.
transactionSettingTransactionSettingTransaction Setting
Configuration for distributed transaction processing (transactions) used when granting rewards attached to messages. When a message with readAcquireActions is opened, transactions are generated and executed to deliver the rewards. Supports auto-run, atomic commit, and asynchronous processing.
receiveMessageScriptScriptSettingScript to run when a message is received
Script Trigger Reference - receiveMessage
readMessageScriptScriptSettingScript to run when a message is opened
Script Trigger Reference - readMessage
deleteMessageScriptScriptSettingScript to run when a message is deleted
Script Trigger Reference - deleteMessage
receiveNotificationNotificationSettingReceive Notification
Push notification settings triggered when a new message is delivered to a user’s inbox. Uses GS2-Gateway to send real-time notifications to the game client, allowing the UI to display a new message indicator or refresh the inbox without polling.
logSettingLogSettingLog Output Setting
Specifies the GS2-Log namespace for outputting API request and response logs related to message operations. Useful for tracking message delivery, opening, reward claims, and deletion for auditing and debugging purposes.

Result

TypeDescription
itemNamespaceNamespace created

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &inbox.CreateNamespaceRequest {
        Name: pointy.String("namespace-0001"),
        Description: nil,
        IsAutomaticDeletingEnabled: nil,
        TransactionSetting: &inbox.TransactionSetting{
            EnableAutoRun: pointy.Bool(false),
            QueueNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"),
        },
        ReceiveMessageScript: nil,
        ReadMessageScript: nil,
        DeleteMessageScript: nil,
        ReceiveNotification: nil,
        LogSetting: &inbox.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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\CreateNamespaceRequest;

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

$session->open();

$client = new Gs2InboxRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName("namespace-0001")
            ->withDescription(null)
            ->withIsAutomaticDeletingEnabled(null)
            ->withTransactionSetting((new \Gs2\Inbox\Model\TransactionSetting())
                ->withEnableAutoRun(False)
                ->withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"))
            ->withReceiveMessageScript(null)
            ->withReadMessageScript(null)
            ->withDeleteMessageScript(null)
            ->withReceiveNotification(null)
            ->withLogSetting((new \Gs2\Inbox\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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.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("namespace-0001")
            .withDescription(null)
            .withIsAutomaticDeletingEnabled(null)
            .withTransactionSetting(new io.gs2.inbox.model.TransactionSetting()
                .withEnableAutoRun(false)
                .withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"))
            .withReceiveMessageScript(null)
            .withReadMessageScript(null)
            .withDeleteMessageScript(null)
            .withReceiveNotification(null)
            .withLogSetting(new io.gs2.inbox.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
    new Gs2.Gs2Inbox.Request.CreateNamespaceRequest()
        .WithName("namespace-0001")
        .WithDescription(null)
        .WithIsAutomaticDeletingEnabled(null)
        .WithTransactionSetting(new Gs2.Gs2Inbox.Model.TransactionSetting()
            .WithEnableAutoRun(false)
            .WithQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"))
        .WithReceiveMessageScript(null)
        .WithReadMessageScript(null)
        .WithDeleteMessageScript(null)
        .WithReceiveNotification(null)
        .WithLogSetting(new Gs2.Gs2Inbox.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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.createNamespace(
        new Gs2Inbox.CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withIsAutomaticDeletingEnabled(null)
            .withTransactionSetting(new Gs2Inbox.model.TransactionSetting()
                .withEnableAutoRun(false)
                .withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"))
            .withReceiveMessageScript(null)
            .withReadMessageScript(null)
            .withDeleteMessageScript(null)
            .withReceiveNotification(null)
            .withLogSetting(new Gs2Inbox.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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.create_namespace(
        inbox.CreateNamespaceRequest()
            .with_name('namespace-0001')
            .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_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:namespace-0001'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('inbox')

api_result = client.create_namespace({
    name="namespace-0001",
    description=nil,
    isAutomaticDeletingEnabled=nil,
    transactionSetting={
        enableAutoRun=false,
        queueNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001",
    },
    receiveMessageScript=nil,
    readMessageScript=nil,
    deleteMessageScript=nil,
    receiveNotification=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
    },
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.create_namespace_async({
    name="namespace-0001",
    description=nil,
    isAutomaticDeletingEnabled=nil,
    transactionSetting={
        enableAutoRun=false,
        queueNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001",
    },
    receiveMessageScript=nil,
    readMessageScript=nil,
    deleteMessageScript=nil,
    receiveNotification=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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['errorMessage'])
end

result = api_result.result
item = result.item;

getNamespaceStatus

Get Namespace status

Get the current status of the specified namespace. This includes whether the Namespace is active, pending, or in some other state.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).

Result

TypeDescription
statusstring

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.GetNamespaceStatus(
    &inbox.GetNamespaceStatusRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->getNamespaceStatus(
        (new GetNamespaceStatusRequest())
            ->withNamespaceName("namespace-0001")
    );
    $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("namespace-0001")
    );
    String status = result.getStatus();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
    new Gs2.Gs2Inbox.Request.GetNamespaceStatusRequest()
        .WithNamespaceName("namespace-0001"),
    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("namespace-0001")
    );
    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('namespace-0001')
    )
    status = result.status
except core.Gs2Exception as e:
    exit(1)
client = gs2('inbox')

api_result = client.get_namespace_status({
    namespaceName="namespace-0001",
})

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

result = api_result.result
status = result.status;
client = gs2('inbox')

api_result_handler = client.get_namespace_status_async({
    namespaceName="namespace-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['errorMessage'])
end

result = api_result.result
status = result.status;

getNamespace

Get namespace

Get detailed information about the specified namespace. This includes the name, description, and other settings of the namespace.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).

Result

TypeDescription
itemNamespaceNamespace

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.GetNamespace(
    &inbox.GetNamespaceRequest {
        NamespaceName: pointy.String("namespace-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\GetNamespaceRequest;

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

$session->open();

$client = new Gs2InboxRestClient(
    $session
);

try {
    $result = $client->getNamespace(
        (new GetNamespaceRequest())
            ->withNamespaceName("namespace-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.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("namespace-0001")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
    new Gs2.Gs2Inbox.Request.GetNamespaceRequest()
        .WithNamespaceName("namespace-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.getNamespace(
        new Gs2Inbox.GetNamespaceRequest()
            .withNamespaceName("namespace-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_namespace(
        inbox.GetNamespaceRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('inbox')

api_result = client.get_namespace({
    namespaceName="namespace-0001",
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.get_namespace_async({
    namespaceName="namespace-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['errorMessage'])
end

result = api_result.result
item = result.item;

updateNamespace

Update Namespace

Updates the settings of the specified namespace. You can modify the description, automatic deletion setting, transaction settings, script callbacks (receiveMessageScript, readMessageScript, deleteMessageScript), receiveNotification, and log settings. Changes take effect immediately for subsequent operations.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
descriptionstring~ 1024 charsDescription
isAutomaticDeletingEnabledboolfalseAutomatic Deletion
When enabled, messages are automatically removed from the user’s message list after they are opened (read). This keeps the inbox clean by removing claimed messages without requiring an explicit delete operation from the client. When disabled, opened messages remain in the list until manually deleted.
transactionSettingTransactionSettingTransaction Setting
Configuration for distributed transaction processing (transactions) used when granting rewards attached to messages. When a message with readAcquireActions is opened, transactions are generated and executed to deliver the rewards. Supports auto-run, atomic commit, and asynchronous processing.
receiveMessageScriptScriptSettingScript to run when a message is received
Script Trigger Reference - receiveMessage
readMessageScriptScriptSettingScript to run when a message is opened
Script Trigger Reference - readMessage
deleteMessageScriptScriptSettingScript to run when a message is deleted
Script Trigger Reference - deleteMessage
receiveNotificationNotificationSettingReceive Notification
Push notification settings triggered when a new message is delivered to a user’s inbox. Uses GS2-Gateway to send real-time notifications to the game client, allowing the UI to display a new message indicator or refresh the inbox without polling.
logSettingLogSettingLog Output Setting
Specifies the GS2-Log namespace for outputting API request and response logs related to message operations. Useful for tracking message delivery, opening, reward claims, and deletion for auditing and debugging purposes.

Result

TypeDescription
itemNamespaceNamespace updated

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &inbox.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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"),
        },
        ReceiveMessageScript: &inbox.ScriptSetting{
            TriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001"),
            DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002"),
        },
        ReadMessageScript: &inbox.ScriptSetting{
            TriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003"),
            DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004"),
        },
        DeleteMessageScript: &inbox.ScriptSetting{
            TriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005"),
            DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006"),
        },
        ReceiveNotification: nil,
        LogSetting: &inbox.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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\UpdateNamespaceRequest;

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

$session->open();

$client = new Gs2InboxRestClient(
    $session
);

try {
    $result = $client->updateNamespace(
        (new UpdateNamespaceRequest())
            ->withNamespaceName("namespace-0001")
            ->withDescription("description1")
            ->withIsAutomaticDeletingEnabled(False)
            ->withTransactionSetting((new \Gs2\Inbox\Model\TransactionSetting())
                ->withEnableAutoRun(False)
                ->withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002"))
            ->withReceiveMessageScript((new \Gs2\Inbox\Model\ScriptSetting())
                ->withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001")
                ->withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002"))
            ->withReadMessageScript((new \Gs2\Inbox\Model\ScriptSetting())
                ->withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003")
                ->withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004"))
            ->withDeleteMessageScript((new \Gs2\Inbox\Model\ScriptSetting())
                ->withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005")
                ->withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006"))
            ->withReceiveNotification(null)
            ->withLogSetting((new \Gs2\Inbox\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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.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("namespace-0001")
            .withDescription("description1")
            .withIsAutomaticDeletingEnabled(false)
            .withTransactionSetting(new io.gs2.inbox.model.TransactionSetting()
                .withEnableAutoRun(false)
                .withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002"))
            .withReceiveMessageScript(new io.gs2.inbox.model.ScriptSetting()
                .withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001")
                .withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002"))
            .withReadMessageScript(new io.gs2.inbox.model.ScriptSetting()
                .withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003")
                .withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004"))
            .withDeleteMessageScript(new io.gs2.inbox.model.ScriptSetting()
                .withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005")
                .withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006"))
            .withReceiveNotification(null)
            .withLogSetting(new io.gs2.inbox.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
    new Gs2.Gs2Inbox.Request.UpdateNamespaceRequest()
        .WithNamespaceName("namespace-0001")
        .WithDescription("description1")
        .WithIsAutomaticDeletingEnabled(false)
        .WithTransactionSetting(new Gs2.Gs2Inbox.Model.TransactionSetting()
            .WithEnableAutoRun(false)
            .WithQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002"))
        .WithReceiveMessageScript(new Gs2.Gs2Inbox.Model.ScriptSetting()
            .WithTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001")
            .WithDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002"))
        .WithReadMessageScript(new Gs2.Gs2Inbox.Model.ScriptSetting()
            .WithTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003")
            .WithDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004"))
        .WithDeleteMessageScript(new Gs2.Gs2Inbox.Model.ScriptSetting()
            .WithTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005")
            .WithDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006"))
        .WithReceiveNotification(null)
        .WithLogSetting(new Gs2.Gs2Inbox.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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.updateNamespace(
        new Gs2Inbox.UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withIsAutomaticDeletingEnabled(false)
            .withTransactionSetting(new Gs2Inbox.model.TransactionSetting()
                .withEnableAutoRun(false)
                .withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002"))
            .withReceiveMessageScript(new Gs2Inbox.model.ScriptSetting()
                .withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001")
                .withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002"))
            .withReadMessageScript(new Gs2Inbox.model.ScriptSetting()
                .withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003")
                .withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004"))
            .withDeleteMessageScript(new Gs2Inbox.model.ScriptSetting()
                .withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005")
                .withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006"))
            .withReceiveNotification(null)
            .withLogSetting(new Gs2Inbox.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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.update_namespace(
        inbox.UpdateNamespaceRequest()
            .with_namespace_name('namespace-0001')
            .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_receive_message_script(
                inbox.ScriptSetting()
                    .with_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001')
                    .with_done_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002'))
            .with_read_message_script(
                inbox.ScriptSetting()
                    .with_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003')
                    .with_done_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004'))
            .with_delete_message_script(
                inbox.ScriptSetting()
                    .with_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005')
                    .with_done_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006'))
            .with_receive_notification(None)
            .with_log_setting(
                inbox.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('inbox')

api_result = client.update_namespace({
    namespaceName="namespace-0001",
    description="description1",
    isAutomaticDeletingEnabled=false,
    transactionSetting={
        enableAutoRun=false,
        queueNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002",
    },
    receiveMessageScript={
        triggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001",
        doneTriggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002",
    },
    readMessageScript={
        triggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003",
        doneTriggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004",
    },
    deleteMessageScript={
        triggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005",
        doneTriggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006",
    },
    receiveNotification=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
    },
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.update_namespace_async({
    namespaceName="namespace-0001",
    description="description1",
    isAutomaticDeletingEnabled=false,
    transactionSetting={
        enableAutoRun=false,
        queueNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0002",
    },
    receiveMessageScript={
        triggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001",
        doneTriggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002",
    },
    readMessageScript={
        triggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003",
        doneTriggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004",
    },
    deleteMessageScript={
        triggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005",
        doneTriggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006",
    },
    receiveNotification=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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['errorMessage'])
end

result = api_result.result
item = result.item;

deleteNamespace

Delete Namespace

Delete the specified namespace. This operation is irreversible and all data associated with the deleted Namespace will be lost.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).

Result

TypeDescription
itemNamespaceThe deleted Namespace

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.DeleteNamespace(
    &inbox.DeleteNamespaceRequest {
        NamespaceName: pointy.String("namespace-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\DeleteNamespaceRequest;

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

$session->open();

$client = new Gs2InboxRestClient(
    $session
);

try {
    $result = $client->deleteNamespace(
        (new DeleteNamespaceRequest())
            ->withNamespaceName("namespace-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.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("namespace-0001")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
    new Gs2.Gs2Inbox.Request.DeleteNamespaceRequest()
        .WithNamespaceName("namespace-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.deleteNamespace(
        new Gs2Inbox.DeleteNamespaceRequest()
            .withNamespaceName("namespace-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_namespace(
        inbox.DeleteNamespaceRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('inbox')

api_result = client.delete_namespace({
    namespaceName="namespace-0001",
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.delete_namespace_async({
    namespaceName="namespace-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['errorMessage'])
end

result = api_result.result
item = result.item;

getServiceVersion

Get the microservice version

Details

Request

Request parameters: None

Result

TypeDescription
itemstringVersion

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.GetServiceVersion(
    &inbox.GetServiceVersionRequest {
    }
)
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\GetServiceVersionRequest;

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

$session->open();

$client = new Gs2InboxRestClient(
    $session
);

try {
    $result = $client->getServiceVersion(
        (new GetServiceVersionRequest())
    );
    $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.GetServiceVersionRequest;
import io.gs2.inbox.result.GetServiceVersionResult;

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

try {
    GetServiceVersionResult result = client.getServiceVersion(
        new GetServiceVersionRequest()
    );
    String item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
    new Gs2.Gs2Inbox.Request.GetServiceVersionRequest(),
    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.getServiceVersion(
        new Gs2Inbox.GetServiceVersionRequest()
    );
    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_service_version(
        inbox.GetServiceVersionRequest()
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('inbox')

api_result = client.get_service_version({
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.get_service_version_async({
})

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['errorMessage'])
end

result = api_result.result
item = result.item;

dumpUserDataByUserId

Dump data associated with the specified user ID

Can be used to meet legal requirements for the protection of personal information, or to back up or migrate data.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
userIdstring
~ 128 charsUser ID
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.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 Gs2InboxRestClient(
    $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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
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['errorMessage'])
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['errorMessage'])
end

result = api_result.result

checkDumpUserDataByUserId

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

Returns the URL of the output data when the dump is complete. If the dump is still in progress, the URL will be empty. The dumped data includes all message records and received global message tracking for the specified user, compressed in gzip format.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
userIdstring
~ 128 charsUser ID
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
urlstringURL of output data

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.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 Gs2InboxRestClient(
    $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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
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['errorMessage'])
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['errorMessage'])
end

result = api_result.result
url = result.url;

cleanUserDataByUserId

Delete user data

Execute cleaning of data associated with the specified user ID This allows you to safely delete specific user data from the project.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
userIdstring
~ 128 charsUser ID
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.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 Gs2InboxRestClient(
    $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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
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['errorMessage'])
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['errorMessage'])
end

result = api_result.result

checkCleanUserDataByUserId

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

Returns completion status of the clean operation. The clean operation deletes all message records and received global message tracking for the specified user across all namespaces owned by the same owner.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
userIdstring
~ 128 charsUser ID
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.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 Gs2InboxRestClient(
    $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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
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['errorMessage'])
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['errorMessage'])
end

result = api_result.result

prepareImportUserDataByUserId

Execute import of data associated with the specified user ID

The data that can be used for import is limited to the data exported by GS2, and old data may fail to import. You can import data with a user ID different from the one you exported, but if the user ID is included in the payload of the user data, this may not be the case.

You can start the actual import process by uploading the exported zip file to the URL returned in the return value of this API and calling importUserDataByUserId.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
userIdstring
~ 128 charsUser ID
timeOffsetTokenstring~ 1024 charsTime offset token

Result

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

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/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 Gs2InboxRestClient(
    $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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
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['errorMessage'])
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['errorMessage'])
end

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

importUserDataByUserId

Execute import of data associated with the specified user ID

The data that can be used for import is limited to the data exported by GS2, and old data may fail to import. You can import data with a user ID different from the one you exported, but if the user ID is included in the payload of the user data, this may not be the case.

Before calling this API, you must call prepareImportUserDataByUserId to complete the upload preparation.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
userIdstring
~ 128 charsUser ID
uploadTokenstring
~ 1024 charsToken received in preparation for upload
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.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 Gs2InboxRestClient(
    $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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
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['errorMessage'])
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['errorMessage'])
end

result = api_result.result

checkImportUserDataByUserId

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

Returns completion status and a URL to the import log when available. The import processes the uploaded ZIP file containing inbox data (inbox.json), validates each record’s structure and data type (Message or Received), and restores the records for the specified user. Template variables in the data are automatically replaced during import.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
userIdstring
~ 128 charsUser ID
uploadTokenstring
~ 1024 charsToken received in preparation for upload
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
urlstringURL of log data

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.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 Gs2InboxRestClient(
    $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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
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['errorMessage'])
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['errorMessage'])
end

result = api_result.result
url = result.url;

describeMessages

Get a list of messages

Retrieves a paginated list of messages in the authenticated user’s inbox. Optionally filter by read status using the isRead parameter; if not specified, all messages are returned regardless of read status.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
accessTokenstring
~ 128 charsAccess token
isReadbool?Read status
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data items to retrieve

Result

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

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/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("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->describeMessages(
        (new DescribeMessagesRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withIsRead(null)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.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("namespace-0001")
            .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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.DescribeMessagesResult> asyncResult = null;
yield return client.DescribeMessages(
    new Gs2.Gs2Inbox.Request.DescribeMessagesRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .with_access_token('accessToken-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="namespace-0001",
    accessToken="accessToken-0001",
    isRead=nil,
    pageToken=nil,
    limit=nil,
})

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

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('inbox')

api_result_handler = client.describe_messages_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

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

describeMessagesByUserId

Get a list of messages by specifying a user ID

Retrieves a paginated list of messages in the specified user’s inbox. Optionally filter by read status using the isRead parameter; if not specified, all messages are returned regardless of read status.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
isReadbool?Read status
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data items to retrieve
timeOffsetTokenstring~ 1024 charsTime offset token

Result

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

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/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("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->describeMessagesByUserId(
        (new DescribeMessagesByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.DescribeMessagesByUserIdResult> asyncResult = null;
yield return client.DescribeMessagesByUserId(
    new Gs2.Gs2Inbox.Request.DescribeMessagesByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    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['errorMessage'])
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="namespace-0001",
    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['errorMessage'])
end

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

sendMessageByUserId

Send a message by specifying a user ID

Creates and delivers a new message to the specified user’s inbox. The message can include metadata (arbitrary JSON content) and readAcquireActions (rewards granted when the message is read). Message expiration can be set using either an absolute timestamp (expiresAt) or a relative duration (expiresTimeSpan) from the time of delivery. If expiresAt is specified, it takes priority over expiresTimeSpan. The message starts in an unread state (isRead=false).

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
metadatastring
~ 4096 charsMetadata
Arbitrary data representing the message content, such as a JSON string containing the message title, body text, sender information, and display parameters. GS2 does not interpret this value; it is passed through to the game client for rendering the message UI. Maximum 4096 characters.
readAcquireActionsList<AcquireAction>[]0 ~ 100 itemsRead Acquire Actions
The list of acquire actions executed when the user opens this message. Used to attach rewards such as items, currency, or resources to messages. Multiple actions can be combined to grant different reward types simultaneously. Up to 100 actions per message.
expiresAtlongDatetime of ttl
Unix time, milliseconds
expiresTimeSpanTimeSpanThe period from the time a message was received (reference time) until it was deleted
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemMessageMessage created

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.SendMessageByUserId(
    &inbox.SendMessageByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->sendMessageByUserId(
        (new SendMessageByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.SendMessageByUserIdResult> asyncResult = null;
yield return client.SendMessageByUserId(
    new Gs2.Gs2Inbox.Request.SendMessageByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.send_message_by_user_id_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

getMessage

Get Message

Retrieves the details of a specific message from the authenticated user’s inbox, including its metadata, read status, and configured acquire actions.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
accessTokenstring
~ 128 charsAccess token
messageNamestring
UUID~ 36 charsMessage Name
Maintains a unique name for each message.
Names are automatically generated in UUID (Universally Unique Identifier) format and used to identify each message.

Result

TypeDescription
itemMessageMessage

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.GetMessage(
    &inbox.GetMessageRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->getMessage(
        (new GetMessageRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withMessageName("message-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.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("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withMessageName("message-0001")
    );
    Message item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.GetMessageResult> asyncResult = null;
yield return client.GetMessage(
    new Gs2.Gs2Inbox.Request.GetMessageRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_message_name('message-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('inbox')

api_result = client.get_message({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    messageName="message-0001",
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.get_message_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

getMessageByUserId

Get message by specifying a user ID

Retrieves the details of a specific message from the specified user’s inbox, including its metadata, read status, and configured acquire actions.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
messageNamestring
UUID~ 36 charsMessage Name
Maintains a unique name for each message.
Names are automatically generated in UUID (Universally Unique Identifier) format and used to identify each message.
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemMessageMessage

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.GetMessageByUserId(
    &inbox.GetMessageByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->getMessageByUserId(
        (new GetMessageByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withUserId("user-0001")
            .withMessageName("message-0001")
            .withTimeOffsetToken(null)
    );
    Message item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.GetMessageByUserIdResult> asyncResult = null;
yield return client.GetMessageByUserId(
    new Gs2.Gs2Inbox.Request.GetMessageByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    userId="user-0001",
    messageName="message-0001",
    timeOffsetToken=nil,
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.get_message_by_user_id_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

receiveGlobalMessage

Receive Global Message that have not yet been received

Converts active global messages into individual messages in the authenticated user’s inbox. Compares the list of active global messages against the user’s received tracking record to identify undelivered messages, and creates new message copies only for those not yet received. The received tracking record is updated to prevent duplicate delivery on subsequent calls. Returns the list of newly created messages.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
accessTokenstring
~ 128 charsAccess token

Result

TypeDescription
itemList<Message>List of received messages

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.ReceiveGlobalMessage(
    &inbox.ReceiveGlobalMessageRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->receiveGlobalMessage(
        (new ReceiveGlobalMessageRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-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.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("namespace-0001")
            .withAccessToken("accessToken-0001")
    );
    List<Message> item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.ReceiveGlobalMessageResult> asyncResult = null;
yield return client.ReceiveGlobalMessage(
    new Gs2.Gs2Inbox.Request.ReceiveGlobalMessageRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .with_access_token('accessToken-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('inbox')

api_result = client.receive_global_message({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.receive_global_message_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

receiveGlobalMessageByUserId

Receive Global Message that have not yet been received by specifying the user ID

Converts active global messages into individual messages in the specified user’s inbox. Compares the list of active global messages against the user’s received tracking record to identify undelivered messages, and creates new message copies only for those not yet received. The received tracking record is updated to prevent duplicate delivery on subsequent calls.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemList<Message>List of received messages

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.ReceiveGlobalMessageByUserId(
    &inbox.ReceiveGlobalMessageByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->receiveGlobalMessageByUserId(
        (new ReceiveGlobalMessageByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    List<Message> item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.ReceiveGlobalMessageByUserIdResult> asyncResult = null;
yield return client.ReceiveGlobalMessageByUserId(
    new Gs2.Gs2Inbox.Request.ReceiveGlobalMessageByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    userId="user-0001",
    timeOffsetToken=nil,
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.receive_global_message_by_user_id_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

openMessage

Marking messages as opened

Marks the specified message as read (opened) in the authenticated user’s inbox. This is a simple state transition that sets isRead to true without executing any acquire actions. To mark as read and also execute associated rewards, use the Read API instead.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
accessTokenstring
~ 128 charsAccess token
messageNamestring
UUID~ 36 charsMessage Name
Maintains a unique name for each message.
Names are automatically generated in UUID (Universally Unique Identifier) format and used to identify each message.

Result

TypeDescription
itemMessageMessage

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.OpenMessage(
    &inbox.OpenMessageRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->openMessage(
        (new OpenMessageRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withMessageName("message-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.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("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withMessageName("message-0001")
    );
    Message item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.OpenMessageResult> asyncResult = null;
yield return client.OpenMessage(
    new Gs2.Gs2Inbox.Request.OpenMessageRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .with_access_token('accessToken-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="namespace-0001",
    accessToken="accessToken-0001",
    messageName="message-0001",
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.open_message_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

openMessageByUserId

Marking messages as opened by specifying a user ID

Marks the specified message as read (opened) in the specified user’s inbox. This is a simple state transition that sets isRead to true without executing any acquire actions. To mark as read and also execute associated rewards, use the Read API instead.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
messageNamestring
UUID~ 36 charsMessage Name
Maintains a unique name for each message.
Names are automatically generated in UUID (Universally Unique Identifier) format and used to identify each message.
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemMessageMessage

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.OpenMessageByUserId(
    &inbox.OpenMessageByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->openMessageByUserId(
        (new OpenMessageByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->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.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("namespace-0001")
            .withUserId("user-0001")
            .withMessageName("message-0001")
            .withTimeOffsetToken(null)
    );
    Message item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.OpenMessageByUserIdResult> asyncResult = null;
yield return client.OpenMessageByUserId(
    new Gs2.Gs2Inbox.Request.OpenMessageByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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.open_message_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    messageName="message-0001",
    timeOffsetToken=nil,
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.open_message_by_user_id_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

closeMessageByUserId

Mark a previously opened message as unread

Reverts the read status of a message back to unread (isRead=false). This is the inverse operation of Open, allowing messages to be returned to the unread state.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
messageNamestring
UUID~ 36 charsMessage Name
Maintains a unique name for each message.
Names are automatically generated in UUID (Universally Unique Identifier) format and used to identify each message.
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemMessageMessage

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.CloseMessageByUserId(
    &inbox.CloseMessageByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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\CloseMessageByUserIdRequest;

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

$session->open();

$client = new Gs2InboxRestClient(
    $session
);

try {
    $result = $client->closeMessageByUserId(
        (new CloseMessageByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->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.CloseMessageByUserIdRequest;
import io.gs2.inbox.result.CloseMessageByUserIdResult;

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

try {
    CloseMessageByUserIdResult result = client.closeMessageByUserId(
        new CloseMessageByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withMessageName("message-0001")
            .withTimeOffsetToken(null)
    );
    Message item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.CloseMessageByUserIdResult> asyncResult = null;
yield return client.CloseMessageByUserId(
    new Gs2.Gs2Inbox.Request.CloseMessageByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .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.closeMessageByUserId(
        new Gs2Inbox.CloseMessageByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .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.close_message_by_user_id(
        inbox.CloseMessageByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .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.close_message_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    messageName="message-0001",
    timeOffsetToken=nil,
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.close_message_by_user_id_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

readMessage

Read message

Marks the message as read and executes the configured readAcquireActions (rewards). If the message has already been read, an “alreadyRead” error is returned to prevent duplicate reward grants. If the message has no acquire actions, it is simply marked as read without generating a transaction. If acquire actions are present, a transaction is returned for executing the reward transaction.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
accessTokenstring
~ 128 charsAccess token
messageNamestring
UUID~ 36 charsMessage Name
Maintains a unique name for each message.
Names are automatically generated in UUID (Universally Unique Identifier) format and used to identify each message.
configList<Config>[]0 ~ 32 itemsSet values to be applied to transaction variables

Result

TypeDescription
itemMessageMessage
transactionIdstringIssued transaction ID
stampSheetstringStamp sheet
stampSheetEncryptionKeyIdstringCryptographic key GRN used for stamp sheet signature calculations
autoRunStampSheetbool?Whether automatic transaction execution is enabled
atomicCommitbool?Whether to commit the transaction atomically
transactionstringIssued transaction
transactionResultTransactionResultTransaction execution result

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.ReadMessage(
    &inbox.ReadMessageRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->readMessage(
        (new ReadMessageRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->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("namespace-0001")
            .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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.ReadMessageResult> asyncResult = null;
yield return client.ReadMessage(
    new Gs2.Gs2Inbox.Request.ReadMessageRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .with_access_token('accessToken-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="namespace-0001",
    accessToken="accessToken-0001",
    messageName="message-0001",
    config=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
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="namespace-0001",
    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['errorMessage'])
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

Read message by specifying a user ID

Marks the message as read and executes the configured readAcquireActions (rewards) for the specified user. If the message has already been read, an “alreadyRead” error is returned to prevent duplicate reward grants. If the message has no acquire actions, it is simply marked as read without generating a transaction. If acquire actions are present, a transaction is returned for executing the reward transaction.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
messageNamestring
UUID~ 36 charsMessage Name
Maintains a unique name for each message.
Names are automatically generated in UUID (Universally Unique Identifier) format and used to identify each message.
configList<Config>[]0 ~ 32 itemsSet values to be applied to transaction variables
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemMessageMessage
transactionIdstringIssued transaction ID
stampSheetstringStamp sheet
stampSheetEncryptionKeyIdstringCryptographic key GRN used for stamp sheet signature calculations
autoRunStampSheetbool?Whether automatic transaction execution is enabled
atomicCommitbool?Whether to commit the transaction atomically
transactionstringIssued transaction
transactionResultTransactionResultTransaction execution result

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.ReadMessageByUserId(
    &inbox.ReadMessageByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->readMessageByUserId(
        (new ReadMessageByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.ReadMessageByUserIdResult> asyncResult = null;
yield return client.ReadMessageByUserId(
    new Gs2.Gs2Inbox.Request.ReadMessageByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    userId="user-0001",
    messageName="message-0001",
    config=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
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="namespace-0001",
    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['errorMessage'])
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;

batchReadMessages

Read messages

Atomically reads multiple messages at once, marking them as read and executing their combined readAcquireActions (rewards). If any of the specified messages has already been read, an “alreadyRead” error is returned and no messages are processed. Messages without acquire actions are marked as read immediately, while messages with rewards are processed together in a single transaction. Up to 10 messages can be read in a single batch operation.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
accessTokenstring
~ 128 charsAccess token
messageNamesList<string>
1 ~ 10 itemsList of message names
configList<Config>[]0 ~ 32 itemsSet values to be applied to transaction variables

Result

TypeDescription
itemsList<Message>List of Message
transactionIdstringIssued transaction ID
stampSheetstringStamp sheet
stampSheetEncryptionKeyIdstringCryptographic key GRN used for stamp sheet signature calculations
autoRunStampSheetbool?Whether automatic transaction execution is enabled
atomicCommitbool?Whether to commit the transaction atomically
transactionstringIssued transaction
transactionResultTransactionResultTransaction execution result

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.BatchReadMessages(
    &inbox.BatchReadMessagesRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        MessageNames: []*string{
            pointy.String("message-0001"),
            pointy.String("message-0002"),
        },
        Config: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
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\BatchReadMessagesRequest;

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

$session->open();

$client = new Gs2InboxRestClient(
    $session
);

try {
    $result = $client->batchReadMessages(
        (new BatchReadMessagesRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withMessageNames([
                "message-0001",
                "message-0002",
            ])
            ->withConfig(null)
    );
    $items = $result->getItems();
    $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.BatchReadMessagesRequest;
import io.gs2.inbox.result.BatchReadMessagesResult;

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

try {
    BatchReadMessagesResult result = client.batchReadMessages(
        new BatchReadMessagesRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withMessageNames(Arrays.asList(
                "message-0001",
                "message-0002"
            ))
            .withConfig(null)
    );
    List<Message> items = result.getItems();
    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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.BatchReadMessagesResult> asyncResult = null;
yield return client.BatchReadMessages(
    new Gs2.Gs2Inbox.Request.BatchReadMessagesRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001")
        .WithMessageNames(new string[] {
            "message-0001",
            "message-0002",
        })
        .WithConfig(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
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.batchReadMessages(
        new Gs2Inbox.BatchReadMessagesRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withMessageNames([
                "message-0001",
                "message-0002",
            ])
            .withConfig(null)
    );
    const items = result.getItems();
    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.batch_read_messages(
        inbox.BatchReadMessagesRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_message_names([
                'message-0001',
                'message-0002',
            ])
            .with_config(None)
    )
    items = result.items
    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.batch_read_messages({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    messageNames={
        "message-0001",
        "message-0002"
    },
    config=nil,
})

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

result = api_result.result
items = result.items;
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.batch_read_messages_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    messageNames={
        "message-0001",
        "message-0002"
    },
    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['errorMessage'])
end

result = api_result.result
items = result.items;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;

batchReadMessagesByUserId

Read messages by specifying a user ID

Atomically reads multiple messages at once for the specified user, marking them as read and executing their combined readAcquireActions (rewards). If any of the specified messages has already been read, an “alreadyRead” error is returned and no messages are processed. Messages without acquire actions are marked as read immediately, while messages with rewards are processed together in a single transaction. Up to 10 messages can be read in a single batch operation.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
messageNamesList<string>
1 ~ 10 itemsList of message names
configList<Config>[]0 ~ 32 itemsSet values to be applied to transaction variables
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemsList<Message>List of Message
transactionIdstringIssued transaction ID
stampSheetstringStamp sheet
stampSheetEncryptionKeyIdstringCryptographic key GRN used for stamp sheet signature calculations
autoRunStampSheetbool?Whether automatic transaction execution is enabled
atomicCommitbool?Whether to commit the transaction atomically
transactionstringIssued transaction
transactionResultTransactionResultTransaction execution result

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.BatchReadMessagesByUserId(
    &inbox.BatchReadMessagesByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        MessageNames: []*string{
            pointy.String("message-0001"),
            pointy.String("message-0002"),
        },
        Config: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
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\BatchReadMessagesByUserIdRequest;

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

$session->open();

$client = new Gs2InboxRestClient(
    $session
);

try {
    $result = $client->batchReadMessagesByUserId(
        (new BatchReadMessagesByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withMessageNames([
                "message-0001",
                "message-0002",
            ])
            ->withConfig(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $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.BatchReadMessagesByUserIdRequest;
import io.gs2.inbox.result.BatchReadMessagesByUserIdResult;

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

try {
    BatchReadMessagesByUserIdResult result = client.batchReadMessagesByUserId(
        new BatchReadMessagesByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withMessageNames(Arrays.asList(
                "message-0001",
                "message-0002"
            ))
            .withConfig(null)
            .withTimeOffsetToken(null)
    );
    List<Message> items = result.getItems();
    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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.BatchReadMessagesByUserIdResult> asyncResult = null;
yield return client.BatchReadMessagesByUserId(
    new Gs2.Gs2Inbox.Request.BatchReadMessagesByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithMessageNames(new string[] {
            "message-0001",
            "message-0002",
        })
        .WithConfig(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
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.batchReadMessagesByUserId(
        new Gs2Inbox.BatchReadMessagesByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withMessageNames([
                "message-0001",
                "message-0002",
            ])
            .withConfig(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    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.batch_read_messages_by_user_id(
        inbox.BatchReadMessagesByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_message_names([
                'message-0001',
                'message-0002',
            ])
            .with_config(None)
            .with_time_offset_token(None)
    )
    items = result.items
    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.batch_read_messages_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    messageNames={
        "message-0001",
        "message-0002"
    },
    config=nil,
    timeOffsetToken=nil,
})

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

result = api_result.result
items = result.items;
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.batch_read_messages_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    messageNames={
        "message-0001",
        "message-0002"
    },
    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['errorMessage'])
end

result = api_result.result
items = result.items;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
atomicCommit = result.atomicCommit;
transaction = result.transaction;
transactionResult = result.transactionResult;

deleteMessage

Delete message

Permanently removes a message from the authenticated user’s inbox. The message record is deleted regardless of its read status.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
accessTokenstring
~ 128 charsAccess token
messageNamestring
UUID~ 36 charsMessage Name
Maintains a unique name for each message.
Names are automatically generated in UUID (Universally Unique Identifier) format and used to identify each message.

Result

TypeDescription
itemMessageMessage deleted

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.DeleteMessage(
    &inbox.DeleteMessageRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->deleteMessage(
        (new DeleteMessageRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withMessageName("message-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.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("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withMessageName("message-0001")
    );
    Message item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.DeleteMessageResult> asyncResult = null;
yield return client.DeleteMessage(
    new Gs2.Gs2Inbox.Request.DeleteMessageRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_message_name('message-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('inbox')

api_result = client.delete_message({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    messageName="message-0001",
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.delete_message_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

deleteMessageByUserId

Delete message by specifying a user ID

Permanently removes a message from the specified user’s inbox. The message record is deleted regardless of its read status.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
messageNamestring
UUID~ 36 charsMessage Name
Maintains a unique name for each message.
Names are automatically generated in UUID (Universally Unique Identifier) format and used to identify each message.
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemMessageMessage deleted

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.DeleteMessageByUserId(
    &inbox.DeleteMessageByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->deleteMessageByUserId(
        (new DeleteMessageByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withUserId("user-0001")
            .withMessageName("message-0001")
            .withTimeOffsetToken(null)
    );
    Message item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.DeleteMessageByUserIdResult> asyncResult = null;
yield return client.DeleteMessageByUserId(
    new Gs2.Gs2Inbox.Request.DeleteMessageByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    userId="user-0001",
    messageName="message-0001",
    timeOffsetToken=nil,
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.delete_message_by_user_id_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

describeGlobalMessages

Get a list of messages to all users

Retrieves the list of currently active global messages in the specified namespace. Only messages within their reception period are returned; messages outside their reception window are excluded. Global messages are broadcast messages that can be converted into individual user messages via the ReceiveGlobalMessage API.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).

Result

TypeDescription
itemsList<GlobalMessage>List of Message to all users

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.DescribeGlobalMessages(
    &inbox.DescribeGlobalMessagesRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->describeGlobalMessages(
        (new DescribeGlobalMessagesRequest())
            ->withNamespaceName("namespace-0001")
    );
    $items = $result->getItems();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace-0001")
    );
    List<GlobalMessage> items = result.getItems();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.DescribeGlobalMessagesResult> asyncResult = null;
yield return client.DescribeGlobalMessages(
    new Gs2.Gs2Inbox.Request.DescribeGlobalMessagesRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
import Gs2Core from '@/gs2/core';
import * as 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("namespace-0001")
    );
    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('namespace-0001')
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)
client = gs2('inbox')

api_result = client.describe_global_messages({
    namespaceName="namespace-0001",
})

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

result = api_result.result
items = result.items;
client = gs2('inbox')

api_result_handler = client.describe_global_messages_async({
    namespaceName="namespace-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['errorMessage'])
end

result = api_result.result
items = result.items;

getGlobalMessage

Get a message for all users

Retrieves a specific global message by name. The message must be within its reception period; if the message is outside the reception window, a 404 error is returned.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
globalMessageNamestring
~ 128 charsGlobal Message name
Global Message-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).

Result

TypeDescription
itemGlobalMessageMessage to all users

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.GetGlobalMessage(
    &inbox.GetGlobalMessageRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->getGlobalMessage(
        (new GetGlobalMessageRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withGlobalMessageName("globalMessage-0001")
    );
    GlobalMessage item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.GetGlobalMessageResult> asyncResult = null;
yield return client.GetGlobalMessage(
    new Gs2.Gs2Inbox.Request.GetGlobalMessageRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    globalMessageName="globalMessage-0001",
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.get_global_message_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

getReceivedByUserId

Get Received Global Message by specifying a user ID

Retrieves the list of global message names that the specified user has already received. This tracking record is used by ReceiveGlobalMessage to determine which global messages have not yet been delivered to the user, preventing duplicate delivery.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemReceivedReceived Global Message

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.GetReceivedByUserId(
    &inbox.GetReceivedByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->getReceivedByUserId(
        (new GetReceivedByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    Received item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.GetReceivedByUserIdResult> asyncResult = null;
yield return client.GetReceivedByUserId(
    new Gs2.Gs2Inbox.Request.GetReceivedByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    userId="user-0001",
    timeOffsetToken=nil,
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.get_received_by_user_id_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

updateReceivedByUserId

Update Received Global Message by specifying a user ID

Directly updates the list of global message names that the user has received. This can be used to manually mark specific global messages as received or to reset the received state for re-delivery.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
receivedGlobalMessageNamesList<string>[]0 ~ 100 itemsReceived Global Message Names
The list of global message names that the user has already received. When the receive global messages operation is executed, messages whose names appear in this list are skipped.
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemReceivedReceived Global Message updated

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.UpdateReceivedByUserId(
    &inbox.UpdateReceivedByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->updateReceivedByUserId(
        (new UpdateReceivedByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.UpdateReceivedByUserIdResult> asyncResult = null;
yield return client.UpdateReceivedByUserId(
    new Gs2.Gs2Inbox.Request.UpdateReceivedByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.update_received_by_user_id_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

deleteReceivedByUserId

Delete Received Global Message by specifying a user ID

Deletes the received tracking record for the specified user. After deletion, the next call to ReceiveGlobalMessage will treat all active global messages as unreceived and deliver them again as individual messages.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemReceivedReceived Global Message

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.DeleteReceivedByUserId(
    &inbox.DeleteReceivedByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->deleteReceivedByUserId(
        (new DeleteReceivedByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    Received item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.DeleteReceivedByUserIdResult> asyncResult = null;
yield return client.DeleteReceivedByUserId(
    new Gs2.Gs2Inbox.Request.DeleteReceivedByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    userId="user-0001",
    timeOffsetToken=nil,
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.delete_received_by_user_id_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

exportMaster

Export Global Message Master in a master data format that can be activated

Exports all global message masters in the namespace as a JSON document suitable for activation. The exported data includes the complete configuration of each global message (metadata, read acquire actions, expiration settings, reception period references). This data can be used to activate the master data in another namespace or stored for version control purposes.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).

Result

TypeDescription
itemCurrentMessageMasterGlobal Message master data that can be activated

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.ExportMaster(
    &inbox.ExportMasterRequest {
        NamespaceName: pointy.String("namespace-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\ExportMasterRequest;

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

$session->open();

$client = new Gs2InboxRestClient(
    $session
);

try {
    $result = $client->exportMaster(
        (new ExportMasterRequest())
            ->withNamespaceName("namespace-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.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("namespace-0001")
    );
    CurrentMessageMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.ExportMasterResult> asyncResult = null;
yield return client.ExportMaster(
    new Gs2.Gs2Inbox.Request.ExportMasterRequest()
        .WithNamespaceName("namespace-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.exportMaster(
        new Gs2Inbox.ExportMasterRequest()
            .withNamespaceName("namespace-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.export_master(
        inbox.ExportMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('inbox')

api_result = client.export_master({
    namespaceName="namespace-0001",
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.export_master_async({
    namespaceName="namespace-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['errorMessage'])
end

result = api_result.result
item = result.item;

getCurrentMessageMaster

Get currently active Global Message master data

Retrieves the currently active master data that defines which global messages are available in the namespace. This is the data that was last activated and is being used to serve global message requests and ReceiveGlobalMessage operations.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).

Result

TypeDescription
itemCurrentMessageMasterCurrently active Global Message master data

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.GetCurrentMessageMaster(
    &inbox.GetCurrentMessageMasterRequest {
        NamespaceName: pointy.String("namespace-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\GetCurrentMessageMasterRequest;

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

$session->open();

$client = new Gs2InboxRestClient(
    $session
);

try {
    $result = $client->getCurrentMessageMaster(
        (new GetCurrentMessageMasterRequest())
            ->withNamespaceName("namespace-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.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("namespace-0001")
    );
    CurrentMessageMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.GetCurrentMessageMasterResult> asyncResult = null;
yield return client.GetCurrentMessageMaster(
    new Gs2.Gs2Inbox.Request.GetCurrentMessageMasterRequest()
        .WithNamespaceName("namespace-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.getCurrentMessageMaster(
        new Gs2Inbox.GetCurrentMessageMasterRequest()
            .withNamespaceName("namespace-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_current_message_master(
        inbox.GetCurrentMessageMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('inbox')

api_result = client.get_current_message_master({
    namespaceName="namespace-0001",
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.get_current_message_master_async({
    namespaceName="namespace-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['errorMessage'])
end

result = api_result.result
item = result.item;

preUpdateCurrentMessageMaster

Update Currently Active Master Data (3-phase version)

When uploading master data larger than 1MB, the update is performed in 3 phases.

  1. Execute this API to obtain a token and URL for uploading.
  2. Upload the master data to the obtained URL.
  3. Execute UpdateCurrentModelMaster by passing the token obtained from the the upload to reflect the master data.
Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).

Result

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

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.PreUpdateCurrentMessageMaster(
    &inbox.PreUpdateCurrentMessageMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Inbox\Gs2InboxRestClient;
use Gs2\Inbox\Request\PreUpdateCurrentMessageMasterRequest;

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

$session->open();

$client = new Gs2InboxRestClient(
    $session
);

try {
    $result = $client->preUpdateCurrentMessageMaster(
        (new PreUpdateCurrentMessageMasterRequest())
            ->withNamespaceName("namespace-0001")
    );
    $uploadToken = $result->getUploadToken();
    $uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.inbox.rest.Gs2InboxRestClient;
import io.gs2.inbox.request.PreUpdateCurrentMessageMasterRequest;
import io.gs2.inbox.result.PreUpdateCurrentMessageMasterResult;

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

try {
    PreUpdateCurrentMessageMasterResult result = client.preUpdateCurrentMessageMaster(
        new PreUpdateCurrentMessageMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    String uploadToken = result.getUploadToken();
    String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.PreUpdateCurrentMessageMasterResult> asyncResult = null;
yield return client.PreUpdateCurrentMessageMaster(
    new Gs2.Gs2Inbox.Request.PreUpdateCurrentMessageMasterRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;
import Gs2Core from '@/gs2/core';
import * as 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.preUpdateCurrentMessageMaster(
        new Gs2Inbox.PreUpdateCurrentMessageMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    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.pre_update_current_message_master(
        inbox.PreUpdateCurrentMessageMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    upload_token = result.upload_token
    upload_url = result.upload_url
except core.Gs2Exception as e:
    exit(1)
client = gs2('inbox')

api_result = client.pre_update_current_message_master({
    namespaceName="namespace-0001",
})

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

result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;
client = gs2('inbox')

api_result_handler = client.pre_update_current_message_master_async({
    namespaceName="namespace-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['errorMessage'])
end

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

updateCurrentMessageMaster

Update currently active Global Message master data

Activates new master data to replace the currently active global messages. Supports two modes: “direct” for inline JSON data (suitable for small payloads), and “preUpload” for data uploaded via a presigned URL (required for data exceeding 1MB, using the token obtained from PreUpdate). After activation, the new global messages become immediately available for ReceiveGlobalMessage operations.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
modeString Enum
enum {
  “direct”,
  “preUpload”
}
“direct”Update mode
DefinitionDescription
“direct”Directly update master data
“preUpload”Upload master data and then update
settingsstring{mode} == “direct”
✓*
~ 5242880 charsMaster Data
* Required if mode is “direct”
uploadTokenstring{mode} == “preUpload”
✓*
~ 1024 charsToken obtained by pre-upload
Used to apply the uploaded master data.
* Required if mode is “preUpload”

Result

TypeDescription
itemCurrentMessageMasterUpdated master data of the currently active Global Messages

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentMessageMaster(
    &inbox.UpdateCurrentMessageMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Mode: pointy.String("direct"),
        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}"),
        UploadToken: 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\UpdateCurrentMessageMasterRequest;

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

$session->open();

$client = new Gs2InboxRestClient(
    $session
);

try {
    $result = $client->updateCurrentMessageMaster(
        (new UpdateCurrentMessageMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withMode("direct")
            ->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}")
            ->withUploadToken(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.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("namespace-0001")
            .withMode("direct")
            .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}")
            .withUploadToken(null)
    );
    CurrentMessageMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.UpdateCurrentMessageMasterResult> asyncResult = null;
yield return client.UpdateCurrentMessageMaster(
    new Gs2.Gs2Inbox.Request.UpdateCurrentMessageMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithMode("direct")
        .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}")
        .WithUploadToken(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.updateCurrentMessageMaster(
        new Gs2Inbox.UpdateCurrentMessageMasterRequest()
            .withNamespaceName("namespace-0001")
            .withMode("direct")
            .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}")
            .withUploadToken(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_current_message_master(
        inbox.UpdateCurrentMessageMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_mode('direct')
            .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}')
            .with_upload_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('inbox')

api_result = client.update_current_message_master({
    namespaceName="namespace-0001",
    mode="direct",
    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}",
    uploadToken=nil,
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.update_current_message_master_async({
    namespaceName="namespace-0001",
    mode="direct",
    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}",
    uploadToken=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['errorMessage'])
end

result = api_result.result
item = result.item;

updateCurrentMessageMasterFromGitHub

Update currently active Global Message master data from GitHub

Fetches master data from a GitHub repository and activates it as the current global message configuration. The checkout setting specifies the repository, branch/tag, and file path to retrieve the master data JSON. Template variables (region, ownerId, userId) in the file are automatically replaced during processing.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
checkoutSettingGitHubCheckoutSetting
Setup to check out master data from GitHub

Result

TypeDescription
itemCurrentMessageMasterUpdated master data of the currently active Global Messages

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentMessageMasterFromGitHub(
    &inbox.UpdateCurrentMessageMasterFromGitHubRequest {
        NamespaceName: pointy.String("namespace-0001"),
        CheckoutSetting: &inbox.GitHubCheckoutSetting{
            ApiKeyId: pointy.String("apiKeyId-0001"),
            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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->updateCurrentMessageMasterFromGitHub(
        (new UpdateCurrentMessageMasterFromGitHubRequest())
            ->withNamespaceName("namespace-0001")
            ->withCheckoutSetting((new GitHubCheckoutSetting())
                ->withApiKeyId("apiKeyId-0001")
                ->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("namespace-0001")
            .withCheckoutSetting(new GitHubCheckoutSetting()
                .withApiKeyId("apiKeyId-0001")
                .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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.UpdateCurrentMessageMasterFromGitHubResult> asyncResult = null;
yield return client.UpdateCurrentMessageMasterFromGitHub(
    new Gs2.Gs2Inbox.Request.UpdateCurrentMessageMasterFromGitHubRequest()
        .WithNamespaceName("namespace-0001")
        .WithCheckoutSetting(new Gs2.Gs2Inbox.Model.GitHubCheckoutSetting()
            .WithApiKeyId("apiKeyId-0001")
            .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("namespace-0001")
            .withCheckoutSetting(new Gs2Inbox.model.GitHubCheckoutSetting()
                .withApiKeyId("apiKeyId-0001")
                .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('namespace-0001')
            .with_checkout_setting(inbox.GitHubCheckoutSetting()
                .with_api_key_id('apiKeyId-0001')
                .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="namespace-0001",
    checkoutSetting={
        api_key_id="apiKeyId-0001",
        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['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.update_current_message_master_from_git_hub_async({
    namespaceName="namespace-0001",
    checkoutSetting={
        api_key_id="apiKeyId-0001",
        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['errorMessage'])
end

result = api_result.result
item = result.item;

describeGlobalMessageMasters

Get a list of messages to all users

Retrieves a paginated list of all global message masters in the specified namespace, regardless of their reception period. This is an administrative view that shows all defined global messages, including those not yet active or already expired. Supports optional name prefix filtering for targeted searches.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
namePrefixstring~ 64 charsFilter by messages to all users prefix
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data items to retrieve

Result

TypeDescription
itemsList<GlobalMessageMaster>List of messages for all users
nextPageTokenstringPage token to retrieve the rest of the listing

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/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("namespace-0001"),
        NamePrefix: 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\DescribeGlobalMessageMastersRequest;

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

$session->open();

$client = new Gs2InboxRestClient(
    $session
);

try {
    $result = $client->describeGlobalMessageMasters(
        (new DescribeGlobalMessageMastersRequest())
            ->withNamespaceName("namespace-0001")
            ->withNamePrefix(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.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("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<GlobalMessageMaster> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.DescribeGlobalMessageMastersResult> asyncResult = null;
yield return client.DescribeGlobalMessageMasters(
    new Gs2.Gs2Inbox.Request.DescribeGlobalMessageMastersRequest()
        .WithNamespaceName("namespace-0001")
        .WithNamePrefix(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.describeGlobalMessageMasters(
        new Gs2Inbox.DescribeGlobalMessageMastersRequest()
            .withNamespaceName("namespace-0001")
            .withNamePrefix(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_global_message_masters(
        inbox.DescribeGlobalMessageMastersRequest()
            .with_namespace_name('namespace-0001')
            .with_name_prefix(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_global_message_masters({
    namespaceName="namespace-0001",
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

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

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('inbox')

api_result_handler = client.describe_global_message_masters_async({
    namespaceName="namespace-0001",
    namePrefix=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['errorMessage'])
end

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

createGlobalMessageMaster

Create a new message for all users

Creates a new global message template that will be broadcast to all users. You can configure readAcquireActions (rewards granted when the message is read), and message expiration using either an absolute timestamp (expiresAt) or a relative duration (expiresTimeSpan) from when the user receives the message. Optionally, messageReceptionPeriodEventId can reference a GS2-Schedule event to control the time window during which the message can be received by users. The created master must be activated through the current master data update process to become available to users.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
namestring
UUID~ 64 charsGlobal Message Name
A unique identifier for this global message within the namespace. Used to track which global messages each user has already received, preventing duplicate delivery. Automatically generated as a UUID if not specified.
metadatastring
~ 4096 charsMetadata
Arbitrary data representing the global message content, such as a JSON string containing the message title, body text, and display parameters. When a user receives this global message, the metadata is copied to the individual message in their inbox. GS2 does not interpret this value. Maximum 4096 characters.
readAcquireActionsList<AcquireAction>[]0 ~ 100 itemsRead Acquire Actions
The list of acquire actions to be executed when a user opens the message copied from this global message. These actions are copied along with the metadata to each user’s individual message. Up to 100 actions per global message.
expiresTimeSpanTimeSpanExpiration Time Span
The duration from the time a user receives (copies) this global message until the copied message expires and is automatically deleted from their inbox. Specified as a combination of days, hours, and minutes. Messages are deleted regardless of read status when the expiration is reached, including any unclaimed attached rewards.
messageReceptionPeriodEventIdstring~ 1024 charsMessage Reception Period Event ID
The GRN of a GS2-Schedule event that defines the time window during which this global message can be received (copied to users’ inboxes). Outside this period, the global message is not delivered even if a user triggers the receive global messages operation. Useful for time-limited event announcements or seasonal campaign rewards.

Result

TypeDescription
itemGlobalMessageMasterMessage to all users created

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.CreateGlobalMessageMaster(
    &inbox.CreateGlobalMessageMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->createGlobalMessageMaster(
        (new CreateGlobalMessageMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.CreateGlobalMessageMasterResult> asyncResult = null;
yield return client.CreateGlobalMessageMaster(
    new Gs2.Gs2Inbox.Request.CreateGlobalMessageMasterRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.create_global_message_master_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

getGlobalMessageMaster

Get a message for all users

Retrieves the details of a specific global message master, including its metadata, read acquire actions, expiration settings, and reception period configuration. Unlike the GlobalMessage Get API, this returns the message regardless of whether it is within the reception period.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
globalMessageNamestring
UUID~ 64 charsGlobal Message Name
A unique identifier for this global message within the namespace. Used to track which global messages each user has already received, preventing duplicate delivery. Automatically generated as a UUID if not specified.

Result

TypeDescription
itemGlobalMessageMasterMessage to all users

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.GetGlobalMessageMaster(
    &inbox.GetGlobalMessageMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->getGlobalMessageMaster(
        (new GetGlobalMessageMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withGlobalMessageName("globalMessageMaster-0001")
    );
    GlobalMessageMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.GetGlobalMessageMasterResult> asyncResult = null;
yield return client.GetGlobalMessageMaster(
    new Gs2.Gs2Inbox.Request.GetGlobalMessageMasterRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    globalMessageName="globalMessageMaster-0001",
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.get_global_message_master_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

updateGlobalMessageMaster

Update message to all users

Updates the properties of an existing global message master. You can modify the metadata, read acquire actions (rewards), expiration settings, and reception period event reference. Changes must be activated through the current master data update process to take effect.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
globalMessageNamestring
UUID~ 64 charsGlobal Message Name
A unique identifier for this global message within the namespace. Used to track which global messages each user has already received, preventing duplicate delivery. Automatically generated as a UUID if not specified.
metadatastring
~ 4096 charsMetadata
Arbitrary data representing the global message content, such as a JSON string containing the message title, body text, and display parameters. When a user receives this global message, the metadata is copied to the individual message in their inbox. GS2 does not interpret this value. Maximum 4096 characters.
readAcquireActionsList<AcquireAction>[]0 ~ 100 itemsRead Acquire Actions
The list of acquire actions to be executed when a user opens the message copied from this global message. These actions are copied along with the metadata to each user’s individual message. Up to 100 actions per global message.
expiresTimeSpanTimeSpanExpiration Time Span
The duration from the time a user receives (copies) this global message until the copied message expires and is automatically deleted from their inbox. Specified as a combination of days, hours, and minutes. Messages are deleted regardless of read status when the expiration is reached, including any unclaimed attached rewards.
messageReceptionPeriodEventIdstring~ 1024 charsMessage Reception Period Event ID
The GRN of a GS2-Schedule event that defines the time window during which this global message can be received (copied to users’ inboxes). Outside this period, the global message is not delivered even if a user triggers the receive global messages operation. Useful for time-limited event announcements or seasonal campaign rewards.

Result

TypeDescription
itemGlobalMessageMasterUpdated message to all users

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.UpdateGlobalMessageMaster(
    &inbox.UpdateGlobalMessageMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->updateGlobalMessageMaster(
        (new UpdateGlobalMessageMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .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;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.UpdateGlobalMessageMasterResult> asyncResult = null;
yield return client.UpdateGlobalMessageMaster(
    new Gs2.Gs2Inbox.Request.UpdateGlobalMessageMasterRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.update_global_message_master_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;

deleteGlobalMessageMaster

Delete messages for all users

Deletes the specified global message master. After activation of the master data update, the message will no longer be available for new user receptions. Messages that have already been received by users as individual messages are not affected.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
globalMessageNamestring
UUID~ 64 charsGlobal Message Name
A unique identifier for this global message within the namespace. Used to track which global messages each user has already received, preventing duplicate delivery. Automatically generated as a UUID if not specified.

Result

TypeDescription
itemGlobalMessageMasterDeleted Message to all users

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/inbox"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := inbox.Gs2InboxRestClient{
    Session: &session,
}
result, err := client.DeleteGlobalMessageMaster(
    &inbox.DeleteGlobalMessageMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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 Gs2InboxRestClient(
    $session
);

try {
    $result = $client->deleteGlobalMessageMaster(
        (new DeleteGlobalMessageMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withGlobalMessageName("globalMessageMaster-0001")
    );
    GlobalMessageMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2InboxRestClient(session);

AsyncResult<Gs2.Gs2Inbox.Result.DeleteGlobalMessageMasterResult> asyncResult = null;
yield return client.DeleteGlobalMessageMaster(
    new Gs2.Gs2Inbox.Request.DeleteGlobalMessageMasterRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    globalMessageName="globalMessageMaster-0001",
})

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

result = api_result.result
item = result.item;
client = gs2('inbox')

api_result_handler = client.delete_global_message_master_async({
    namespaceName="namespace-0001",
    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['errorMessage'])
end

result = api_result.result
item = result.item;