API Reference of GS2-Grade SDK

Model

Namespace

Namespace

Namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project. Basically, GS2 services have a layer called namespace, and different namespaces are treated as completely different data spaces, even for the same service.

Therefore, it is necessary to create a namespace before starting to use each service.

TypeConditionRequireDefaultLimitationDescription
namespaceIdstring~ 1024 charsNamespace GRN
namestring~ 128 charsNamespace name
descriptionstring~ 1024 charsDescription
transactionSettingTransactionSettingTransaction settings
changeGradeScriptScriptSettingScript to be executed when grade changes
logSettingLogSettingLog output settings
createdAtlongNowDatetime of creation (Unix time unit:milliseconds)
updatedAtlongNowDatetime of last update (Unix time unit:milliseconds)
revisionlong0~ 9223372036854775805Revision

GradeModelMaster

Grade Model Master

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

TypeConditionRequireDefaultLimitationDescription
gradeModelIdstring~ 1024 charsGrade Model Master GRN
namestring~ 128 charsGrade Model Name
descriptionstring~ 1024 charsDescription
metadatastring~ 2048 charsmetadata
defaultGradesList<DefaultGradeModel>~ 100 itemsList of Default grade model
experienceModelIdstring~ 1024 charsExperience model GRN to link grade and rank cap
gradeEntriesList<GradeEntryModel>~ 100 itemsList of Grade entry
acquireActionRatesList<AcquireActionRate>~ 100 itemsList of Remuneration addition table
createdAtlongNowDatetime of creation (Unix time unit:milliseconds)
updatedAtlongNowDatetime of last update (Unix time unit:milliseconds)
revisionlong0~ 9223372036854775805Revision

GradeModel

Grade Model

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

TypeConditionRequireDefaultLimitationDescription
gradeModelIdstring~ 1024 charsGrade Model GRN
namestring~ 128 charsGrade Model Name
metadatastring~ 2048 charsmetadata
defaultGradesList<DefaultGradeModel>~ 100 itemsList of Default grade model
experienceModelIdstring~ 1024 charsExperience model GRN to link grade and rank cap
gradeEntriesList<GradeEntryModel>1 ~ 100 itemsList of Grade entry
acquireActionRatesList<AcquireActionRate>~ 100 itemsList of Remuneration addition table

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.

TypeConditionRequireDefaultLimitationDescription
statusIdstring~ 1024 charsStatus GRN
gradeNamestring~ 128 charsGrade Model Name
userIdstring~ 128 charsUser Id
propertyIdstring~ 1024 charsProperty ID
gradeValuelong11 ~ 9223372036854775805Current Grade
createdAtlongNowDatetime of creation (Unix time unit:milliseconds)
updatedAtlongNowDatetime of last update (Unix time unit:milliseconds)
revisionlong0~ 9223372036854775805Revision

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.

TypeConditionRequireDefaultLimitationDescription
propertyIdRegexstring~ 1024 charsRegular expression for property ID to which default value is applied
defaultGradeValuelong~ 9223372036854775805Default grade value

GradeEntryModel

Grade Entry

TypeConditionRequireDefaultLimitationDescription
metadatastring~ 2048 charsmetadata
rankCapValuelong~ 9223372036854775805Rank cap value to be set in GS2-Experience
propertyIdRegexstring~ 1024 charsRegular expression for property ID that can be used for grade up
gradeUpPropertyIdRegexstring~ 1024 charsRegular expression for property ID that can be used for grade up

AcquireActionRate

Remuneration addition table master

You can adjust the amount of rewards according to the rank.

TypeConditionRequireDefaultLimitationDescription
namestring~ 128 charsRemuneration addition table name
modeenum {
    “double”,
    “big”
}
“double”~ 128 charsRemuneration addition table type
ratesList<double>{mode} == “double”1 ~ 1000 itemsAmount added per grade (multiplier)
bigRatesList<string>{mode} == “big”1 ~ 1000 itemsAmount added per grade (multiplier)

Enumeration type definition to specify as mode

Enumerator String DefinitionDescription
doubleFloating point number less than 2^48
bigFloating point number less than 1024 digits

CurrentGradeMaster

Currently available master data

GS2 uses JSON format files for master data management. By uploading the file, you can actually reflect the settings on the server.

We provide a master data editor on the management console as a way to create JSON files, but you can also create JSON files using the The service can also be used by creating a tool more appropriate for game management and exporting a JSON file in the appropriate format.

TypeConditionRequireDefaultLimitationDescription
namespaceIdstring~ 1024 charsCurrently prize table grade setting GRN
settingsstring~ 5242880 charsMaster data

AcquireAction

Acquire Action

TypeConditionRequireDefaultLimitationDescription
actionenum {
"Gs2AdReward:AcquirePointByUserId",
"Gs2Dictionary:AddEntriesByUserId",
"Gs2Enchant:ReDrawBalanceParameterStatusByUserId",
"Gs2Enchant:SetBalanceParameterStatusByUserId",
"Gs2Enchant:ReDrawRarityParameterStatusByUserId",
"Gs2Enchant:AddRarityParameterStatusByUserId",
"Gs2Enchant:SetRarityParameterStatusByUserId",
"Gs2Enhance:DirectEnhanceByUserId",
"Gs2Enhance:UnleashByUserId",
"Gs2Enhance:CreateProgressByUserId",
"Gs2Exchange:ExchangeByUserId",
"Gs2Exchange:IncrementalExchangeByUserId",
"Gs2Exchange:CreateAwaitByUserId",
"Gs2Exchange:AcquireForceByUserId",
"Gs2Exchange:SkipByUserId",
"Gs2Experience:AddExperienceByUserId",
"Gs2Experience:SetExperienceByUserId",
"Gs2Experience:AddRankCapByUserId",
"Gs2Experience:SetRankCapByUserId",
"Gs2Experience:MultiplyAcquireActionsByUserId",
"Gs2Formation:AddMoldCapacityByUserId",
"Gs2Formation:SetMoldCapacityByUserId",
"Gs2Formation:AcquireActionsToFormProperties",
"Gs2Formation:SetFormByUserId",
"Gs2Formation:AcquireActionsToPropertyFormProperties",
"Gs2Friend:UpdateProfileByUserId",
"Gs2Grade:AddGradeByUserId",
"Gs2Grade:ApplyRankCapByUserId",
"Gs2Grade:MultiplyAcquireActionsByUserId",
"Gs2Guild:IncreaseMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Guild:SetMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Idle:IncreaseMaximumIdleMinutesByUserId",
"Gs2Idle:SetMaximumIdleMinutesByUserId",
"Gs2Idle:ReceiveByUserId",
"Gs2Inbox:SendMessageByUserId",
"Gs2Inventory:AddCapacityByUserId",
"Gs2Inventory:SetCapacityByUserId",
"Gs2Inventory:AcquireItemSetByUserId",
"Gs2Inventory:AcquireItemSetWithGradeByUserId",
"Gs2Inventory:AddReferenceOfByUserId",
"Gs2Inventory:DeleteReferenceOfByUserId",
"Gs2Inventory:AcquireSimpleItemsByUserId",
"Gs2Inventory:SetSimpleItemsByUserId",
"Gs2Inventory:AcquireBigItemByUserId",
"Gs2Inventory:SetBigItemByUserId",
"Gs2JobQueue:PushByUserId",
"Gs2Limit:CountDownByUserId",
"Gs2Limit:DeleteCounterByUserId",
"Gs2LoginReward:DeleteReceiveStatusByUserId",
"Gs2LoginReward:UnmarkReceivedByUserId",
"Gs2Lottery:DrawByUserId",
"Gs2Lottery:ResetBoxByUserId",
"Gs2Mission:RevertReceiveByUserId",
"Gs2Mission:IncreaseCounterByUserId",
"Gs2Mission:SetCounterByUserId",
"Gs2Money:DepositByUserId",
"Gs2Money:RevertRecordReceipt",
"Gs2Money2:DepositByUserId",
"Gs2Quest:CreateProgressByUserId",
"Gs2Schedule:TriggerByUserId",
"Gs2Script:InvokeScript",
"Gs2SerialKey:RevertUseByUserId",
"Gs2SerialKey:IssueOnce",
"Gs2Showcase:DecrementPurchaseCountByUserId",
"Gs2Showcase:ForceReDrawByUserId",
"Gs2SkillTree:MarkReleaseByUserId",
"Gs2Stamina:RecoverStaminaByUserId",
"Gs2Stamina:RaiseMaxValueByUserId",
"Gs2Stamina:SetMaxValueByUserId",
"Gs2Stamina:SetRecoverIntervalByUserId",
"Gs2Stamina:SetRecoverValueByUserId",
"Gs2StateMachine:StartStateMachineByUserId",
}
~ 128 charsTypes of actions to be performed in the acquire action
requeststring~ 1048576 charsJSON of request

GitHubCheckoutSetting

Setup to check out master data from GitHub

TypeConditionRequireDefaultLimitationDescription
apiKeyIdstring~ 1024 charsGitHub API key GRN
repositoryNamestring~ 1024 charsRepository Name
sourcePathstring~ 1024 charsSource code file path
referenceTypeenum {
    “commit_hash”,
    “branch”,
    “tag”
}
~ 128 charsSource of code
commitHashstring{referenceType} == “commit_hash”~ 1024 charsCommit hash
branchNamestring{referenceType} == “branch”~ 1024 charsBranch Name
tagNamestring{referenceType} == “tag”~ 1024 charsTag Name

Enumeration type definition to specify as referenceType

Enumerator String DefinitionDescription
commit_hashCommit hash
branchBranch
tagTag

ScriptSetting

Script settings

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

There are two main ways to execute a script: synchronous execution and asynchronous execution. Synchronous execution blocks processing until the script has finished executing. Instead, you can use the script execution result to stop the execution of the API or to tamper with the result of the API.

On the other hand, asynchronous execution does not block processing until the script has finished executing. Instead, you can use the script execution result to stop the execution of the API or to tamper with the result of the API. However, asynchronous execution does not block processing until the script has finished executing, so it is generally recommended to use asynchronous execution.

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.

TypeConditionRequireDefaultLimitationDescription
triggerScriptIdstring~ 1024 charsScript GRN
doneTriggerTargetTypeenum {
    “none”,
    “gs2_script”,
    “aws”
}
“none”~ 128 charsNotification of Completion
doneTriggerScriptIdstring{doneTriggerTargetType} == “gs2_script”~ 1024 charsScript GRN
doneTriggerQueueNamespaceIdstring{doneTriggerTargetType} == “gs2_script”~ 1024 charsNamespace GRN

Enumeration type definition to specify as doneTriggerTargetType

Enumerator String DefinitionDescription
noneNone
gs2_scriptGS2-Script
awsAmazon EventBridge

LogSetting

Log setting

This type manages log output settings. This type holds the identifier of the log namespace used to output log data. The log namespace ID specifies the GS2-Log namespace to aggregate and store the log data. Through this setting, API request and response log data under this namespace will be output to the target GS2-Log. GS2-Log provides logs in real time, which can be used for system monitoring, analysis, debugging, etc.

TypeConditionRequireDefaultLimitationDescription
loggingNamespaceIdstring~ 1024 charsNamespace GRN

TransactionSetting

Transaction settings

TypeConditionRequireDefaultLimitationDescription
enableAutoRunboolfalseAutomatically run issued transactions on the server side, or
distributorNamespaceIdstring“grn:gs2:{region}:{ownerId}:distributor:default”~ 1024 charsGS2-Distributor namespace used for transaction execution
queueNamespaceIdstring“grn:gs2:{region}:{ownerId}:queue:default”~ 1024 charsNamespace in GS2-JobQueue used to run the transaction

Methods

describeNamespaces

Get list of namespaces

Request

TypeConditionRequireDefaultLimitationDescription
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data acquired

Result

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

Implementation Example

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

try {
    $result = $client->describeNamespaces(
        (new DescribeNamespacesRequest())
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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()
            .withPageToken(null)
            .withLimit(null)
    );
    List<Namespace> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DescribeNamespacesRequest;
using Gs2.Gs2Grade.Result.DescribeNamespacesResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
    new Gs2.Gs2Grade.Request.DescribeNamespacesRequest()
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as 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()
            .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_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({
    pageToken=nil,
    limit=nil,
})

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

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

api_result_handler = client.describe_namespaces_async({
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

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

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

createNamespace

Create a new namespace

Request

TypeConditionRequireDefaultLimitationDescription
namestring~ 128 charsNamespace name
descriptionstring~ 1024 charsDescription
transactionSettingTransactionSettingTransaction settings
changeGradeScriptScriptSettingScript to be executed when grade changes
logSettingLogSettingLog output settings

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("namespace1"),
        Description: nil,
        TransactionSetting: nil,
        ChangeGradeScript: nil,
        LogSetting: &grade.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName(self::namespace1)
            ->withDescription(null)
            ->withTransactionSetting(null)
            ->withChangeGradeScript(null)
            ->withLogSetting((new \Gs2\Grade\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
            .withDescription(null)
            .withTransactionSetting(null)
            .withChangeGradeScript(null)
            .withLogSetting(new io.gs2.grade.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.CreateNamespaceRequest;
using Gs2.Gs2Grade.Result.CreateNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
    new Gs2.Gs2Grade.Request.CreateNamespaceRequest()
        .WithName("namespace1")
        .WithDescription(null)
        .WithTransactionSetting(null)
        .WithChangeGradeScript(null)
        .WithLogSetting(new Gs2.Gs2Grade.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace1")
            .withDescription(null)
            .withTransactionSetting(null)
            .withChangeGradeScript(null)
            .withLogSetting(new Gs2Grade.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import 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(self.hash1)
            .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:namespace1'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.create_namespace({
    name="namespace1",
    description=nil,
    transactionSetting=nil,
    changeGradeScript=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
    },
})

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

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

api_result_handler = client.create_namespace_async({
    name="namespace1",
    description=nil,
    transactionSetting=nil,
    changeGradeScript=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
    },
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

getNamespaceStatus

Get namespace status

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name

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("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
status := result.Status
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getNamespaceStatus(
        (new GetNamespaceStatusRequest())
            ->withNamespaceName(self::namespace1)
    );
    $status = $result->getStatus();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
    );
    String status = result.getStatus();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Grade.Result.GetNamespaceStatusResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
    new Gs2.Gs2Grade.Request.GetNamespaceStatusRequest()
        .WithNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as 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("namespace1")
    );
    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(self.hash1)
    )
    status = result.status
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.get_namespace_status({
    namespaceName="namespace1",
})

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

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

api_result_handler = client.get_namespace_status_async({
    namespaceName="namespace1",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
status = result.status;

getNamespace

Get namespace

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name

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("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getNamespace(
        (new GetNamespaceRequest())
            ->withNamespaceName(self::namespace1)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.GetNamespaceRequest;
using Gs2.Gs2Grade.Result.GetNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
    new Gs2.Gs2Grade.Request.GetNamespaceRequest()
        .WithNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace1")
    );
    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(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.get_namespace({
    namespaceName="namespace1",
})

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

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

api_result_handler = client.get_namespace_async({
    namespaceName="namespace1",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

updateNamespace

Update namespace

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
descriptionstring~ 1024 charsDescription
transactionSettingTransactionSettingTransaction settings
changeGradeScriptScriptSettingScript to be executed when grade changes
logSettingLogSettingLog output settings

Result

TypeDescription
itemNamespaceUpdated 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.UpdateNamespace(
    &grade.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace1"),
        Description: pointy.String("description1"),
        TransactionSetting: nil,
        ChangeGradeScript: &grade.ScriptSetting{
            TriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002"),
            DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003"),
        },
        LogSetting: &grade.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateNamespace(
        (new UpdateNamespaceRequest())
            ->withNamespaceName(self::namespace1)
            ->withDescription("description1")
            ->withTransactionSetting(null)
            ->withChangeGradeScript((new \Gs2\Grade\Model\ScriptSetting())
                ->withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:\namespace1:script:script-1002")
                ->withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:\namespace1:script:script-1003"))
            ->withLogSetting((new \Gs2\Grade\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
            .withDescription("description1")
            .withTransactionSetting(null)
            .withChangeGradeScript(new io.gs2.grade.model.ScriptSetting()
                .withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002")
                .withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003"))
            .withLogSetting(new io.gs2.grade.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.UpdateNamespaceRequest;
using Gs2.Gs2Grade.Result.UpdateNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
    new Gs2.Gs2Grade.Request.UpdateNamespaceRequest()
        .WithNamespaceName("namespace1")
        .WithDescription("description1")
        .WithTransactionSetting(null)
        .WithChangeGradeScript(new Gs2.Gs2Grade.Model.ScriptSetting()
            .WithTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002")
            .WithDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003"))
        .WithLogSetting(new Gs2.Gs2Grade.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace1")
            .withDescription("description1")
            .withTransactionSetting(null)
            .withChangeGradeScript(new Gs2Grade.model.ScriptSetting()
                .withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002")
                .withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003"))
            .withLogSetting(new Gs2Grade.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import 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(self.hash1)
            .with_description('description1')
            .with_transaction_setting(None)
            .with_change_grade_script(
                grade.ScriptSetting()
                    .with_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002')
                    .with_done_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003'))
            .with_log_setting(
                grade.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.update_namespace({
    namespaceName="namespace1",
    description="description1",
    transactionSetting=nil,
    changeGradeScript={
        triggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002",
        doneTriggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003",
    },
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
    },
})

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

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

api_result_handler = client.update_namespace_async({
    namespaceName="namespace1",
    description="description1",
    transactionSetting=nil,
    changeGradeScript={
        triggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002",
        doneTriggerScriptId="grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003",
    },
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
    },
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

deleteNamespace

Delete namespace

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name

Result

TypeDescription
itemNamespaceDeleted 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("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteNamespace(
        (new DeleteNamespaceRequest())
            ->withNamespaceName(self::namespace1)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DeleteNamespaceRequest;
using Gs2.Gs2Grade.Result.DeleteNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
    new Gs2.Gs2Grade.Request.DeleteNamespaceRequest()
        .WithNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace1")
    );
    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(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.delete_namespace({
    namespaceName="namespace1",
})

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

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

api_result_handler = client.delete_namespace_async({
    namespaceName="namespace1",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

dumpUserDataByUserId

Get dump data of the data associated with the specified user ID

Request

TypeConditionRequireDefaultLimitationDescription
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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->dumpUserDataByUserId(
        (new DumpUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DumpUserDataByUserIdRequest;
using Gs2.Gs2Grade.Result.DumpUserDataByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
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['message'])
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['message'])
end

result = api_result.result

checkDumpUserDataByUserId

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

Request

TypeConditionRequireDefaultLimitationDescription
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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->checkDumpUserDataByUserId(
        (new CheckDumpUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
    $url = $result->getUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.CheckDumpUserDataByUserIdRequest;
using Gs2.Gs2Grade.Result.CheckDumpUserDataByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
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['message'])
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['message'])
end

result = api_result.result
url = result.url;

cleanUserDataByUserId

Get clean data of the data associated with the specified user ID

Request

TypeConditionRequireDefaultLimitationDescription
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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->cleanUserDataByUserId(
        (new CleanUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.CleanUserDataByUserIdRequest;
using Gs2.Gs2Grade.Result.CleanUserDataByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
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['message'])
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['message'])
end

result = api_result.result

checkCleanUserDataByUserId

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

Request

TypeConditionRequireDefaultLimitationDescription
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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->checkCleanUserDataByUserId(
        (new CheckCleanUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.CheckCleanUserDataByUserIdRequest;
using Gs2.Gs2Grade.Result.CheckCleanUserDataByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
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['message'])
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['message'])
end

result = api_result.result

prepareImportUserDataByUserId

Start importing data associated with the specified user ID

Request

TypeConditionRequireDefaultLimitationDescription
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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->prepareImportUserDataByUserId(
        (new PrepareImportUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
    $uploadToken = $result->getUploadToken();
    $uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.PrepareImportUserDataByUserIdRequest;
using Gs2.Gs2Grade.Result.PrepareImportUserDataByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
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['message'])
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['message'])
end

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

importUserDataByUserId

Start importing data associated with the specified user ID

Request

TypeConditionRequireDefaultLimitationDescription
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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->importUserDataByUserId(
        (new ImportUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withUploadToken("upload-0001")
            ->withTimeOffsetToken(null)
    );
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.ImportUserDataByUserIdRequest;
using Gs2.Gs2Grade.Result.ImportUserDataByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
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['message'])
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['message'])
end

result = api_result.result

checkImportUserDataByUserId

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

Request

TypeConditionRequireDefaultLimitationDescription
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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->checkImportUserDataByUserId(
        (new CheckImportUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withUploadToken("upload-0001")
            ->withTimeOffsetToken(null)
    );
    $url = $result->getUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.CheckImportUserDataByUserIdRequest;
using Gs2.Gs2Grade.Result.CheckImportUserDataByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
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['message'])
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['message'])
end

result = api_result.result
url = result.url;

describeGradeModelMasters

Get list of grade model masters

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data acquired

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("namespace1"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeGradeModelMasters(
        (new DescribeGradeModelMastersRequest())
            ->withNamespaceName(self::namespace1)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
            .withPageToken(null)
            .withLimit(null)
    );
    List<GradeModelMaster> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DescribeGradeModelMastersRequest;
using Gs2.Gs2Grade.Result.DescribeGradeModelMastersResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DescribeGradeModelMastersResult> asyncResult = null;
yield return client.DescribeGradeModelMasters(
    new Gs2.Gs2Grade.Request.DescribeGradeModelMastersRequest()
        .WithNamespaceName("namespace1")
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as 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("namespace1")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import 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(self.hash1)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.describe_grade_model_masters({
    namespaceName="namespace1",
    pageToken=nil,
    limit=nil,
})

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

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

api_result_handler = client.describe_grade_model_masters_async({
    namespaceName="namespace1",
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

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

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

createGradeModelMaster

Create new grade model master

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
namestring~ 128 charsGrade Model Name
descriptionstring~ 1024 charsDescription
metadatastring~ 2048 charsmetadata
defaultGradesList<DefaultGradeModel>~ 100 itemsList of Default grade model
experienceModelIdstring~ 1024 charsExperience model GRN to link grade and rank cap
gradeEntriesList<GradeEntryModel>~ 100 itemsList of Grade entry
acquireActionRatesList<AcquireActionRate>~ 100 itemsList of Remuneration addition table

Result

TypeDescription
itemGradeModelMasterCreated Grade 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.CreateGradeModelMaster(
    &grade.CreateGradeModelMasterRequest {
        NamespaceName: pointy.String("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createGradeModelMaster(
        (new CreateGradeModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.CreateGradeModelMasterRequest;
using Gs2.Gs2Grade.Result.CreateGradeModelMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.CreateGradeModelMasterResult> asyncResult = null;
yield return client.CreateGradeModelMaster(
    new Gs2.Gs2Grade.Request.CreateGradeModelMasterRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .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="namespace1",
    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['message'])
end

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

api_result_handler = client.create_grade_model_master_async({
    namespaceName="namespace1",
    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['message'])
end

result = api_result.result
item = result.item;

getGradeModelMaster

Get Grade model master

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
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("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getGradeModelMaster(
        (new GetGradeModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .withGradeName("grade-model-0001")
    );
    GradeModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.GetGradeModelMasterRequest;
using Gs2.Gs2Grade.Result.GetGradeModelMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetGradeModelMasterResult> asyncResult = null;
yield return client.GetGradeModelMaster(
    new Gs2.Gs2Grade.Request.GetGradeModelMasterRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .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="namespace1",
    gradeName="grade-model-0001",
})

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

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

api_result_handler = client.get_grade_model_master_async({
    namespaceName="namespace1",
    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['message'])
end

result = api_result.result
item = result.item;

updateGradeModelMaster

Update Grade Model Master

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
gradeNamestring~ 128 charsGrade Model Name
descriptionstring~ 1024 charsDescription
metadatastring~ 2048 charsmetadata
defaultGradesList<DefaultGradeModel>~ 100 itemsList of Default grade model
experienceModelIdstring~ 1024 charsExperience model GRN to link grade and rank cap
gradeEntriesList<GradeEntryModel>~ 100 itemsList of Grade entry
acquireActionRatesList<AcquireActionRate>~ 100 itemsList of Remuneration addition table

Result

TypeDescription
itemGradeModelMasterUpdated Grade 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.UpdateGradeModelMaster(
    &grade.UpdateGradeModelMasterRequest {
        NamespaceName: pointy.String("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateGradeModelMaster(
        (new UpdateGradeModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.UpdateGradeModelMasterRequest;
using Gs2.Gs2Grade.Result.UpdateGradeModelMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.UpdateGradeModelMasterResult> asyncResult = null;
yield return client.UpdateGradeModelMaster(
    new Gs2.Gs2Grade.Request.UpdateGradeModelMasterRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .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="namespace1",
    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['message'])
end

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

api_result_handler = client.update_grade_model_master_async({
    namespaceName="namespace1",
    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['message'])
end

result = api_result.result
item = result.item;

deleteGradeModelMaster

Delete Grade Model Master

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
gradeNamestring~ 128 charsGrade Model Name

Result

TypeDescription
itemGradeModelMasterDeleted Grade 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.DeleteGradeModelMaster(
    &grade.DeleteGradeModelMasterRequest {
        NamespaceName: pointy.String("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteGradeModelMaster(
        (new DeleteGradeModelMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .withGradeName("grade-model-0001")
    );
    GradeModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DeleteGradeModelMasterRequest;
using Gs2.Gs2Grade.Result.DeleteGradeModelMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DeleteGradeModelMasterResult> asyncResult = null;
yield return client.DeleteGradeModelMaster(
    new Gs2.Gs2Grade.Request.DeleteGradeModelMasterRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .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="namespace1",
    gradeName="grade-model-0001",
})

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

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

api_result_handler = client.delete_grade_model_master_async({
    namespaceName="namespace1",
    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['message'])
end

result = api_result.result
item = result.item;

describeGradeModels

Get list of grade and rank-up threshold models

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name

Result

TypeDescription
itemsList<GradeModel>List of Grade 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.DescribeGradeModels(
    &grade.DescribeGradeModelsRequest {
        NamespaceName: pointy.String("namespace2"),
    }
)
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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeGradeModels(
        (new DescribeGradeModelsRequest())
            ->withNamespaceName(self::namespace2)
    );
    $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("namespace2")
    );
    List<GradeModel> items = result.getItems();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DescribeGradeModelsRequest;
using Gs2.Gs2Grade.Result.DescribeGradeModelsResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DescribeGradeModelsResult> asyncResult = null;
yield return client.DescribeGradeModels(
    new Gs2.Gs2Grade.Request.DescribeGradeModelsRequest()
        .WithNamespaceName("namespace2"),
    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("namespace2")
    );
    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(self.hash2)
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.describe_grade_models({
    namespaceName="namespace2",
})

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

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

api_result_handler = client.describe_grade_models_async({
    namespaceName="namespace2",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
items = result.items;

getGradeModel

Get Grade Model

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
gradeNamestring~ 128 charsGrade Model Name

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("namespace2"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getGradeModel(
        (new GetGradeModelRequest())
            ->withNamespaceName(self::namespace2)
            ->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("namespace2")
            .withGradeName("grade-0001")
    );
    GradeModel item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.GetGradeModelRequest;
using Gs2.Gs2Grade.Result.GetGradeModelResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetGradeModelResult> asyncResult = null;
yield return client.GetGradeModel(
    new Gs2.Gs2Grade.Request.GetGradeModelRequest()
        .WithNamespaceName("namespace2")
        .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("namespace2")
            .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(self.hash2)
            .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="namespace2",
    gradeName="grade-0001",
})

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

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

api_result_handler = client.get_grade_model_async({
    namespaceName="namespace2",
    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['message'])
end

result = api_result.result
item = result.item;

describeStatuses

Get list of statuses

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
gradeNamestring~ 128 charsGrade Model Name
accessTokenstring~ 128 charsUser Id
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data acquired

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("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeStatuses(
        (new DescribeStatusesRequest())
            ->withNamespaceName(self::namespace1)
            ->withGradeName("grade-0001")
            ->withAccessToken(self::$accessToken0001)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DescribeStatusesRequest;
using Gs2.Gs2Grade.Result.DescribeStatusesResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DescribeStatusesResult> asyncResult = null;
yield return client.DescribeStatuses(
    new Gs2.Gs2Grade.Request.DescribeStatusesRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .with_grade_name('grade-0001')
            .with_access_token(self.access_token_0001)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.describe_statuses({
    namespaceName="namespace1",
    gradeName="grade-0001",
    accessToken="accessToken-0001",
    pageToken=nil,
    limit=nil,
})

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

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

api_result_handler = client.describe_statuses_async({
    namespaceName="namespace1",
    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['message'])
end

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

describeStatusesByUserId

Get list of statuses by user ID

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
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 acquired
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("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeStatusesByUserId(
        (new DescribeStatusesByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DescribeStatusesByUserIdRequest;
using Gs2.Gs2Grade.Result.DescribeStatusesByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DescribeStatusesByUserIdResult> asyncResult = null;
yield return client.DescribeStatusesByUserId(
    new Gs2.Gs2Grade.Request.DescribeStatusesByUserIdRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .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="namespace1",
    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['message'])
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="namespace1",
    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['message'])
end

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

getStatus

Get Status

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
accessTokenstring~ 128 charsUser Id
gradeNamestring~ 128 charsGrade Model Name
propertyIdstring~ 1024 charsProperty ID

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("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getStatus(
        (new GetStatusRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->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("namespace1")
            .withAccessToken("accessToken-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
    );
    Status item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.GetStatusRequest;
using Gs2.Gs2Grade.Result.GetStatusResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetStatusResult> asyncResult = null;
yield return client.GetStatus(
    new Gs2.Gs2Grade.Request.GetStatusRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .with_access_token(self.access_token_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="namespace1",
    accessToken="accessToken-0001",
    gradeName="grade-0001",
    propertyId="property-0001",
})

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

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

api_result_handler = client.get_status_async({
    namespaceName="namespace1",
    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['message'])
end

result = api_result.result
item = result.item;

getStatusByUserId

Get status by specifying user ID

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
userIdstring~ 128 charsUser Id
gradeNamestring~ 128 charsGrade Model Name
propertyIdstring~ 1024 charsProperty ID
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("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getStatusByUserId(
        (new GetStatusByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withTimeOffsetToken(null)
    );
    Status item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.GetStatusByUserIdRequest;
using Gs2.Gs2Grade.Result.GetStatusByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetStatusByUserIdResult> asyncResult = null;
yield return client.GetStatusByUserId(
    new Gs2.Gs2Grade.Request.GetStatusByUserIdRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .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="namespace1",
    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['message'])
end

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

api_result_handler = client.get_status_by_user_id_async({
    namespaceName="namespace1",
    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['message'])
end

result = api_result.result
item = result.item;

addGradeByUserId

Add grade by specifying user ID

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
userIdstring~ 128 charsUser Id
gradeNamestring~ 128 charsGrade Model Name
propertyIdstring~ 1024 charsProperty ID
gradeValuelong0~ 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("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->addGradeByUserId(
        (new AddGradeByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.AddGradeByUserIdRequest;
using Gs2.Gs2Grade.Result.AddGradeByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.AddGradeByUserIdResult> asyncResult = null;
yield return client.AddGradeByUserId(
    new Gs2.Gs2Grade.Request.AddGradeByUserIdRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .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="namespace1",
    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['message'])
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="namespace1",
    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['message'])
end

result = api_result.result
item = result.item;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

subGrade

Subtract grade

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
accessTokenstring~ 128 charsUser Id
gradeNamestring~ 128 charsGrade Model Name
propertyIdstring~ 1024 charsProperty ID
gradeValuelong0~ 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("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->subGrade(
        (new SubGradeRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.SubGradeRequest;
using Gs2.Gs2Grade.Result.SubGradeResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.SubGradeResult> asyncResult = null;
yield return client.SubGrade(
    new Gs2.Gs2Grade.Request.SubGradeRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .with_access_token(self.access_token_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="namespace1",
    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['message'])
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="namespace1",
    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['message'])
end

result = api_result.result
item = result.item;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

subGradeByUserId

Subtract grade by specifying user ID

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
userIdstring~ 128 charsUser Id
gradeNamestring~ 128 charsGrade Model Name
propertyIdstring~ 1024 charsProperty ID
gradeValuelong0~ 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("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->subGradeByUserId(
        (new SubGradeByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.SubGradeByUserIdRequest;
using Gs2.Gs2Grade.Result.SubGradeByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.SubGradeByUserIdResult> asyncResult = null;
yield return client.SubGradeByUserId(
    new Gs2.Gs2Grade.Request.SubGradeByUserIdRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .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="namespace1",
    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['message'])
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="namespace1",
    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['message'])
end

result = api_result.result
item = result.item;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

setGradeByUserId

Set cumulative grade gained

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
userIdstring~ 128 charsUser Id
gradeNamestring~ 128 charsGrade Model Name
propertyIdstring~ 1024 charsProperty ID
gradeValuelong11 ~ 9223372036854775805Current Grade
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemStatusUpdated Status
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("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->setGradeByUserId(
        (new SetGradeByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.SetGradeByUserIdRequest;
using Gs2.Gs2Grade.Result.SetGradeByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.SetGradeByUserIdResult> asyncResult = null;
yield return client.SetGradeByUserId(
    new Gs2.Gs2Grade.Request.SetGradeByUserIdRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .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="namespace1",
    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['message'])
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="namespace1",
    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['message'])
end

result = api_result.result
item = result.item;
old = result.old;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

applyRankCap

Apply rank cap to GS2-Experience

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
accessTokenstring~ 128 charsUser Id
gradeNamestring~ 128 charsGrade Model Name
propertyIdstring~ 1024 charsProperty ID

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("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->applyRankCap(
        (new ApplyRankCapRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.ApplyRankCapRequest;
using Gs2.Gs2Grade.Result.ApplyRankCapResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.ApplyRankCapResult> asyncResult = null;
yield return client.ApplyRankCap(
    new Gs2.Gs2Grade.Request.ApplyRankCapRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .with_access_token(self.access_token_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="namespace1",
    accessToken="accessToken-0001",
    gradeName="grade-0001",
    propertyId="property-0001",
})

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

result = api_result.result
item = result.item;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

applyRankCapByUserId

Apply rank cap to GS2-Experience by user ID

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
userIdstring~ 128 charsUser Id
gradeNamestring~ 128 charsGrade Model Name
propertyIdstring~ 1024 charsProperty ID
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("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->applyRankCapByUserId(
        (new ApplyRankCapByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.ApplyRankCapByUserIdRequest;
using Gs2.Gs2Grade.Result.ApplyRankCapByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.ApplyRankCapByUserIdResult> asyncResult = null;
yield return client.ApplyRankCapByUserId(
    new Gs2.Gs2Grade.Request.ApplyRankCapByUserIdRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .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="namespace1",
    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['message'])
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="namespace1",
    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['message'])
end

result = api_result.result
item = result.item;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

deleteStatusByUserId

Delete status

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
userIdstring~ 128 charsUser Id
gradeNamestring~ 128 charsGrade Model Name
propertyIdstring~ 1024 charsProperty ID
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemStatusDeleted Status

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("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteStatusByUserId(
        (new DeleteStatusByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withPropertyId("property-0001")
            .withTimeOffsetToken(null)
    );
    Status item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.DeleteStatusByUserIdRequest;
using Gs2.Gs2Grade.Result.DeleteStatusByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.DeleteStatusByUserIdResult> asyncResult = null;
yield return client.DeleteStatusByUserId(
    new Gs2.Gs2Grade.Request.DeleteStatusByUserIdRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .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="namespace1",
    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['message'])
end

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

api_result_handler = client.delete_status_by_user_id_async({
    namespaceName="namespace1",
    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['message'])
end

result = api_result.result
item = result.item;

verifyGrade

Verify grade

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
accessTokenstring~ 128 charsUser Id
gradeNamestring~ 128 charsGrade Model Name
verifyTypeenum {
    “less”,
    “lessEqual”,
    “greater”,
    “greaterEqual”,
    “equal”,
    “notEqual”
}
~ 128 charsType of verification
propertyIdstring~ 1024 charsProperty ID
gradeValuelong11 ~ 9223372036854775805Current Grade
multiplyValueSpecifyingQuantityboolfalseWhether to multiply the value used for verification when specifying the quantity

Enumeration type definition to specify as verifyType

Enumerator String DefinitionDescription
lessGrade is less than the specified value
lessEqualGrade is less than or equal to the specified value
greaterGrade is greater than the specified value
greaterEqualGrade is greater than or equal to the specified value
equalGrade is equal to the specified value
notEqualGrade is not equal to the specified value

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.VerifyGrade(
    &grade.VerifyGradeRequest {
        NamespaceName: pointy.String("namespace1"),
        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")
}
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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->verifyGrade(
        (new VerifyGradeRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->withGradeName("grade-0001")
            ->withVerifyType("less")
            ->withPropertyId("property-0001")
            ->withGradeValue(2)
            ->withMultiplyValueSpecifyingQuantity(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.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("namespace1")
            .withAccessToken("accessToken-0001")
            .withGradeName("grade-0001")
            .withVerifyType("less")
            .withPropertyId("property-0001")
            .withGradeValue(2L)
            .withMultiplyValueSpecifyingQuantity(null)
    );
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.VerifyGradeRequest;
using Gs2.Gs2Grade.Result.VerifyGradeResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.VerifyGradeResult> asyncResult = null;
yield return client.VerifyGrade(
    new Gs2.Gs2Grade.Request.VerifyGradeRequest()
        .WithNamespaceName("namespace1")
        .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;
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("namespace1")
            .withAccessToken("accessToken-0001")
            .withGradeName("grade-0001")
            .withVerifyType("less")
            .withPropertyId("property-0001")
            .withGradeValue(2)
            .withMultiplyValueSpecifyingQuantity(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(
        grade.VerifyGradeRequest()
            .with_namespace_name(self.hash1)
            .with_access_token(self.access_token_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)
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.verify_grade({
    namespaceName="namespace1",
    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['message'])
end

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

api_result_handler = client.verify_grade_async({
    namespaceName="namespace1",
    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['message'])
end

result = api_result.result

verifyGradeByUserId

Verify grade by user ID

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
userIdstring~ 128 charsUser Id
gradeNamestring~ 128 charsGrade Model Name
verifyTypeenum {
    “less”,
    “lessEqual”,
    “greater”,
    “greaterEqual”,
    “equal”,
    “notEqual”
}
~ 128 charsType of verification
propertyIdstring~ 1024 charsProperty ID
gradeValuelong11 ~ 9223372036854775805Current Grade
multiplyValueSpecifyingQuantityboolfalseWhether to multiply the value used for verification when specifying the quantity
timeOffsetTokenstring~ 1024 charsTime offset token

Enumeration type definition to specify as verifyType

Enumerator String DefinitionDescription
lessGrade is less than the specified value
lessEqualGrade is less than or equal to the specified value
greaterGrade is greater than the specified value
greaterEqualGrade is greater than or equal to the specified value
equalGrade is equal to the specified value
notEqualGrade is not equal to the specified value

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.VerifyGradeByUserId(
    &grade.VerifyGradeByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        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")
}
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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->verifyGradeByUserId(
        (new VerifyGradeByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId("user-0001")
            ->withGradeName("grade-0001")
            ->withVerifyType("less")
            ->withPropertyId("property-0001")
            ->withGradeValue(2)
            ->withMultiplyValueSpecifyingQuantity(null)
            ->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.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("namespace1")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withVerifyType("less")
            .withPropertyId("property-0001")
            .withGradeValue(2L)
            .withMultiplyValueSpecifyingQuantity(null)
            .withTimeOffsetToken(null)
    );
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.VerifyGradeByUserIdRequest;
using Gs2.Gs2Grade.Result.VerifyGradeByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.VerifyGradeByUserIdResult> asyncResult = null;
yield return client.VerifyGradeByUserId(
    new Gs2.Gs2Grade.Request.VerifyGradeByUserIdRequest()
        .WithNamespaceName("namespace1")
        .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;
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("namespace1")
            .withUserId("user-0001")
            .withGradeName("grade-0001")
            .withVerifyType("less")
            .withPropertyId("property-0001")
            .withGradeValue(2)
            .withMultiplyValueSpecifyingQuantity(null)
            .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_by_user_id(
        grade.VerifyGradeByUserIdRequest()
            .with_namespace_name(self.hash1)
            .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)
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.verify_grade_by_user_id({
    namespaceName="namespace1",
    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['message'])
end

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

api_result_handler = client.verify_grade_by_user_id_async({
    namespaceName="namespace1",
    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['message'])
end

result = api_result.result

verifyGradeUpMaterial

Verify grade up material

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
accessTokenstring~ 128 charsUser Id
gradeNamestring~ 128 charsGrade Model Name
verifyTypeenum {
    “match”,
    “notMatch”
}
~ 128 charsType of verification
propertyIdstring~ 1024 charsProperty ID
materialPropertyIdstring~ 1024 charsProperty ID

Enumeration type definition to specify as verifyType

Enumerator String DefinitionDescription
matchGrade is equal to the specified value
notMatchGrade is not equal to the specified value

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("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->verifyGradeUpMaterial(
        (new VerifyGradeUpMaterialRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->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("namespace1")
            .withAccessToken("accessToken-0001")
            .withGradeName("grade-0001")
            .withVerifyType("match")
            .withPropertyId("property-0001")
            .withMaterialPropertyId("property-0002")
    );
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.VerifyGradeUpMaterialRequest;
using Gs2.Gs2Grade.Result.VerifyGradeUpMaterialResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.VerifyGradeUpMaterialResult> asyncResult = null;
yield return client.VerifyGradeUpMaterial(
    new Gs2.Gs2Grade.Request.VerifyGradeUpMaterialRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .with_access_token(self.access_token_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="namespace1",
    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['message'])
end

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

api_result_handler = client.verify_grade_up_material_async({
    namespaceName="namespace1",
    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['message'])
end

result = api_result.result

verifyGradeUpMaterialByUserId

Verify grade up material by user ID

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
userIdstring~ 128 charsUser Id
gradeNamestring~ 128 charsGrade Model Name
verifyTypeenum {
    “match”,
    “notMatch”
}
~ 128 charsType of verification
propertyIdstring~ 1024 charsProperty ID
materialPropertyIdstring~ 1024 charsProperty ID
timeOffsetTokenstring~ 1024 charsTime offset token

Enumeration type definition to specify as verifyType

Enumerator String DefinitionDescription
matchGrade is equal to the specified value
notMatchGrade is not equal to the specified value

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("namespace1"),
        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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->verifyGradeUpMaterialByUserId(
        (new VerifyGradeUpMaterialByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->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("namespace1")
            .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.VerifyGradeUpMaterialByUserIdRequest;
using Gs2.Gs2Grade.Result.VerifyGradeUpMaterialByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.VerifyGradeUpMaterialByUserIdResult> asyncResult = null;
yield return client.VerifyGradeUpMaterialByUserId(
    new Gs2.Gs2Grade.Request.VerifyGradeUpMaterialByUserIdRequest()
        .WithNamespaceName("namespace1")
        .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("namespace1")
            .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(self.hash1)
            .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="namespace1",
    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['message'])
end

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

api_result_handler = client.verify_grade_up_material_by_user_id_async({
    namespaceName="namespace1",
    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['message'])
end

result = api_result.result

addGradeByStampSheet

Execute grade addition as an acquire action

Request

TypeConditionRequireDefaultLimitationDescription
stampSheetstring~ 5242880 charsTransaction
keyIdstring~ 1024 charsencryption key GRN

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.AddGradeByStampSheet(
    &grade.AddGradeByStampSheetRequest {
        StampSheet: pointy.String("stampSheet"),
        KeyId: pointy.String("key-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\AddGradeByStampSheetRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->addGradeByStampSheet(
        (new AddGradeByStampSheetRequest())
            ->withStampSheet(self::stampSheet)
            ->withKeyId(self::key-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.AddGradeByStampSheetRequest;
import io.gs2.grade.result.AddGradeByStampSheetResult;

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

try {
    AddGradeByStampSheetResult result = client.addGradeByStampSheet(
        new AddGradeByStampSheetRequest()
            .withStampSheet("stampSheet")
            .withKeyId("key-0001")
    );
    Status item = result.getItem();
    String experienceNamespaceName = result.getExperienceNamespaceName();
    Status experienceStatus = result.getExperienceStatus();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.AddGradeByStampSheetRequest;
using Gs2.Gs2Grade.Result.AddGradeByStampSheetResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.AddGradeByStampSheetResult> asyncResult = null;
yield return client.AddGradeByStampSheet(
    new Gs2.Gs2Grade.Request.AddGradeByStampSheetRequest()
        .WithStampSheet("stampSheet")
        .WithKeyId("key-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.addGradeByStampSheet(
        new Gs2Grade.AddGradeByStampSheetRequest()
            .withStampSheet("stampSheet")
            .withKeyId("key-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.add_grade_by_stamp_sheet(
        grade.AddGradeByStampSheetRequest()
            .with_stamp_sheet(self.stamp_sheet)
            .with_key_id(self.key1.key_id)
    )
    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_stamp_sheet({
    stampSheet="stampSheet",
    keyId="key-0001",
})

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

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

api_result_handler = client.add_grade_by_stamp_sheet_async({
    stampSheet="stampSheet",
    keyId="key-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

applyRankCapByStampSheet

Execute GS2-Experience rank cap application as an acquire action

Request

TypeConditionRequireDefaultLimitationDescription
stampSheetstring~ 5242880 charsTransaction
keyIdstring~ 1024 charsencryption key GRN

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.ApplyRankCapByStampSheet(
    &grade.ApplyRankCapByStampSheetRequest {
        StampSheet: pointy.String("stampSheet"),
        KeyId: pointy.String("key-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\ApplyRankCapByStampSheetRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->applyRankCapByStampSheet(
        (new ApplyRankCapByStampSheetRequest())
            ->withStampSheet(self::stampSheet)
            ->withKeyId(self::key-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.ApplyRankCapByStampSheetRequest;
import io.gs2.grade.result.ApplyRankCapByStampSheetResult;

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

try {
    ApplyRankCapByStampSheetResult result = client.applyRankCapByStampSheet(
        new ApplyRankCapByStampSheetRequest()
            .withStampSheet("stampSheet")
            .withKeyId("key-0001")
    );
    Status item = result.getItem();
    String experienceNamespaceName = result.getExperienceNamespaceName();
    Status experienceStatus = result.getExperienceStatus();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.ApplyRankCapByStampSheetRequest;
using Gs2.Gs2Grade.Result.ApplyRankCapByStampSheetResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.ApplyRankCapByStampSheetResult> asyncResult = null;
yield return client.ApplyRankCapByStampSheet(
    new Gs2.Gs2Grade.Request.ApplyRankCapByStampSheetRequest()
        .WithStampSheet("stampSheet")
        .WithKeyId("key-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.applyRankCapByStampSheet(
        new Gs2Grade.ApplyRankCapByStampSheetRequest()
            .withStampSheet("stampSheet")
            .withKeyId("key-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_by_stamp_sheet(
        grade.ApplyRankCapByStampSheetRequest()
            .with_stamp_sheet(self.stamp_sheet)
            .with_key_id(self.key1.key_id)
    )
    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_stamp_sheet({
    stampSheet="stampSheet",
    keyId="key-0001",
})

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

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

api_result_handler = client.apply_rank_cap_by_stamp_sheet_async({
    stampSheet="stampSheet",
    keyId="key-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

subGradeByStampTask

Execute grade subtraction as a consume action

Request

TypeConditionRequireDefaultLimitationDescription
stampTaskstring~ 5242880 charsConsume Action
keyIdstring~ 1024 charsencryption key GRN

Result

TypeDescription
itemStatusStatus after subtraction
newContextStackstringRequest of context in which consume action execution results are recorded
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.SubGradeByStampTask(
    &grade.SubGradeByStampTaskRequest {
        StampTask: pointy.String("stampTask"),
        KeyId: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
newContextStack := result.NewContextStack
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\SubGradeByStampTaskRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->subGradeByStampTask(
        (new SubGradeByStampTaskRequest())
            ->withStampTask(self::stampTask)
            ->withKeyId(self::key-0001)
    );
    $item = $result->getItem();
    $newContextStack = $result->getNewContextStack();
    $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.SubGradeByStampTaskRequest;
import io.gs2.grade.result.SubGradeByStampTaskResult;

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

try {
    SubGradeByStampTaskResult result = client.subGradeByStampTask(
        new SubGradeByStampTaskRequest()
            .withStampTask("stampTask")
            .withKeyId("key-0001")
    );
    Status item = result.getItem();
    String newContextStack = result.getNewContextStack();
    String experienceNamespaceName = result.getExperienceNamespaceName();
    Status experienceStatus = result.getExperienceStatus();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.SubGradeByStampTaskRequest;
using Gs2.Gs2Grade.Result.SubGradeByStampTaskResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.SubGradeByStampTaskResult> asyncResult = null;
yield return client.SubGradeByStampTask(
    new Gs2.Gs2Grade.Request.SubGradeByStampTaskRequest()
        .WithStampTask("stampTask")
        .WithKeyId("key-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var newContextStack = result.NewContextStack;
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.subGradeByStampTask(
        new Gs2Grade.SubGradeByStampTaskRequest()
            .withStampTask("stampTask")
            .withKeyId("key-0001")
    );
    const item = result.getItem();
    const newContextStack = result.getNewContextStack();
    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_stamp_task(
        grade.SubGradeByStampTaskRequest()
            .with_stamp_task(self.stamp_task)
            .with_key_id(self.key1.key_id)
    )
    item = result.item
    new_context_stack = result.new_context_stack
    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_stamp_task({
    stampTask="stampTask",
    keyId="key-0001",
})

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

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

api_result_handler = client.sub_grade_by_stamp_task_async({
    stampTask="stampTask",
    keyId="key-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;
newContextStack = result.newContextStack;
experienceNamespaceName = result.experienceNamespaceName;
experienceStatus = result.experienceStatus;

multiplyAcquireActionsByUserId

Add resources according to the grade of the target property of the grade specified by the user ID

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
userIdstring~ 128 charsUser Id
gradeNamestring~ 128 charsGrade Model Name
propertyIdstring~ 1024 charsProperty ID
rateNamestring~ 128 charsRemuneration addition table name
acquireActionsList<AcquireAction>[]~ 100 itemsList of Acquire Action
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemsList<AcquireAction>Rewards
transactionIdstringIssed transaction ID
stampSheetstringStamp sheet
stampSheetEncryptionKeyIdstringCryptographic key GRN used for stamp sheet signature calculations
autoRunStampSheetbool?Is transaction auto-execution enabled?

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("namespace1"),
        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
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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->multiplyAcquireActionsByUserId(
        (new MultiplyAcquireActionsByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->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();
} 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("namespace1")
            .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();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.MultiplyAcquireActionsByUserIdRequest;
using Gs2.Gs2Grade.Result.MultiplyAcquireActionsByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.MultiplyAcquireActionsByUserIdResult> asyncResult = null;
yield return client.MultiplyAcquireActionsByUserId(
    new Gs2.Gs2Grade.Request.MultiplyAcquireActionsByUserIdRequest()
        .WithNamespaceName("namespace1")
        .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;
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("namespace1")
            .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();
} 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(self.hash1)
            .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
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.multiply_acquire_actions_by_user_id({
    namespaceName="namespace1",
    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['message'])
end

result = api_result.result
items = result.items;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
client = gs2('grade')

api_result_handler = client.multiply_acquire_actions_by_user_id_async({
    namespaceName="namespace1",
    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['message'])
end

result = api_result.result
items = result.items;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;

multiplyAcquireActionsByStampSheet

Execute resource addition as an acquire action according to the grade of the property subject to the grade value

Request

TypeConditionRequireDefaultLimitationDescription
stampSheetstring~ 5242880 charsTransaction
keyIdstring~ 1024 charsencryption key GRN

Result

TypeDescription
itemsList<AcquireAction>Rewards
transactionIdstringIssed transaction ID
stampSheetstringStamp sheet
stampSheetEncryptionKeyIdstringCryptographic key GRN used for stamp sheet signature calculations
autoRunStampSheetbool?Is transaction auto-execution enabled?

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.MultiplyAcquireActionsByStampSheet(
    &grade.MultiplyAcquireActionsByStampSheetRequest {
        StampSheet: pointy.String("stampSheet"),
        KeyId: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
transactionId := result.TransactionId
stampSheet := result.StampSheet
stampSheetEncryptionKeyId := result.StampSheetEncryptionKeyId
autoRunStampSheet := result.AutoRunStampSheet
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\MultiplyAcquireActionsByStampSheetRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->multiplyAcquireActionsByStampSheet(
        (new MultiplyAcquireActionsByStampSheetRequest())
            ->withStampSheet(self::stampSheet)
            ->withKeyId(self::key-0001)
    );
    $items = $result->getItems();
    $transactionId = $result->getTransactionId();
    $stampSheet = $result->getStampSheet();
    $stampSheetEncryptionKeyId = $result->getStampSheetEncryptionKeyId();
    $autoRunStampSheet = $result->getAutoRunStampSheet();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.MultiplyAcquireActionsByStampSheetRequest;
import io.gs2.grade.result.MultiplyAcquireActionsByStampSheetResult;

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

try {
    MultiplyAcquireActionsByStampSheetResult result = client.multiplyAcquireActionsByStampSheet(
        new MultiplyAcquireActionsByStampSheetRequest()
            .withStampSheet("stampSheet")
            .withKeyId("key-0001")
    );
    List<AcquireAction> items = result.getItems();
    String transactionId = result.getTransactionId();
    String stampSheet = result.getStampSheet();
    String stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
    boolean autoRunStampSheet = result.getAutoRunStampSheet();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.MultiplyAcquireActionsByStampSheetRequest;
using Gs2.Gs2Grade.Result.MultiplyAcquireActionsByStampSheetResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.MultiplyAcquireActionsByStampSheetResult> asyncResult = null;
yield return client.MultiplyAcquireActionsByStampSheet(
    new Gs2.Gs2Grade.Request.MultiplyAcquireActionsByStampSheetRequest()
        .WithStampSheet("stampSheet")
        .WithKeyId("key-0001"),
    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;
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.multiplyAcquireActionsByStampSheet(
        new Gs2Grade.MultiplyAcquireActionsByStampSheetRequest()
            .withStampSheet("stampSheet")
            .withKeyId("key-0001")
    );
    const items = result.getItems();
    const transactionId = result.getTransactionId();
    const stampSheet = result.getStampSheet();
    const stampSheetEncryptionKeyId = result.getStampSheetEncryptionKeyId();
    const autoRunStampSheet = result.getAutoRunStampSheet();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import 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_stamp_sheet(
        grade.MultiplyAcquireActionsByStampSheetRequest()
            .with_stamp_sheet(self.stamp_sheet)
            .with_key_id(self.key1.key_id)
    )
    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
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.multiply_acquire_actions_by_stamp_sheet({
    stampSheet="stampSheet",
    keyId="key-0001",
})

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

result = api_result.result
items = result.items;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;
client = gs2('grade')

api_result_handler = client.multiply_acquire_actions_by_stamp_sheet_async({
    stampSheet="stampSheet",
    keyId="key-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
items = result.items;
transactionId = result.transactionId;
stampSheet = result.stampSheet;
stampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
autoRunStampSheet = result.autoRunStampSheet;

verifyGradeByStampTask

Execute grade verification as a verify action

Request

TypeConditionRequireDefaultLimitationDescription
stampTaskstring~ 5242880 charsVerify Action
keyIdstring~ 1024 charsencryption key GRN

Result

TypeDescription
newContextStackstringRequest of context in which verify action execution results are recorded

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.VerifyGradeByStampTask(
    &grade.VerifyGradeByStampTaskRequest {
        StampTask: pointy.String("stampTask"),
        KeyId: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
newContextStack := result.NewContextStack
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\VerifyGradeByStampTaskRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->verifyGradeByStampTask(
        (new VerifyGradeByStampTaskRequest())
            ->withStampTask(self::stampTask)
            ->withKeyId(self::key-0001)
    );
    $newContextStack = $result->getNewContextStack();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.VerifyGradeByStampTaskRequest;
import io.gs2.grade.result.VerifyGradeByStampTaskResult;

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

try {
    VerifyGradeByStampTaskResult result = client.verifyGradeByStampTask(
        new VerifyGradeByStampTaskRequest()
            .withStampTask("stampTask")
            .withKeyId("key-0001")
    );
    String newContextStack = result.getNewContextStack();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.VerifyGradeByStampTaskRequest;
using Gs2.Gs2Grade.Result.VerifyGradeByStampTaskResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.VerifyGradeByStampTaskResult> asyncResult = null;
yield return client.VerifyGradeByStampTask(
    new Gs2.Gs2Grade.Request.VerifyGradeByStampTaskRequest()
        .WithStampTask("stampTask")
        .WithKeyId("key-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var newContextStack = result.NewContextStack;
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.verifyGradeByStampTask(
        new Gs2Grade.VerifyGradeByStampTaskRequest()
            .withStampTask("stampTask")
            .withKeyId("key-0001")
    );
    const newContextStack = result.getNewContextStack();
} 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_stamp_task(
        grade.VerifyGradeByStampTaskRequest()
            .with_stamp_task(self.stamp_task)
            .with_key_id(self.key1.key_id)
    )
    new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.verify_grade_by_stamp_task({
    stampTask="stampTask",
    keyId="key-0001",
})

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

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

api_result_handler = client.verify_grade_by_stamp_task_async({
    stampTask="stampTask",
    keyId="key-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
newContextStack = result.newContextStack;

verifyGradeUpMaterialByStampTask

Execute material verification used for grade up as a verify action

Request

TypeConditionRequireDefaultLimitationDescription
stampTaskstring~ 5242880 charsVerify Action
keyIdstring~ 1024 charsencryption key GRN

Result

TypeDescription
newContextStackstringRequest of context in which verify action execution results are recorded

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.VerifyGradeUpMaterialByStampTask(
    &grade.VerifyGradeUpMaterialByStampTaskRequest {
        StampTask: pointy.String("stampTask"),
        KeyId: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
newContextStack := result.NewContextStack
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Grade\Gs2GradeRestClient;
use Gs2\Grade\Request\VerifyGradeUpMaterialByStampTaskRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->verifyGradeUpMaterialByStampTask(
        (new VerifyGradeUpMaterialByStampTaskRequest())
            ->withStampTask(self::stampTask)
            ->withKeyId(self::key-0001)
    );
    $newContextStack = $result->getNewContextStack();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.grade.rest.Gs2GradeRestClient;
import io.gs2.grade.request.VerifyGradeUpMaterialByStampTaskRequest;
import io.gs2.grade.result.VerifyGradeUpMaterialByStampTaskResult;

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

try {
    VerifyGradeUpMaterialByStampTaskResult result = client.verifyGradeUpMaterialByStampTask(
        new VerifyGradeUpMaterialByStampTaskRequest()
            .withStampTask("stampTask")
            .withKeyId("key-0001")
    );
    String newContextStack = result.getNewContextStack();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.VerifyGradeUpMaterialByStampTaskRequest;
using Gs2.Gs2Grade.Result.VerifyGradeUpMaterialByStampTaskResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.VerifyGradeUpMaterialByStampTaskResult> asyncResult = null;
yield return client.VerifyGradeUpMaterialByStampTask(
    new Gs2.Gs2Grade.Request.VerifyGradeUpMaterialByStampTaskRequest()
        .WithStampTask("stampTask")
        .WithKeyId("key-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var newContextStack = result.NewContextStack;
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.verifyGradeUpMaterialByStampTask(
        new Gs2Grade.VerifyGradeUpMaterialByStampTaskRequest()
            .withStampTask("stampTask")
            .withKeyId("key-0001")
    );
    const newContextStack = result.getNewContextStack();
} 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_stamp_task(
        grade.VerifyGradeUpMaterialByStampTaskRequest()
            .with_stamp_task(self.stamp_task)
            .with_key_id(self.key1.key_id)
    )
    new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.verify_grade_up_material_by_stamp_task({
    stampTask="stampTask",
    keyId="key-0001",
})

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

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

api_result_handler = client.verify_grade_up_material_by_stamp_task_async({
    stampTask="stampTask",
    keyId="key-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
newContextStack = result.newContextStack;

exportMaster

Export master data for currently available grade settings

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name

Result

TypeDescription
itemCurrentGradeMasterCurrently available grade settings

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("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->exportMaster(
        (new ExportMasterRequest())
            ->withNamespaceName(self::namespace1)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
    );
    CurrentGradeMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.ExportMasterRequest;
using Gs2.Gs2Grade.Result.ExportMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.ExportMasterResult> asyncResult = null;
yield return client.ExportMaster(
    new Gs2.Gs2Grade.Request.ExportMasterRequest()
        .WithNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace1")
    );
    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(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.export_master({
    namespaceName="namespace1",
})

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

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

api_result_handler = client.export_master_async({
    namespaceName="namespace1",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

getCurrentGradeMaster

Retrieve the currently available grade settings

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name

Result

TypeDescription
itemCurrentGradeMasterCurrently available grade settings

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("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getCurrentGradeMaster(
        (new GetCurrentGradeMasterRequest())
            ->withNamespaceName(self::namespace1)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
    );
    CurrentGradeMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.GetCurrentGradeMasterRequest;
using Gs2.Gs2Grade.Result.GetCurrentGradeMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.GetCurrentGradeMasterResult> asyncResult = null;
yield return client.GetCurrentGradeMaster(
    new Gs2.Gs2Grade.Request.GetCurrentGradeMasterRequest()
        .WithNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace1")
    );
    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(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.get_current_grade_master({
    namespaceName="namespace1",
})

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

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

api_result_handler = client.get_current_grade_master_async({
    namespaceName="namespace1",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

updateCurrentGradeMaster

Update the currently available grade settings

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
settingsstring~ 5242880 charsMaster data

Result

TypeDescription
itemCurrentGradeMasterUpdated and currently available grade settings

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("namespace1"),
        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:.*\"}]}]}"),
    }
)
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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateCurrentGradeMaster(
        (new UpdateCurrentGradeMasterRequest())
            ->withNamespaceName(self::namespace1)
            ->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:.*"}]}]}')
    );
    $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("namespace1")
            .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:.*\"}]}]}")
    );
    CurrentGradeMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.UpdateCurrentGradeMasterRequest;
using Gs2.Gs2Grade.Result.UpdateCurrentGradeMasterResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.UpdateCurrentGradeMasterResult> asyncResult = null;
yield return client.UpdateCurrentGradeMaster(
    new Gs2.Gs2Grade.Request.UpdateCurrentGradeMasterRequest()
        .WithNamespaceName("namespace1")
        .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:.*\"}]}]}"),
    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("namespace1")
            .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:.*\"}]}]}")
    );
    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(self.hash1)
            .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:.*"}]}]}')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.update_current_grade_master({
    namespaceName="namespace1",
    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:.*\"}]}]}",
})

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

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

api_result_handler = client.update_current_grade_master_async({
    namespaceName="namespace1",
    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:.*\"}]}]}",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

updateCurrentGradeMasterFromGitHub

Update the currently available grade settings

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
checkoutSettingGitHubCheckoutSettingSetup to check out master data from GitHub

Result

TypeDescription
itemCurrentGradeMasterUpdated and currently available grade settings

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("namespace1"),
        CheckoutSetting: &grade.GitHubCheckoutSetting{
            ApiKeyId: pointy.String("$gitHubApiKey1.apiKeyId"),
            RepositoryName: pointy.String("gs2io/master-data"),
            SourcePath: pointy.String("path/to/file.json"),
            ReferenceType: pointy.String("branch"),
            BranchName: pointy.String("develop"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateCurrentGradeMasterFromGitHub(
        (new UpdateCurrentGradeMasterFromGitHubRequest())
            ->withNamespaceName(self::namespace1)
            ->withCheckoutSetting((new GitHubCheckoutSetting())
                ->withApiKeyId(self::$gitHubApiKey1.apiKeyId)
                ->withRepositoryName("gs2io/master-data")
                ->withSourcePath("path/to/file.json")
                ->withReferenceType("branch")
                ->withBranchName("develop")
            )
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace1")
            .withCheckoutSetting(new GitHubCheckoutSetting()
                .withApiKeyId("$gitHubApiKey1.apiKeyId")
                .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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Grade.Gs2GradeRestClient;
using Gs2.Gs2Grade.Request.UpdateCurrentGradeMasterFromGitHubRequest;
using Gs2.Gs2Grade.Result.UpdateCurrentGradeMasterFromGitHubResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2GradeRestClient(session);

AsyncResult<Gs2.Gs2Grade.Result.UpdateCurrentGradeMasterFromGitHubResult> asyncResult = null;
yield return client.UpdateCurrentGradeMasterFromGitHub(
    new Gs2.Gs2Grade.Request.UpdateCurrentGradeMasterFromGitHubRequest()
        .WithNamespaceName("namespace1")
        .WithCheckoutSetting(new Gs2.Gs2Grade.Model.GitHubCheckoutSetting()
            .WithApiKeyId("$gitHubApiKey1.apiKeyId")
            .WithRepositoryName("gs2io/master-data")
            .WithSourcePath("path/to/file.json")
            .WithReferenceType("branch")
            .WithBranchName("develop")
        ),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace1")
            .withCheckoutSetting(new Gs2Grade.model.GitHubCheckoutSetting()
                .withApiKeyId("$gitHubApiKey1.apiKeyId")
                .withRepositoryName("gs2io/master-data")
                .withSourcePath("path/to/file.json")
                .withReferenceType("branch")
                .withBranchName("develop")
            )
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import 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(self.hash1)
            .with_checkout_setting(grade.GitHubCheckoutSetting()
                .with_api_key_id(self.git_hub_api_key1.api_key_id)
                .with_repository_name('gs2io/master-data')
                .with_source_path('path/to/file.json')
                .with_reference_type('branch')
                .with_branch_name('develop')
            )
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('grade')

api_result = client.update_current_grade_master_from_git_hub({
    namespaceName="namespace1",
    checkoutSetting={
        api_key_id="$gitHubApiKey1.apiKeyId",
        repository_name="gs2io/master-data",
        source_path="path/to/file.json",
        reference_type="branch",
        branch_name="develop",
    },
})

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

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

api_result_handler = client.update_current_grade_master_from_git_hub_async({
    namespaceName="namespace1",
    checkoutSetting={
        api_key_id="$gitHubApiKey1.apiKeyId",
        repository_name="gs2io/master-data",
        source_path="path/to/file.json",
        reference_type="branch",
        branch_name="develop",
    },
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;