API Reference of GS2-Datastore SDK
Model
Namespace
Namespace
Namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project. Basically, GS2 services have a layer called namespace, and different namespaces are treated as completely different data spaces, even for the same service.
Therefore, it is necessary to create a namespace before starting to use each service.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceId | string | ✓ | ~ 1024 chars | Namespace GRN | ||
name | string | ✓ | ~ 128 chars | Namespace name | ||
description | string | ~ 1024 chars | Description | |||
doneUploadScript | ScriptSetting | Script to be executed when reporting upload completion | ||||
logSetting | LogSetting | Log output settings | ||||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
ScriptSetting
Script settings
In GS2, you can associate custom scripts with microservice events and execute them. This model holds the settings for triggering script execution.
There are two main ways to execute a script: synchronous execution and asynchronous execution. Synchronous execution blocks processing until the script has finished executing. Instead, you can use the script execution result to stop the execution of the API or to tamper with the result of the API.
On the other hand, asynchronous execution does not block processing until the script has finished executing. Instead, you can use the script execution result to stop the execution of the API or to tamper with the result of the API. However, asynchronous execution does not block processing until the script has finished executing, so it is generally recommended to use asynchronous execution.
There are two types of asynchronous execution methods: GS2-Script and Amazon EventBridge. By using Amazon EventBridge, you can write processing in languages other than Lua.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
triggerScriptId | string | ~ 1024 chars | Script GRN | |||
doneTriggerTargetType | enum [ “none”, “gs2_script”, “aws” ] | ✓ | “none” | ~ 128 chars | Notification of Completion | |
doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024 chars | Script GRN | ||
doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024 chars | Namespace GRN |
DataObject
Data Object
Data objects are data uploaded by game players. Data is generation managed, with 30 days of historical data stored.
Access permissions can be set for the data. There are three scopes: public, which can be accessed by anyone; protected, which can be accessed only by the game player with the specified user ID; and private, which can be accessed only by the game player himself.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
dataObjectId | string | ✓ | ~ 1024 chars | Data object GRN | ||
name | string | ✓ | UUID | ~ 128 chars | Data object Name | |
userId | string | ✓ | ~ 128 chars | User Id | ||
scope | enum [ “public”, “protected”, “private” ] | ✓ | “private” | ~ 128 chars | File access permission | |
allowUserIds | List<string> | {scope} != none and {scope} == “protected” | [] | ~ 10000 items | List of user IDs to be published | |
status | enum [ “ACTIVE”, “UPLOADING”, “DELETED” ] | ✓ | ~ 128 chars | Status | ||
generation | string | ~ 128 chars | Data Generation | |||
previousGeneration | string | ~ 128 chars | Generation of previously valid data | |||
createdAt | long | ✓ | Datetime of creation | |||
updatedAt | long | ✓ | Datetime of last update | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
DataObjectHistory
Data Object History
You can check the update history of data objects.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
dataObjectHistoryId | string | ✓ | ~ 1024 chars | History of Data object GRN | ||
dataObjectName | string | ✓ | UUID | ~ 128 chars | Data object Name | |
generation | string | ✓ | ~ 128 chars | Generations ID | ||
contentLength | long | ✓ | ~ 10485760 | File size | ||
createdAt | long | ✓ | Datetime of creation | |||
revision | long | 0 | ~ 9223372036854775805 | Revision |
LogSetting
Log setting
This type manages log output settings. This type holds the identifier of the log namespace used to output log data. The log namespace ID specifies the GS2-Log namespace to aggregate and store the log data. Through this setting, API request and response log data under this namespace will be output to the target GS2-Log. GS2-Log provides logs in real time, which can be used for system monitoring, analysis, debugging, etc.
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
loggingNamespaceId | string | ✓ | ~ 1024 chars | Namespace GRN |
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/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&datastore.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\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DescribeNamespacesRequest;
import io.gs2.datastore.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(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.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.DescribeNamespacesRequest;
using Gs2.Gs2Datastore.Result.DescribeNamespacesResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Datastore.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 Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2Datastore.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 datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.describe_namespaces(
datastore.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('datastore')
api_result = client.describe_namespaces({
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
createNamespace
Create a new namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
name | string | ✓ | ~ 128 chars | Namespace name | ||
description | string | ~ 1024 chars | Description | |||
logSetting | LogSetting | Log output settings | ||||
doneUploadScript | ScriptSetting | Script to be executed when reporting upload completion |
Result
Type | Description | |
---|---|---|
item | Namespace | Namespace created |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&datastore.CreateNamespaceRequest {
Name: pointy.String("namespace1"),
Description: nil,
LogSetting: &datastore.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
},
DoneUploadScript: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\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\Datastore\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
->withDoneUploadScript(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.CreateNamespaceRequest;
import io.gs2.datastore.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withLogSetting(new io.gs2.datastore.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
.withDoneUploadScript(null)
);
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.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.CreateNamespaceRequest;
using Gs2.Gs2Datastore.Result.CreateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Datastore.Request.CreateNamespaceRequest()
.WithName("namespace1")
.WithDescription(null)
.WithLogSetting(new Gs2.Gs2Datastore.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
.WithDoneUploadScript(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.createNamespace(
new Gs2Datastore.CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withLogSetting(new Gs2Datastore.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
.withDoneUploadScript(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.create_namespace(
datastore.CreateNamespaceRequest()
.with_name(self.hash1)
.with_description(None)
.with_log_setting(
datastore.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
.with_done_upload_script(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.create_namespace({
name="namespace1",
description=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
},
doneUploadScript=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getNamespaceStatus
Get namespace status
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
status | string |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&datastore.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\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.GetNamespaceStatusRequest;
import io.gs2.datastore.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(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.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Datastore.Result.GetNamespaceStatusResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Datastore.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 Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2Datastore.GetNamespaceStatusRequest()
.withNamespaceName("namespace1")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.get_namespace_status(
datastore.GetNamespaceStatusRequest()
.with_namespace_name(self.hash1)
)
status = result.status
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.get_namespace_status({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
status = result.status;
getNamespace
Get namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | Namespace | Namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&datastore.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\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.GetNamespaceRequest;
import io.gs2.datastore.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(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.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.GetNamespaceRequest;
using Gs2.Gs2Datastore.Result.GetNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Datastore.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 Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.getNamespace(
new Gs2Datastore.GetNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.get_namespace(
datastore.GetNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.get_namespace({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateNamespace
Update namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
description | string | ~ 1024 chars | Description | |||
logSetting | LogSetting | Log output settings | ||||
doneUploadScript | ScriptSetting | Script to be executed when reporting upload completion |
Result
Type | Description | |
---|---|---|
item | Namespace | Updated namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&datastore.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
Description: pointy.String("description1"),
LogSetting: &datastore.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
},
DoneUploadScript: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\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\Datastore\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
->withDoneUploadScript(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.UpdateNamespaceRequest;
import io.gs2.datastore.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withLogSetting(new io.gs2.datastore.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
.withDoneUploadScript(null)
);
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.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.UpdateNamespaceRequest;
using Gs2.Gs2Datastore.Result.UpdateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Datastore.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace1")
.WithDescription("description1")
.WithLogSetting(new Gs2.Gs2Datastore.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
.WithDoneUploadScript(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2Datastore.UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withLogSetting(new Gs2Datastore.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
.withDoneUploadScript(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.update_namespace(
datastore.UpdateNamespaceRequest()
.with_namespace_name(self.hash1)
.with_description('description1')
.with_log_setting(
datastore.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
.with_done_upload_script(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.update_namespace({
namespaceName="namespace1",
description="description1",
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
},
doneUploadScript=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
deleteNamespace
Delete namespace
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | Namespace | Deleted namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&datastore.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\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DeleteNamespaceRequest;
import io.gs2.datastore.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(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.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.DeleteNamespaceRequest;
using Gs2.Gs2Datastore.Result.DeleteNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Datastore.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 Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2Datastore.DeleteNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.delete_namespace(
datastore.DeleteNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.delete_namespace({
namespaceName="namespace1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
dumpUserDataByUserId
Get dump data of the data associated with the specified user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description |
---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DumpUserDataByUserId(
&datastore.DumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->dumpUserDataByUserId(
(new DumpUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DumpUserDataByUserIdRequest;
import io.gs2.datastore.result.DumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DumpUserDataByUserIdResult result = client.dumpUserDataByUserId(
new DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.DumpUserDataByUserIdRequest;
using Gs2.Gs2Datastore.Result.DumpUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
new Gs2.Gs2Datastore.Request.DumpUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.dumpUserDataByUserId(
new Gs2Datastore.DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.dump_user_data_by_user_id(
datastore.DumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.dump_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
checkDumpUserDataByUserId
Check if the dump of the data associated with the specified user ID is complete
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
url | string | URL of output data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
&datastore.CheckDumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.Url
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\CheckDumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->checkDumpUserDataByUserId(
(new CheckDumpUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$url = $result->getUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.datastore.result.CheckDumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
CheckDumpUserDataByUserIdResult result = client.checkDumpUserDataByUserId(
new CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
String url = result.getUrl();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.CheckDumpUserDataByUserIdRequest;
using Gs2.Gs2Datastore.Result.CheckDumpUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
new Gs2.Gs2Datastore.Request.CheckDumpUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.checkDumpUserDataByUserId(
new Gs2Datastore.CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.check_dump_user_data_by_user_id(
datastore.CheckDumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.check_dump_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
cleanUserDataByUserId
Get clean data of the data associated with the specified user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description |
---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.CleanUserDataByUserId(
&datastore.CleanUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\CleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->cleanUserDataByUserId(
(new CleanUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.CleanUserDataByUserIdRequest;
import io.gs2.datastore.result.CleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
CleanUserDataByUserIdResult result = client.cleanUserDataByUserId(
new CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.CleanUserDataByUserIdRequest;
using Gs2.Gs2Datastore.Result.CleanUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
new Gs2.Gs2Datastore.Request.CleanUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.cleanUserDataByUserId(
new Gs2Datastore.CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.clean_user_data_by_user_id(
datastore.CleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.clean_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
checkCleanUserDataByUserId
Check if the clean of the data associated with the specified user ID is complete
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description |
---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
&datastore.CheckCleanUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\CheckCleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->checkCleanUserDataByUserId(
(new CheckCleanUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.datastore.result.CheckCleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
CheckCleanUserDataByUserIdResult result = client.checkCleanUserDataByUserId(
new CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.CheckCleanUserDataByUserIdRequest;
using Gs2.Gs2Datastore.Result.CheckCleanUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
new Gs2.Gs2Datastore.Request.CheckCleanUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.checkCleanUserDataByUserId(
new Gs2Datastore.CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.check_clean_user_data_by_user_id(
datastore.CheckCleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.check_clean_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
prepareImportUserDataByUserId
Start importing data associated with the specified user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
uploadToken | string | Token used to reflect results after upload |
uploadUrl | string | URL used to upload user data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
&datastore.PrepareImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->prepareImportUserDataByUserId(
(new PrepareImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$uploadToken = $result->getUploadToken();
$uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.datastore.result.PrepareImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareImportUserDataByUserIdResult result = client.prepareImportUserDataByUserId(
new PrepareImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
String uploadToken = result.getUploadToken();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.PrepareImportUserDataByUserIdRequest;
using Gs2.Gs2Datastore.Result.PrepareImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
new Gs2.Gs2Datastore.Request.PrepareImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareImportUserDataByUserId(
new Gs2Datastore.PrepareImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const uploadToken = result.getUploadToken();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_import_user_data_by_user_id(
datastore.PrepareImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
upload_token = result.upload_token
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.prepare_import_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;
importUserDataByUserId
Start importing data associated with the specified user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
uploadToken | string | ✓ | ~ 1024 chars | Token received in preparation for upload | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description |
---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.ImportUserDataByUserId(
&datastore.ImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\ImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->importUserDataByUserId(
(new ImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withUploadToken("upload-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.ImportUserDataByUserIdRequest;
import io.gs2.datastore.result.ImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
ImportUserDataByUserIdResult result = client.importUserDataByUserId(
new ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.ImportUserDataByUserIdRequest;
using Gs2.Gs2Datastore.Result.ImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
new Gs2.Gs2Datastore.Request.ImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithUploadToken("upload-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.importUserDataByUserId(
new Gs2Datastore.ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.import_user_data_by_user_id(
datastore.ImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_upload_token('upload-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.import_user_data_by_user_id({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
checkImportUserDataByUserId
Check if the import of the data associated with the specified user ID is complete
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | ||
uploadToken | string | ✓ | ~ 1024 chars | Token received in preparation for upload | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
url | string | URL of log data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
&datastore.CheckImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.Url
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\CheckImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->checkImportUserDataByUserId(
(new CheckImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withUploadToken("upload-0001")
->withTimeOffsetToken(null)
);
$url = $result->getUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.CheckImportUserDataByUserIdRequest;
import io.gs2.datastore.result.CheckImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
CheckImportUserDataByUserIdResult result = client.checkImportUserDataByUserId(
new CheckImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
String url = result.getUrl();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.CheckImportUserDataByUserIdRequest;
using Gs2.Gs2Datastore.Result.CheckImportUserDataByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
new Gs2.Gs2Datastore.Request.CheckImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithUploadToken("upload-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.checkImportUserDataByUserId(
new Gs2Datastore.CheckImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.check_import_user_data_by_user_id(
datastore.CheckImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_upload_token('upload-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.check_import_user_data_by_user_id({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
describeDataObjects
Get list of data objects
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
accessToken | string | ✓ | ~ 128 chars | User Id | ||
status | enum [ “ACTIVE”, “UPLOADING”, “DELETED” ] | ~ 128 chars | Status | |||
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<DataObject> | List of Data object |
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/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DescribeDataObjects(
&datastore.DescribeDataObjectsRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("accessToken-0001"),
Status: pointy.String("ACTIVE"),
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\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DescribeDataObjectsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeDataObjects(
(new DescribeDataObjectsRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withStatus("ACTIVE")
->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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DescribeDataObjectsRequest;
import io.gs2.datastore.result.DescribeDataObjectsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DescribeDataObjectsResult result = client.describeDataObjects(
new DescribeDataObjectsRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withStatus("ACTIVE")
.withPageToken(null)
.withLimit(null)
);
List<DataObject> 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.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.DescribeDataObjectsRequest;
using Gs2.Gs2Datastore.Result.DescribeDataObjectsResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DescribeDataObjectsResult> asyncResult = null;
yield return client.DescribeDataObjects(
new Gs2.Gs2Datastore.Request.DescribeDataObjectsRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("accessToken-0001")
.WithStatus("ACTIVE")
.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 Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.describeDataObjects(
new Gs2Datastore.DescribeDataObjectsRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withStatus("ACTIVE")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.describe_data_objects(
datastore.DescribeDataObjectsRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_status('ACTIVE')
.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('datastore')
api_result = client.describe_data_objects({
namespaceName="namespace1",
accessToken="accessToken-0001",
status="ACTIVE",
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;
describeDataObjectsByUserId
Obtain list of data objects by specifying the user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
status | enum [ “ACTIVE”, “UPLOADING”, “DELETED” ] | ~ 128 chars | Status | |||
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired | |
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
items | List<DataObject> | List of Data object |
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/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DescribeDataObjectsByUserId(
&datastore.DescribeDataObjectsByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
Status: pointy.String("ACTIVE"),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DescribeDataObjectsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeDataObjectsByUserId(
(new DescribeDataObjectsByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withStatus("ACTIVE")
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DescribeDataObjectsByUserIdRequest;
import io.gs2.datastore.result.DescribeDataObjectsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DescribeDataObjectsByUserIdResult result = client.describeDataObjectsByUserId(
new DescribeDataObjectsByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withStatus("ACTIVE")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<DataObject> 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.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.DescribeDataObjectsByUserIdRequest;
using Gs2.Gs2Datastore.Result.DescribeDataObjectsByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DescribeDataObjectsByUserIdResult> asyncResult = null;
yield return client.DescribeDataObjectsByUserId(
new Gs2.Gs2Datastore.Request.DescribeDataObjectsByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithStatus("ACTIVE")
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.describeDataObjectsByUserId(
new Gs2Datastore.DescribeDataObjectsByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withStatus("ACTIVE")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.describe_data_objects_by_user_id(
datastore.DescribeDataObjectsByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_status('ACTIVE')
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.describe_data_objects_by_user_id({
namespaceName="namespace1",
userId="user-0001",
status="ACTIVE",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
prepareUpload
Prepare to upload data objects
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
accessToken | string | ✓ | ~ 128 chars | User Id | ||
name | string | ~ 128 chars | Data object name | |||
contentType | string | ✓ | “application/octet-stream” | ~ 256 chars | MIME-Type of the data to be uploaded | |
scope | enum [ “public”, “protected”, “private” ] | ✓ | “private” | ~ 128 chars | File access permission | |
allowUserIds | List<string> | {scope} != none and {scope} == “protected” | [] | ~ 10000 items | List of user IDs to be published | |
updateIfExists | bool | ✓ | false | Whether to raise an error if data already exists or to update the data |
Result
Type | Description | |
---|---|---|
item | DataObject | Data object |
uploadUrl | string | URL used to execute the upload process |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareUpload(
&datastore.PrepareUploadRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("accessToken-0001"),
Name: pointy.String("dataObject-0001"),
ContentType: nil,
Scope: pointy.String("public"),
AllowUserIds: nil,
UpdateIfExists: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
uploadUrl := result.UploadUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareUploadRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->prepareUpload(
(new PrepareUploadRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withName("dataObject-0001")
->withContentType(null)
->withScope("public")
->withAllowUserIds(null)
->withUpdateIfExists(null)
);
$item = $result->getItem();
$uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareUploadRequest;
import io.gs2.datastore.result.PrepareUploadResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareUploadResult result = client.prepareUpload(
new PrepareUploadRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withName("dataObject-0001")
.withContentType(null)
.withScope("public")
.withAllowUserIds(null)
.withUpdateIfExists(null)
);
DataObject item = result.getItem();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.PrepareUploadRequest;
using Gs2.Gs2Datastore.Result.PrepareUploadResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareUploadResult> asyncResult = null;
yield return client.PrepareUpload(
new Gs2.Gs2Datastore.Request.PrepareUploadRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("accessToken-0001")
.WithName("dataObject-0001")
.WithContentType(null)
.WithScope("public")
.WithAllowUserIds(null)
.WithUpdateIfExists(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var uploadUrl = result.UploadUrl;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareUpload(
new Gs2Datastore.PrepareUploadRequest()
.withNamespaceName("namespace1")
.withAccessToken("accessToken-0001")
.withName("dataObject-0001")
.withContentType(null)
.withScope("public")
.withAllowUserIds(null)
.withUpdateIfExists(null)
);
const item = result.getItem();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_upload(
datastore.PrepareUploadRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_name('dataObject-0001')
.with_content_type(None)
.with_scope('public')
.with_allow_user_ids(None)
.with_update_if_exists(None)
)
item = result.item
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.prepare_upload({
namespaceName="namespace1",
accessToken="accessToken-0001",
name="dataObject-0001",
contentType=nil,
scope="public",
allowUserIds=nil,
updateIfExists=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
uploadUrl = result.uploadUrl;
prepareUploadByUserId
Prepare to upload a data object by specifying a user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
userId | string | ✓ | ~ 128 chars | User Id | ||
name | string | ~ 128 chars | Data object name | |||
contentType | string | ✓ | “application/octet-stream” | ~ 256 chars | MIME-Type of the data to be uploaded | |
scope | enum [ “public”, “protected”, “private” ] | ✓ | “private” | ~ 128 chars | File access permission | |
allowUserIds | List<string> | {scope} != none and {scope} == “protected” | [] | ~ 10000 items | List of user IDs to be published | |
updateIfExists | bool | ✓ | false | Whether to raise an error if data already exists or to update the data | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | DataObject | Data object |
uploadUrl | string | URL used to execute the upload process |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareUploadByUserId(
&datastore.PrepareUploadByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
Name: pointy.String("dataObject-0001"),
ContentType: nil,
Scope: pointy.String("public"),
AllowUserIds: nil,
UpdateIfExists: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
uploadUrl := result.UploadUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareUploadByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->prepareUploadByUserId(
(new PrepareUploadByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withName("dataObject-0001")
->withContentType(null)
->withScope("public")
->withAllowUserIds(null)
->withUpdateIfExists(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareUploadByUserIdRequest;
import io.gs2.datastore.result.PrepareUploadByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareUploadByUserIdResult result = client.prepareUploadByUserId(
new PrepareUploadByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withName("dataObject-0001")
.withContentType(null)
.withScope("public")
.withAllowUserIds(null)
.withUpdateIfExists(null)
.withTimeOffsetToken(null)
);
DataObject item = result.getItem();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.PrepareUploadByUserIdRequest;
using Gs2.Gs2Datastore.Result.PrepareUploadByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareUploadByUserIdResult> asyncResult = null;
yield return client.PrepareUploadByUserId(
new Gs2.Gs2Datastore.Request.PrepareUploadByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithName("dataObject-0001")
.WithContentType(null)
.WithScope("public")
.WithAllowUserIds(null)
.WithUpdateIfExists(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var uploadUrl = result.UploadUrl;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareUploadByUserId(
new Gs2Datastore.PrepareUploadByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withName("dataObject-0001")
.withContentType(null)
.withScope("public")
.withAllowUserIds(null)
.withUpdateIfExists(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_upload_by_user_id(
datastore.PrepareUploadByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_name('dataObject-0001')
.with_content_type(None)
.with_scope('public')
.with_allow_user_ids(None)
.with_update_if_exists(None)
.with_time_offset_token(None)
)
item = result.item
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.prepare_upload_by_user_id({
namespaceName="namespace1",
userId="user-0001",
name="dataObject-0001",
contentType=nil,
scope="public",
allowUserIds=nil,
updateIfExists=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
uploadUrl = result.uploadUrl;
updateDataObject
Update data objects
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
dataObjectName | string | ✓ | UUID | ~ 128 chars | Data object Name | |
accessToken | string | ✓ | ~ 128 chars | User Id | ||
scope | enum [ “public”, “protected”, “private” ] | ✓ | “private” | ~ 128 chars | File access permission | |
allowUserIds | List<string> | {scope} != none and {scope} == “protected” | [] | ~ 10000 items | List of user IDs to be published |
Result
Type | Description | |
---|---|---|
item | DataObject | Data object |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.UpdateDataObject(
&datastore.UpdateDataObjectRequest {
NamespaceName: pointy.String("namespace1"),
DataObjectName: pointy.String("dataObject-0001"),
AccessToken: pointy.String("accessToken-0001"),
Scope: pointy.String("public"),
AllowUserIds: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\UpdateDataObjectRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateDataObject(
(new UpdateDataObjectRequest())
->withNamespaceName(self::namespace1)
->withDataObjectName("dataObject-0001")
->withAccessToken(self::$accessToken0001)
->withScope("public")
->withAllowUserIds(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.UpdateDataObjectRequest;
import io.gs2.datastore.result.UpdateDataObjectResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
UpdateDataObjectResult result = client.updateDataObject(
new UpdateDataObjectRequest()
.withNamespaceName("namespace1")
.withDataObjectName("dataObject-0001")
.withAccessToken("accessToken-0001")
.withScope("public")
.withAllowUserIds(null)
);
DataObject 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.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.UpdateDataObjectRequest;
using Gs2.Gs2Datastore.Result.UpdateDataObjectResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.UpdateDataObjectResult> asyncResult = null;
yield return client.UpdateDataObject(
new Gs2.Gs2Datastore.Request.UpdateDataObjectRequest()
.WithNamespaceName("namespace1")
.WithDataObjectName("dataObject-0001")
.WithAccessToken("accessToken-0001")
.WithScope("public")
.WithAllowUserIds(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.updateDataObject(
new Gs2Datastore.UpdateDataObjectRequest()
.withNamespaceName("namespace1")
.withDataObjectName("dataObject-0001")
.withAccessToken("accessToken-0001")
.withScope("public")
.withAllowUserIds(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.update_data_object(
datastore.UpdateDataObjectRequest()
.with_namespace_name(self.hash1)
.with_data_object_name('dataObject-0001')
.with_access_token(self.access_token_0001)
.with_scope('public')
.with_allow_user_ids(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.update_data_object({
namespaceName="namespace1",
dataObjectName="dataObject-0001",
accessToken="accessToken-0001",
scope="public",
allowUserIds=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateDataObjectByUserId
Update data object with user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
dataObjectName | string | ✓ | UUID | ~ 128 chars | Data object Name | |
userId | string | ✓ | ~ 128 chars | User Id | ||
scope | enum [ “public”, “protected”, “private” ] | ✓ | “private” | ~ 128 chars | File access permission | |
allowUserIds | List<string> | {scope} != none and {scope} == “protected” | [] | ~ 10000 items | List of user IDs to be published | |
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | DataObject | Data object |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.UpdateDataObjectByUserId(
&datastore.UpdateDataObjectByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
DataObjectName: pointy.String("dataObject-0001"),
UserId: pointy.String("user-0001"),
Scope: pointy.String("public"),
AllowUserIds: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\UpdateDataObjectByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateDataObjectByUserId(
(new UpdateDataObjectByUserIdRequest())
->withNamespaceName(self::namespace1)
->withDataObjectName("dataObject-0001")
->withUserId("user-0001")
->withScope("public")
->withAllowUserIds(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.UpdateDataObjectByUserIdRequest;
import io.gs2.datastore.result.UpdateDataObjectByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
UpdateDataObjectByUserIdResult result = client.updateDataObjectByUserId(
new UpdateDataObjectByUserIdRequest()
.withNamespaceName("namespace1")
.withDataObjectName("dataObject-0001")
.withUserId("user-0001")
.withScope("public")
.withAllowUserIds(null)
.withTimeOffsetToken(null)
);
DataObject 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.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.UpdateDataObjectByUserIdRequest;
using Gs2.Gs2Datastore.Result.UpdateDataObjectByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.UpdateDataObjectByUserIdResult> asyncResult = null;
yield return client.UpdateDataObjectByUserId(
new Gs2.Gs2Datastore.Request.UpdateDataObjectByUserIdRequest()
.WithNamespaceName("namespace1")
.WithDataObjectName("dataObject-0001")
.WithUserId("user-0001")
.WithScope("public")
.WithAllowUserIds(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.updateDataObjectByUserId(
new Gs2Datastore.UpdateDataObjectByUserIdRequest()
.withNamespaceName("namespace1")
.withDataObjectName("dataObject-0001")
.withUserId("user-0001")
.withScope("public")
.withAllowUserIds(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.update_data_object_by_user_id(
datastore.UpdateDataObjectByUserIdRequest()
.with_namespace_name(self.hash1)
.with_data_object_name('dataObject-0001')
.with_user_id('user-0001')
.with_scope('public')
.with_allow_user_ids(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.update_data_object_by_user_id({
namespaceName="namespace1",
dataObjectName="dataObject-0001",
userId="user-0001",
scope="public",
allowUserIds=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
prepareReUpload
Prepare to re-upload data objects
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
dataObjectName | string | ✓ | UUID | ~ 128 chars | Data object Name | |
accessToken | string | ✓ | ~ 128 chars | User Id | ||
contentType | string | ✓ | “application/octet-stream” | ~ 256 chars | MIME-Type of the data to be uploaded |
Result
Type | Description | |
---|---|---|
item | DataObject | Data object |
uploadUrl | string | URL used to execute the upload process |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareReUpload(
&datastore.PrepareReUploadRequest {
NamespaceName: pointy.String("namespace1"),
DataObjectName: pointy.String("dataObject-0001"),
AccessToken: pointy.String("accessToken-0001"),
ContentType: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
uploadUrl := result.UploadUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareReUploadRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->prepareReUpload(
(new PrepareReUploadRequest())
->withNamespaceName(self::namespace1)
->withDataObjectName("dataObject-0001")
->withAccessToken(self::$accessToken0001)
->withContentType(null)
);
$item = $result->getItem();
$uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareReUploadRequest;
import io.gs2.datastore.result.PrepareReUploadResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareReUploadResult result = client.prepareReUpload(
new PrepareReUploadRequest()
.withNamespaceName("namespace1")
.withDataObjectName("dataObject-0001")
.withAccessToken("accessToken-0001")
.withContentType(null)
);
DataObject item = result.getItem();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.PrepareReUploadRequest;
using Gs2.Gs2Datastore.Result.PrepareReUploadResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareReUploadResult> asyncResult = null;
yield return client.PrepareReUpload(
new Gs2.Gs2Datastore.Request.PrepareReUploadRequest()
.WithNamespaceName("namespace1")
.WithDataObjectName("dataObject-0001")
.WithAccessToken("accessToken-0001")
.WithContentType(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var uploadUrl = result.UploadUrl;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareReUpload(
new Gs2Datastore.PrepareReUploadRequest()
.withNamespaceName("namespace1")
.withDataObjectName("dataObject-0001")
.withAccessToken("accessToken-0001")
.withContentType(null)
);
const item = result.getItem();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_re_upload(
datastore.PrepareReUploadRequest()
.with_namespace_name(self.hash1)
.with_data_object_name('dataObject-0001')
.with_access_token(self.access_token_0001)
.with_content_type(None)
)
item = result.item
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.prepare_re_upload({
namespaceName="namespace1",
dataObjectName="dataObject-0001",
accessToken="accessToken-0001",
contentType=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
uploadUrl = result.uploadUrl;
prepareReUploadByUserId
Prepare to re-upload data objects
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
dataObjectName | string | ✓ | UUID | ~ 128 chars | Data object Name | |
userId | string | ✓ | ~ 128 chars | User Id | ||
contentType | string | ✓ | “application/octet-stream” | ~ 256 chars | MIME-Type of the data to be uploaded | |
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | DataObject | Data object |
uploadUrl | string | URL used to execute the upload process |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareReUploadByUserId(
&datastore.PrepareReUploadByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
DataObjectName: pointy.String("dataObject-0001"),
UserId: pointy.String("user-0001"),
ContentType: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
uploadUrl := result.UploadUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareReUploadByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->prepareReUploadByUserId(
(new PrepareReUploadByUserIdRequest())
->withNamespaceName(self::namespace1)
->withDataObjectName("dataObject-0001")
->withUserId("user-0001")
->withContentType(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareReUploadByUserIdRequest;
import io.gs2.datastore.result.PrepareReUploadByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareReUploadByUserIdResult result = client.prepareReUploadByUserId(
new PrepareReUploadByUserIdRequest()
.withNamespaceName("namespace1")
.withDataObjectName("dataObject-0001")
.withUserId("user-0001")
.withContentType(null)
.withTimeOffsetToken(null)
);
DataObject item = result.getItem();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.PrepareReUploadByUserIdRequest;
using Gs2.Gs2Datastore.Result.PrepareReUploadByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareReUploadByUserIdResult> asyncResult = null;
yield return client.PrepareReUploadByUserId(
new Gs2.Gs2Datastore.Request.PrepareReUploadByUserIdRequest()
.WithNamespaceName("namespace1")
.WithDataObjectName("dataObject-0001")
.WithUserId("user-0001")
.WithContentType(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var uploadUrl = result.UploadUrl;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareReUploadByUserId(
new Gs2Datastore.PrepareReUploadByUserIdRequest()
.withNamespaceName("namespace1")
.withDataObjectName("dataObject-0001")
.withUserId("user-0001")
.withContentType(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_re_upload_by_user_id(
datastore.PrepareReUploadByUserIdRequest()
.with_namespace_name(self.hash1)
.with_data_object_name('dataObject-0001')
.with_user_id('user-0001')
.with_content_type(None)
.with_time_offset_token(None)
)
item = result.item
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.prepare_re_upload_by_user_id({
namespaceName="namespace1",
dataObjectName="dataObject-0001",
userId="user-0001",
contentType=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
uploadUrl = result.uploadUrl;
doneUpload
Report completion of data object upload
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
dataObjectName | string | ✓ | UUID | ~ 128 chars | Data object Name | |
accessToken | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | DataObject | Data object |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DoneUpload(
&datastore.DoneUploadRequest {
NamespaceName: pointy.String("namespace1"),
DataObjectName: pointy.String("dataObject-0001"),
AccessToken: pointy.String("accessToken-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DoneUploadRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->doneUpload(
(new DoneUploadRequest())
->withNamespaceName(self::namespace1)
->withDataObjectName("dataObject-0001")
->withAccessToken(self::$accessToken0001)
);
$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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DoneUploadRequest;
import io.gs2.datastore.result.DoneUploadResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DoneUploadResult result = client.doneUpload(
new DoneUploadRequest()
.withNamespaceName("namespace1")
.withDataObjectName("dataObject-0001")
.withAccessToken("accessToken-0001")
);
DataObject 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.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.DoneUploadRequest;
using Gs2.Gs2Datastore.Result.DoneUploadResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DoneUploadResult> asyncResult = null;
yield return client.DoneUpload(
new Gs2.Gs2Datastore.Request.DoneUploadRequest()
.WithNamespaceName("namespace1")
.WithDataObjectName("dataObject-0001")
.WithAccessToken("accessToken-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.doneUpload(
new Gs2Datastore.DoneUploadRequest()
.withNamespaceName("namespace1")
.withDataObjectName("dataObject-0001")
.withAccessToken("accessToken-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.done_upload(
datastore.DoneUploadRequest()
.with_namespace_name(self.hash1)
.with_data_object_name('dataObject-0001')
.with_access_token(self.access_token_0001)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.done_upload({
namespaceName="namespace1",
dataObjectName="dataObject-0001",
accessToken="accessToken-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
doneUploadByUserId
Report completion of data object upload by specifying user ID
Request
Type | Condition | Require | Default | Limitation | Description | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
dataObjectName | string | ✓ | UUID | ~ 128 chars | Data object Name | |
userId | string | ✓ | ~ 128 chars | User Id | ||
timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
Type | Description | |
---|---|---|
item | DataObject | Data object |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DoneUploadByUserId(
&datastore.DoneUploadByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
DataObjectName: pointy.String("dataObject-0001"),
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DoneUploadByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->doneUploadByUserId(
(new DoneUploadByUserIdRequest())
->withNamespaceName(self::namespace1)
->withDataObjectName("dataObject-0001")
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DoneUploadByUserIdRequest;
import io.gs2.datastore.result.DoneUploadByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DoneUploadByUserIdResult result = client.doneUploadByUserId(
new DoneUploadByUserIdRequest()
.withNamespaceName("namespace1")
.withDataObjectName("dataObject-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
DataObject 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.Gs2Datastore.Gs2DatastoreRestClient;
using Gs2.Gs2Datastore.Request.DoneUploadByUserIdRequest;
using Gs2.Gs2Datastore.Result.DoneUploadByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DoneUploadByUserIdResult> asyncResult = null;
yield return client.DoneUploadByUserId(
new Gs2.Gs2Datastore.Request.DoneUploadByUserIdRequest()
.WithNamespaceName("namespace1")
.WithDataObjectName("dataObject-0001")
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.doneUploadByUserId(
new Gs2Datastore.DoneUploadByUserIdRequest()
.withNamespaceName("namespace1")
.withDataObjectName("dataObject-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.done_upload_by_user_id(
datastore.DoneUploadByUserIdRequest()
.with_namespace_name(self.hash1)
.with_data_object_name('dataObject-0001')
.with_user_id('user-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('datastore')
api_result = client.done_upload_by_user_id({
namespaceName="namespace1",
dataObjectName="dataObject-0001",
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item