API Reference of GS2-SerialKey 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 | | ✓ | | ~ 32 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 |
IssueJob
Serial Code Issuance Request
An entity is created when the serial code issuance process is executed.
The quantity of serial codes issued can range from 1 to 100000, and the progress of the issuing process can be monitored.
When the issuing process is completed, the status will change from PROCESSING to COMPLETE, and you will be able to access information about the serial code issued.
| Type | Condition | Require | Default | Limitation | Description |
---|
issueJobId | string | | ✓ | | ~ 1024 chars | Issue Job GRN |
name | string | | ✓ | UUID | ~ 36 chars | Issue Job ID |
metadata | string | | | | ~ 2048 chars | metadata |
issuedCount | int | | ✓ | 0 | ~ 1000000 | Quantity of serial keys issued |
issueRequestCount | int | | ✓ | | 1 ~ 100000 | Quantity of serial keys issued |
status | enum [‘PROCESSING’, ‘COMPLETE’] | | ✓ | “PROCESSING” | ~ 128 chars | Status |
createdAt | long | | ✓ | | | Datetime of creation |
revision | long | | | 0 | ~ 9223372036854775805 | Revision |
SerialKey
Serial Code
The serial code issued can be used only once.
Serial codes are issued in the format “RPCLP-FP7N-NCDMJ-FLVA-IRI4” and the data length cannot be changed.
Information on the type of campaign is also included within the serial code. When using the serial code, simply specify the namespace in which the serial code is to be used.
| Type | Condition | Require | Default | Limitation | Description |
---|
serialKeyId | string | | ✓ | | ~ 1024 chars | Serial Key GRN |
campaignModelName | string | | ✓ | | ~ 128 chars | Campaign name |
code | string | | ✓ | | ~ 48 chars | Serial Code |
metadata | string | | | | ~ 2048 chars | metadata |
status | enum [‘ACTIVE’, ‘USED’, ‘INACTIVE’] | | ✓ | “ACTIVE” | ~ 128 chars | Status |
usedUserId | string | {status} == “USED” | ✓ | | ~ 128 chars | User Id |
createdAt | long | | ✓ | | | Datetime of creation |
usedAt | long | | | | | Used at |
updatedAt | long | | ✓ | | | Datetime of last update |
revision | long | | | 0 | ~ 9223372036854775805 | Revision |
CampaignModel
Campaign Model
| Type | Condition | Require | Default | Limitation | Description |
---|
campaignId | string | | ✓ | | ~ 1024 chars | Campaign Model Master GRN |
name | string | | ✓ | | ~ 128 chars | Campaign name |
metadata | string | | | | ~ 2048 chars | metadata |
enableCampaignCode | bool | | ✓ | false | | Allow redemption with campaign code |
CampaignModelMaster
Campaign Model
| Type | Condition | Require | Default | Limitation | Description |
---|
campaignId | string | | ✓ | | ~ 1024 chars | Campaign Model Master GRN |
name | string | | ✓ | | ~ 128 chars | Campaign name |
description | string | | | | ~ 1024 chars | description of Namespace |
metadata | string | | | | ~ 2048 chars | metadata |
enableCampaignCode | bool | | ✓ | false | | Allow redemption with campaign code |
createdAt | long | | ✓ | | | Datetime of creation |
updatedAt | long | | ✓ | | | Datetime of last update |
revision | long | | | 0 | ~ 9223372036854775805 | Revision |
CurrentCampaignMaster
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 | Namespace GRN |
settings | string | | ✓ | | ~ 5242880 chars | Master data |
LogSetting
Log export settings
| Type | Condition | Require | Default | Limitation | Description |
---|
loggingNamespaceId | string | | ✓ | | ~ 1024 chars | Namespace GRN |
GitHubCheckoutSetting
| 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 |
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/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&serial_key.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\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.DescribeNamespacesRequest;
import io.gs2.serialKey.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.DescribeNamespacesRequest;
using Gs2.Gs2SerialKey.Result.DescribeNamespacesResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2SerialKey.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 Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2SerialKey.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 serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.describe_namespaces(
serial_key.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('serialKey')
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 | | ✓ | | ~ 32 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/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&serial_key.CreateNamespaceRequest {
Name: pointy.String("namespace1"),
Description: nil,
LogSetting: &serialKey.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\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\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\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.CreateNamespaceRequest;
import io.gs2.serialKey.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withLogSetting(new io.gs2.serialKey.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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.CreateNamespaceRequest;
using Gs2.Gs2SerialKey.Result.CreateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2SerialKey.Request.CreateNamespaceRequest()
.WithName("namespace1")
.WithDescription(null)
.WithLogSetting(new Gs2.Gs2SerialKey.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 Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.createNamespace(
new Gs2SerialKey.CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withLogSetting(new Gs2SerialKey.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 serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.create_namespace(
serial_key.CreateNamespaceRequest()
.with_name(self.hash1)
.with_description(None)
.with_log_setting(
serial_key.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('serialKey')
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 | | ✓ | | ~ 32 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/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&serial_key.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\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.GetNamespaceStatusRequest;
import io.gs2.serialKey.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.GetNamespaceStatusRequest;
using Gs2.Gs2SerialKey.Result.GetNamespaceStatusResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2SerialKey.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 Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2SerialKey.GetNamespaceStatusRequest()
.withNamespaceName("namespace1")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.get_namespace_status(
serial_key.GetNamespaceStatusRequest()
.with_namespace_name(self.hash1)
)
status = result.status
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
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 | | ✓ | | ~ 32 chars | Namespace name |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&serial_key.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\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.GetNamespaceRequest;
import io.gs2.serialKey.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.GetNamespaceRequest;
using Gs2.Gs2SerialKey.Result.GetNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2SerialKey.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 Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.getNamespace(
new Gs2SerialKey.GetNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.get_namespace(
serial_key.GetNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
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 | | ✓ | | ~ 32 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/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&serial_key.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
Description: pointy.String("description1"),
LogSetting: &serialKey.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\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\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\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.UpdateNamespaceRequest;
import io.gs2.serialKey.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withLogSetting(new io.gs2.serialKey.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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.UpdateNamespaceRequest;
using Gs2.Gs2SerialKey.Result.UpdateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2SerialKey.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace1")
.WithDescription("description1")
.WithLogSetting(new Gs2.Gs2SerialKey.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 Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2SerialKey.UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withLogSetting(new Gs2SerialKey.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 serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.update_namespace(
serial_key.UpdateNamespaceRequest()
.with_namespace_name(self.hash1)
.with_description('description1')
.with_log_setting(
serial_key.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('serialKey')
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 | | ✓ | | ~ 32 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/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&serial_key.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\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\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.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.DeleteNamespaceRequest;
import io.gs2.serialKey.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.DeleteNamespaceRequest;
using Gs2.Gs2SerialKey.Result.DeleteNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2SerialKey.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 Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2SerialKey.DeleteNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.delete_namespace(
serial_key.DeleteNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
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;
describeIssueJobs
Get list of issue jobs
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
campaignModelName | string | | ✓ | | ~ 128 chars | Campaign 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<IssueJob> | List of Issue Job |
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/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.DescribeIssueJobs(
&serial_key.DescribeIssueJobsRequest {
NamespaceName: pointy.String("namespace1"),
CampaignModelName: pointy.String("campaign-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\Request\DescribeIssueJobsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeIssueJobs(
(new DescribeIssueJobsRequest())
->withNamespaceName(self::namespace1)
->withCampaignModelName("campaign-0001")
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.DescribeIssueJobsRequest;
import io.gs2.serialKey.result.DescribeIssueJobsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(session);
try {
DescribeIssueJobsResult result = client.describeIssueJobs(
new DescribeIssueJobsRequest()
.withNamespaceName("namespace1")
.withCampaignModelName("campaign-0001")
.withPageToken(null)
.withLimit(null)
);
List<IssueJob> 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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.DescribeIssueJobsRequest;
using Gs2.Gs2SerialKey.Result.DescribeIssueJobsResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.DescribeIssueJobsResult> asyncResult = null;
yield return client.DescribeIssueJobs(
new Gs2.Gs2SerialKey.Request.DescribeIssueJobsRequest()
.WithNamespaceName("namespace1")
.WithCampaignModelName("campaign-0001")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.describeIssueJobs(
new Gs2SerialKey.DescribeIssueJobsRequest()
.withNamespaceName("namespace1")
.withCampaignModelName("campaign-0001")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.describe_issue_jobs(
serial_key.DescribeIssueJobsRequest()
.with_namespace_name(self.hash1)
.with_campaign_model_name('campaign-0001')
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
api_result = client.describe_issue_jobs({
namespaceName='namespace1',
campaignModelName='campaign-0001',
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
getIssueJob
Get issue job
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
campaignModelName | string | | ✓ | | ~ 128 chars | Campaign name |
issueJobName | string | | ✓ | UUID | ~ 36 chars | Issue Job ID |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.GetIssueJob(
&serial_key.GetIssueJobRequest {
NamespaceName: pointy.String("namespace1"),
CampaignModelName: pointy.String("campaign-0001"),
IssueJobName: pointy.String("campaign-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\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\Request\GetIssueJobRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getIssueJob(
(new GetIssueJobRequest())
->withNamespaceName(self::namespace1)
->withCampaignModelName("campaign-0001")
->withIssueJobName("campaign-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.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.GetIssueJobRequest;
import io.gs2.serialKey.result.GetIssueJobResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(session);
try {
GetIssueJobResult result = client.getIssueJob(
new GetIssueJobRequest()
.withNamespaceName("namespace1")
.withCampaignModelName("campaign-0001")
.withIssueJobName("campaign-0001")
);
IssueJob 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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.GetIssueJobRequest;
using Gs2.Gs2SerialKey.Result.GetIssueJobResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.GetIssueJobResult> asyncResult = null;
yield return client.GetIssueJob(
new Gs2.Gs2SerialKey.Request.GetIssueJobRequest()
.WithNamespaceName("namespace1")
.WithCampaignModelName("campaign-0001")
.WithIssueJobName("campaign-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 Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.getIssueJob(
new Gs2SerialKey.GetIssueJobRequest()
.withNamespaceName("namespace1")
.withCampaignModelName("campaign-0001")
.withIssueJobName("campaign-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.get_issue_job(
serial_key.GetIssueJobRequest()
.with_namespace_name(self.hash1)
.with_campaign_model_name('campaign-0001')
.with_issue_job_name('campaign-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
api_result = client.get_issue_job({
namespaceName='namespace1',
campaignModelName='campaign-0001',
issueJobName='campaign-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
issue
Create issue job
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
campaignModelName | string | | ✓ | | ~ 128 chars | Campaign name |
metadata | string | | | | ~ 2048 chars | metadata |
issueRequestCount | int | | ✓ | | 1 ~ 100000 | Quantity of serial keys issued |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.Issue(
&serial_key.IssueRequest {
NamespaceName: pointy.String("namespace1"),
CampaignModelName: pointy.String("campaign-0001"),
Metadata: nil,
IssueRequestCount: pointy.Int32(30),
}
)
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\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\Request\IssueRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->issue(
(new IssueRequest())
->withNamespaceName(self::namespace1)
->withCampaignModelName("campaign-0001")
->withMetadata(null)
->withIssueRequestCount(30)
);
$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.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.IssueRequest;
import io.gs2.serialKey.result.IssueResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(session);
try {
IssueResult result = client.issue(
new IssueRequest()
.withNamespaceName("namespace1")
.withCampaignModelName("campaign-0001")
.withMetadata(null)
.withIssueRequestCount(30)
);
IssueJob 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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.IssueRequest;
using Gs2.Gs2SerialKey.Result.IssueResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.IssueResult> asyncResult = null;
yield return client.Issue(
new Gs2.Gs2SerialKey.Request.IssueRequest()
.WithNamespaceName("namespace1")
.WithCampaignModelName("campaign-0001")
.WithMetadata(null)
.WithIssueRequestCount(30),
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 Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.issue(
new Gs2SerialKey.IssueRequest()
.withNamespaceName("namespace1")
.withCampaignModelName("campaign-0001")
.withMetadata(null)
.withIssueRequestCount(30)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.issue(
serial_key.IssueRequest()
.with_namespace_name(self.hash1)
.with_campaign_model_name('campaign-0001')
.with_metadata(None)
.with_issue_request_count(30)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
api_result = client.issue({
namespaceName='namespace1',
campaignModelName='campaign-0001',
metadata=nil,
issueRequestCount=30,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
describeSerialKeys
Get list of serial keys
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
campaignModelName | string | | ✓ | | ~ 128 chars | Campaign name |
issueJobName | string | | ✓ | UUID | ~ 36 chars | Issue Job ID |
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<SerialKey> | List of Serial Code |
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/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.DescribeSerialKeys(
&serial_key.DescribeSerialKeysRequest {
NamespaceName: pointy.String("namespace1"),
CampaignModelName: pointy.String("campaign-0001"),
IssueJobName: pointy.String("job-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\Request\DescribeSerialKeysRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeSerialKeys(
(new DescribeSerialKeysRequest())
->withNamespaceName(self::namespace1)
->withCampaignModelName("campaign-0001")
->withIssueJobName("job-0001")
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.DescribeSerialKeysRequest;
import io.gs2.serialKey.result.DescribeSerialKeysResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(session);
try {
DescribeSerialKeysResult result = client.describeSerialKeys(
new DescribeSerialKeysRequest()
.withNamespaceName("namespace1")
.withCampaignModelName("campaign-0001")
.withIssueJobName("job-0001")
.withPageToken(null)
.withLimit(null)
);
List<SerialKey> 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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.DescribeSerialKeysRequest;
using Gs2.Gs2SerialKey.Result.DescribeSerialKeysResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.DescribeSerialKeysResult> asyncResult = null;
yield return client.DescribeSerialKeys(
new Gs2.Gs2SerialKey.Request.DescribeSerialKeysRequest()
.WithNamespaceName("namespace1")
.WithCampaignModelName("campaign-0001")
.WithIssueJobName("job-0001")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.describeSerialKeys(
new Gs2SerialKey.DescribeSerialKeysRequest()
.withNamespaceName("namespace1")
.withCampaignModelName("campaign-0001")
.withIssueJobName("job-0001")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.describe_serial_keys(
serial_key.DescribeSerialKeysRequest()
.with_namespace_name(self.hash1)
.with_campaign_model_name('campaign-0001')
.with_issue_job_name('job-0001')
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
api_result = client.describe_serial_keys({
namespaceName='namespace1',
campaignModelName='campaign-0001',
issueJobName='job-0001',
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
downloadSerialCodes
Get a list of serial codes by file
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
campaignModelName | string | | ✓ | | ~ 128 chars | Campaign name |
issueJobName | string | | ✓ | UUID | ~ 36 chars | Issue Job ID |
Result
| Type | Description |
---|
url | string | URL of file |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.DownloadSerialCodes(
&serial_key.DownloadSerialCodesRequest {
NamespaceName: pointy.String("namespace1"),
CampaignModelName: pointy.String("campaign-0001"),
IssueJobName: pointy.String("job-0001"),
}
)
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\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\Request\DownloadSerialCodesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->downloadSerialCodes(
(new DownloadSerialCodesRequest())
->withNamespaceName(self::namespace1)
->withCampaignModelName("campaign-0001")
->withIssueJobName("job-0001")
);
$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.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.DownloadSerialCodesRequest;
import io.gs2.serialKey.result.DownloadSerialCodesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(session);
try {
DownloadSerialCodesResult result = client.downloadSerialCodes(
new DownloadSerialCodesRequest()
.withNamespaceName("namespace1")
.withCampaignModelName("campaign-0001")
.withIssueJobName("job-0001")
);
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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.DownloadSerialCodesRequest;
using Gs2.Gs2SerialKey.Result.DownloadSerialCodesResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.DownloadSerialCodesResult> asyncResult = null;
yield return client.DownloadSerialCodes(
new Gs2.Gs2SerialKey.Request.DownloadSerialCodesRequest()
.WithNamespaceName("namespace1")
.WithCampaignModelName("campaign-0001")
.WithIssueJobName("job-0001"),
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 Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.downloadSerialCodes(
new Gs2SerialKey.DownloadSerialCodesRequest()
.withNamespaceName("namespace1")
.withCampaignModelName("campaign-0001")
.withIssueJobName("job-0001")
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.download_serial_codes(
serial_key.DownloadSerialCodesRequest()
.with_namespace_name(self.hash1)
.with_campaign_model_name('campaign-0001')
.with_issue_job_name('job-0001')
)
url = result.url
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
api_result = client.download_serial_codes({
namespaceName='namespace1',
campaignModelName='campaign-0001',
issueJobName='job-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
getSerialKey
Consume Serial Code
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
code | string | | ✓ | | ~ 48 chars | Serial Code |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.GetSerialKey(
&serial_key.GetSerialKeyRequest {
NamespaceName: pointy.String("namespace1"),
Code: pointy.String("code-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
campaignModel := result.CampaignModel
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\Request\GetSerialKeyRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getSerialKey(
(new GetSerialKeyRequest())
->withNamespaceName(self::namespace1)
->withCode("code-0001")
);
$item = $result->getItem();
$campaignModel = $result->getCampaignModel();
} 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.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.GetSerialKeyRequest;
import io.gs2.serialKey.result.GetSerialKeyResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(session);
try {
GetSerialKeyResult result = client.getSerialKey(
new GetSerialKeyRequest()
.withNamespaceName("namespace1")
.withCode("code-0001")
);
SerialKey item = result.getItem();
CampaignModel campaignModel = result.getCampaignModel();
} 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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.GetSerialKeyRequest;
using Gs2.Gs2SerialKey.Result.GetSerialKeyResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.GetSerialKeyResult> asyncResult = null;
yield return client.GetSerialKey(
new Gs2.Gs2SerialKey.Request.GetSerialKeyRequest()
.WithNamespaceName("namespace1")
.WithCode("code-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var campaignModel = result.CampaignModel;
import Gs2Core from '@/gs2/core';
import * as Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.getSerialKey(
new Gs2SerialKey.GetSerialKeyRequest()
.withNamespaceName("namespace1")
.withCode("code-0001")
);
const item = result.getItem();
const campaignModel = result.getCampaignModel();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.get_serial_key(
serial_key.GetSerialKeyRequest()
.with_namespace_name(self.hash1)
.with_code('code-0001')
)
item = result.item
campaign_model = result.campaign_model
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
api_result = client.get_serial_key({
namespaceName='namespace1',
code='code-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
campaignModel = result.campaignModel;
use
Consume Serial Code
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | | ✓ | | ~ 128 chars | User Id |
code | string | | ✓ | | ~ 48 chars | Serial Code |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.Use(
&serial_key.UseRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("$access_token_0001"),
Code: pointy.String("code-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
campaignModel := result.CampaignModel
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\Request\UseRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->use(
(new UseRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withCode("code-0001")
);
$item = $result->getItem();
$campaignModel = $result->getCampaignModel();
} 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.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.UseRequest;
import io.gs2.serialKey.result.UseResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(session);
try {
UseResult result = client.use(
new UseRequest()
.withNamespaceName("namespace1")
.withAccessToken("$access_token_0001")
.withCode("code-0001")
);
SerialKey item = result.getItem();
CampaignModel campaignModel = result.getCampaignModel();
} 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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.UseRequest;
using Gs2.Gs2SerialKey.Result.UseResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.UseResult> asyncResult = null;
yield return client.Use(
new Gs2.Gs2SerialKey.Request.UseRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("$access_token_0001")
.WithCode("code-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var campaignModel = result.CampaignModel;
import Gs2Core from '@/gs2/core';
import * as Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.use(
new Gs2SerialKey.UseRequest()
.withNamespaceName("namespace1")
.withAccessToken("$access_token_0001")
.withCode("code-0001")
);
const item = result.getItem();
const campaignModel = result.getCampaignModel();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.use(
serial_key.UseRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_code('code-0001')
)
item = result.item
campaign_model = result.campaign_model
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
api_result = client.use({
namespaceName='namespace1',
accessToken='$access_token_0001',
code='code-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
campaignModel = result.campaignModel;
useByUserId
Consume Serial Code by specifying user ID
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
userId | string | | ✓ | | ~ 128 chars | User Id |
code | string | | ✓ | | ~ 48 chars | Serial Code |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.UseByUserId(
&serial_key.UseByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
Code: pointy.String("code-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
campaignModel := result.CampaignModel
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\Request\UseByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->useByUserId(
(new UseByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withCode("code-0001")
);
$item = $result->getItem();
$campaignModel = $result->getCampaignModel();
} 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.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.UseByUserIdRequest;
import io.gs2.serialKey.result.UseByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(session);
try {
UseByUserIdResult result = client.useByUserId(
new UseByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withCode("code-0001")
);
SerialKey item = result.getItem();
CampaignModel campaignModel = result.getCampaignModel();
} 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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.UseByUserIdRequest;
using Gs2.Gs2SerialKey.Result.UseByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.UseByUserIdResult> asyncResult = null;
yield return client.UseByUserId(
new Gs2.Gs2SerialKey.Request.UseByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithCode("code-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var campaignModel = result.CampaignModel;
import Gs2Core from '@/gs2/core';
import * as Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.useByUserId(
new Gs2SerialKey.UseByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withCode("code-0001")
);
const item = result.getItem();
const campaignModel = result.getCampaignModel();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.use_by_user_id(
serial_key.UseByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_code('code-0001')
)
item = result.item
campaign_model = result.campaign_model
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
api_result = client.use_by_user_id({
namespaceName='namespace1',
userId='user-0001',
code='code-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
campaignModel = result.campaignModel;
revertUseByUserId
Consume Serial Code by specifying user ID
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
userId | string | | ✓ | | ~ 128 chars | User Id |
code | string | | ✓ | | ~ 48 chars | Serial Code |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.RevertUseByUserId(
&serial_key.RevertUseByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
Code: pointy.String("code-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
campaignModel := result.CampaignModel
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\Request\RevertUseByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->revertUseByUserId(
(new RevertUseByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withCode("code-0001")
);
$item = $result->getItem();
$campaignModel = $result->getCampaignModel();
} 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.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.RevertUseByUserIdRequest;
import io.gs2.serialKey.result.RevertUseByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(session);
try {
RevertUseByUserIdResult result = client.revertUseByUserId(
new RevertUseByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withCode("code-0001")
);
SerialKey item = result.getItem();
CampaignModel campaignModel = result.getCampaignModel();
} 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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.RevertUseByUserIdRequest;
using Gs2.Gs2SerialKey.Result.RevertUseByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.RevertUseByUserIdResult> asyncResult = null;
yield return client.RevertUseByUserId(
new Gs2.Gs2SerialKey.Request.RevertUseByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithCode("code-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var campaignModel = result.CampaignModel;
import Gs2Core from '@/gs2/core';
import * as Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.revertUseByUserId(
new Gs2SerialKey.RevertUseByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withCode("code-0001")
);
const item = result.getItem();
const campaignModel = result.getCampaignModel();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.revert_use_by_user_id(
serial_key.RevertUseByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_code('code-0001')
)
item = result.item
campaign_model = result.campaign_model
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
api_result = client.revert_use_by_user_id({
namespaceName='namespace1',
userId='user-0001',
code='code-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
campaignModel = result.campaignModel;
useByStampTask
Use Stamp Tasks to Consume Serial Code
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
stampTask | string | | ✓ | | ~ 5242880 chars | Stamp task |
keyId | string | | ✓ | | ~ 1024 chars | encryption key GRN |
Result
| Type | Description |
---|
item | SerialKey | SerialKey |
campaignModel | CampaignModel | Campaign Model |
newContextStack | string | Request of context in which stamp task execution results are recorded |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.UseByStampTask(
&serial_key.UseByStampTaskRequest {
StampTask: pointy.String("$stampTask"),
KeyId: pointy.String("$key1.keyId"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
campaignModel := result.CampaignModel
newContextStack := result.NewContextStack
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\Request\UseByStampTaskRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->useByStampTask(
(new UseByStampTaskRequest())
->withStampTask(self::$stampTask)
->withKeyId(self::$key1.keyId)
);
$item = $result->getItem();
$campaignModel = $result->getCampaignModel();
$newContextStack = $result->getNewContextStack();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.UseByStampTaskRequest;
import io.gs2.serialKey.result.UseByStampTaskResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(session);
try {
UseByStampTaskResult result = client.useByStampTask(
new UseByStampTaskRequest()
.withStampTask("$stampTask")
.withKeyId("$key1.keyId")
);
SerialKey item = result.getItem();
CampaignModel campaignModel = result.getCampaignModel();
String newContextStack = result.getNewContextStack();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.UseByStampTaskRequest;
using Gs2.Gs2SerialKey.Result.UseByStampTaskResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.UseByStampTaskResult> asyncResult = null;
yield return client.UseByStampTask(
new Gs2.Gs2SerialKey.Request.UseByStampTaskRequest()
.WithStampTask("$stampTask")
.WithKeyId("$key1.keyId"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var campaignModel = result.CampaignModel;
var newContextStack = result.NewContextStack;
import Gs2Core from '@/gs2/core';
import * as Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.useByStampTask(
new Gs2SerialKey.UseByStampTaskRequest()
.withStampTask("$stampTask")
.withKeyId("$key1.keyId")
);
const item = result.getItem();
const campaignModel = result.getCampaignModel();
const newContextStack = result.getNewContextStack();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.use_by_stamp_task(
serial_key.UseByStampTaskRequest()
.with_stamp_task(self.stamp_task)
.with_key_id(self.key1.key_id)
)
item = result.item
campaign_model = result.campaign_model
new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
api_result = client.use_by_stamp_task({
stampTask='$stampTask',
keyId='$key1.keyId',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
campaignModel = result.campaignModel;
newContextStack = result.newContextStack;
revertUseByStampSheet
Use Stamp Sheets to Consume Serial Code
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
stampSheet | string | | ✓ | | ~ 5242880 chars | Stamp sheet |
keyId | string | | ✓ | | ~ 1024 chars | encryption key GRN |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.RevertUseByStampSheet(
&serial_key.RevertUseByStampSheetRequest {
StampSheet: pointy.String("$stampSheet"),
KeyId: pointy.String("$key1.keyId"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
campaignModel := result.CampaignModel
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\Request\RevertUseByStampSheetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->revertUseByStampSheet(
(new RevertUseByStampSheetRequest())
->withStampSheet(self::$stampSheet)
->withKeyId(self::$key1.keyId)
);
$item = $result->getItem();
$campaignModel = $result->getCampaignModel();
} 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.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.RevertUseByStampSheetRequest;
import io.gs2.serialKey.result.RevertUseByStampSheetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(session);
try {
RevertUseByStampSheetResult result = client.revertUseByStampSheet(
new RevertUseByStampSheetRequest()
.withStampSheet("$stampSheet")
.withKeyId("$key1.keyId")
);
SerialKey item = result.getItem();
CampaignModel campaignModel = result.getCampaignModel();
} 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.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.RevertUseByStampSheetRequest;
using Gs2.Gs2SerialKey.Result.RevertUseByStampSheetResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.RevertUseByStampSheetResult> asyncResult = null;
yield return client.RevertUseByStampSheet(
new Gs2.Gs2SerialKey.Request.RevertUseByStampSheetRequest()
.WithStampSheet("$stampSheet")
.WithKeyId("$key1.keyId"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var campaignModel = result.CampaignModel;
import Gs2Core from '@/gs2/core';
import * as Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.revertUseByStampSheet(
new Gs2SerialKey.RevertUseByStampSheetRequest()
.withStampSheet("$stampSheet")
.withKeyId("$key1.keyId")
);
const item = result.getItem();
const campaignModel = result.getCampaignModel();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.revert_use_by_stamp_sheet(
serial_key.RevertUseByStampSheetRequest()
.with_stamp_sheet(self.stamp_sheet)
.with_key_id(self.key1.key_id)
)
item = result.item
campaign_model = result.campaign_model
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
api_result = client.revert_use_by_stamp_sheet({
stampSheet='$stampSheet',
keyId='$key1.keyId',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
campaignModel = result.campaignModel;
describeCampaignModels
Get list of campaign models
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.DescribeCampaignModels(
&serial_key.DescribeCampaignModelsRequest {
NamespaceName: pointy.String("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\SerialKey\Gs2SerialKeyRestClient;
use Gs2\SerialKey\Request\DescribeCampaignModelsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeCampaignModels(
(new DescribeCampaignModelsRequest())
->withNamespaceName(self::namespace1)
);
$items = $result->getItems();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.serialKey.rest.Gs2SerialKeyRestClient;
import io.gs2.serialKey.request.DescribeCampaignModelsRequest;
import io.gs2.serialKey.result.DescribeCampaignModelsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2SerialKeyRestClient client = new Gs2SerialKeyRestClient(session);
try {
DescribeCampaignModelsResult result = client.describeCampaignModels(
new DescribeCampaignModelsRequest()
.withNamespaceName("namespace1")
);
List<CampaignModel> items = result.getItems();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2SerialKey.Gs2SerialKeyRestClient;
using Gs2.Gs2SerialKey.Request.DescribeCampaignModelsRequest;
using Gs2.Gs2SerialKey.Result.DescribeCampaignModelsResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2SerialKeyRestClient(session);
AsyncResult<Gs2.Gs2SerialKey.Result.DescribeCampaignModelsResult> asyncResult = null;
yield return client.DescribeCampaignModels(
new Gs2.Gs2SerialKey.Request.DescribeCampaignModelsRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
import Gs2Core from '@/gs2/core';
import * as Gs2SerialKey from '@/gs2/serialKey';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2SerialKey.Gs2SerialKeyRestClient(session);
try {
const result = await client.describeCampaignModels(
new Gs2SerialKey.DescribeCampaignModelsRequest()
.withNamespaceName("namespace1")
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import serial_key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = serial_key.Gs2SerialKeyRestClient(session)
try:
result = client.describe_campaign_models(
serial_key.DescribeCampaignModelsRequest()
.with_namespace_name(self.hash1)
)
items = result.items
except core.Gs2Exception as e:
exit(1)
client = gs2('serialKey')
api_result = client.describe_campaign_models({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
getCampaignModel
Get campaign model
Request
| Type | Condition | Require | Default | Limitation | Description |
---|
namespaceName | string | | ✓ | | ~ 32 chars | Namespace name |
campaignModelName | string | | ✓ | | ~ 128 chars | Campaign name |
Result
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/serial_key"
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 := serial_key.Gs2SerialKeyRestClient{
Session: &session,
}
result, err := client.GetCampaignModel(
&serial_key.GetCampaignModelRequest {
NamespaceName: pointy.String("namespace1"),
CampaignModelName: pointy.String("campaign-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\SerialKey\Gs2SerialKeyRestClient;
use