API Reference of GS2-AdReward SDK

Model

Namespace

Namespace

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

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

TypeConditionRequireDefaultLimitationDescription
namespaceIdstring~ 1024 charsNamespace GRN
namestring~ 32 charsNamespace name
descriptionstring~ 1024 charsDescription
admobAdMobAdMob settings
unityAdUnityAdUnity Ads settings
appLovinMaxesList<AppLovinMax>~ 10 itemsAppLovin MAX settings
acquirePointScriptScriptSettingScript to be executed when points are acquired
consumePointScriptScriptSettingScript to be executed when points are consumed
changePointNotificationNotificationSettingPush notification when point changes
logSettingLogSettingLog output settings
createdAtlongDatetime of creation
updatedAtlongDatetime of last update
revisionlong0~ 9223372036854775805Revision

Point

Ad viewing points

Records the total number of points earned by the player by viewing ads. Each time a player views an ad, they earn points, which can be used to exchange rewards or purchase in-game benefits.

TypeConditionRequireDefaultLimitationDescription
pointIdstring~ 1024 charsPoint GRN
userIdstring~ 128 charsUser Id
pointlong0~ 9223372036854775805Number of points held
createdAtlongDatetime of creation
updatedAtlongDatetime of last update
revisionlong0~ 9223372036854775805Revision

AdMob

AdMob settings

Maintains a list of allowed ad unit IDs and uses it to verify Ad Mob’s viewing completion WebHook.

TypeConditionRequireDefaultLimitationDescription
allowAdUnitIdsList<string>1 ~ 10 itemsList of allowed ad unit IDs

UnityAd

Unity Ads settings

Used to store the Unity Ads-related cryptographic keys used by the application or game. The cryptographic keys are issued by Unity Ads and are used to verify the completion of ad viewing.

TypeConditionRequireDefaultLimitationDescription
keysList<string>~ 10 itemsList of cryptographic keys

AppLovinMax

AppLovin MAX settings

Maintains a list of allowed ad unit IDs and uses it to verify Ad Mob’s viewing completion WebHook.

TypeConditionRequireDefaultLimitationDescription
allowAdUnitIdstring~ 16 charsAllowed ad unit ID
eventKeystring~ 128 charsAppLovin Event Key

ScriptSetting

Script settings

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

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

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

There are two types of asynchronous execution methods: GS2-Script and Amazon EventBridge. By using Amazon EventBridge, you can write processing in languages other than Lua.

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

NotificationSetting

Push notification settings

This is a setting for sending push notifications when an event occurs in a GS2 microservice. The push notification here refers to the processing via the WebSocket interface provided by GS2-Gateway, and is different from the push notification of a smartphone. For example, when a matchmaking is completed or a friend request is received, the GS2-Gateway can send a push notification via the WebSocket interface, and the game client can detect the change of the state.

GS2-Gateway’s push notifications can be used to send additional processing to mobile push notifications when the destination device is offline. If you use mobile push notifications well, you may be able to realize a flow in which you can notify the player by using mobile push notifications even if you end the game during matchmaking and return to the game.

TypeConditionRequireDefaultLimitationDescription
gatewayNamespaceIdstring“grn:gs2:{region}:{ownerId}:gateway:default”~ 1024 charsGS2-Gateway namespace to use for push notifications
enableTransferMobileNotificationbool?falseForwarding to mobile push notification
soundstring{enableTransferMobileNotification} == true~ 1024 charsSound file name to be used for mobile push notifications

LogSetting

Log setting

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

TypeConditionRequireDefaultLimitationDescription
loggingNamespaceIdstring~ 1024 charsNamespace GRN

Methods

describeNamespaces

Get list of namespaces

Get a list of all namespaces in the project. You can use the optional page token to start acquiring data from a specific location in the list. You can also limit the number of namespaces to be acquired.

Request

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

Result

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

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.DescribeNamespaces(
    &ad_reward.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\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\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.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.DescribeNamespacesRequest;
import io.gs2.adReward.result.DescribeNamespacesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2AdRewardRestClient client = new Gs2AdRewardRestClient(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.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.DescribeNamespacesRequest;
using Gs2.Gs2AdReward.Result.DescribeNamespacesResult;

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

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

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

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

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

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

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 new namespace

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

Request

TypeConditionRequireDefaultLimitationDescription
namestring~ 32 charsNamespace name
admobAdMobAdMob settings
unityAdUnityAdUnity Ads settings
appLovinMaxesList<AppLovinMax>~ 10 itemsAppLovin MAX settings
descriptionstring~ 1024 charsDescription
acquirePointScriptScriptSettingScript to be executed when points are acquired
consumePointScriptScriptSettingScript to be executed when points are consumed
changePointNotificationNotificationSettingPush notification when point changes
logSettingLogSettingLog output settings

Result

TypeDescription
itemNamespaceNamespace created

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &ad_reward.CreateNamespaceRequest {
        Name: pointy.String("namespace1"),
        Admob: &adReward.AdMob{
            AllowAdUnitIds: []*string{
                pointy.String("1"),
                pointy.String("2"),
                pointy.String("3"),
            },
        },
        UnityAd: &adReward.UnityAd{
            Keys: []*string{
                pointy.String("key-0001"),
                pointy.String("key-0002"),
            },
        },
        AppLovinMaxes: nil,
        Description: nil,
        AcquirePointScript: nil,
        ConsumePointScript: nil,
        ChangePointNotification: &adReward.NotificationSetting{
            GatewayNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:gateway:namespace1"),
        },
        LogSetting: &adReward.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\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)
            ->withAdmob((new \Gs2\AdReward\Model\AdMob())
                ->withAllowAdUnitIds([
                    "1",
                    "2",
                    "3",
                ]))
            ->withUnityAd((new \Gs2\AdReward\Model\UnityAd())
                ->withKeys([
                    "key-0001",
                    "key-0002",
                ]))
            ->withAppLovinMaxes(null)
            ->withDescription(null)
            ->withAcquirePointScript(null)
            ->withConsumePointScript(null)
            ->withChangePointNotification((new \Gs2\AdReward\Model\NotificationSetting())
                ->withGatewayNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:gateway:\namespace1"))
            ->withLogSetting((new \Gs2\AdReward\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.CreateNamespaceRequest;
import io.gs2.adReward.result.CreateNamespaceResult;

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

try {
    CreateNamespaceResult result = client.createNamespace(
        new CreateNamespaceRequest()
            .withName("namespace1")
            .withAdmob(new io.gs2.adReward.model.AdMob()
                .withAllowAdUnitIds(Arrays.asList(
                    "1",
                    "2",
                    "3"
                )))
            .withUnityAd(new io.gs2.adReward.model.UnityAd()
                .withKeys(Arrays.asList(
                    "key-0001",
                    "key-0002"
                )))
            .withAppLovinMaxes(null)
            .withDescription(null)
            .withAcquirePointScript(null)
            .withConsumePointScript(null)
            .withChangePointNotification(new io.gs2.adReward.model.NotificationSetting()
                .withGatewayNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:gateway:namespace1"))
            .withLogSetting(new io.gs2.adReward.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.CreateNamespaceRequest;
using Gs2.Gs2AdReward.Result.CreateNamespaceResult;

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

AsyncResult<Gs2.Gs2AdReward.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
    new Gs2.Gs2AdReward.Request.CreateNamespaceRequest()
        .WithName("namespace1")
        .WithAdmob(new Gs2.Gs2AdReward.Model.AdMob()
            .WithAllowAdUnitIds(new string[] {
                "1",
                "2",
                "3",
            }))
        .WithUnityAd(new Gs2.Gs2AdReward.Model.UnityAd()
            .WithKeys(new string[] {
                "key-0001",
                "key-0002",
            }))
        .WithAppLovinMaxes(null)
        .WithDescription(null)
        .WithAcquirePointScript(null)
        .WithConsumePointScript(null)
        .WithChangePointNotification(new Gs2.Gs2AdReward.Model.NotificationSetting()
            .WithGatewayNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:gateway:namespace1"))
        .WithLogSetting(new Gs2.Gs2AdReward.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2AdReward from '@/gs2/adReward';

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

try {
    const result = await client.createNamespace(
        new Gs2AdReward.CreateNamespaceRequest()
            .withName("namespace1")
            .withAdmob(new Gs2AdReward.model.AdMob()
                .withAllowAdUnitIds([
                    "1",
                    "2",
                    "3",
                ]))
            .withUnityAd(new Gs2AdReward.model.UnityAd()
                .withKeys([
                    "key-0001",
                    "key-0002",
                ]))
            .withAppLovinMaxes(null)
            .withDescription(null)
            .withAcquirePointScript(null)
            .withConsumePointScript(null)
            .withChangePointNotification(new Gs2AdReward.model.NotificationSetting()
                .withGatewayNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:gateway:namespace1"))
            .withLogSetting(new Gs2AdReward.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ad_reward

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

try:
    result = client.create_namespace(
        ad_reward.CreateNamespaceRequest()
            .with_name(self.hash1)
            .with_admob(
                ad_reward.AdMob()
                    .with_allow_ad_unit_ids([
                        '1',
                        '2',
                        '3',
                    ]))
            .with_unity_ad(
                ad_reward.UnityAd()
                    .with_keys([
                        'key-0001',
                        'key-0002',
                    ]))
            .with_app_lovin_maxes(None)
            .with_description(None)
            .with_acquire_point_script(None)
            .with_consume_point_script(None)
            .with_change_point_notification(
                ad_reward.NotificationSetting()
                    .with_gateway_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:gateway:namespace1'))
            .with_log_setting(
                ad_reward.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('adReward')

api_result = client.create_namespace({
    name="namespace1",
    admob={
        allowAdUnitIds={
            "1",
            "2",
            "3"
        },
    },
    unityAd={
        keys={
            "key-0001",
            "key-0002"
        },
    },
    appLovinMaxes=nil,
    description=nil,
    acquirePointScript=nil,
    consumePointScript=nil,
    changePointNotification={
        gatewayNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:gateway:namespace1",
    },
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
    },
})

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

result = api_result.result
item = result.item;

getNamespaceStatus

Get namespace status

Get the current status of the specified namespace. This includes whether the namespace is active, pending, or in some other state.

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name

Result

TypeDescription
statusstring

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.GetNamespaceStatus(
    &ad_reward.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\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\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.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.GetNamespaceStatusRequest;
import io.gs2.adReward.result.GetNamespaceStatusResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2AdRewardRestClient client = new Gs2AdRewardRestClient(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.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.GetNamespaceStatusRequest;
using Gs2.Gs2AdReward.Result.GetNamespaceStatusResult;

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

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

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

try {
    const result = await client.getNamespaceStatus(
        new Gs2AdReward.GetNamespaceStatusRequest()
            .withNamespaceName("namespace1")
    );
    const status = result.getStatus();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ad_reward

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

try:
    result = client.get_namespace_status(
        ad_reward.GetNamespaceStatusRequest()
            .with_namespace_name(self.hash1)
    )
    status = result.status
except core.Gs2Exception as e:
    exit(1)
client = gs2('adReward')

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

Get detailed information about the specified namespace. This includes the name, description, and other settings of the namespace.

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name

Result

TypeDescription
itemNamespaceNamespace

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.GetNamespace(
    &ad_reward.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\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\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.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.GetNamespaceRequest;
import io.gs2.adReward.result.GetNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2AdRewardRestClient client = new Gs2AdRewardRestClient(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.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.GetNamespaceRequest;
using Gs2.Gs2AdReward.Result.GetNamespaceResult;

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

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

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

try {
    const result = await client.getNamespace(
        new Gs2AdReward.GetNamespaceRequest()
            .withNamespaceName("namespace1")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ad_reward

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

try:
    result = client.get_namespace(
        ad_reward.GetNamespaceRequest()
            .with_namespace_name(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('adReward')

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

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

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
descriptionstring~ 1024 charsDescription
admobAdMobAdMob settings
unityAdUnityAdUnity Ads settings
appLovinMaxesList<AppLovinMax>~ 10 itemsAppLovin MAX settings
acquirePointScriptScriptSettingScript to be executed when points are acquired
consumePointScriptScriptSettingScript to be executed when points are consumed
changePointNotificationNotificationSettingPush notification when point changes
logSettingLogSettingLog output settings

Result

TypeDescription
itemNamespaceUpdated namespace

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &ad_reward.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace1"),
        Description: pointy.String("description1"),
        Admob: &adReward.AdMob{
            AllowAdUnitIds: []*string{
                pointy.String("2"),
                pointy.String("3"),
                pointy.String("4"),
            },
        },
        UnityAd: &adReward.UnityAd{
            Keys: []*string{
                pointy.String("key-1001"),
                pointy.String("key-1002"),
            },
        },
        AppLovinMaxes: nil,
        AcquirePointScript: nil,
        ConsumePointScript: nil,
        ChangePointNotification: &adReward.NotificationSetting{
            GatewayNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:gateway:namespace1"),
        },
        LogSetting: &adReward.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\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")
            ->withAdmob((new \Gs2\AdReward\Model\AdMob())
                ->withAllowAdUnitIds([
                    "2",
                    "3",
                    "4",
                ]))
            ->withUnityAd((new \Gs2\AdReward\Model\UnityAd())
                ->withKeys([
                    "key-1001",
                    "key-1002",
                ]))
            ->withAppLovinMaxes(null)
            ->withAcquirePointScript(null)
            ->withConsumePointScript(null)
            ->withChangePointNotification((new \Gs2\AdReward\Model\NotificationSetting())
                ->withGatewayNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:gateway:\namespace1"))
            ->withLogSetting((new \Gs2\AdReward\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.UpdateNamespaceRequest;
import io.gs2.adReward.result.UpdateNamespaceResult;

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

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withAdmob(new io.gs2.adReward.model.AdMob()
                .withAllowAdUnitIds(Arrays.asList(
                    "2",
                    "3",
                    "4"
                )))
            .withUnityAd(new io.gs2.adReward.model.UnityAd()
                .withKeys(Arrays.asList(
                    "key-1001",
                    "key-1002"
                )))
            .withAppLovinMaxes(null)
            .withAcquirePointScript(null)
            .withConsumePointScript(null)
            .withChangePointNotification(new io.gs2.adReward.model.NotificationSetting()
                .withGatewayNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:gateway:namespace1"))
            .withLogSetting(new io.gs2.adReward.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.UpdateNamespaceRequest;
using Gs2.Gs2AdReward.Result.UpdateNamespaceResult;

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

AsyncResult<Gs2.Gs2AdReward.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
    new Gs2.Gs2AdReward.Request.UpdateNamespaceRequest()
        .WithNamespaceName("namespace1")
        .WithDescription("description1")
        .WithAdmob(new Gs2.Gs2AdReward.Model.AdMob()
            .WithAllowAdUnitIds(new string[] {
                "2",
                "3",
                "4",
            }))
        .WithUnityAd(new Gs2.Gs2AdReward.Model.UnityAd()
            .WithKeys(new string[] {
                "key-1001",
                "key-1002",
            }))
        .WithAppLovinMaxes(null)
        .WithAcquirePointScript(null)
        .WithConsumePointScript(null)
        .WithChangePointNotification(new Gs2.Gs2AdReward.Model.NotificationSetting()
            .WithGatewayNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:gateway:namespace1"))
        .WithLogSetting(new Gs2.Gs2AdReward.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2AdReward from '@/gs2/adReward';

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

try {
    const result = await client.updateNamespace(
        new Gs2AdReward.UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withAdmob(new Gs2AdReward.model.AdMob()
                .withAllowAdUnitIds([
                    "2",
                    "3",
                    "4",
                ]))
            .withUnityAd(new Gs2AdReward.model.UnityAd()
                .withKeys([
                    "key-1001",
                    "key-1002",
                ]))
            .withAppLovinMaxes(null)
            .withAcquirePointScript(null)
            .withConsumePointScript(null)
            .withChangePointNotification(new Gs2AdReward.model.NotificationSetting()
                .withGatewayNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:gateway:namespace1"))
            .withLogSetting(new Gs2AdReward.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ad_reward

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

try:
    result = client.update_namespace(
        ad_reward.UpdateNamespaceRequest()
            .with_namespace_name(self.hash1)
            .with_description('description1')
            .with_admob(
                ad_reward.AdMob()
                    .with_allow_ad_unit_ids([
                        '2',
                        '3',
                        '4',
                    ]))
            .with_unity_ad(
                ad_reward.UnityAd()
                    .with_keys([
                        'key-1001',
                        'key-1002',
                    ]))
            .with_app_lovin_maxes(None)
            .with_acquire_point_script(None)
            .with_consume_point_script(None)
            .with_change_point_notification(
                ad_reward.NotificationSetting()
                    .with_gateway_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:gateway:namespace1'))
            .with_log_setting(
                ad_reward.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('adReward')

api_result = client.update_namespace({
    namespaceName="namespace1",
    description="description1",
    admob={
        allowAdUnitIds={
            "2",
            "3",
            "4"
        },
    },
    unityAd={
        keys={
            "key-1001",
            "key-1002"
        },
    },
    appLovinMaxes=nil,
    acquirePointScript=nil,
    consumePointScript=nil,
    changePointNotification={
        gatewayNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:gateway:namespace1",
    },
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
    },
})

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

result = api_result.result
item = result.item;

deleteNamespace

Delete namespace

Delete the specified namespace. This operation is irreversible and all data associated with the deleted namespace will be lost.

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name

Result

TypeDescription
itemNamespaceDeleted namespace

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.DeleteNamespace(
    &ad_reward.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\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\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.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.DeleteNamespaceRequest;
import io.gs2.adReward.result.DeleteNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2AdRewardRestClient client = new Gs2AdRewardRestClient(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.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.DeleteNamespaceRequest;
using Gs2.Gs2AdReward.Result.DeleteNamespaceResult;

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

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

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

try {
    const result = await client.deleteNamespace(
        new Gs2AdReward.DeleteNamespaceRequest()
            .withNamespaceName("namespace1")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ad_reward

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

try:
    result = client.delete_namespace(
        ad_reward.DeleteNamespaceRequest()
            .with_namespace_name(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('adReward')

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

Can be used to meet legal requirements for the protection of personal information, or to back up or migrate data.

Request

TypeConditionRequireDefaultLimitationDescription
userIdstring~ 128 charsUser Id
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.DumpUserDataByUserId(
    &ad_reward.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\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\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.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.DumpUserDataByUserIdRequest;
import io.gs2.adReward.result.DumpUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2AdRewardRestClient client = new Gs2AdRewardRestClient(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.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.DumpUserDataByUserIdRequest;
using Gs2.Gs2AdReward.Result.DumpUserDataByUserIdResult;

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

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

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

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

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

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

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

TypeConditionRequireDefaultLimitationDescription
userIdstring~ 128 charsUser Id
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
urlstringURL of output data

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
    &ad_reward.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\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\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.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.adReward.result.CheckDumpUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2AdRewardRestClient client = new Gs2AdRewardRestClient(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.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.CheckDumpUserDataByUserIdRequest;
using Gs2.Gs2AdReward.Result.CheckDumpUserDataByUserIdResult;

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

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

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

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

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

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

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

Delete user data

Execute cleaning of data associated with the specified user ID This allows you to safely delete specific user data from the project.

Request

TypeConditionRequireDefaultLimitationDescription
userIdstring~ 128 charsUser Id
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.CleanUserDataByUserId(
    &ad_reward.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\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\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.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.CleanUserDataByUserIdRequest;
import io.gs2.adReward.result.CleanUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2AdRewardRestClient client = new Gs2AdRewardRestClient(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.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.CleanUserDataByUserIdRequest;
using Gs2.Gs2AdReward.Result.CleanUserDataByUserIdResult;

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

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

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

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

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

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

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 cleaning of the data associated with the specified user ID is complete

Request

TypeConditionRequireDefaultLimitationDescription
userIdstring~ 128 charsUser Id
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
    &ad_reward.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\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\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.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.adReward.result.CheckCleanUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2AdRewardRestClient client = new Gs2AdRewardRestClient(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.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.CheckCleanUserDataByUserIdRequest;
using Gs2.Gs2AdReward.Result.CheckCleanUserDataByUserIdResult;

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

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

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

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

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

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

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

Execute import of data associated with the specified user ID

The data that can be used for import is limited to the data exported by GS2, and old data may fail to import. You can import data with a user ID different from the one you exported, but if the user ID is included in the payload of the user data, this may not be the case.

You can start the actual import process by uploading the exported zip file to the URL returned in the return value of this API and calling importUserDataByUserId.

Request

TypeConditionRequireDefaultLimitationDescription
userIdstring~ 128 charsUser Id
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
uploadTokenstringToken used to reflect results after upload
uploadUrlstringURL used to upload user data

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
    &ad_reward.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\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\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.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.adReward.result.PrepareImportUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2AdRewardRestClient client = new Gs2AdRewardRestClient(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.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.PrepareImportUserDataByUserIdRequest;
using Gs2.Gs2AdReward.Result.PrepareImportUserDataByUserIdResult;

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

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

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

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

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

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

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

Execute import of data associated with the specified user ID

The data that can be used for import is limited to the data exported by GS2, and old data may fail to import. You can import data with a user ID different from the one you exported, but if the user ID is included in the payload of the user data, this may not be the case.

Before calling this API, you must call prepareImportUserDataByUserId to complete the upload preparation.

Request

TypeConditionRequireDefaultLimitationDescription
userIdstring~ 128 charsUser Id
uploadTokenstring~ 1024 charsToken received in preparation for upload
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.ImportUserDataByUserId(
    &ad_reward.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\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\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.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.ImportUserDataByUserIdRequest;
import io.gs2.adReward.result.ImportUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2AdRewardRestClient client = new Gs2AdRewardRestClient(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.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.ImportUserDataByUserIdRequest;
using Gs2.Gs2AdReward.Result.ImportUserDataByUserIdResult;

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

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

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

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

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

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

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

TypeConditionRequireDefaultLimitationDescription
userIdstring~ 128 charsUser Id
uploadTokenstring~ 1024 charsToken received in preparation for upload
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
urlstringURL of log data

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
    &ad_reward.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\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\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.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.CheckImportUserDataByUserIdRequest;
import io.gs2.adReward.result.CheckImportUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2AdRewardRestClient client = new Gs2AdRewardRestClient(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.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.CheckImportUserDataByUserIdRequest;
using Gs2.Gs2AdReward.Result.CheckImportUserDataByUserIdResult;

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

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

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

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

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

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

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;

getPoint

Get Point

Returns the total number of points associated with the specified user ID. This allows you to check how many points the user currently holds.

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
accessTokenstring~ 128 charsUser Id

Result

TypeDescription
itemPointPoint

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.GetPoint(
    &ad_reward.GetPointRequest {
        NamespaceName: pointy.String("namespace1"),
        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\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\Request\GetPointRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getPoint(
        (new GetPointRequest())
            ->withNamespaceName(self::namespace1)
            ->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.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.GetPointRequest;
import io.gs2.adReward.result.GetPointResult;

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

try {
    GetPointResult result = client.getPoint(
        new GetPointRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("accessToken-0001")
    );
    Point 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.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.GetPointRequest;
using Gs2.Gs2AdReward.Result.GetPointResult;

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

AsyncResult<Gs2.Gs2AdReward.Result.GetPointResult> asyncResult = null;
yield return client.GetPoint(
    new Gs2.Gs2AdReward.Request.GetPointRequest()
        .WithNamespaceName("namespace1")
        .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 Gs2AdReward from '@/gs2/adReward';

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

try {
    const result = await client.getPoint(
        new Gs2AdReward.GetPointRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("accessToken-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ad_reward

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

try:
    result = client.get_point(
        ad_reward.GetPointRequest()
            .with_namespace_name(self.hash1)
            .with_access_token(self.access_token_0001)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('adReward')

api_result = client.get_point({
    namespaceName="namespace1",
    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;

getPointByUserId

Get Point by specifying user ID

Returns the total number of points associated with the specified user ID. This allows you to check how many points the user currently holds.

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
userIdstring~ 128 charsUser Id
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemPointPoint

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.GetPointByUserId(
    &ad_reward.GetPointByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        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\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\Request\GetPointByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getPointByUserId(
        (new GetPointByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->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.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.GetPointByUserIdRequest;
import io.gs2.adReward.result.GetPointByUserIdResult;

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

try {
    GetPointByUserIdResult result = client.getPointByUserId(
        new GetPointByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    Point 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.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.GetPointByUserIdRequest;
using Gs2.Gs2AdReward.Result.GetPointByUserIdResult;

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

AsyncResult<Gs2.Gs2AdReward.Result.GetPointByUserIdResult> asyncResult = null;
yield return client.GetPointByUserId(
    new Gs2.Gs2AdReward.Request.GetPointByUserIdRequest()
        .WithNamespaceName("namespace1")
        .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 Gs2AdReward from '@/gs2/adReward';

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

try {
    const result = await client.getPointByUserId(
        new Gs2AdReward.GetPointByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import ad_reward

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

try:
    result = client.get_point_by_user_id(
        ad_reward.GetPointByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('adReward')

api_result = client.get_point_by_user_id({
    namespaceName="namespace1",
    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 = result.item;

acquirePointByUserId

Acquire Point by specifying user ID

Adds a specific number of points to the specified user ID and returns the result.

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
userIdstring~ 128 charsUser Id
pointlong1 ~ 9223372036854775805Acquire Points
timeOffsetTokenstring~ 1024 charsTime offset token

Result

TypeDescription
itemPointPoint

Implementation Example

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/ad_reward"
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 := ad_reward.Gs2AdRewardRestClient{
    Session: &session,
}
result, err := client.AcquirePointByUserId(
    &ad_reward.AcquirePointByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        UserId: pointy.String("user-0001"),
        Point: pointy.Int64(1),
        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\AdReward\Gs2AdRewardRestClient;
use Gs2\AdReward\Request\AcquirePointByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->acquirePointByUserId(
        (new AcquirePointByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId("user-0001")
            ->withPoint(1)
            ->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.adReward.rest.Gs2AdRewardRestClient;
import io.gs2.adReward.request.AcquirePointByUserIdRequest;
import io.gs2.adReward.result.AcquirePointByUserIdResult;

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

try {
    AcquirePointByUserIdResult result = client.acquirePointByUserId(
        new AcquirePointByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withPoint(1L)
            .withTimeOffsetToken(null)
    );
    Point 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.Gs2AdReward.Gs2AdRewardRestClient;
using Gs2.Gs2AdReward.Request.AcquirePointByUserIdRequest;
using Gs2.Gs2AdReward.Result.AcquirePointByUserIdResult;

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

AsyncResult<Gs2.Gs2AdReward.Result.AcquirePointByUserIdResult> asyncResult = null;
yield return client.AcquirePointByUserId(
    new Gs2.Gs2AdReward.Request.AcquirePointByUserIdRequest()
        .WithNamespaceName("namespace1")
        .WithUserId("user-0001")
        .WithPoint(1L)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item =</