API Reference of GS2-Limit SDK
Model
Namespace
Namespace
Namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project. Basically, GS2 services have a layer called namespace, and different namespaces are treated as completely different data spaces, even for the same service.
Therefore, it is necessary to create a namespace before starting to use each service.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceId | string | ✓ | ~ 1024 chars | Namespace GRN | ||
name | string | ✓ | ~ 128 chars | Namespace name | ||
description | string | ~ 1024 chars | Description | |||
logSetting | LogSetting | Log output settings | ||||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
Counter
Current value of frequency limit
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
counterId | string | ✓ | ~ 1024 chars | Counter GRN | ||
limitName | string | ✓ | ~ 128 chars | Name of limit model | ||
name | string | ✓ | ~ 128 chars | Counter Name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
count | int | ✓ | 0 | ~ 2147483646 | count value | |
nextResetAt | long | Next reset timing | ||||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
LimitModelMaster
Frequency Limit Master
The reset interval can be set for the limit. The reset interval can be set to daily, weekly, monthly, or not reset. All times are specified in Coordinated Universal Time (UTC).
The maximum number of times limit is not set in the master data. Because the product can be purchased when the purchase count counter is less than 3 times, using a step-up gacha-like mechanism. A product that can be purchased when the aforementioned product cannot be purchased and the purchase count counter is less than 5 times. This is so that the maximum value can be changed depending on the context.
Multiple counters can be created for the count limit settings defined here. For example, if you have a quest reward that can only be received once, instead of having a count limit for each quest By providing a single count limit and a counter for each quest, you can avoid exploding the number of settings.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
limitModelId | string | ✓ | ~ 1024 chars | Limit Model Master GRN | ||
name | string | ✓ | ~ 128 chars | Limit Model Name | ||
description | string | ~ 1024 chars | Description | |||
metadata | string | ~ 2048 chars | metadata | |||
resetType | enum [ “notReset”, “daily”, “weekly”, “monthly” ] | ✓ | ~ 128 chars | Reset timing | ||
resetDayOfMonth | int | {resetType} == “monthly” | ✓ | 1 ~ 31 | Date to reset (If the value exceeds the days of the month, it is treated as the last day.) | |
resetDayOfWeek | enum [ “sunday”, “monday”, “tuesday”, “wednesday”, “thursday”, “friday”, “saturday” ] | {resetType} == “weekly” | ✓ | ~ 128 chars | Day of the week to reset | |
resetHour | int | {resetType} in [“monthly”, “weekly”, “daily”] | ✓ | ~ 23 | Reset hour | |
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
CurrentLimitMaster
Currently available master data
GS2 uses JSON format files for master data management. By uploading the file, you can actually reflect the settings on the server.
We provide a master data editor on the management console as a way to create JSON files, but you can also create JSON files using the The service can also be used by creating a tool more appropriate for game management and exporting a JSON file in the appropriate format.
Please refer to the documentation for the format of the JSON file.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceId | string | ✓ | ~ 1024 chars | Currently available frequency limit setting GRN | ||
settings | string | ✓ | ~ 5242880 chars | Master data |
GitHubCheckoutSetting
Setup to check out master data from GitHub
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
apiKeyId | string | ✓ | ~ 1024 chars | GitHub API key GRN | ||
repositoryName | string | ✓ | ~ 1024 chars | Repository Name | ||
sourcePath | string | ✓ | ~ 1024 chars | Source code file path | ||
referenceType | enum [ “commit_hash”, “branch”, “tag” ] | ✓ | ~ 128 chars | Source of code | ||
commitHash | string | {referenceType} == “commit_hash” | ✓ | ~ 1024 chars | Commit hash | |
branchName | string | {referenceType} == “branch” | ✓ | ~ 1024 chars | Branch Name | |
tagName | string | {referenceType} == “tag” | ✓ | ~ 1024 chars | Tag Name |
LogSetting
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.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
loggingNamespaceId | string | ✓ | ~ 1024 chars | Namespace GRN |
LimitModel
Limit model
The reset interval can be set for the limit. The reset interval can be selected from daily, weekly, monthly, or not reset.
The maximum number of times limit is not set in the master data. Because the system works like a step-up gacha, a product can be purchased when the purchase count counter is less than 3 times. A product that can be purchased when the aforementioned product cannot be purchased and the purchase count counter is less than 5 times. This is so that the maximum value can be changed depending on the context.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
limitModelId | string | ✓ | ~ 1024 chars | Limit Model GRN | ||
name | string | ✓ | ~ 128 chars | Limit Model Name | ||
metadata | string | ~ 2048 chars | metadata | |||
resetType | enum [ “notReset”, “daily”, “weekly”, “monthly” ] | ✓ | ~ 128 chars | Reset timing | ||
resetDayOfMonth | int | {resetType} == “monthly” | ✓ | 1 ~ 31 | Date to reset (If the value exceeds the days of the month, it is treated as the last day.) | |
resetDayOfWeek | enum [ “sunday”, “monday”, “tuesday”, “wednesday”, “thursday”, “friday”, “saturday” ] | {resetType} == “weekly” | ✓ | ~ 128 chars | Day of the week to reset | |
resetHour | int | {resetType} in [“monthly”, “weekly”, “daily”] | ✓ | ~ 23 | Reset hour |
Methods
describeNamespaces
Get list of namespaces
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | List<Namespace> | List of Namespace |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&limit.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\Limit\Gs2LimitRestClient;
use Gs2\Limit\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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DescribeNamespacesRequest;
import io.gs2.limit.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.DescribeNamespacesRequest;
using Gs2.Gs2Limit.Result.DescribeNamespacesResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Limit.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2Limit.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 limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.describe_namespaces(
limit.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('limit')
api_result = client.describe_namespaces({
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
createNamespace
Create a new namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
name | string | ✓ | ~ 128 chars | Namespace name | ||
description | string | ~ 1024 chars | Description | |||
logSetting | LogSetting | Log output settings |
Result
Type | Description | |
---|---|---|
item | Namespace | Namespace created |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&limit.CreateNamespaceRequest {
Name: pointy.String("namespace1"),
Description: nil,
LogSetting: &limit.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\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)
->withLogSetting((new \Gs2\Limit\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CreateNamespaceRequest;
import io.gs2.limit.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withLogSetting(new io.gs2.limit.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.CreateNamespaceRequest;
using Gs2.Gs2Limit.Result.CreateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Limit.Request.CreateNamespaceRequest()
.WithName("namespace1")
.WithDescription(null)
.WithLogSetting(new Gs2.Gs2Limit.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.createNamespace(
new Gs2Limit.CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withLogSetting(new Gs2Limit.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.create_namespace(
limit.CreateNamespaceRequest()
.with_name(self.hash1)
.with_description(None)
.with_log_setting(
limit.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
api_result = client.create_namespace({
name="namespace1",
description=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getNamespaceStatus
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
status | string |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&limit.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\Limit\Gs2LimitRestClient;
use Gs2\Limit\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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetNamespaceStatusRequest;
import io.gs2.limit.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Limit.Result.GetNamespaceStatusResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Limit.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2Limit.GetNamespaceStatusRequest()
.withNamespaceName("namespace1")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.get_namespace_status(
limit.GetNamespaceStatusRequest()
.with_namespace_name(self.hash1)
)
status = result.status
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
api_result = client.get_namespace_status({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
status = result.status;
getNamespace
Get namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | Namespace | Namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&limit.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\Limit\Gs2LimitRestClient;
use Gs2\Limit\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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetNamespaceRequest;
import io.gs2.limit.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.GetNamespaceRequest;
using Gs2.Gs2Limit.Result.GetNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Limit.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.getNamespace(
new Gs2Limit.GetNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.get_namespace(
limit.GetNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
api_result = client.get_namespace({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateNamespace
Update namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
description | string | ~ 1024 chars | Description | |||
logSetting | LogSetting | Log output settings |
Result
Type | Description | |
---|---|---|
item | Namespace | Updated namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&limit.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
Description: pointy.String("description1"),
LogSetting: &limit.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\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")
->withLogSetting((new \Gs2\Limit\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.UpdateNamespaceRequest;
import io.gs2.limit.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withLogSetting(new io.gs2.limit.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.UpdateNamespaceRequest;
using Gs2.Gs2Limit.Result.UpdateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Limit.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace1")
.WithDescription("description1")
.WithLogSetting(new Gs2.Gs2Limit.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2Limit.UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withLogSetting(new Gs2Limit.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.update_namespace(
limit.UpdateNamespaceRequest()
.with_namespace_name(self.hash1)
.with_description('description1')
.with_log_setting(
limit.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
api_result = client.update_namespace({
namespaceName="namespace1",
description="description1",
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
deleteNamespace
Delete namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | Namespace | Deleted namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&limit.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\Limit\Gs2LimitRestClient;
use Gs2\Limit\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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DeleteNamespaceRequest;
import io.gs2.limit.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.DeleteNamespaceRequest;
using Gs2.Gs2Limit.Result.DeleteNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Limit.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2Limit.DeleteNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.delete_namespace(
limit.DeleteNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
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;
dumpUserDataByUserId
Get dump data of the data associated with the specified user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description |
---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.DumpUserDataByUserId(
&limit.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\Limit\Gs2LimitRestClient;
use Gs2\Limit\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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DumpUserDataByUserIdRequest;
import io.gs2.limit.result.DumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.DumpUserDataByUserIdRequest;
using Gs2.Gs2Limit.Result.DumpUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
new Gs2.Gs2Limit.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.dumpUserDataByUserId(
new Gs2Limit.DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.dump_user_data_by_user_id(
limit.DumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
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
checkDumpUserDataByUserId
Check if the dump of the data associated with the specified user ID is complete
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
url | string | URL of output data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
&limit.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\Limit\Gs2LimitRestClient;
use Gs2\Limit\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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.limit.result.CheckDumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.CheckDumpUserDataByUserIdRequest;
using Gs2.Gs2Limit.Result.CheckDumpUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
new Gs2.Gs2Limit.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.checkDumpUserDataByUserId(
new Gs2Limit.CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.check_dump_user_data_by_user_id(
limit.CheckDumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
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;
cleanUserDataByUserId
Get clean data of the data associated with the specified user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description |
---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.CleanUserDataByUserId(
&limit.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\Limit\Gs2LimitRestClient;
use Gs2\Limit\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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CleanUserDataByUserIdRequest;
import io.gs2.limit.result.CleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.CleanUserDataByUserIdRequest;
using Gs2.Gs2Limit.Result.CleanUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
new Gs2.Gs2Limit.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.cleanUserDataByUserId(
new Gs2Limit.CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.clean_user_data_by_user_id(
limit.CleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
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
checkCleanUserDataByUserId
Check if the clean of the data associated with the specified user ID is complete
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description |
---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
&limit.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\Limit\Gs2LimitRestClient;
use Gs2\Limit\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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.limit.result.CheckCleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.CheckCleanUserDataByUserIdRequest;
using Gs2.Gs2Limit.Result.CheckCleanUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
new Gs2.Gs2Limit.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.checkCleanUserDataByUserId(
new Gs2Limit.CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.check_clean_user_data_by_user_id(
limit.CheckCleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
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
prepareImportUserDataByUserId
Start importing data associated with the specified user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
uploadToken | string | Token used to reflect results after upload |
uploadUrl | string | URL used to upload user data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
&limit.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\Limit\Gs2LimitRestClient;
use Gs2\Limit\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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.limit.result.PrepareImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.PrepareImportUserDataByUserIdRequest;
using Gs2.Gs2Limit.Result.PrepareImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
new Gs2.Gs2Limit.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.prepareImportUserDataByUserId(
new Gs2Limit.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 limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.prepare_import_user_data_by_user_id(
limit.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('limit')
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;
importUserDataByUserId
Start importing data associated with the specified user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
uploadToken | string | ✓ | ~ 1024 chars | Token received in preparation for upload | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description |
---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.ImportUserDataByUserId(
&limit.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\Limit\Gs2LimitRestClient;
use Gs2\Limit\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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.ImportUserDataByUserIdRequest;
import io.gs2.limit.result.ImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.ImportUserDataByUserIdRequest;
using Gs2.Gs2Limit.Result.ImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
new Gs2.Gs2Limit.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.importUserDataByUserId(
new Gs2Limit.ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.import_user_data_by_user_id(
limit.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('limit')
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
checkImportUserDataByUserId
Check if the import of the data associated with the specified user ID is complete
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
uploadToken | string | ✓ | ~ 1024 chars | Token received in preparation for upload | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
url | string | URL of log data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
&limit.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\Limit\Gs2LimitRestClient;
use Gs2\Limit\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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CheckImportUserDataByUserIdRequest;
import io.gs2.limit.result.CheckImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.CheckImportUserDataByUserIdRequest;
using Gs2.Gs2Limit.Result.CheckImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
new Gs2.Gs2Limit.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.checkImportUserDataByUserId(
new Gs2Limit.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 limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.check_import_user_data_by_user_id(
limit.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('limit')
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;
describeCounters
Get list of counters
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
accessToken | string | ✓ | ~ 128 chars | User Id | ||
limitName | string | ~ 128 chars | Limit Model Name | |||
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | List<Counter> | List of Counter |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.DescribeCounters(
&limit.DescribeCountersRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("accessToken-0001"),
LimitName: pointy.String("daily"),
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DescribeCountersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeCounters(
(new DescribeCountersRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withLimitName("daily")
->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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DescribeCountersRequest;
import io.gs2.limit.result.DescribeCountersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(session);
try {
DescribeCountersResult result = client.describeCounters(
new DescribeCountersRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withLimitName("daily")
.withPageToken(null)
.withLimit(null)
);
List<Counter> 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.DescribeCountersRequest;
using Gs2.Gs2Limit.Result.DescribeCountersResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.DescribeCountersResult> asyncResult = null;
yield return client.DescribeCounters(
new Gs2.Gs2Limit.Request.DescribeCountersRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("accessToken-0001")
.WithLimitName("daily")
.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.describeCounters(
new Gs2Limit.DescribeCountersRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withLimitName("daily")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.describe_counters(
limit.DescribeCountersRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_limit_name('daily')
.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('limit')
api_result = client.describe_counters({
namespaceName="namespace1",
accessToken="accessToken-0001",
limitName="daily",
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;
describeCountersByUserId
Get list of counters by user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
limitName | string | ~ 128 chars | Limit Model Name | |||
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired | |
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
items | List<Counter> | List of Counter |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.DescribeCountersByUserId(
&limit.DescribeCountersByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
LimitName: pointy.String("daily"),
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DescribeCountersByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeCountersByUserId(
(new DescribeCountersByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withLimitName("daily")
->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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DescribeCountersByUserIdRequest;
import io.gs2.limit.result.DescribeCountersByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(session);
try {
DescribeCountersByUserIdResult result = client.describeCountersByUserId(
new DescribeCountersByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withLimitName("daily")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<Counter> 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.DescribeCountersByUserIdRequest;
using Gs2.Gs2Limit.Result.DescribeCountersByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.DescribeCountersByUserIdResult> asyncResult = null;
yield return client.DescribeCountersByUserId(
new Gs2.Gs2Limit.Request.DescribeCountersByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithLimitName("daily")
.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.describeCountersByUserId(
new Gs2Limit.DescribeCountersByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withLimitName("daily")
.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 limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.describe_counters_by_user_id(
limit.DescribeCountersByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_limit_name('daily')
.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('limit')
api_result = client.describe_counters_by_user_id({
namespaceName="namespace1",
userId="user-0001",
limitName="daily",
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;
getCounter
Get a Counter
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
limitName | string | ✓ | ~ 128 chars | Name of limit model | ||
accessToken | string | ✓ | ~ 128 chars | User Id | ||
counterName | string | ✓ | ~ 128 chars | Counter Name |
Result
Type | Description | |
---|---|---|
item | Counter | Counter |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.GetCounter(
&limit.GetCounterRequest {
NamespaceName: pointy.String("namespace1"),
LimitName: pointy.String("daily"),
AccessToken: pointy.String("accessToken-0001"),
CounterName: pointy.String("counter1"),
}
)
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetCounterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getCounter(
(new GetCounterRequest())
->withNamespaceName(self::namespace1)
->withLimitName("daily")
->withAccessToken(self::$accessToken0001)
->withCounterName("counter1")
);
$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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetCounterRequest;
import io.gs2.limit.result.GetCounterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(session);
try {
GetCounterResult result = client.getCounter(
new GetCounterRequest()
.withNamespaceName("namespace1")
.withLimitName("daily")
.withAccessToken("accessToken-0001")
.withCounterName("counter1")
);
Counter 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.GetCounterRequest;
using Gs2.Gs2Limit.Result.GetCounterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.GetCounterResult> asyncResult = null;
yield return client.GetCounter(
new Gs2.Gs2Limit.Request.GetCounterRequest()
.WithNamespaceName("namespace1")
.WithLimitName("daily")
.WithAccessToken("accessToken-0001")
.WithCounterName("counter1"),
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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.getCounter(
new Gs2Limit.GetCounterRequest()
.withNamespaceName("namespace1")
.withLimitName("daily")
.withAccessToken("accessToken-0001")
.withCounterName("counter1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.get_counter(
limit.GetCounterRequest()
.with_namespace_name(self.hash1)
.with_limit_name('daily')
.with_access_token(self.access_token_0001)
.with_counter_name('counter1')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
api_result = client.get_counter({
namespaceName="namespace1",
limitName="daily",
accessToken="accessToken-0001",
counterName="counter1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getCounterByUserId
Get a counter by specifying a user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
limitName | string | ✓ | ~ 128 chars | Name of limit model | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
counterName | string | ✓ | ~ 128 chars | Counter Name | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | Counter | Counter |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.GetCounterByUserId(
&limit.GetCounterByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
LimitName: pointy.String("daily"),
UserId: pointy.String("user-0001"),
CounterName: pointy.String("counter2"),
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetCounterByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getCounterByUserId(
(new GetCounterByUserIdRequest())
->withNamespaceName(self::namespace1)
->withLimitName("daily")
->withUserId("user-0001")
->withCounterName("counter2")
->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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetCounterByUserIdRequest;
import io.gs2.limit.result.GetCounterByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(session);
try {
GetCounterByUserIdResult result = client.getCounterByUserId(
new GetCounterByUserIdRequest()
.withNamespaceName("namespace1")
.withLimitName("daily")
.withUserId("user-0001")
.withCounterName("counter2")
.withTimeOffsetToken(null)
);
Counter 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.GetCounterByUserIdRequest;
using Gs2.Gs2Limit.Result.GetCounterByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.GetCounterByUserIdResult> asyncResult = null;
yield return client.GetCounterByUserId(
new Gs2.Gs2Limit.Request.GetCounterByUserIdRequest()
.WithNamespaceName("namespace1")
.WithLimitName("daily")
.WithUserId("user-0001")
.WithCounterName("counter2")
.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.getCounterByUserId(
new Gs2Limit.GetCounterByUserIdRequest()
.withNamespaceName("namespace1")
.withLimitName("daily")
.withUserId("user-0001")
.withCounterName("counter2")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.get_counter_by_user_id(
limit.GetCounterByUserIdRequest()
.with_namespace_name(self.hash1)
.with_limit_name('daily')
.with_user_id('user-0001')
.with_counter_name('counter2')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
api_result = client.get_counter_by_user_id({
namespaceName="namespace1",
limitName="daily",
userId="user-0001",
counterName="counter2",
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;
countUp
Count-up
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
limitName | string | ✓ | ~ 128 chars | Name of limit model | ||
counterName | string | ✓ | ~ 128 chars | Counter Name | ||
accessToken | string | ✓ | ~ 128 chars | User Id | ||
countUpValue | int | ✓ | 1 | 1 ~ 2147483646 | Amount to count up | |
maxValue | int | 1 ~ 2147483646 | Maximum value allowed to count up |
Result
Type | Description | |
---|---|---|
item | Counter | Counter with increased count |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.CountUp(
&limit.CountUpRequest {
NamespaceName: pointy.String("namespace1"),
LimitName: pointy.String("daily"),
CounterName: pointy.String("counter1"),
AccessToken: pointy.String("accessToken-0001"),
CountUpValue: pointy.Int32(1),
MaxValue: pointy.Int32(100),
}
)
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CountUpRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->countUp(
(new CountUpRequest())
->withNamespaceName(self::namespace1)
->withLimitName("daily")
->withCounterName("counter1")
->withAccessToken(self::$accessToken0001)
->withCountUpValue(1)
->withMaxValue(100)
);
$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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CountUpRequest;
import io.gs2.limit.result.CountUpResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(session);
try {
CountUpResult result = client.countUp(
new CountUpRequest()
.withNamespaceName("namespace1")
.withLimitName("daily")
.withCounterName("counter1")
.withAccessToken("accessToken-0001")
.withCountUpValue(1)
.withMaxValue(100)
);
Counter 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.CountUpRequest;
using Gs2.Gs2Limit.Result.CountUpResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.CountUpResult> asyncResult = null;
yield return client.CountUp(
new Gs2.Gs2Limit.Request.CountUpRequest()
.WithNamespaceName("namespace1")
.WithLimitName("daily")
.WithCounterName("counter1")
.WithAccessToken("accessToken-0001")
.WithCountUpValue(1)
.WithMaxValue(100),
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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.countUp(
new Gs2Limit.CountUpRequest()
.withNamespaceName("namespace1")
.withLimitName("daily")
.withCounterName("counter1")
.withAccessToken("accessToken-0001")
.withCountUpValue(1)
.withMaxValue(100)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.count_up(
limit.CountUpRequest()
.with_namespace_name(self.hash1)
.with_limit_name('daily')
.with_counter_name('counter1')
.with_access_token(self.access_token_0001)
.with_count_up_value(1)
.with_max_value(100)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
api_result = client.count_up({
namespaceName="namespace1",
limitName="daily",
counterName="counter1",
accessToken="accessToken-0001",
countUpValue=1,
maxValue=100,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
countUpByUserId
count-up by the specify user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
limitName | string | ✓ | ~ 128 chars | Name of limit model | ||
counterName | string | ✓ | ~ 128 chars | Counter Name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
countUpValue | int | ✓ | 1 | 1 ~ 2147483646 | Amount to count up | |
maxValue | int | 1 ~ 2147483646 | Maximum value allowed to count up | |||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | Counter | Counter with increased count |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.CountUpByUserId(
&limit.CountUpByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
LimitName: pointy.String("daily"),
CounterName: pointy.String("counter2"),
UserId: pointy.String("user-0001"),
CountUpValue: pointy.Int32(2),
MaxValue: pointy.Int32(100),
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CountUpByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->countUpByUserId(
(new CountUpByUserIdRequest())
->withNamespaceName(self::namespace1)
->withLimitName("daily")
->withCounterName("counter2")
->withUserId("user-0001")
->withCountUpValue(2)
->withMaxValue(100)
->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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CountUpByUserIdRequest;
import io.gs2.limit.result.CountUpByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(session);
try {
CountUpByUserIdResult result = client.countUpByUserId(
new CountUpByUserIdRequest()
.withNamespaceName("namespace1")
.withLimitName("daily")
.withCounterName("counter2")
.withUserId("user-0001")
.withCountUpValue(2)
.withMaxValue(100)
.withTimeOffsetToken(null)
);
Counter 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.CountUpByUserIdRequest;
using Gs2.Gs2Limit.Result.CountUpByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.CountUpByUserIdResult> asyncResult = null;
yield return client.CountUpByUserId(
new Gs2.Gs2Limit.Request.CountUpByUserIdRequest()
.WithNamespaceName("namespace1")
.WithLimitName("daily")
.WithCounterName("counter2")
.WithUserId("user-0001")
.WithCountUpValue(2)
.WithMaxValue(100)
.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.countUpByUserId(
new Gs2Limit.CountUpByUserIdRequest()
.withNamespaceName("namespace1")
.withLimitName("daily")
.withCounterName("counter2")
.withUserId("user-0001")
.withCountUpValue(2)
.withMaxValue(100)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.count_up_by_user_id(
limit.CountUpByUserIdRequest()
.with_namespace_name(self.hash1)
.with_limit_name('daily')
.with_counter_name('counter2')
.with_user_id('user-0001')
.with_count_up_value(2)
.with_max_value(100)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
api_result = client.count_up_by_user_id({
namespaceName="namespace1",
limitName="daily",
counterName="counter2",
userId="user-0001",
countUpValue=2,
maxValue=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;
countDownByUserId
count-down by the specify user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
limitName | string | ✓ | ~ 128 chars | Name of limit model | ||
counterName | string | ✓ | ~ 128 chars | Counter Name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
countDownValue | int | ✓ | 1 | 1 ~ 2147483646 | Amount to count down | |
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | Counter | Counter with increased count |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.CountDownByUserId(
&limit.CountDownByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
LimitName: pointy.String("daily"),
CounterName: pointy.String("counter2"),
UserId: pointy.String("user-0001"),
CountDownValue: pointy.Int32(2),
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CountDownByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->countDownByUserId(
(new CountDownByUserIdRequest())
->withNamespaceName(self::namespace1)
->withLimitName("daily")
->withCounterName("counter2")
->withUserId("user-0001")
->withCountDownValue(2)
->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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CountDownByUserIdRequest;
import io.gs2.limit.result.CountDownByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(session);
try {
CountDownByUserIdResult result = client.countDownByUserId(
new CountDownByUserIdRequest()
.withNamespaceName("namespace1")
.withLimitName("daily")
.withCounterName("counter2")
.withUserId("user-0001")
.withCountDownValue(2)
.withTimeOffsetToken(null)
);
Counter 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.CountDownByUserIdRequest;
using Gs2.Gs2Limit.Result.CountDownByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.CountDownByUserIdResult> asyncResult = null;
yield return client.CountDownByUserId(
new Gs2.Gs2Limit.Request.CountDownByUserIdRequest()
.WithNamespaceName("namespace1")
.WithLimitName("daily")
.WithCounterName("counter2")
.WithUserId("user-0001")
.WithCountDownValue(2)
.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.countDownByUserId(
new Gs2Limit.CountDownByUserIdRequest()
.withNamespaceName("namespace1")
.withLimitName("daily")
.withCounterName("counter2")
.withUserId("user-0001")
.withCountDownValue(2)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.count_down_by_user_id(
limit.CountDownByUserIdRequest()
.with_namespace_name(self.hash1)
.with_limit_name('daily')
.with_counter_name('counter2')
.with_user_id('user-0001')
.with_count_down_value(2)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
api_result = client.count_down_by_user_id({
namespaceName="namespace1",
limitName="daily",
counterName="counter2",
userId="user-0001",
countDownValue=2,
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;
deleteCounterByUserId
Delete counter by specifying user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
limitName | string | ✓ | ~ 128 chars | Name of limit model | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
counterName | string | ✓ | ~ 128 chars | Counter Name | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | Counter | Deleted counter |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.DeleteCounterByUserId(
&limit.DeleteCounterByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
LimitName: pointy.String("daily"),
UserId: pointy.String("user-0001"),
CounterName: pointy.String("counter1"),
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DeleteCounterByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteCounterByUserId(
(new DeleteCounterByUserIdRequest())
->withNamespaceName(self::namespace1)
->withLimitName("daily")
->withUserId("user-0001")
->withCounterName("counter1")
->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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DeleteCounterByUserIdRequest;
import io.gs2.limit.result.DeleteCounterByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(session);
try {
DeleteCounterByUserIdResult result = client.deleteCounterByUserId(
new DeleteCounterByUserIdRequest()
.withNamespaceName("namespace1")
.withLimitName("daily")
.withUserId("user-0001")
.withCounterName("counter1")
.withTimeOffsetToken(null)
);
Counter 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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.DeleteCounterByUserIdRequest;
using Gs2.Gs2Limit.Result.DeleteCounterByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.DeleteCounterByUserIdResult> asyncResult = null;
yield return client.DeleteCounterByUserId(
new Gs2.Gs2Limit.Request.DeleteCounterByUserIdRequest()
.WithNamespaceName("namespace1")
.WithLimitName("daily")
.WithUserId("user-0001")
.WithCounterName("counter1")
.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.deleteCounterByUserId(
new Gs2Limit.DeleteCounterByUserIdRequest()
.withNamespaceName("namespace1")
.withLimitName("daily")
.withUserId("user-0001")
.withCounterName("counter1")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.delete_counter_by_user_id(
limit.DeleteCounterByUserIdRequest()
.with_namespace_name(self.hash1)
.with_limit_name('daily')
.with_user_id('user-0001')
.with_counter_name('counter1')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
api_result = client.delete_counter_by_user_id({
namespaceName="namespace1",
limitName="daily",
userId="user-0001",
counterName="counter1",
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;
verifyCounter
Verify counter value
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
accessToken | string | ✓ | ~ 128 chars | User Id | ||
limitName | string | ✓ | ~ 128 chars | Name of limit model | ||
counterName | string | ✓ | ~ 128 chars | Counter Name | ||
verifyType | enum [ “less”, “lessEqual”, “greater”, “greaterEqual”, “equal”, “notEqual” ] | ✓ | ~ 128 chars | Type of verification | ||
count | int | ✓ | 0 | ~ 2147483646 | count value | |
multiplyValueSpecifyingQuantity | bool | ✓ | true | Whether to multiply the value used for verification when specifying the quantity |
Result
Type | Description |
---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.VerifyCounter(
&limit.VerifyCounterRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("accessToken-0001"),
LimitName: pointy.String("daily"),
CounterName: pointy.String("counter2"),
VerifyType: pointy.String("less"),
Count: pointy.Int32(10),
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\VerifyCounterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->verifyCounter(
(new VerifyCounterRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withLimitName("daily")
->withCounterName("counter2")
->withVerifyType("less")
->withCount(10)
->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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.VerifyCounterRequest;
import io.gs2.limit.result.VerifyCounterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(session);
try {
VerifyCounterResult result = client.verifyCounter(
new VerifyCounterRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withLimitName("daily")
.withCounterName("counter2")
.withVerifyType("less")
.withCount(10)
.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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.VerifyCounterRequest;
using Gs2.Gs2Limit.Result.VerifyCounterResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.VerifyCounterResult> asyncResult = null;
yield return client.VerifyCounter(
new Gs2.Gs2Limit.Request.VerifyCounterRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("accessToken-0001")
.WithLimitName("daily")
.WithCounterName("counter2")
.WithVerifyType("less")
.WithCount(10)
.WithMultiplyValueSpecifyingQuantity(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.verifyCounter(
new Gs2Limit.VerifyCounterRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withLimitName("daily")
.withCounterName("counter2")
.withVerifyType("less")
.withCount(10)
.withMultiplyValueSpecifyingQuantity(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.verify_counter(
limit.VerifyCounterRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_limit_name('daily')
.with_counter_name('counter2')
.with_verify_type('less')
.with_count(10)
.with_multiply_value_specifying_quantity(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
api_result = client.verify_counter({
namespaceName="namespace1",
accessToken="accessToken-0001",
limitName="daily",
counterName="counter2",
verifyType="less",
count=10,
multiplyValueSpecifyingQuantity=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
verifyCounterByUserId
Verify counter value by user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
limitName | string | ✓ | ~ 128 chars | Name of limit model | ||
counterName | string | ✓ | ~ 128 chars | Counter Name | ||
verifyType | enum [ “less”, “lessEqual”, “greater”, “greaterEqual”, “equal”, “notEqual” ] | ✓ | ~ 128 chars | Type of verification | ||
count | int | ✓ | 0 | ~ 2147483646 | count value | |
multiplyValueSpecifyingQuantity | bool | ✓ | true | Whether to multiply the value used for verification when specifying the quantity | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description |
---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
Session: &session,
}
result, err := client.VerifyCounterByUserId(
&limit.VerifyCounterByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
LimitName: pointy.String("daily"),
CounterName: pointy.String("counter2"),
VerifyType: pointy.String("less"),
Count: pointy.Int32(10),
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\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\VerifyCounterByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->verifyCounterByUserId(
(new VerifyCounterByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withLimitName("daily")
->withCounterName("counter2")
->withVerifyType("less")
->withCount(10)
->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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.VerifyCounterByUserIdRequest;
import io.gs2.limit.result.VerifyCounterByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2LimitRestClient client = new Gs2LimitRestClient(session);
try {
VerifyCounterByUserIdResult result = client.verifyCounterByUserId(
new VerifyCounterByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withLimitName("daily")
.withCounterName("counter2")
.withVerifyType("less")
.withCount(10)
.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.Gs2Limit.Gs2LimitRestClient;
using Gs2.Gs2Limit.Request.VerifyCounterByUserIdRequest;
using Gs2.Gs2Limit.Result.VerifyCounterByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2LimitRestClient(session);
AsyncResult<Gs2.Gs2Limit.Result.VerifyCounterByUserIdResult> asyncResult = null;
yield return client.VerifyCounterByUserId(
new Gs2.Gs2Limit.Request.VerifyCounterByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithLimitName("daily")
.WithCounterName("counter2")
.WithVerifyType("less")
.WithCount(10)
.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 Gs2Limit from '@/gs2/limit';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Limit.Gs2LimitRestClient(session);
try {
const result = await client.verifyCounterByUserId(
new Gs2Limit.VerifyCounterByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withLimitName("daily")
.withCounterName("counter2")
.withVerifyType("less")
.withCount(10)
.withMultiplyValueSpecifyingQuantity(null)
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import limit
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = limit.Gs2LimitRestClient(session)
try:
result = client.verify_counter_by_user_id(
limit.VerifyCounterByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_limit_name('daily')
.with_counter_name('counter2')
.with_verify_type('less')
.with_count(10)
.with_multiply_value_specifying_quantity(None)
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('limit')
api_result = client.verify_counter_by_user_id({
namespaceName="namespace1",
userId="user-0001",
limitName="daily",
counterName="counter2",
verifyType="less",
count=10,
multiplyValueSpecifyingQuantity=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
countUpByStampTask
Execute count-up as consume action
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
stampTask | string | ✓ | ~ 5242880 chars | Consume Action | ||
keyId | string | ✓ | ~ 1024 chars | encryption key GRN |
Result
Type | Description | |
---|---|---|
item | Counter | Counter with increased count |
newContextStack | string | Request of context in which consume action execution results are recorded |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",