GS2-Grade SDK API Reference

Specification of models and API references for GS2-Grade 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
transactionSettingTransactionSettingTransaction Setting
Configuration for controlling how distributed transactions are executed when processing grade operations. Supports auto-run, atomic commit, and async processing options.
changeGradeScriptScriptSettingScript setting to be executed when grade changes
Script Trigger Reference - changeGrade
logSettingLogSettingLog Output Setting
Configuration for outputting log data of grade operations to GS2-Log. By specifying a GS2-Log namespace, API request and response logs for grade changes and rank cap updates can be collected.
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. Because synchronous execution blocks processing until the script finishes executing, you can use the script result to stop the API execution or control the API response.

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, Because asynchronous execution does not affect the API response flow, it 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”

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”

Status

Status

A status is an entity that exists for each property ID and holds the value of the current grade.

The property ID is a status-specific ID and can be set to any value by the developer. It is strongly recommended that the value be the same as the property ID of the GS2-Experience.

Details
TypeConditionRequiredDefaultValue LimitsDescription
statusIdstring
*
~ 1024 charsStatus GRN
* Set automatically by the server
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
userIdstring
~ 128 charsUser ID
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.
gradeValuelong11 ~ 9223372036854775805Current Grade
The current grade value of this status. Used as an index into the grade model’s grade entries array to determine the rank cap for the linked GS2-Experience model. When this value changes, the rank cap of the associated experience status is automatically updated to the value defined in the corresponding grade entry.
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

GradeModel

Grade Model

A Grade Model is an entity that indicates the rank of characters and equipment, and allows you to set the rank cap for GS2-Experience based on the grade.

Details
TypeConditionRequiredDefaultValue LimitsDescription
gradeModelIdstring
*
~ 1024 charsGrade Model GRN
* Set automatically by the server
namestring
~ 128 charsGrade Model name
Grade Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadatastring~ 2048 charsMetadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
defaultGradesList<DefaultGradeModel>0 ~ 100 itemsList of Default Grade Models
An ordered list of default grade rules evaluated when creating a new status. Each entry defines a property ID regex pattern and the grade value to assign when matched. If no pattern matches, the default grade value of 0 is used.
experienceModelIdstring
~ 1024 charsGS2-Experience Experience Model GRN
The GRN of the GS2-Experience experience model to link with this grade model. When a grade value changes, the corresponding rank cap in the linked experience model is automatically updated based on the grade entry mappings. This enables grade-driven progression where higher grades unlock higher rank caps.
gradeEntriesList<GradeEntryModel>
1 ~ 100 itemsList of Grade Entry Models
The ordered list of grade entries that map each grade value to a rank cap for the linked GS2-Experience model. The index in the array corresponds to the grade value, so the first entry (index 0) defines the rank cap for grade 0, the second for grade 1, and so on.
acquireActionRatesList<AcquireActionRate>0 ~ 100 itemsList of Reward Addition Tables
A collection of named multiplier tables used to scale reward amounts based on grade. Multiple tables can be defined to apply different scaling rules to different types of rewards (e.g., experience points, currency, items).

DefaultGradeModel

Default Grade Model

You can set the default grade value according to the match of the property ID regular expression when creating a new grade.

Details
TypeConditionRequiredDefaultValue LimitsDescription
propertyIdRegexstring
~ 1024 charsProperty ID Regex
A regular expression pattern matched against the property ID of a newly created grade status. When the property ID matches this pattern, the specified default grade value is assigned as the initial grade instead of 0. Patterns are evaluated in order, and the first match is used.
defaultGradeValuelong
0 ~ 9223372036854775805Default Grade Value
The initial grade value assigned to a newly created status when its property ID matches the propertyIdRegex pattern. This value determines the starting rank cap for the linked GS2-Experience model, as the grade entry at this index defines the corresponding rank cap.

GradeEntryModel

Grade Entry Model

Defines the mapping between a grade value and a rank cap for the linked GS2-Experience model. Each entry also specifies regex patterns for matching property IDs, enabling the system to determine which resources can be used for grade-up operations and how their property IDs are transformed.

Details
TypeConditionRequiredDefaultValue LimitsDescription
metadatastring~ 2048 charsMetadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
rankCapValuelong
0 ~ 9223372036854775805Rank Cap Value
The rank cap value to set in the linked GS2-Experience model when this grade is applied. When a player’s grade changes to the value corresponding to this entry, the rank cap of the associated experience status is automatically updated to this value, controlling the maximum achievable rank.
propertyIdRegexstring
~ 1024 charsProperty ID Regex
A regular expression pattern applied to the grade status’s property ID to extract variables for grade-up matching. Capture groups (parenthesized parts) in this pattern become available as $1, $2, etc. in gradeUpPropertyIdRegex. For example, a pattern like “character-(.+)” extracts the character identifier for use in matching grade-up material property IDs.
gradeUpPropertyIdRegexstring
~ 1024 charsGrade-Up Property ID Regex
A regular expression pattern that identifies which resource property IDs can be consumed for grade advancement. This pattern can reference capture groups from propertyIdRegex using $1, $2, etc. For example, if propertyIdRegex extracts “sword-001” as $1, this pattern might be “grade-up-material-$1” to match materials specific to that sword.

AcquireActionRate

Reward Addition Table

Defines a named multiplier table that scales reward amounts based on the current grade value. Each grade value maps to a multiplier applied to acquire actions in transactions, allowing higher-graded characters or equipment to receive proportionally more rewards. Supports both standard double-precision mode and big number mode for extremely large values.

Details
TypeConditionRequiredDefaultValue LimitsDescription
namestring
~ 128 charsReward Addition Table Name
A unique identifier for this multiplier table within the grade model. Referenced when applying grade-based reward scaling to specific acquire actions in transactions.
modeString Enum
enum {
  “double”,
  “big”
}
“double”Reward Addition Table Type
Selects the numeric precision mode for multiplier values. “double” mode uses standard floating-point numbers suitable for most cases. “big” mode uses string-represented numbers supporting up to 1024 digits, for games requiring extremely large value calculations.
DefinitionDescription
“double”Floating point number less than 2^48
“big”Floating point number less than 1024 digits
ratesList<double>{mode} == “double”
✓*
1 ~ 1000 itemsMultiplier List per Grade (double mode)
An array of reward multipliers indexed by grade value, using double-precision floating-point numbers. The entry at index 0 is the multiplier for grade 0, index 1 for grade 1, and so on. Used when mode is set to “double”.
* Required if mode is “double”
bigRatesList<string>{mode} == “big”
✓*
1 ~ 1000 itemsMultiplier List per Grade (big mode)
An array of reward multipliers indexed by grade value, using string-represented numbers for extended precision. The entry at index 0 is the multiplier for grade 0, index 1 for grade 1, and so on. Used when mode is set to “big” for games requiring very large number calculations.
* Required if mode is “big”

AcquireAction

Acquire Action

Details
TypeConditionRequiredDefaultValue LimitsDescription
actionString Enum
enum {
}
Type of action to be executed in the Acquire Action
requeststring
~ 524288 charsJSON string of the request used when executing the action

VerifyActionResult

Verify Action execution result

Details
TypeConditionRequiredDefaultValue LimitsDescription
actionString Enum
enum {
}
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 {
}
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 {
}
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

CurrentGradeMaster

Currently active Grade Model master data

This master data describes the definitions of Grade Model 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

GradeModelMaster

Grade Model Master

Grade Model Master is data used to edit and manage Grade Model 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 Grade Model actually referenced by the game.

An Grade Model is an entity that sets the threshold of grade required for rank advancement and for each default and maximum rank cap.

Details
TypeConditionRequiredDefaultValue LimitsDescription
gradeModelIdstring
*
~ 1024 charsGrade Model Master GRN
* Set automatically by the server
namestring
~ 128 charsGrade Model name
descriptionstring~ 1024 charsDescription
metadatastring~ 2048 charsMetadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
defaultGradesList<DefaultGradeModel>0 ~ 100 itemsList of Default Grade Models
An ordered list of default grade rules evaluated when creating a new status. Each entry defines a property ID regex pattern and the grade value to assign when matched. If no pattern matches, the default grade value of 0 is used.
experienceModelIdstring
~ 1024 charsGS2-Experience Experience Model GRN
The GRN of the GS2-Experience experience model to link with this grade model. When a grade value changes, the corresponding rank cap in the linked experience model is automatically updated based on the grade entry mappings. This enables grade-driven progression where higher grades unlock higher rank caps.
gradeEntriesList<GradeEntryModel>0 ~ 100 itemsList of Grade Entry Models
The ordered list of grade entries that map each grade value to a rank cap for the linked GS2-Experience model. The index in the array corresponds to the grade value, so the first entry (index 0) defines the rank cap for grade 0, the second for grade 1, and so on.
acquireActionRatesList<AcquireActionRate>0 ~ 100 itemsList of Reward Addition Tables
A collection of named multiplier tables used to scale reward amounts based on grade. Multiple tables can be defined to apply different scaling rules to different types of rewards (e.g., experience points, currency, items).
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

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 Namespaces
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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.DescribeNamespaces(
    &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\DescribeNamespacesRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DescribeNamespacesRequest;
import io.gs2.grade.result.DescribeNamespacesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
    new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

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

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

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

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('grade')

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

You must specify detailed information including the name, description, and various settings of the namespace.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
descriptionstring~ 1024 charsDescription
transactionSettingTransactionSettingTransaction Setting
Configuration for controlling how distributed transactions are executed when processing grade operations. Supports auto-run, atomic commit, and async processing options.
changeGradeScriptScriptSettingScript setting to be executed when grade changes
Script Trigger Reference - changeGrade
logSettingLogSettingLog Output Setting
Configuration for outputting log data of grade operations to GS2-Log. By specifying a GS2-Log namespace, API request and response logs for grade changes and rank cap updates can be collected.

Result

TypeDescription
itemNamespaceNamespace created

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &grade.CreateNamespaceRequest {
        Name: pointy.String("namespace-0001"),
        Description: nil,
        TransactionSetting: nil,
        ChangeGradeScript: nil,
        LogSetting: &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\CreateNamespaceRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName("namespace-0001")
            ->withDescription(null)
            ->withTransactionSetting(null)
            ->withChangeGradeScript(null)
            ->withLogSetting((new \Gs2\Grade\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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.CreateNamespaceRequest;
import io.gs2.grade.result.CreateNamespaceResult;

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

try {
    CreateNamespaceResult result = client.createNamespace(
        new CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withTransactionSetting(null)
            .withChangeGradeScript(null)
            .withLogSetting(new io.gs2.grade.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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
    new Gs2.Gs2Grade.Request.CreateNamespaceRequest()
        .WithName("namespace-0001")
        .WithDescription(null)
        .WithTransactionSetting(null)
        .WithChangeGradeScript(null)
        .WithLogSetting(new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.createNamespace(
        new Gs2Grade.CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withTransactionSetting(null)
            .withChangeGradeScript(null)
            .withLogSetting(new Gs2Grade.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 grade

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

try:
    result = client.create_namespace(
        grade.CreateNamespaceRequest()
            .with_name('namespace-0001')
            .with_description(None)
            .with_transaction_setting(None)
            .with_change_grade_script(None)
            .with_log_setting(
                grade.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('grade')

api_result = client.create_namespace({
    name="namespace-0001",
    description=nil,
    transactionSetting=nil,
    changeGradeScript=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('grade')

api_result_handler = client.create_namespace_async({
    name="namespace-0001",
    description=nil,
    transactionSetting=nil,
    changeGradeScript=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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.GetNamespaceStatus(
    &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\GetNamespaceStatusRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.GetNamespaceStatusRequest;
import io.gs2.grade.result.GetNamespaceStatusResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
    new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.getNamespaceStatus(
        new Gs2Grade.GetNamespaceStatusRequest()
            .withNamespaceName("namespace-0001")
    );
    const status = result.getStatus();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.get_namespace_status(
        grade.GetNamespaceStatusRequest()
            .with_namespace_name('namespace-0001')
    )
    status = result.status
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

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('grade')

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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.GetNamespace(
    &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\GetNamespaceRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.GetNamespaceRequest;
import io.gs2.grade.result.GetNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
    new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.getNamespace(
        new Gs2Grade.GetNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.get_namespace(
        grade.GetNamespaceRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

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('grade')

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

Update the settings of the specified namespace. You can change the description of the Namespace and specific settings.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
descriptionstring~ 1024 charsDescription
transactionSettingTransactionSettingTransaction Setting
Configuration for controlling how distributed transactions are executed when processing grade operations. Supports auto-run, atomic commit, and async processing options.
changeGradeScriptScriptSettingScript setting to be executed when grade changes
Script Trigger Reference - changeGrade
logSettingLogSettingLog Output Setting
Configuration for outputting log data of grade operations to GS2-Log. By specifying a GS2-Log namespace, API request and response logs for grade changes and rank cap updates can be collected.

Result

TypeDescription
itemNamespaceNamespace updated

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &grade.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Description: pointy.String("description1"),
        TransactionSetting: nil,
        ChangeGradeScript: &grade.ScriptSetting{
            TriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002"),
            DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003"),
        },
        LogSetting: &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\UpdateNamespaceRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->updateNamespace(
        (new UpdateNamespaceRequest())
            ->withNamespaceName("namespace-0001")
            ->withDescription("description1")
            ->withTransactionSetting(null)
            ->withChangeGradeScript((new \Gs2\Grade\Model\ScriptSetting())
                ->withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002")
                ->withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003"))
            ->withLogSetting((new \Gs2\Grade\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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.UpdateNamespaceRequest;
import io.gs2.grade.result.UpdateNamespaceResult;

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

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withTransactionSetting(null)
            .withChangeGradeScript(new io.gs2.grade.model.ScriptSetting()
                .withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002")
                .withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003"))
            .withLogSetting(new io.gs2.grade.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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
    new Gs2.Gs2Grade.Request.UpdateNamespaceRequest()
        .WithNamespaceName("namespace-0001")
        .WithDescription("description1")
        .WithTransactionSetting(null)
        .WithChangeGradeScript(new Gs2.Gs2Grade.Model.ScriptSetting()
            .WithTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002")
            .WithDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003"))
        .WithLogSetting(new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.updateNamespace(
        new Gs2Grade.UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withTransactionSetting(null)
            .withChangeGradeScript(new Gs2Grade.model.ScriptSetting()
                .withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002")
                .withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003"))
            .withLogSetting(new Gs2Grade.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 grade

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

try:
    result = client.update_namespace(
        grade.UpdateNamespaceRequest()
            .with_namespace_name('namespace-0001')
            .with_description('description1')
            .with_transaction_setting(None)
            .with_change_grade_script(
                grade.ScriptSetting()
                    .with_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002')
                    .with_done_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003'))
            .with_log_setting(
                grade.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('grade')

api_result = client.update_namespace({
    namespaceName="namespace-0001",
    description="description1",
    transactionSetting=nil,
    changeGradeScript={
        triggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002",
        doneTriggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003",
    },
    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('grade')

api_result_handler = client.update_namespace_async({
    namespaceName="namespace-0001",
    description="description1",
    transactionSetting=nil,
    changeGradeScript={
        triggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002",
        doneTriggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003",
    },
    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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.DeleteNamespace(
    &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\DeleteNamespaceRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DeleteNamespaceRequest;
import io.gs2.grade.result.DeleteNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
    new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.deleteNamespace(
        new Gs2Grade.DeleteNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.delete_namespace(
        grade.DeleteNamespaceRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

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('grade')

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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.GetServiceVersion(
    &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\GetServiceVersionRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.GetServiceVersionRequest;
import io.gs2.grade.result.GetServiceVersionResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
    new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.getServiceVersion(
        new Gs2Grade.GetServiceVersionRequest()
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.get_service_version(
        grade.GetServiceVersionRequest()
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

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('grade')

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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.DumpUserDataByUserId(
    &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\DumpUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DumpUserDataByUserIdRequest;
import io.gs2.grade.result.DumpUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
    new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

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

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

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

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('grade')

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

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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
    &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\CheckDumpUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.grade.result.CheckDumpUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
    new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

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

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

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

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('grade')

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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.CleanUserDataByUserId(
    &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\CleanUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.CleanUserDataByUserIdRequest;
import io.gs2.grade.result.CleanUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
    new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

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

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

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

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('grade')

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

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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
    &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\CheckCleanUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.grade.result.CheckCleanUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
    new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

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

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

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

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('grade')

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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
    &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\PrepareImportUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.grade.result.PrepareImportUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
    new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.prepareImportUserDataByUserId(
        new Gs2Grade.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 grade

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

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

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('grade')

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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.ImportUserDataByUserId(
    &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\ImportUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.ImportUserDataByUserIdRequest;
import io.gs2.grade.result.ImportUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
    new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

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

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

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

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('grade')

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

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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
    &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\CheckImportUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.CheckImportUserDataByUserIdRequest;
import io.gs2.grade.result.CheckImportUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2GradeRestClient client = new Gs2GradeRestClient(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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
    new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.checkImportUserDataByUserId(
        new Gs2Grade.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 grade

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

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

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('grade')

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;

describeStatuses

Get a list of statuses

Retrieves a paginated list of grade statuses for the requesting user. Each status represents a grade value associated with a specific grade model and property ID. An optional grade model name filter can be specified to retrieve statuses for a specific grade model only.

Details

Request

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

Result

TypeDescription
itemsList<Status>List of Status
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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.DescribeStatuses(
    &grade.DescribeStatusesRequest {
        NamespaceName: pointy.String("namespace-0001"),
        GradeName: pointy.String("grade-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\DescribeStatusesRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->describeStatuses(
        (new DescribeStatusesRequest())
            ->withNamespaceName("namespace-0001")
            ->withGradeName("grade-0001")
            ->withAccessToken("accessToken-0001")
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DescribeStatusesRequest;
import io.gs2.grade.result.DescribeStatusesResult;

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

try {
    DescribeStatusesResult result = client.describeStatuses(
        new DescribeStatusesRequest()
            .withNamespaceName("namespace-0001")
            .withGradeName("grade-0001")
            .withAccessToken("accessToken-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Status> 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DescribeStatusesResult> asyncResult = null;
yield return client.DescribeStatuses(
    new Gs2.Gs2Grade.Request.DescribeStatusesRequest()
        .WithNamespaceName("namespace-0001")
        .WithGradeName("grade-0001")
        .WithAccessToken("accessToken-0001")
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.describeStatuses(
        new Gs2Grade.DescribeStatusesRequest()
            .withNamespaceName("namespace-0001")
            .withGradeName("grade-0001")
            .withAccessToken("accessToken-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.describe_statuses(
        grade.DescribeStatusesRequest()
            .with_namespace_name('namespace-0001')
            .with_grade_name('grade-0001')
            .with_access_token('accessToken-0001')
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.describe_statuses({
    namespaceName="namespace-0001",
    gradeName="grade-0001",
    accessToken="accessToken-0001",
    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('grade')

api_result_handler = client.describe_statuses_async({
    namespaceName="namespace-0001",
    gradeName="grade-0001",
    accessToken="accessToken-0001",
    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;

describeStatusesByUserId

Get a list of statuses by specifying a user ID

Retrieves a paginated list of grade statuses for the specified user (server-side operation). Each status represents a grade value associated with a specific grade model and property ID. An optional grade model name filter can be specified to retrieve statuses for a specific grade model only.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
gradeNamestring~ 128 charsGrade Model name
userIdstring
~ 128 charsUser ID
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<Status>List of Status
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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.DescribeStatusesByUserId(
    &grade.DescribeStatusesByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        GradeName: pointy.String("grade-0001"),
        UserId: pointy.String("user-0001"),
        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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\DescribeStatusesByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->describeStatusesByUserId(
        (new DescribeStatusesByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withGradeName("grade-0001")
            ->withUserId("user-0001")
            ->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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DescribeStatusesByUserIdRequest;
import io.gs2.grade.result.DescribeStatusesByUserIdResult;

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

try {
    DescribeStatusesByUserIdResult result = client.describeStatusesByUserId(
        new DescribeStatusesByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withGradeName("grade-0001")
            .withUserId("user-0001")
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<Status> 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DescribeStatusesByUserIdResult> asyncResult = null;
yield return client.DescribeStatusesByUserId(
    new Gs2.Gs2Grade.Request.DescribeStatusesByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithGradeName("grade-0001")
        .WithUserId("user-0001")
        .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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.describeStatusesByUserId(
        new Gs2Grade.DescribeStatusesByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withGradeName("grade-0001")
            .withUserId("user-0001")
            .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 grade

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

try:
    result = client.describe_statuses_by_user_id(
        grade.DescribeStatusesByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_grade_name('grade-0001')
            .with_user_id('user-0001')
            .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('grade')

api_result = client.describe_statuses_by_user_id({
    namespaceName="namespace-0001",
    gradeName="grade-0001",
    userId="user-0001",
    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('grade')

api_result_handler = client.describe_statuses_by_user_id_async({
    namespaceName="namespace-0001",
    gradeName="grade-0001",
    userId="user-0001",
    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;

getStatus

Get Status

Retrieves the grade status for the requesting user, identified by grade model name and property ID. Returns the current grade value for the specified property.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
accessTokenstring
~ 128 charsAccess token
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.

Result

TypeDescription
itemStatusStatus

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.GetStatus(
    &grade.GetStatusRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        GradeName: pointy.String("grade-0001"),
        PropertyId: pointy.String("property-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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\GetStatusRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->getStatus(
        (new GetStatusRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withGradeName("grade-0001")
            ->withPropertyId("property-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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.GetStatusRequest;
import io.gs2.grade.result.GetStatusResult;

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

try {
    GetStatusResult result = client.getStatus(
        new GetStatusRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
    );
    Status 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetStatusResult> asyncResult = null;
yield return client.GetStatus(
    new Gs2.Gs2Grade.Request.GetStatusRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001")
        .WithGradeName("grade-0001")
        .WithPropertyId("property-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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.getStatus(
        new Gs2Grade.GetStatusRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.get_status(
        grade.GetStatusRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_grade_name('grade-0001')
            .with_property_id('property-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.get_status({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    gradeName="grade-0001",
    propertyId="property-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('grade')

api_result_handler = client.get_status_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    gradeName="grade-0001",
    propertyId="property-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;

getStatusByUserId

Get status by specifying a user ID

Retrieves the grade status for the specified user (server-side operation), identified by grade model name and property ID. Returns the current grade value for the specified property.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemStatusStatus

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.GetStatusByUserId(
    &grade.GetStatusByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        GradeName: pointy.String("grade-0001"),
        PropertyId: pointy.String("property-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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\GetStatusByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->getStatusByUserId(
        (new GetStatusByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withGradeName("grade-0001")
            ->withPropertyId("property-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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.GetStatusByUserIdRequest;
import io.gs2.grade.result.GetStatusByUserIdResult;

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

try {
    GetStatusByUserIdResult result = client.getStatusByUserId(
        new GetStatusByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withTimeOffsetToken(null)
    );
    Status 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetStatusByUserIdResult> asyncResult = null;
yield return client.GetStatusByUserId(
    new Gs2.Gs2Grade.Request.GetStatusByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithGradeName("grade-0001")
        .WithPropertyId("property-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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.getStatusByUserId(
        new Gs2Grade.GetStatusByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.get_status_by_user_id(
        grade.GetStatusByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_grade_name('grade-0001')
            .with_property_id('property-0001')
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.get_status_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    propertyId="property-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('grade')

api_result_handler = client.get_status_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    propertyId="property-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;

addGradeByUserId

Add grade by specifying a user ID

Adds the specified grade value to the user’s current grade for the given grade model and property. After updating the grade value, the rank cap is automatically applied to the linked GS2-Experience status. The rank cap value is determined by the grade entry matching the new grade level. Returns the updated grade status along with the Experience namespace name and the updated Experience status.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.
gradeValuelong00 ~ 9223372036854775805Gained Grade
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemStatusStatus after addition
experienceNamespaceNamestringGS2-Experience Namespace Name
experienceStatusStatusGS2-Experience Status after addition

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.AddGradeByUserId(
    &grade.AddGradeByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        GradeName: pointy.String("grade-0001"),
        PropertyId: pointy.String("property-0001"),
        GradeValue: pointy.Int64(10),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
experienceNamespaceName := result.ExperienceNamespaceName
experienceStatus := result.ExperienceStatus
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\AddGradeByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->addGradeByUserId(
        (new AddGradeByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withGradeName("grade-0001")
            ->withPropertyId("property-0001")
            ->withGradeValue(10)
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
    $experienceNamespaceName = $result->getExperienceNamespaceName();
    $experienceStatus = $result->getExperienceStatus();
} 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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.AddGradeByUserIdRequest;
import io.gs2.grade.result.AddGradeByUserIdResult;

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

try {
    AddGradeByUserIdResult result = client.addGradeByUserId(
        new AddGradeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withGradeValue(10L)
            .withTimeOffsetToken(null)
    );
    Status item = result.getItem();
    String experienceNamespaceName = result.getExperienceNamespaceName();
    Status experienceStatus = result.getExperienceStatus();
} 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.AddGradeByUserIdResult> asyncResult = null;
yield return client.AddGradeByUserId(
    new Gs2.Gs2Grade.Request.AddGradeByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithGradeName("grade-0001")
        .WithPropertyId("property-0001")
        .WithGradeValue(10L)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var experienceNamespaceName = result.ExperienceNamespaceName;
var experienceStatus = result.ExperienceStatus;
import Gs2Core from '@/gs2/core';
import * as Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.addGradeByUserId(
        new Gs2Grade.AddGradeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withGradeValue(10)
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
    const experienceNamespaceName = result.getExperienceNamespaceName();
    const experienceStatus = result.getExperienceStatus();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.add_grade_by_user_id(
        grade.AddGradeByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_grade_name('grade-0001')
            .with_property_id('property-0001')
            .with_grade_value(10)
            .with_time_offset_token(None)
    )
    item = result.item
    experience_namespace_name = result.experience_namespace_name
    experience_status = result.experience_status
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.add_grade_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    propertyId="property-0001",
    gradeValue=10,
    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;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;
client = gs2('grade')

api_result_handler = client.add_grade_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    propertyId="property-0001",
    gradeValue=10,
    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;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

subGrade

Subtract grade

Subtracts the specified grade value from the requesting user’s current grade for the given grade model and property. After updating the grade value, the rank cap is automatically applied to the linked GS2-Experience status. The rank cap value is determined by the grade entry matching the new grade level. Returns the updated grade status along with the Experience namespace name and the updated Experience status.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
accessTokenstring
~ 128 charsAccess token
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.
gradeValuelong00 ~ 9223372036854775805Lost Grade

Result

TypeDescription
itemStatusStatus after subtraction
experienceNamespaceNamestringGS2-Experience Namespace Name
experienceStatusStatusGS2-Experience Status after addition

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.SubGrade(
    &grade.SubGradeRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        GradeName: pointy.String("grade-0001"),
        PropertyId: pointy.String("property-0001"),
        GradeValue: pointy.Int64(10),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
experienceNamespaceName := result.ExperienceNamespaceName
experienceStatus := result.ExperienceStatus
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\SubGradeRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->subGrade(
        (new SubGradeRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withGradeName("grade-0001")
            ->withPropertyId("property-0001")
            ->withGradeValue(10)
    );
    $item = $result->getItem();
    $experienceNamespaceName = $result->getExperienceNamespaceName();
    $experienceStatus = $result->getExperienceStatus();
} 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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.SubGradeRequest;
import io.gs2.grade.result.SubGradeResult;

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

try {
    SubGradeResult result = client.subGrade(
        new SubGradeRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withGradeValue(10L)
    );
    Status item = result.getItem();
    String experienceNamespaceName = result.getExperienceNamespaceName();
    Status experienceStatus = result.getExperienceStatus();
} 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.SubGradeResult> asyncResult = null;
yield return client.SubGrade(
    new Gs2.Gs2Grade.Request.SubGradeRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001")
        .WithGradeName("grade-0001")
        .WithPropertyId("property-0001")
        .WithGradeValue(10L),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var experienceNamespaceName = result.ExperienceNamespaceName;
var experienceStatus = result.ExperienceStatus;
import Gs2Core from '@/gs2/core';
import * as Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.subGrade(
        new Gs2Grade.SubGradeRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withGradeValue(10)
    );
    const item = result.getItem();
    const experienceNamespaceName = result.getExperienceNamespaceName();
    const experienceStatus = result.getExperienceStatus();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.sub_grade(
        grade.SubGradeRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_grade_name('grade-0001')
            .with_property_id('property-0001')
            .with_grade_value(10)
    )
    item = result.item
    experience_namespace_name = result.experience_namespace_name
    experience_status = result.experience_status
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.sub_grade({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    gradeName="grade-0001",
    propertyId="property-0001",
    gradeValue=10,
})

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

result = api_result.result
item = result.item;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;
client = gs2('grade')

api_result_handler = client.sub_grade_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    gradeName="grade-0001",
    propertyId="property-0001",
    gradeValue=10,
})

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;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

subGradeByUserId

Subtract grade by specifying a user ID

Subtracts the specified grade value from the specified user’s current grade for the given grade model and property (server-side operation). After updating the grade value, the rank cap is automatically applied to the linked GS2-Experience status. The rank cap value is determined by the grade entry matching the new grade level. Returns the updated grade status along with the Experience namespace name and the updated Experience status.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.
gradeValuelong00 ~ 9223372036854775805Lost Grade
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemStatusStatus after subtraction
experienceNamespaceNamestringGS2-Experience Namespace Name
experienceStatusStatusGS2-Experience Status after addition

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.SubGradeByUserId(
    &grade.SubGradeByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        GradeName: pointy.String("grade-0001"),
        PropertyId: pointy.String("property-0001"),
        GradeValue: pointy.Int64(10),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
experienceNamespaceName := result.ExperienceNamespaceName
experienceStatus := result.ExperienceStatus
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\SubGradeByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->subGradeByUserId(
        (new SubGradeByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withGradeName("grade-0001")
            ->withPropertyId("property-0001")
            ->withGradeValue(10)
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
    $experienceNamespaceName = $result->getExperienceNamespaceName();
    $experienceStatus = $result->getExperienceStatus();
} 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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.SubGradeByUserIdRequest;
import io.gs2.grade.result.SubGradeByUserIdResult;

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

try {
    SubGradeByUserIdResult result = client.subGradeByUserId(
        new SubGradeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withGradeValue(10L)
            .withTimeOffsetToken(null)
    );
    Status item = result.getItem();
    String experienceNamespaceName = result.getExperienceNamespaceName();
    Status experienceStatus = result.getExperienceStatus();
} 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.SubGradeByUserIdResult> asyncResult = null;
yield return client.SubGradeByUserId(
    new Gs2.Gs2Grade.Request.SubGradeByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithGradeName("grade-0001")
        .WithPropertyId("property-0001")
        .WithGradeValue(10L)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var experienceNamespaceName = result.ExperienceNamespaceName;
var experienceStatus = result.ExperienceStatus;
import Gs2Core from '@/gs2/core';
import * as Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.subGradeByUserId(
        new Gs2Grade.SubGradeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withGradeValue(10)
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
    const experienceNamespaceName = result.getExperienceNamespaceName();
    const experienceStatus = result.getExperienceStatus();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.sub_grade_by_user_id(
        grade.SubGradeByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_grade_name('grade-0001')
            .with_property_id('property-0001')
            .with_grade_value(10)
            .with_time_offset_token(None)
    )
    item = result.item
    experience_namespace_name = result.experience_namespace_name
    experience_status = result.experience_status
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.sub_grade_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    propertyId="property-0001",
    gradeValue=10,
    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;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;
client = gs2('grade')

api_result_handler = client.sub_grade_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    propertyId="property-0001",
    gradeValue=10,
    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;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

setGradeByUserId

Set cumulative grade gained

Directly sets the grade value for the specified user’s grade status (server-side operation). The previous grade status is captured before the update and returned as the ‘old’ field for audit purposes. After setting the new grade value, the rank cap is automatically applied to the linked GS2-Experience status. The rank cap value is determined by the grade entry matching the new grade level.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.
gradeValuelong11 ~ 9223372036854775805Current Grade
The current grade value of this status. Used as an index into the grade model’s grade entries array to determine the rank cap for the linked GS2-Experience model. When this value changes, the rank cap of the associated experience status is automatically updated to the value defined in the corresponding grade entry.
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemStatusStatus updated
oldStatusStatus before update
experienceNamespaceNamestringGS2-Experience Namespace Name
experienceStatusStatusGS2-Experience Status after addition

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.SetGradeByUserId(
    &grade.SetGradeByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        GradeName: pointy.String("grade-0001"),
        PropertyId: pointy.String("property-0001"),
        GradeValue: pointy.Int64(100),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
old := result.Old
experienceNamespaceName := result.ExperienceNamespaceName
experienceStatus := result.ExperienceStatus
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\SetGradeByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->setGradeByUserId(
        (new SetGradeByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withGradeName("grade-0001")
            ->withPropertyId("property-0001")
            ->withGradeValue(100)
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
    $old = $result->getOld();
    $experienceNamespaceName = $result->getExperienceNamespaceName();
    $experienceStatus = $result->getExperienceStatus();
} 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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.SetGradeByUserIdRequest;
import io.gs2.grade.result.SetGradeByUserIdResult;

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

try {
    SetGradeByUserIdResult result = client.setGradeByUserId(
        new SetGradeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withGradeValue(100L)
            .withTimeOffsetToken(null)
    );
    Status item = result.getItem();
    Status old = result.getOld();
    String experienceNamespaceName = result.getExperienceNamespaceName();
    Status experienceStatus = result.getExperienceStatus();
} 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.SetGradeByUserIdResult> asyncResult = null;
yield return client.SetGradeByUserId(
    new Gs2.Gs2Grade.Request.SetGradeByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithGradeName("grade-0001")
        .WithPropertyId("property-0001")
        .WithGradeValue(100L)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var old = result.Old;
var experienceNamespaceName = result.ExperienceNamespaceName;
var experienceStatus = result.ExperienceStatus;
import Gs2Core from '@/gs2/core';
import * as Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.setGradeByUserId(
        new Gs2Grade.SetGradeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withGradeValue(100)
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
    const old = result.getOld();
    const experienceNamespaceName = result.getExperienceNamespaceName();
    const experienceStatus = result.getExperienceStatus();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.set_grade_by_user_id(
        grade.SetGradeByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_grade_name('grade-0001')
            .with_property_id('property-0001')
            .with_grade_value(100)
            .with_time_offset_token(None)
    )
    item = result.item
    old = result.old
    experience_namespace_name = result.experience_namespace_name
    experience_status = result.experience_status
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.set_grade_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    propertyId="property-0001",
    gradeValue=100,
    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;
old = result.old;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;
client = gs2('grade')

api_result_handler = client.set_grade_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    propertyId="property-0001",
    gradeValue=100,
    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;
old = result.old;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

applyRankCap

Apply rank cap to GS2-Experience Status

Applies the rank cap corresponding to the current grade to the linked GS2-Experience status for the requesting user. Looks up the grade entry matching the current grade value to determine the rank cap value. This is useful when the grade has been modified externally and the Experience rank cap needs to be synchronized. Returns the updated grade status along with the Experience namespace name and the updated Experience status.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
accessTokenstring
~ 128 charsAccess token
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.

Result

TypeDescription
itemStatusStatus
experienceNamespaceNamestringGS2-Experience Namespace Name
experienceStatusStatusGS2-Experience Status after addition

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.ApplyRankCap(
    &grade.ApplyRankCapRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        GradeName: pointy.String("grade-0001"),
        PropertyId: pointy.String("property-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
experienceNamespaceName := result.ExperienceNamespaceName
experienceStatus := result.ExperienceStatus
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\ApplyRankCapRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->applyRankCap(
        (new ApplyRankCapRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withGradeName("grade-0001")
            ->withPropertyId("property-0001")
    );
    $item = $result->getItem();
    $experienceNamespaceName = $result->getExperienceNamespaceName();
    $experienceStatus = $result->getExperienceStatus();
} 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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.ApplyRankCapRequest;
import io.gs2.grade.result.ApplyRankCapResult;

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

try {
    ApplyRankCapResult result = client.applyRankCap(
        new ApplyRankCapRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
    );
    Status item = result.getItem();
    String experienceNamespaceName = result.getExperienceNamespaceName();
    Status experienceStatus = result.getExperienceStatus();
} 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.ApplyRankCapResult> asyncResult = null;
yield return client.ApplyRankCap(
    new Gs2.Gs2Grade.Request.ApplyRankCapRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001")
        .WithGradeName("grade-0001")
        .WithPropertyId("property-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var experienceNamespaceName = result.ExperienceNamespaceName;
var experienceStatus = result.ExperienceStatus;
import Gs2Core from '@/gs2/core';
import * as Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.applyRankCap(
        new Gs2Grade.ApplyRankCapRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
    );
    const item = result.getItem();
    const experienceNamespaceName = result.getExperienceNamespaceName();
    const experienceStatus = result.getExperienceStatus();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.apply_rank_cap(
        grade.ApplyRankCapRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_grade_name('grade-0001')
            .with_property_id('property-0001')
    )
    item = result.item
    experience_namespace_name = result.experience_namespace_name
    experience_status = result.experience_status
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.apply_rank_cap({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    gradeName="grade-0001",
    propertyId="property-0001",
})

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

result = api_result.result
item = result.item;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;
client = gs2('grade')

api_result_handler = client.apply_rank_cap_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    gradeName="grade-0001",
    propertyId="property-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;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

applyRankCapByUserId

Apply rank cap to GS2-Experience Status by specifying a user ID

Applies the rank cap corresponding to the current grade to the linked GS2-Experience status for the specified user (server-side operation). Looks up the grade entry matching the current grade value to determine the rank cap value. This is useful when the grade has been modified externally and the Experience rank cap needs to be synchronized. Returns the updated grade status along with the Experience namespace name and the updated Experience status.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemStatusStatus
experienceNamespaceNamestringGS2-Experience Namespace Name
experienceStatusStatusGS2-Experience Status after addition

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.ApplyRankCapByUserId(
    &grade.ApplyRankCapByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        GradeName: pointy.String("grade-0001"),
        PropertyId: pointy.String("property-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
experienceNamespaceName := result.ExperienceNamespaceName
experienceStatus := result.ExperienceStatus
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\ApplyRankCapByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->applyRankCapByUserId(
        (new ApplyRankCapByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withGradeName("grade-0001")
            ->withPropertyId("property-0001")
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
    $experienceNamespaceName = $result->getExperienceNamespaceName();
    $experienceStatus = $result->getExperienceStatus();
} 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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.ApplyRankCapByUserIdRequest;
import io.gs2.grade.result.ApplyRankCapByUserIdResult;

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

try {
    ApplyRankCapByUserIdResult result = client.applyRankCapByUserId(
        new ApplyRankCapByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withTimeOffsetToken(null)
    );
    Status item = result.getItem();
    String experienceNamespaceName = result.getExperienceNamespaceName();
    Status experienceStatus = result.getExperienceStatus();
} 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.ApplyRankCapByUserIdResult> asyncResult = null;
yield return client.ApplyRankCapByUserId(
    new Gs2.Gs2Grade.Request.ApplyRankCapByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithGradeName("grade-0001")
        .WithPropertyId("property-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var experienceNamespaceName = result.ExperienceNamespaceName;
var experienceStatus = result.ExperienceStatus;
import Gs2Core from '@/gs2/core';
import * as Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.applyRankCapByUserId(
        new Gs2Grade.ApplyRankCapByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
    const experienceNamespaceName = result.getExperienceNamespaceName();
    const experienceStatus = result.getExperienceStatus();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.apply_rank_cap_by_user_id(
        grade.ApplyRankCapByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_grade_name('grade-0001')
            .with_property_id('property-0001')
            .with_time_offset_token(None)
    )
    item = result.item
    experience_namespace_name = result.experience_namespace_name
    experience_status = result.experience_status
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.apply_rank_cap_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    propertyId="property-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;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;
client = gs2('grade')

api_result_handler = client.apply_rank_cap_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    propertyId="property-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;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

deleteStatusByUserId

Delete status by specifying a user ID

Deletes the grade status for the specified user, identified by grade model name and property ID (server-side operation). The deleted status data is returned in the response. Note that this does not automatically update the linked GS2-Experience rank cap.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemStatusStatus deleted

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.DeleteStatusByUserId(
    &grade.DeleteStatusByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        GradeName: pointy.String("grade-0001"),
        PropertyId: pointy.String("property-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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\DeleteStatusByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->deleteStatusByUserId(
        (new DeleteStatusByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withGradeName("grade-0001")
            ->withPropertyId("property-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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DeleteStatusByUserIdRequest;
import io.gs2.grade.result.DeleteStatusByUserIdResult;

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

try {
    DeleteStatusByUserIdResult result = client.deleteStatusByUserId(
        new DeleteStatusByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withTimeOffsetToken(null)
    );
    Status 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DeleteStatusByUserIdResult> asyncResult = null;
yield return client.DeleteStatusByUserId(
    new Gs2.Gs2Grade.Request.DeleteStatusByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithGradeName("grade-0001")
        .WithPropertyId("property-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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.deleteStatusByUserId(
        new Gs2Grade.DeleteStatusByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.delete_status_by_user_id(
        grade.DeleteStatusByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_grade_name('grade-0001')
            .with_property_id('property-0001')
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.delete_status_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    propertyId="property-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('grade')

api_result_handler = client.delete_status_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    propertyId="property-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;

verifyGrade

Verify grade

Verifies that the requesting user’s grade value satisfies a specified condition. Supports six comparison operators: less, lessEqual, greater, greaterEqual, equal, and notEqual. If the condition is not met, an error is returned with a descriptive message including the expected and actual values. When multiplyValueSpecifyingQuantity is true, the verification threshold value is multiplied by the specified quantity.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
accessTokenstring
~ 128 charsAccess token
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
verifyTypeString Enum
enum {
  “less”,
  “lessEqual”,
  “greater”,
  “greaterEqual”,
  “equal”,
  “notEqual”
}
Type of verification
DefinitionDescription
“less”Grade is less than the specified value
“lessEqual”Grade is less than or equal to the specified value
“greater”Grade is greater than the specified value
“greaterEqual”Grade is greater than or equal to the specified value
“equal”Grade is equal to the specified value
“notEqual”Grade is not equal to the specified value
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.
gradeValuelong11 ~ 9223372036854775805Current Grade
The current grade value of this status. Used as an index into the grade model’s grade entries array to determine the rank cap for the linked GS2-Experience model. When this value changes, the rank cap of the associated experience status is automatically updated to the value defined in the corresponding grade entry.
multiplyValueSpecifyingQuantityboolfalseWhether to multiply the value used for verification when specifying the quantity

Result

TypeDescription
itemStatusStatus deleted

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.VerifyGrade(
    &grade.VerifyGradeRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        GradeName: pointy.String("grade-0001"),
        VerifyType: pointy.String("less"),
        PropertyId: pointy.String("property-0001"),
        GradeValue: pointy.Int64(2),
        MultiplyValueSpecifyingQuantity: 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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\VerifyGradeRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->verifyGrade(
        (new VerifyGradeRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withGradeName("grade-0001")
            ->withVerifyType("less")
            ->withPropertyId("property-0001")
            ->withGradeValue(2)
            ->withMultiplyValueSpecifyingQuantity(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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.VerifyGradeRequest;
import io.gs2.grade.result.VerifyGradeResult;

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

try {
    VerifyGradeResult result = client.verifyGrade(
        new VerifyGradeRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withGradeName("grade-0001")
            .withVerifyType("less")
            .withPropertyId("property-0001")
            .withGradeValue(2L)
            .withMultiplyValueSpecifyingQuantity(null)
    );
    Status 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.VerifyGradeResult> asyncResult = null;
yield return client.VerifyGrade(
    new Gs2.Gs2Grade.Request.VerifyGradeRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001")
        .WithGradeName("grade-0001")
        .WithVerifyType("less")
        .WithPropertyId("property-0001")
        .WithGradeValue(2L)
        .WithMultiplyValueSpecifyingQuantity(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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.verifyGrade(
        new Gs2Grade.VerifyGradeRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withGradeName("grade-0001")
            .withVerifyType("less")
            .withPropertyId("property-0001")
            .withGradeValue(2)
            .withMultiplyValueSpecifyingQuantity(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.verify_grade(
        grade.VerifyGradeRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_grade_name('grade-0001')
            .with_verify_type('less')
            .with_property_id('property-0001')
            .with_grade_value(2)
            .with_multiply_value_specifying_quantity(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.verify_grade({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    gradeName="grade-0001",
    verifyType="less",
    propertyId="property-0001",
    gradeValue=2,
    multiplyValueSpecifyingQuantity=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('grade')

api_result_handler = client.verify_grade_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    gradeName="grade-0001",
    verifyType="less",
    propertyId="property-0001",
    gradeValue=2,
    multiplyValueSpecifyingQuantity=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;

verifyGradeByUserId

Verify grade by specifying a user ID

Verifies that the specified user’s grade value satisfies a specified condition (server-side operation). Supports six comparison operators: less, lessEqual, greater, greaterEqual, equal, and notEqual. If the condition is not met, an error is returned with a descriptive message including the expected and actual values. When multiplyValueSpecifyingQuantity is true, the verification threshold value is multiplied by the specified quantity.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
verifyTypeString Enum
enum {
  “less”,
  “lessEqual”,
  “greater”,
  “greaterEqual”,
  “equal”,
  “notEqual”
}
Type of verification
DefinitionDescription
“less”Grade is less than the specified value
“lessEqual”Grade is less than or equal to the specified value
“greater”Grade is greater than the specified value
“greaterEqual”Grade is greater than or equal to the specified value
“equal”Grade is equal to the specified value
“notEqual”Grade is not equal to the specified value
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.
gradeValuelong11 ~ 9223372036854775805Current Grade
The current grade value of this status. Used as an index into the grade model’s grade entries array to determine the rank cap for the linked GS2-Experience model. When this value changes, the rank cap of the associated experience status is automatically updated to the value defined in the corresponding grade entry.
multiplyValueSpecifyingQuantityboolfalseWhether to multiply the value used for verification when specifying the quantity
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemStatusStatus deleted

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.VerifyGradeByUserId(
    &grade.VerifyGradeByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        GradeName: pointy.String("grade-0001"),
        VerifyType: pointy.String("less"),
        PropertyId: pointy.String("property-0001"),
        GradeValue: pointy.Int64(2),
        MultiplyValueSpecifyingQuantity: 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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\VerifyGradeByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->verifyGradeByUserId(
        (new VerifyGradeByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withGradeName("grade-0001")
            ->withVerifyType("less")
            ->withPropertyId("property-0001")
            ->withGradeValue(2)
            ->withMultiplyValueSpecifyingQuantity(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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.VerifyGradeByUserIdRequest;
import io.gs2.grade.result.VerifyGradeByUserIdResult;

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

try {
    VerifyGradeByUserIdResult result = client.verifyGradeByUserId(
        new VerifyGradeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withVerifyType("less")
            .withPropertyId("property-0001")
            .withGradeValue(2L)
            .withMultiplyValueSpecifyingQuantity(null)
            .withTimeOffsetToken(null)
    );
    Status 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.VerifyGradeByUserIdResult> asyncResult = null;
yield return client.VerifyGradeByUserId(
    new Gs2.Gs2Grade.Request.VerifyGradeByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithGradeName("grade-0001")
        .WithVerifyType("less")
        .WithPropertyId("property-0001")
        .WithGradeValue(2L)
        .WithMultiplyValueSpecifyingQuantity(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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.verifyGradeByUserId(
        new Gs2Grade.VerifyGradeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withVerifyType("less")
            .withPropertyId("property-0001")
            .withGradeValue(2)
            .withMultiplyValueSpecifyingQuantity(null)
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.verify_grade_by_user_id(
        grade.VerifyGradeByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_grade_name('grade-0001')
            .with_verify_type('less')
            .with_property_id('property-0001')
            .with_grade_value(2)
            .with_multiply_value_specifying_quantity(None)
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.verify_grade_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    verifyType="less",
    propertyId="property-0001",
    gradeValue=2,
    multiplyValueSpecifyingQuantity=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('grade')

api_result_handler = client.verify_grade_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    verifyType="less",
    propertyId="property-0001",
    gradeValue=2,
    multiplyValueSpecifyingQuantity=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;

verifyGradeUpMaterial

Verify grade up material

Verifies whether a material property ID is valid for grading up the specified property. The verification builds a regex pattern from the grade entry’s PropertyIdRegex and GradeUpPropertyIdRegex, then checks if the material property ID matches. Supports two verification types: ‘match’ (material must match the pattern) and ’notMatch’ (material must not match the pattern). This is used to validate that a material item is eligible to be consumed for a grade upgrade.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
accessTokenstring
~ 128 charsAccess token
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
verifyTypeString Enum
enum {
  “match”,
  “notMatch”
}
Type of verification
DefinitionDescription
“match”Grade is equal to the specified value
“notMatch”Grade is not equal to the specified value
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.
materialPropertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.VerifyGradeUpMaterial(
    &grade.VerifyGradeUpMaterialRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        GradeName: pointy.String("grade-0001"),
        VerifyType: pointy.String("match"),
        PropertyId: pointy.String("property-0001"),
        MaterialPropertyId: pointy.String("property-0002"),
    }
)
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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\VerifyGradeUpMaterialRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->verifyGradeUpMaterial(
        (new VerifyGradeUpMaterialRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withGradeName("grade-0001")
            ->withVerifyType("match")
            ->withPropertyId("property-0001")
            ->withMaterialPropertyId("property-0002")
    );
} 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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.VerifyGradeUpMaterialRequest;
import io.gs2.grade.result.VerifyGradeUpMaterialResult;

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

try {
    VerifyGradeUpMaterialResult result = client.verifyGradeUpMaterial(
        new VerifyGradeUpMaterialRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withGradeName("grade-0001")
            .withVerifyType("match")
            .withPropertyId("property-0001")
            .withMaterialPropertyId("property-0002")
    );
} 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.VerifyGradeUpMaterialResult> asyncResult = null;
yield return client.VerifyGradeUpMaterial(
    new Gs2.Gs2Grade.Request.VerifyGradeUpMaterialRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001")
        .WithGradeName("grade-0001")
        .WithVerifyType("match")
        .WithPropertyId("property-0001")
        .WithMaterialPropertyId("property-0002"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.verifyGradeUpMaterial(
        new Gs2Grade.VerifyGradeUpMaterialRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withGradeName("grade-0001")
            .withVerifyType("match")
            .withPropertyId("property-0001")
            .withMaterialPropertyId("property-0002")
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.verify_grade_up_material(
        grade.VerifyGradeUpMaterialRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_grade_name('grade-0001')
            .with_verify_type('match')
            .with_property_id('property-0001')
            .with_material_property_id('property-0002')
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.verify_grade_up_material({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    gradeName="grade-0001",
    verifyType="match",
    propertyId="property-0001",
    materialPropertyId="property-0002",
})

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

result = api_result.result
client = gs2('grade')

api_result_handler = client.verify_grade_up_material_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    gradeName="grade-0001",
    verifyType="match",
    propertyId="property-0001",
    materialPropertyId="property-0002",
})

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

verifyGradeUpMaterialByUserId

Verify grade up material by specifying a user ID

Verifies whether a material property ID is valid for grading up the specified property for the specified user (server-side operation). The verification builds a regex pattern from the grade entry’s PropertyIdRegex and GradeUpPropertyIdRegex, then checks if the material property ID matches. Supports two verification types: ‘match’ (material must match the pattern) and ’notMatch’ (material must not match the pattern).

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
verifyTypeString Enum
enum {
  “match”,
  “notMatch”
}
Type of verification
DefinitionDescription
“match”Grade is equal to the specified value
“notMatch”Grade is not equal to the specified value
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.
materialPropertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.VerifyGradeUpMaterialByUserId(
    &grade.VerifyGradeUpMaterialByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        GradeName: pointy.String("grade-0001"),
        VerifyType: pointy.String("match"),
        PropertyId: pointy.String("property-0001"),
        MaterialPropertyId: pointy.String("property-0002"),
        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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\VerifyGradeUpMaterialByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->verifyGradeUpMaterialByUserId(
        (new VerifyGradeUpMaterialByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withGradeName("grade-0001")
            ->withVerifyType("match")
            ->withPropertyId("property-0001")
            ->withMaterialPropertyId("property-0002")
            ->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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.VerifyGradeUpMaterialByUserIdRequest;
import io.gs2.grade.result.VerifyGradeUpMaterialByUserIdResult;

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

try {
    VerifyGradeUpMaterialByUserIdResult result = client.verifyGradeUpMaterialByUserId(
        new VerifyGradeUpMaterialByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withVerifyType("match")
            .withPropertyId("property-0001")
            .withMaterialPropertyId("property-0002")
            .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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.VerifyGradeUpMaterialByUserIdResult> asyncResult = null;
yield return client.VerifyGradeUpMaterialByUserId(
    new Gs2.Gs2Grade.Request.VerifyGradeUpMaterialByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithGradeName("grade-0001")
        .WithVerifyType("match")
        .WithPropertyId("property-0001")
        .WithMaterialPropertyId("property-0002")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.verifyGradeUpMaterialByUserId(
        new Gs2Grade.VerifyGradeUpMaterialByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withVerifyType("match")
            .withPropertyId("property-0001")
            .withMaterialPropertyId("property-0002")
            .withTimeOffsetToken(null)
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.verify_grade_up_material_by_user_id(
        grade.VerifyGradeUpMaterialByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_grade_name('grade-0001')
            .with_verify_type('match')
            .with_property_id('property-0001')
            .with_material_property_id('property-0002')
            .with_time_offset_token(None)
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.verify_grade_up_material_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    verifyType="match",
    propertyId="property-0001",
    materialPropertyId="property-0002",
    timeOffsetToken=nil,
})

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

result = api_result.result
client = gs2('grade')

api_result_handler = client.verify_grade_up_material_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    verifyType="match",
    propertyId="property-0001",
    materialPropertyId="property-0002",
    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

multiplyAcquireActionsByUserId

Multiply acquire actions by grade-based rate

Multiplies the quantities of the specified acquire actions by a rate multiplier determined by the user’s current grade. The rate multiplier is looked up from the grade model’s acquireActionRates using the specified rateName and the current grade value. The multiplied acquire actions are then executed as a transaction, enabling grade-based reward scaling (e.g., higher grades receive more resources).

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
gradeNamestring
~ 128 charsGrade Model Name
The name of the grade model that this status belongs to. References the grade model definition which contains the grade entry mappings, linked experience model, and reward addition tables.
propertyIdstring
~ 1024 charsProperty ID
A developer-defined identifier for this grade status, unique within the user and grade model. It is strongly recommended to use the same value as the property ID of the linked GS2-Experience status, as this ensures correct synchronization of grade values with rank caps.
rateNamestring
~ 128 charsReward Addition Table Name
A unique identifier for this multiplier table within the grade model. Referenced when applying grade-based reward scaling to specific acquire actions in transactions.
acquireActionsList<AcquireAction>[]0 ~ 100 itemsList of Acquire Actions
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemsList<AcquireAction>Rewards
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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.MultiplyAcquireActionsByUserId(
    &grade.MultiplyAcquireActionsByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        GradeName: pointy.String("grade-0001"),
        PropertyId: pointy.String("property-0001"),
        RateName: pointy.String("rate-0001"),
        AcquireActions: []grade.AcquireAction{
            grade.AcquireAction{
                Action: pointy.String("Gs2Grade:AddRankCapByUserId"),
                Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"gradeName\": \"character\", \"propertyId\": \"property-0001\", \"userId\": \"#{userId}\", \"rankCapValue\": 1}"),
            },
        },
        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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\MultiplyAcquireActionsByUserIdRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->multiplyAcquireActionsByUserId(
        (new MultiplyAcquireActionsByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withGradeName("grade-0001")
            ->withPropertyId("property-0001")
            ->withRateName("rate-0001")
            ->withAcquireActions([
                (new AcquireAction())
                    ->withAction("Gs2Grade:AddRankCapByUserId")
                    ->withRequest("{\"namespaceName\": \"namespace-0001\", \"gradeName\": \"character\", \"propertyId\": \"property-0001\", \"userId\": \"#{userId}\", \"rankCapValue\": 1}"),
            ])
            ->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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.MultiplyAcquireActionsByUserIdRequest;
import io.gs2.grade.result.MultiplyAcquireActionsByUserIdResult;

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

try {
    MultiplyAcquireActionsByUserIdResult result = client.multiplyAcquireActionsByUserId(
        new MultiplyAcquireActionsByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withRateName("rate-0001")
            .withAcquireActions(Arrays.asList(
                new AcquireAction()
                    .withAction("Gs2Grade:AddRankCapByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"gradeName\": \"character\", \"propertyId\": \"property-0001\", \"userId\": \"#{userId}\", \"rankCapValue\": 1}")
            ))
            .withTimeOffsetToken(null)
    );
    List<AcquireAction> 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.MultiplyAcquireActionsByUserIdResult> asyncResult = null;
yield return client.MultiplyAcquireActionsByUserId(
    new Gs2.Gs2Grade.Request.MultiplyAcquireActionsByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithGradeName("grade-0001")
        .WithPropertyId("property-0001")
        .WithRateName("rate-0001")
        .WithAcquireActions(new Gs2.Core.Model.AcquireAction[] {
            new Gs2.Core.Model.AcquireAction()
                .WithAction("Gs2Grade:AddRankCapByUserId")
                .WithRequest("{\"namespaceName\": \"namespace-0001\", \"gradeName\": \"character\", \"propertyId\": \"property-0001\", \"userId\": \"#{userId}\", \"rankCapValue\": 1}"),
        })
        .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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.multiplyAcquireActionsByUserId(
        new Gs2Grade.MultiplyAcquireActionsByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withRateName("rate-0001")
            .withAcquireActions([
                new Gs2Grade.model.AcquireAction()
                    .withAction("Gs2Grade:AddRankCapByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"gradeName\": \"character\", \"propertyId\": \"property-0001\", \"userId\": \"#{userId}\", \"rankCapValue\": 1}"),
            ])
            .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 grade

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

try:
    result = client.multiply_acquire_actions_by_user_id(
        grade.MultiplyAcquireActionsByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_grade_name('grade-0001')
            .with_property_id('property-0001')
            .with_rate_name('rate-0001')
            .with_acquire_actions([
                grade.AcquireAction()
                    .with_action('Gs2Grade:AddRankCapByUserId')
                    .with_request('{"namespaceName": "namespace-0001", "gradeName": "character", "propertyId": "property-0001", "userId": "#{userId}", "rankCapValue": 1}'),
            ])
            .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('grade')

api_result = client.multiply_acquire_actions_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    propertyId="property-0001",
    rateName="rate-0001",
    acquireActions={
        {
            action="Gs2Grade:AddRankCapByUserId",
            request="{\"namespaceName\": \"namespace-0001\", \"gradeName\": \"character\", \"propertyId\": \"property-0001\", \"userId\": \"#{userId}\", \"rankCapValue\": 1}",
        }
    },
    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('grade')

api_result_handler = client.multiply_acquire_actions_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    gradeName="grade-0001",
    propertyId="property-0001",
    rateName="rate-0001",
    acquireActions={
        {
            action="Gs2Grade:AddRankCapByUserId",
            request="{\"namespaceName\": \"namespace-0001\", \"gradeName\": \"character\", \"propertyId\": \"property-0001\", \"userId\": \"#{userId}\", \"rankCapValue\": 1}",
        }
    },
    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;

describeGradeModels

Get a list of Grade Models

Retrieves the list of currently active (published) Grade Models in the specified namespace. Grade Models define the grade structure, including grade entries, default grades, the linked Experience Model, and acquire action rate multipliers. Unlike Grade Model Masters, these are read-only and represent the configuration currently in use.

Details

Request

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

Result

TypeDescription
itemsList<GradeModel>List of Grade Models

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.DescribeGradeModels(
    &grade.DescribeGradeModelsRequest {
        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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\DescribeGradeModelsRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->describeGradeModels(
        (new DescribeGradeModelsRequest())
            ->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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DescribeGradeModelsRequest;
import io.gs2.grade.result.DescribeGradeModelsResult;

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

try {
    DescribeGradeModelsResult result = client.describeGradeModels(
        new DescribeGradeModelsRequest()
            .withNamespaceName("namespace-0001")
    );
    List<GradeModel> 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DescribeGradeModelsResult> asyncResult = null;
yield return client.DescribeGradeModels(
    new Gs2.Gs2Grade.Request.DescribeGradeModelsRequest()
        .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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.describeGradeModels(
        new Gs2Grade.DescribeGradeModelsRequest()
            .withNamespaceName("namespace-0001")
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.describe_grade_models(
        grade.DescribeGradeModelsRequest()
            .with_namespace_name('namespace-0001')
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.describe_grade_models({
    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('grade')

api_result_handler = client.describe_grade_models_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;

getGradeModel

Get Grade Model

Retrieves the detailed information of a specific currently active Grade Model by name. Includes the grade entries that define progression levels and their associated rank cap values for the linked Experience service.

Details

Request

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

Result

TypeDescription
itemGradeModelGrade Model

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.GetGradeModel(
    &grade.GetGradeModelRequest {
        NamespaceName: pointy.String("namespace-0001"),
        GradeName: pointy.String("grade-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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\GetGradeModelRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->getGradeModel(
        (new GetGradeModelRequest())
            ->withNamespaceName("namespace-0001")
            ->withGradeName("grade-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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.GetGradeModelRequest;
import io.gs2.grade.result.GetGradeModelResult;

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

try {
    GetGradeModelResult result = client.getGradeModel(
        new GetGradeModelRequest()
            .withNamespaceName("namespace-0001")
            .withGradeName("grade-0001")
    );
    GradeModel 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetGradeModelResult> asyncResult = null;
yield return client.GetGradeModel(
    new Gs2.Gs2Grade.Request.GetGradeModelRequest()
        .WithNamespaceName("namespace-0001")
        .WithGradeName("grade-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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.getGradeModel(
        new Gs2Grade.GetGradeModelRequest()
            .withNamespaceName("namespace-0001")
            .withGradeName("grade-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.get_grade_model(
        grade.GetGradeModelRequest()
            .with_namespace_name('namespace-0001')
            .with_grade_name('grade-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.get_grade_model({
    namespaceName="namespace-0001",
    gradeName="grade-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('grade')

api_result_handler = client.get_grade_model_async({
    namespaceName="namespace-0001",
    gradeName="grade-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;

exportMaster

Export Grade Model Master in a master data format that can be activated

Exports all Grade Model Master definitions in the namespace as a single JSON document suitable for activation. The exported data includes grade models with their grade entries, default grades, experience model links, and acquire action rates. This is used to review master data before activating it, or to back up the current master configuration.

Details

Request

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

Result

TypeDescription
itemCurrentGradeMasterGrade Model master data that can be activated

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.ExportMaster(
    &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\ExportMasterRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.ExportMasterRequest;
import io.gs2.grade.result.ExportMasterResult;

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

try {
    ExportMasterResult result = client.exportMaster(
        new ExportMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    CurrentGradeMaster 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.ExportMasterResult> asyncResult = null;
yield return client.ExportMaster(
    new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.exportMaster(
        new Gs2Grade.ExportMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.export_master(
        grade.ExportMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

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('grade')

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;

getCurrentGradeMaster

Get currently active Grade Model master data

Retrieves the Grade Model master data that is currently activated and in use in the specified namespace. The returned data contains the JSON definition of all grade models that are currently serving runtime requests.

Details

Request

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

Result

TypeDescription
itemCurrentGradeMasterCurrently active Grade Model master data

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.GetCurrentGradeMaster(
    &grade.GetCurrentGradeMasterRequest {
        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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\GetCurrentGradeMasterRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->getCurrentGradeMaster(
        (new GetCurrentGradeMasterRequest())
            ->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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.GetCurrentGradeMasterRequest;
import io.gs2.grade.result.GetCurrentGradeMasterResult;

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

try {
    GetCurrentGradeMasterResult result = client.getCurrentGradeMaster(
        new GetCurrentGradeMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    CurrentGradeMaster 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetCurrentGradeMasterResult> asyncResult = null;
yield return client.GetCurrentGradeMaster(
    new Gs2.Gs2Grade.Request.GetCurrentGradeMasterRequest()
        .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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.getCurrentGradeMaster(
        new Gs2Grade.GetCurrentGradeMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.get_current_grade_master(
        grade.GetCurrentGradeMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.get_current_grade_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('grade')

api_result_handler = client.get_current_grade_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;

preUpdateCurrentGradeMaster

Update currently active Grade Model 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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.PreUpdateCurrentGradeMaster(
    &grade.PreUpdateCurrentGradeMasterRequest {
        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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\PreUpdateCurrentGradeMasterRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->preUpdateCurrentGradeMaster(
        (new PreUpdateCurrentGradeMasterRequest())
            ->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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.PreUpdateCurrentGradeMasterRequest;
import io.gs2.grade.result.PreUpdateCurrentGradeMasterResult;

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

try {
    PreUpdateCurrentGradeMasterResult result = client.preUpdateCurrentGradeMaster(
        new PreUpdateCurrentGradeMasterRequest()
            .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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.PreUpdateCurrentGradeMasterResult> asyncResult = null;
yield return client.PreUpdateCurrentGradeMaster(
    new Gs2.Gs2Grade.Request.PreUpdateCurrentGradeMasterRequest()
        .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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.preUpdateCurrentGradeMaster(
        new Gs2Grade.PreUpdateCurrentGradeMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    const uploadToken = result.getUploadToken();
    const uploadUrl = result.getUploadUrl();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.pre_update_current_grade_master(
        grade.PreUpdateCurrentGradeMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    upload_token = result.upload_token
    upload_url = result.upload_url
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.pre_update_current_grade_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('grade')

api_result_handler = client.pre_update_current_grade_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;

updateCurrentGradeMaster

Update currently active Grade Model master data

Activates new Grade Model master data, replacing the currently active configuration. Supports two modes: ‘direct’ for inline master data (suitable for data under 1MB), and ‘preUpload’ for applying data that was previously uploaded via PreUpdate. Once activated, all grade-related runtime operations (grade lookups, rank cap applications, acquire action rate multiplications) will use the new configuration.

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
itemCurrentGradeMasterUpdated master data of the currently active Grade Models

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentGradeMaster(
    &grade.UpdateCurrentGradeMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Mode: pointy.String("direct"),
        Settings: pointy.String("{\"version\": \"2023-12-25\", \"gradeModels\": [{\"name\": \"grade-0001\", \"metadata\": \"GRADE_0001\", \"experienceModelId\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\", \"defaultGrades\": [{\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:r-.*\", \"defaultGradeValue\": 2}, {\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:sr-.*\", \"defaultGradeValue\": 3}, {\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*\", \"defaultGradeValue\": 4}], \"gradeEntries\": [{\"rankCapValue\": 50, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 60, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 70, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 80, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}]}]}"),
        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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\UpdateCurrentGradeMasterRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->updateCurrentGradeMaster(
        (new UpdateCurrentGradeMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withMode("direct")
            ->withSettings('{"version": "2023-12-25", "gradeModels": [{"name": "grade-0001", "metadata": "GRADE_0001", "experienceModelId": "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001", "defaultGrades": [{"propertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:r-.*", "defaultGradeValue": 2}, {"propertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:sr-.*", "defaultGradeValue": 3}, {"propertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*", "defaultGradeValue": 4}], "gradeEntries": [{"rankCapValue": 50, "propertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*", "gradeUpPropertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*"}, {"rankCapValue": 60, "propertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*", "gradeUpPropertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*"}, {"rankCapValue": 70, "propertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*", "gradeUpPropertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*"}, {"rankCapValue": 80, "propertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*", "gradeUpPropertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*"}]}]}')
            ->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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.UpdateCurrentGradeMasterRequest;
import io.gs2.grade.result.UpdateCurrentGradeMasterResult;

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

try {
    UpdateCurrentGradeMasterResult result = client.updateCurrentGradeMaster(
        new UpdateCurrentGradeMasterRequest()
            .withNamespaceName("namespace-0001")
            .withMode("direct")
            .withSettings("{\"version\": \"2023-12-25\", \"gradeModels\": [{\"name\": \"grade-0001\", \"metadata\": \"GRADE_0001\", \"experienceModelId\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\", \"defaultGrades\": [{\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:r-.*\", \"defaultGradeValue\": 2}, {\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:sr-.*\", \"defaultGradeValue\": 3}, {\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*\", \"defaultGradeValue\": 4}], \"gradeEntries\": [{\"rankCapValue\": 50, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 60, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 70, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 80, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}]}]}")
            .withUploadToken(null)
    );
    CurrentGradeMaster 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.UpdateCurrentGradeMasterResult> asyncResult = null;
yield return client.UpdateCurrentGradeMaster(
    new Gs2.Gs2Grade.Request.UpdateCurrentGradeMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithMode("direct")
        .WithSettings("{\"version\": \"2023-12-25\", \"gradeModels\": [{\"name\": \"grade-0001\", \"metadata\": \"GRADE_0001\", \"experienceModelId\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\", \"defaultGrades\": [{\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:r-.*\", \"defaultGradeValue\": 2}, {\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:sr-.*\", \"defaultGradeValue\": 3}, {\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*\", \"defaultGradeValue\": 4}], \"gradeEntries\": [{\"rankCapValue\": 50, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 60, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 70, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 80, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}]}]}")
        .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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.updateCurrentGradeMaster(
        new Gs2Grade.UpdateCurrentGradeMasterRequest()
            .withNamespaceName("namespace-0001")
            .withMode("direct")
            .withSettings("{\"version\": \"2023-12-25\", \"gradeModels\": [{\"name\": \"grade-0001\", \"metadata\": \"GRADE_0001\", \"experienceModelId\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\", \"defaultGrades\": [{\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:r-.*\", \"defaultGradeValue\": 2}, {\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:sr-.*\", \"defaultGradeValue\": 3}, {\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*\", \"defaultGradeValue\": 4}], \"gradeEntries\": [{\"rankCapValue\": 50, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 60, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 70, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 80, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}]}]}")
            .withUploadToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.update_current_grade_master(
        grade.UpdateCurrentGradeMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_mode('direct')
            .with_settings('{"version": "2023-12-25", "gradeModels": [{"name": "grade-0001", "metadata": "GRADE_0001", "experienceModelId": "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001", "defaultGrades": [{"propertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:r-.*", "defaultGradeValue": 2}, {"propertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:sr-.*", "defaultGradeValue": 3}, {"propertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*", "defaultGradeValue": 4}], "gradeEntries": [{"rankCapValue": 50, "propertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*", "gradeUpPropertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*"}, {"rankCapValue": 60, "propertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*", "gradeUpPropertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*"}, {"rankCapValue": 70, "propertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*", "gradeUpPropertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*"}, {"rankCapValue": 80, "propertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*", "gradeUpPropertyIdRegex": "grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*"}]}]}')
            .with_upload_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.update_current_grade_master({
    namespaceName="namespace-0001",
    mode="direct",
    settings="{\"version\": \"2023-12-25\", \"gradeModels\": [{\"name\": \"grade-0001\", \"metadata\": \"GRADE_0001\", \"experienceModelId\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\", \"defaultGrades\": [{\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:r-.*\", \"defaultGradeValue\": 2}, {\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:sr-.*\", \"defaultGradeValue\": 3}, {\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*\", \"defaultGradeValue\": 4}], \"gradeEntries\": [{\"rankCapValue\": 50, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 60, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 70, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 80, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}]}]}",
    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('grade')

api_result_handler = client.update_current_grade_master_async({
    namespaceName="namespace-0001",
    mode="direct",
    settings="{\"version\": \"2023-12-25\", \"gradeModels\": [{\"name\": \"grade-0001\", \"metadata\": \"GRADE_0001\", \"experienceModelId\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\", \"defaultGrades\": [{\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:r-.*\", \"defaultGradeValue\": 2}, {\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:sr-.*\", \"defaultGradeValue\": 3}, {\"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*\", \"defaultGradeValue\": 4}], \"gradeEntries\": [{\"rankCapValue\": 50, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 60, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 70, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}, {\"rankCapValue\": 80, \"propertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*\", \"gradeUpPropertyIdRegex\": \"grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*\"}]}]}",
    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;

updateCurrentGradeMasterFromGitHub

Update currently active Grade Model master data from GitHub

Checks out Grade Model master data from a specified GitHub repository and activates it. The checkout settings specify the repository, branch/tag, and file path to retrieve. This enables Git-based master data management workflows where grade configurations are version-controlled in a repository.

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
itemCurrentGradeMasterUpdated master data of the currently active Grade Models

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentGradeMasterFromGitHub(
    &grade.UpdateCurrentGradeMasterFromGitHubRequest {
        NamespaceName: pointy.String("namespace-0001"),
        CheckoutSetting: &grade.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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\UpdateCurrentGradeMasterFromGitHubRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->updateCurrentGradeMasterFromGitHub(
        (new UpdateCurrentGradeMasterFromGitHubRequest())
            ->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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.UpdateCurrentGradeMasterFromGitHubRequest;
import io.gs2.grade.result.UpdateCurrentGradeMasterFromGitHubResult;

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

try {
    UpdateCurrentGradeMasterFromGitHubResult result = client.updateCurrentGradeMasterFromGitHub(
        new UpdateCurrentGradeMasterFromGitHubRequest()
            .withNamespaceName("namespace-0001")
            .withCheckoutSetting(new GitHubCheckoutSetting()
                .withApiKeyId("apiKeyId-0001")
                .withRepositoryName("gs2io/master-data")
                .withSourcePath("path/to/file.json")
                .withReferenceType("branch")
                .withBranchName("develop")
            )
    );
    CurrentGradeMaster 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.UpdateCurrentGradeMasterFromGitHubResult> asyncResult = null;
yield return client.UpdateCurrentGradeMasterFromGitHub(
    new Gs2.Gs2Grade.Request.UpdateCurrentGradeMasterFromGitHubRequest()
        .WithNamespaceName("namespace-0001")
        .WithCheckoutSetting(new Gs2.Gs2Grade.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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.updateCurrentGradeMasterFromGitHub(
        new Gs2Grade.UpdateCurrentGradeMasterFromGitHubRequest()
            .withNamespaceName("namespace-0001")
            .withCheckoutSetting(new Gs2Grade.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 grade

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

try:
    result = client.update_current_grade_master_from_git_hub(
        grade.UpdateCurrentGradeMasterFromGitHubRequest()
            .with_namespace_name('namespace-0001')
            .with_checkout_setting(grade.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('grade')

api_result = client.update_current_grade_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('grade')

api_result_handler = client.update_current_grade_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;

describeGradeModelMasters

Get a list of Grade Model Masters

Retrieves a paginated list of editable Grade Model Masters with optional name prefix filtering. Grade Model Masters define the grade structure including grade entries, default grades, linked Experience Model, and acquire action rates. Changes to masters do not take effect until the master data is activated via the CurrentGradeMaster API.

Details

Request

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

Result

TypeDescription
itemsList<GradeModelMaster>List of Grade Model Masters
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/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.DescribeGradeModelMasters(
    &grade.DescribeGradeModelMastersRequest {
        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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\DescribeGradeModelMastersRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->describeGradeModelMasters(
        (new DescribeGradeModelMastersRequest())
            ->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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DescribeGradeModelMastersRequest;
import io.gs2.grade.result.DescribeGradeModelMastersResult;

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

try {
    DescribeGradeModelMastersResult result = client.describeGradeModelMasters(
        new DescribeGradeModelMastersRequest()
            .withNamespaceName("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<GradeModelMaster> 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DescribeGradeModelMastersResult> asyncResult = null;
yield return client.DescribeGradeModelMasters(
    new Gs2.Gs2Grade.Request.DescribeGradeModelMastersRequest()
        .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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.describeGradeModelMasters(
        new Gs2Grade.DescribeGradeModelMastersRequest()
            .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 grade

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

try:
    result = client.describe_grade_model_masters(
        grade.DescribeGradeModelMastersRequest()
            .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('grade')

api_result = client.describe_grade_model_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('grade')

api_result_handler = client.describe_grade_model_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;

createGradeModelMaster

Create a new Grade Model Master

Creates a new editable Grade Model Master definition. Key configuration includes:

  • defaultGrades: Initial grade values for new users
  • experienceModelId: Links this grade to a GS2-Experience model for rank cap management
  • gradeEntries: Defines each grade level with its rank cap value and property ID matching patterns
  • acquireActionRates: Rate multipliers applied to acquire actions based on the current grade Changes do not take effect until the master data is activated via the CurrentGradeMaster API.
Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
namestring
~ 128 charsGrade Model name
descriptionstring~ 1024 charsDescription
metadatastring~ 2048 charsMetadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
defaultGradesList<DefaultGradeModel>0 ~ 100 itemsList of Default Grade Models
An ordered list of default grade rules evaluated when creating a new status. Each entry defines a property ID regex pattern and the grade value to assign when matched. If no pattern matches, the default grade value of 0 is used.
experienceModelIdstring
~ 1024 charsGS2-Experience Experience Model GRN
gradeEntriesList<GradeEntryModel>0 ~ 100 itemsList of Grade Entry Models
The ordered list of grade entries that map each grade value to a rank cap for the linked GS2-Experience model. The index in the array corresponds to the grade value, so the first entry (index 0) defines the rank cap for grade 0, the second for grade 1, and so on.
acquireActionRatesList<AcquireActionRate>0 ~ 100 itemsList of Reward Addition Tables
A collection of named multiplier tables used to scale reward amounts based on grade. Multiple tables can be defined to apply different scaling rules to different types of rewards (e.g., experience points, currency, items).

Result

TypeDescription
itemGradeModelMasterGrade Model Master created

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.CreateGradeModelMaster(
    &grade.CreateGradeModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Name: pointy.String("grade-model-0001"),
        Description: nil,
        Metadata: nil,
        DefaultGrades: []grade.DefaultGradeModel{
            grade.DefaultGradeModel{
                PropertyIdRegex: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*"),
                DefaultGradeValue: pointy.Int64(2),
            },
        },
        ExperienceModelId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001"),
        GradeEntries: []grade.GradeEntryModel{
            grade.GradeEntryModel{
                Metadata: pointy.String("GRADE_ENTRY_METADATA"),
                RankCapValue: pointy.Int64(50),
                PropertyIdRegex: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*"),
                GradeUpPropertyIdRegex: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*"),
            },
        },
        AcquireActionRates: []grade.AcquireActionRate{
            grade.AcquireActionRate{
                Name: pointy.String("rate-0001"),
                Rates: []*float64{
                    pointy.Float64(1.0),
                    pointy.Float64(1.5),
                    pointy.Float64(2.0),
                },
            },
            grade.AcquireActionRate{
                Name: pointy.String("rate-0002"),
                Rates: []*float64{
                    pointy.Float64(10.0),
                    pointy.Float64(15.5),
                    pointy.Float64(20.0),
                },
            },
        },
    }
)
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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\CreateGradeModelMasterRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->createGradeModelMaster(
        (new CreateGradeModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withName("grade-model-0001")
            ->withDescription(null)
            ->withMetadata(null)
            ->withDefaultGrades([
                (new \Gs2\Grade\Model\DefaultGradeModel())
                    ->withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*")
                    ->withDefaultGradeValue(2),
            ])
            ->withExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
            ->withGradeEntries([
                (new \Gs2\Grade\Model\GradeEntryModel())
                    ->withMetadata("GRADE_ENTRY_METADATA")
                    ->withRankCapValue(50)
                    ->withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*")
                    ->withGradeUpPropertyIdRegex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*'),
            ])
            ->withAcquireActionRates([
                (new \Gs2\Grade\Model\AcquireActionRate())
                    ->withName("rate-0001")
                    ->withRates([
                        1.0,
                        1.5,
                        2.0,
                    ]),
                (new \Gs2\Grade\Model\AcquireActionRate())
                    ->withName("rate-0002")
                    ->withRates([
                        10.0,
                        15.5,
                        20.0,
                    ]),
            ])
    );
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.CreateGradeModelMasterRequest;
import io.gs2.grade.result.CreateGradeModelMasterResult;

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

try {
    CreateGradeModelMasterResult result = client.createGradeModelMaster(
        new CreateGradeModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withName("grade-model-0001")
            .withDescription(null)
            .withMetadata(null)
            .withDefaultGrades(Arrays.asList(
                new io.gs2.grade.model.DefaultGradeModel()
                    .withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*")
                    .withDefaultGradeValue(2L)
            ))
            .withExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
            .withGradeEntries(Arrays.asList(
                new io.gs2.grade.model.GradeEntryModel()
                    .withMetadata("GRADE_ENTRY_METADATA")
                    .withRankCapValue(50L)
                    .withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*")
                    .withGradeUpPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*")
            ))
            .withAcquireActionRates(Arrays.asList(
                new io.gs2.grade.model.AcquireActionRate()
                    .withName("rate-0001")
                    .withRates(Arrays.asList(
                        1.0,
                        1.5,
                        2.0
                    )),
                new io.gs2.grade.model.AcquireActionRate()
                    .withName("rate-0002")
                    .withRates(Arrays.asList(
                        10.0,
                        15.5,
                        20.0
                    ))
            ))
    );
    GradeModelMaster 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.CreateGradeModelMasterResult> asyncResult = null;
yield return client.CreateGradeModelMaster(
    new Gs2.Gs2Grade.Request.CreateGradeModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithName("grade-model-0001")
        .WithDescription(null)
        .WithMetadata(null)
        .WithDefaultGrades(new Gs2.Gs2Grade.Model.DefaultGradeModel[] {
            new Gs2.Gs2Grade.Model.DefaultGradeModel()
                .WithPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*")
                .WithDefaultGradeValue(2L),
        })
        .WithExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
        .WithGradeEntries(new Gs2.Gs2Grade.Model.GradeEntryModel[] {
            new Gs2.Gs2Grade.Model.GradeEntryModel()
                .WithMetadata("GRADE_ENTRY_METADATA")
                .WithRankCapValue(50L)
                .WithPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*")
                .WithGradeUpPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*"),
        })
        .WithAcquireActionRates(new Gs2.Gs2Grade.Model.AcquireActionRate[] {
            new Gs2.Gs2Grade.Model.AcquireActionRate()
                .WithName("rate-0001")
                .WithRates(new double[] {
                    1.0,
                    1.5,
                    2.0,
                }),
            new Gs2.Gs2Grade.Model.AcquireActionRate()
                .WithName("rate-0002")
                .WithRates(new double[] {
                    10.0,
                    15.5,
                    20.0,
                }),
        }),
    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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.createGradeModelMaster(
        new Gs2Grade.CreateGradeModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withName("grade-model-0001")
            .withDescription(null)
            .withMetadata(null)
            .withDefaultGrades([
                new Gs2Grade.model.DefaultGradeModel()
                    .withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*")
                    .withDefaultGradeValue(2),
            ])
            .withExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
            .withGradeEntries([
                new Gs2Grade.model.GradeEntryModel()
                    .withMetadata("GRADE_ENTRY_METADATA")
                    .withRankCapValue(50)
                    .withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*")
                    .withGradeUpPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*"),
            ])
            .withAcquireActionRates([
                new Gs2Grade.model.AcquireActionRate()
                    .withName("rate-0001")
                    .withRates([
                        1.0,
                        1.5,
                        2.0,
                    ]),
                new Gs2Grade.model.AcquireActionRate()
                    .withName("rate-0002")
                    .withRates([
                        10.0,
                        15.5,
                        20.0,
                    ]),
            ])
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.create_grade_model_master(
        grade.CreateGradeModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_name('grade-model-0001')
            .with_description(None)
            .with_metadata(None)
            .with_default_grades([
                grade.DefaultGradeModel()
                    .with_property_id_regex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*')
                    .with_default_grade_value(2),
            ])
            .with_experience_model_id('grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001')
            .with_grade_entries([
                grade.GradeEntryModel()
                    .with_metadata('GRADE_ENTRY_METADATA')
                    .with_rank_cap_value(50)
                    .with_property_id_regex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*')
                    .with_grade_up_property_id_regex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*'),
            ])
            .with_acquire_action_rates([
                grade.AcquireActionRate()
                    .with_name('rate-0001')
                    .with_rates([
                        1.0,
                        1.5,
                        2.0,
                    ]),
                grade.AcquireActionRate()
                    .with_name('rate-0002')
                    .with_rates([
                        10.0,
                        15.5,
                        20.0,
                    ]),
            ])
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.create_grade_model_master({
    namespaceName="namespace-0001",
    name="grade-model-0001",
    description=nil,
    metadata=nil,
    defaultGrades={
        {
            propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*",
            defaultGradeValue=2,
        }
    },
    experienceModelId="grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001",
    gradeEntries={
        {
            metadata="GRADE_ENTRY_METADATA",
            rankCapValue=50,
            propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*",
            gradeUpPropertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*",
        }
    },
    acquireActionRates={
        {
            name="rate-0001",
            rates={
                1.0,
                1.5,
                2.0
            },
        },
        {
            name="rate-0002",
            rates={
                10.0,
                15.5,
                20.0
            },
        }
    },
})

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('grade')

api_result_handler = client.create_grade_model_master_async({
    namespaceName="namespace-0001",
    name="grade-model-0001",
    description=nil,
    metadata=nil,
    defaultGrades={
        {
            propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:ssr-.*",
            defaultGradeValue=2,
        }
    },
    experienceModelId="grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001",
    gradeEntries={
        {
            metadata="GRADE_ENTRY_METADATA",
            rankCapValue=50,
            propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:(.*):.*",
            gradeUpPropertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0001:item:$1:.*",
        }
    },
    acquireActionRates={
        {
            name="rate-0001",
            rates={
                1.0,
                1.5,
                2.0
            },
        },
        {
            name="rate-0002",
            rates={
                10.0,
                15.5,
                20.0
            },
        }
    },
})

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;

getGradeModelMaster

Get Grade Model Master

Retrieves the detailed information of a specific editable Grade Model Master by name.

Details

Request

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

Result

TypeDescription
itemGradeModelMasterGrade Model Master

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.GetGradeModelMaster(
    &grade.GetGradeModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        GradeName: pointy.String("grade-model-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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\GetGradeModelMasterRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->getGradeModelMaster(
        (new GetGradeModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withGradeName("grade-model-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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.GetGradeModelMasterRequest;
import io.gs2.grade.result.GetGradeModelMasterResult;

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

try {
    GetGradeModelMasterResult result = client.getGradeModelMaster(
        new GetGradeModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withGradeName("grade-model-0001")
    );
    GradeModelMaster 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetGradeModelMasterResult> asyncResult = null;
yield return client.GetGradeModelMaster(
    new Gs2.Gs2Grade.Request.GetGradeModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithGradeName("grade-model-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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.getGradeModelMaster(
        new Gs2Grade.GetGradeModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withGradeName("grade-model-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.get_grade_model_master(
        grade.GetGradeModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_grade_name('grade-model-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.get_grade_model_master({
    namespaceName="namespace-0001",
    gradeName="grade-model-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('grade')

api_result_handler = client.get_grade_model_master_async({
    namespaceName="namespace-0001",
    gradeName="grade-model-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;

updateGradeModelMaster

Update Grade Model Master

Updates the description, metadata, default grades, experience model link, grade entries, and acquire action rates of an existing Grade Model Master. The grade model name cannot be changed after creation. Changes do not take effect until the master data is re-activated via the CurrentGradeMaster API.

Details

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
gradeNamestring
~ 128 charsGrade Model name
descriptionstring~ 1024 charsDescription
metadatastring~ 2048 charsMetadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
defaultGradesList<DefaultGradeModel>0 ~ 100 itemsList of Default Grade Models
An ordered list of default grade rules evaluated when creating a new status. Each entry defines a property ID regex pattern and the grade value to assign when matched. If no pattern matches, the default grade value of 0 is used.
experienceModelIdstring
~ 1024 charsGS2-Experience Experience Model GRN
gradeEntriesList<GradeEntryModel>0 ~ 100 itemsList of Grade Entry Models
The ordered list of grade entries that map each grade value to a rank cap for the linked GS2-Experience model. The index in the array corresponds to the grade value, so the first entry (index 0) defines the rank cap for grade 0, the second for grade 1, and so on.
acquireActionRatesList<AcquireActionRate>0 ~ 100 itemsList of Reward Addition Tables
A collection of named multiplier tables used to scale reward amounts based on grade. Multiple tables can be defined to apply different scaling rules to different types of rewards (e.g., experience points, currency, items).

Result

TypeDescription
itemGradeModelMasterGrade Model Master updated

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.UpdateGradeModelMaster(
    &grade.UpdateGradeModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        GradeName: pointy.String("grade-model-0001"),
        Description: nil,
        Metadata: nil,
        DefaultGrades: []grade.DefaultGradeModel{
            grade.DefaultGradeModel{
                PropertyIdRegex: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*"),
                DefaultGradeValue: pointy.Int64(3),
            },
        },
        ExperienceModelId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001"),
        GradeEntries: []grade.GradeEntryModel{
            grade.GradeEntryModel{
                Metadata: pointy.String("GRADE_ENTRY_METADATA1"),
                RankCapValue: pointy.Int64(60),
                PropertyIdRegex: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*"),
                GradeUpPropertyIdRegex: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*"),
            },
        },
        AcquireActionRates: []grade.AcquireActionRate{
            grade.AcquireActionRate{
                Name: pointy.String("rate-0001"),
                Mode: pointy.String("big"),
                BigRates: []*string{
                    pointy.String("100000000000000"),
                    pointy.String("10000000000000000000000000000"),
                    pointy.String("1000000000000000000000000000000000000000000"),
                },
            },
            grade.AcquireActionRate{
                Name: pointy.String("rate-0002"),
                Mode: pointy.String("big"),
                BigRates: []*string{
                    pointy.String("100000000000000"),
                    pointy.String("10000000000000000000000000000"),
                    pointy.String("1000000000000000000000000000000000000000000"),
                },
            },
        },
    }
)
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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\UpdateGradeModelMasterRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->updateGradeModelMaster(
        (new UpdateGradeModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withGradeName("grade-model-0001")
            ->withDescription(null)
            ->withMetadata(null)
            ->withDefaultGrades([
                (new \Gs2\Grade\Model\DefaultGradeModel())
                    ->withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*")
                    ->withDefaultGradeValue(3),
            ])
            ->withExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
            ->withGradeEntries([
                (new \Gs2\Grade\Model\GradeEntryModel())
                    ->withMetadata("GRADE_ENTRY_METADATA1")
                    ->withRankCapValue(60)
                    ->withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*")
                    ->withGradeUpPropertyIdRegex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*'),
            ])
            ->withAcquireActionRates([
                (new \Gs2\Grade\Model\AcquireActionRate())
                    ->withName("rate-0001")
                    ->withMode("big")
                    ->withBigRates([
                        "100000000000000",
                        "10000000000000000000000000000",
                        "1000000000000000000000000000000000000000000",
                    ]),
                (new \Gs2\Grade\Model\AcquireActionRate())
                    ->withName("rate-0002")
                    ->withMode("big")
                    ->withBigRates([
                        "100000000000000",
                        "10000000000000000000000000000",
                        "1000000000000000000000000000000000000000000",
                    ]),
            ])
    );
    $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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.UpdateGradeModelMasterRequest;
import io.gs2.grade.result.UpdateGradeModelMasterResult;

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

try {
    UpdateGradeModelMasterResult result = client.updateGradeModelMaster(
        new UpdateGradeModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withGradeName("grade-model-0001")
            .withDescription(null)
            .withMetadata(null)
            .withDefaultGrades(Arrays.asList(
                new io.gs2.grade.model.DefaultGradeModel()
                    .withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*")
                    .withDefaultGradeValue(3L)
            ))
            .withExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
            .withGradeEntries(Arrays.asList(
                new io.gs2.grade.model.GradeEntryModel()
                    .withMetadata("GRADE_ENTRY_METADATA1")
                    .withRankCapValue(60L)
                    .withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*")
                    .withGradeUpPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*")
            ))
            .withAcquireActionRates(Arrays.asList(
                new io.gs2.grade.model.AcquireActionRate()
                    .withName("rate-0001")
                    .withMode("big")
                    .withBigRates(Arrays.asList(
                        "100000000000000",
                        "10000000000000000000000000000",
                        "1000000000000000000000000000000000000000000"
                    )),
                new io.gs2.grade.model.AcquireActionRate()
                    .withName("rate-0002")
                    .withMode("big")
                    .withBigRates(Arrays.asList(
                        "100000000000000",
                        "10000000000000000000000000000",
                        "1000000000000000000000000000000000000000000"
                    ))
            ))
    );
    GradeModelMaster 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.UpdateGradeModelMasterResult> asyncResult = null;
yield return client.UpdateGradeModelMaster(
    new Gs2.Gs2Grade.Request.UpdateGradeModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithGradeName("grade-model-0001")
        .WithDescription(null)
        .WithMetadata(null)
        .WithDefaultGrades(new Gs2.Gs2Grade.Model.DefaultGradeModel[] {
            new Gs2.Gs2Grade.Model.DefaultGradeModel()
                .WithPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*")
                .WithDefaultGradeValue(3L),
        })
        .WithExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
        .WithGradeEntries(new Gs2.Gs2Grade.Model.GradeEntryModel[] {
            new Gs2.Gs2Grade.Model.GradeEntryModel()
                .WithMetadata("GRADE_ENTRY_METADATA1")
                .WithRankCapValue(60L)
                .WithPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*")
                .WithGradeUpPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*"),
        })
        .WithAcquireActionRates(new Gs2.Gs2Grade.Model.AcquireActionRate[] {
            new Gs2.Gs2Grade.Model.AcquireActionRate()
                .WithName("rate-0001")
                .WithMode("big")
                .WithBigRates(new string[] {
                    "100000000000000",
                    "10000000000000000000000000000",
                    "1000000000000000000000000000000000000000000",
                }),
            new Gs2.Gs2Grade.Model.AcquireActionRate()
                .WithName("rate-0002")
                .WithMode("big")
                .WithBigRates(new string[] {
                    "100000000000000",
                    "10000000000000000000000000000",
                    "1000000000000000000000000000000000000000000",
                }),
        }),
    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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.updateGradeModelMaster(
        new Gs2Grade.UpdateGradeModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withGradeName("grade-model-0001")
            .withDescription(null)
            .withMetadata(null)
            .withDefaultGrades([
                new Gs2Grade.model.DefaultGradeModel()
                    .withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*")
                    .withDefaultGradeValue(3),
            ])
            .withExperienceModelId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001")
            .withGradeEntries([
                new Gs2Grade.model.GradeEntryModel()
                    .withMetadata("GRADE_ENTRY_METADATA1")
                    .withRankCapValue(60)
                    .withPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*")
                    .withGradeUpPropertyIdRegex("grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*"),
            ])
            .withAcquireActionRates([
                new Gs2Grade.model.AcquireActionRate()
                    .withName("rate-0001")
                    .withMode("big")
                    .withBigRates([
                        "100000000000000",
                        "10000000000000000000000000000",
                        "1000000000000000000000000000000000000000000",
                    ]),
                new Gs2Grade.model.AcquireActionRate()
                    .withName("rate-0002")
                    .withMode("big")
                    .withBigRates([
                        "100000000000000",
                        "10000000000000000000000000000",
                        "1000000000000000000000000000000000000000000",
                    ]),
            ])
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.update_grade_model_master(
        grade.UpdateGradeModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_grade_name('grade-model-0001')
            .with_description(None)
            .with_metadata(None)
            .with_default_grades([
                grade.DefaultGradeModel()
                    .with_property_id_regex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*')
                    .with_default_grade_value(3),
            ])
            .with_experience_model_id('grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001')
            .with_grade_entries([
                grade.GradeEntryModel()
                    .with_metadata('GRADE_ENTRY_METADATA1')
                    .with_rank_cap_value(60)
                    .with_property_id_regex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*')
                    .with_grade_up_property_id_regex('grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*'),
            ])
            .with_acquire_action_rates([
                grade.AcquireActionRate()
                    .with_name('rate-0001')
                    .with_mode('big')
                    .with_big_rates([
                        '100000000000000',
                        '10000000000000000000000000000',
                        '1000000000000000000000000000000000000000000',
                    ]),
                grade.AcquireActionRate()
                    .with_name('rate-0002')
                    .with_mode('big')
                    .with_big_rates([
                        '100000000000000',
                        '10000000000000000000000000000',
                        '1000000000000000000000000000000000000000000',
                    ]),
            ])
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.update_grade_model_master({
    namespaceName="namespace-0001",
    gradeName="grade-model-0001",
    description=nil,
    metadata=nil,
    defaultGrades={
        {
            propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*",
            defaultGradeValue=3,
        }
    },
    experienceModelId="grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001",
    gradeEntries={
        {
            metadata="GRADE_ENTRY_METADATA1",
            rankCapValue=60,
            propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*",
            gradeUpPropertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*",
        }
    },
    acquireActionRates={
        {
            name="rate-0001",
            mode="big",
            bigRates={
                "100000000000000",
                "10000000000000000000000000000",
                "1000000000000000000000000000000000000000000"
            },
        },
        {
            name="rate-0002",
            mode="big",
            bigRates={
                "100000000000000",
                "10000000000000000000000000000",
                "1000000000000000000000000000000000000000000"
            },
        }
    },
})

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('grade')

api_result_handler = client.update_grade_model_master_async({
    namespaceName="namespace-0001",
    gradeName="grade-model-0001",
    description=nil,
    metadata=nil,
    defaultGrades={
        {
            propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:ssr-.*",
            defaultGradeValue=3,
        }
    },
    experienceModelId="grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001",
    gradeEntries={
        {
            metadata="GRADE_ENTRY_METADATA1",
            rankCapValue=60,
            propertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:(.*):.*",
            gradeUpPropertyIdRegex="grn:gs2:ap-northeast-1:YourOwnerId:inventory:namespace-0001:inventory:inventory-0002:item:$1:.*",
        }
    },
    acquireActionRates={
        {
            name="rate-0001",
            mode="big",
            bigRates={
                "100000000000000",
                "10000000000000000000000000000",
                "1000000000000000000000000000000000000000000"
            },
        },
        {
            name="rate-0002",
            mode="big",
            bigRates={
                "100000000000000",
                "10000000000000000000000000000",
                "1000000000000000000000000000000000000000000"
            },
        }
    },
})

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;

deleteGradeModelMaster

Delete Grade Model Master

Deletes an editable Grade Model Master definition. This only affects the master data; the currently active (published) model is not affected until the master data is re-activated.

Details

Request

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

Result

TypeDescription
itemGradeModelMasterGrade Model Master deleted

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/grade"
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 := grade.Gs2GradeRestClient{
    Session: &session,
}
result, err := client.DeleteGradeModelMaster(
    &grade.DeleteGradeModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        GradeName: pointy.String("grade-model-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\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\DeleteGradeModelMasterRequest;

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

$session->open();

$client = new Gs2GradeRestClient(
    $session
);

try {
    $result = $client->deleteGradeModelMaster(
        (new DeleteGradeModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withGradeName("grade-model-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.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.DeleteGradeModelMasterRequest;
import io.gs2.grade.result.DeleteGradeModelMasterResult;

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

try {
    DeleteGradeModelMasterResult result = client.deleteGradeModelMaster(
        new DeleteGradeModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withGradeName("grade-model-0001")
    );
    GradeModelMaster 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 Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DeleteGradeModelMasterResult> asyncResult = null;
yield return client.DeleteGradeModelMaster(
    new Gs2.Gs2Grade.Request.DeleteGradeModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithGradeName("grade-model-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 Gs2Grade from '@/gs2/grade';

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

try {
    const result = await client.deleteGradeModelMaster(
        new Gs2Grade.DeleteGradeModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withGradeName("grade-model-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import grade

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

try:
    result = client.delete_grade_model_master(
        grade.DeleteGradeModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_grade_name('grade-model-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.delete_grade_model_master({
    namespaceName="namespace-0001",
    gradeName="grade-model-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('grade')

api_result_handler = client.delete_grade_model_master_async({
    namespaceName="namespace-0001",
    gradeName="grade-model-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;