GS2-Friend SDK API リファレンス

モデル

Namespace

ネームスペース

ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。 GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。

そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。

有効化条件必須デフォルト値の制限説明
namespaceIdstring~ 1024文字ネームスペースGRN
namestring~ 32文字ネームスペース名
descriptionstring~ 1024文字説明文
followScriptScriptSettingフォローされたときに実行するスクリプト
unfollowScriptScriptSettingアンフォローされたときに実行するスクリプト
sendRequestScriptScriptSettingフレンドリクエストを発行したときに実行するスクリプト
cancelRequestScriptScriptSettingフレンドリクエストをキャンセルしたときに実行するスクリプト
acceptRequestScriptScriptSettingフレンドリクエストを承諾したときに実行するスクリプト
rejectRequestScriptScriptSettingフレンドリクエストを拒否したときに実行するスクリプト
deleteFriendScriptScriptSettingフレンドを削除したときに実行するスクリプト
updateProfileScriptScriptSettingプロフィールを更新したときに実行するスクリプト
followNotificationNotificationSettingフォローされたときのプッシュ通知
receiveRequestNotificationNotificationSettingフレンドリクエストが届いたときのプッシュ通知
acceptRequestNotificationNotificationSettingフレンドリクエストが承認されたときのプッシュ通知
logSettingLogSettingログの出力設定
createdAtlong作成日時
updatedAtlong最終更新日時
revisionlong0~ 9223372036854775805リビジョン

Profile

プロフィール

プロフィールはゲームプレイヤーに関する情報を格納します。

プロフィールは公開範囲ごとに設定することが可能で、3種類あります。 friend フレンド関係が成立している相手に閲覧可能な内容 follow フォローされている相手が閲覧可能な内容 public 誰でも閲覧可能な内容

有効化条件必須デフォルト値の制限説明
profileIdstring~ 1024文字プロフィールGRN
userIdstring~ 128文字ユーザーID
publicProfilestring~ 1024文字公開されるプロフィール
followerProfilestring~ 1024文字フォロワー向けに公開されるプロフィール
friendProfilestring~ 1024文字フレンド向けに公開されるプロフィール
createdAtlong作成日時
updatedAtlong最終更新日時
revisionlong0~ 9223372036854775805リビジョン

Follow

フォロー

フォローとは単方向のゲームプレイヤー間の関係です。 フォローリクエストを送信すると直ちに関係が成立します。

有効化条件必須デフォルト値の制限説明
followIdstring~ 1024文字フォローGRN
userIdstring~ 128文字ユーザーID
targetUserIdsList<string>フォローしているユーザーIDリスト
createdAtlong作成日時
updatedAtlong最終更新日時
revisionlong0~ 9223372036854775805リビジョン

Friend

フレンド

フレンドとは双方向で承認されたゲームプレイヤー間の関係です。 フレンド関係を成立させるには一方がリクエストを送信し、もう一方が承認する必要があります。

有効化条件必須デフォルト値の制限説明
friendIdstring~ 1024文字フレンドGRN
userIdstring~ 128文字ユーザーID
targetUserIdsList<string>フレンドのユーザーIDリスト
createdAtlong作成日時
updatedAtlong最終更新日時
revisionlong0~ 9223372036854775805リビジョン

SendBox

送信ボックス

送信したフレンドリクエスト

有効化条件必須デフォルト値の制限説明
sendBoxIdstring~ 1024文字フレンドリクエストの受信ボックスGRN
userIdstring~ 128文字ユーザーID
targetUserIdsList<string>フレンドリクエストの宛先ユーザーIDリスト
createdAtlong作成日時
updatedAtlong最終更新日時
revisionlong0~ 9223372036854775805リビジョン

Inbox

有効化条件必須デフォルト値の制限説明
inboxIdstring~ 1024文字フレンドリクエストの受信ボックスGRN
userIdstring~ 128文字ユーザーID
fromUserIdsList<string>フレンドリクエストを送ってきたユーザーIDリスト
createdAtlong作成日時
updatedAtlong最終更新日時
revisionlong0~ 9223372036854775805リビジョン

BlackList

有効化条件必須デフォルト値の制限説明
blackListIdstring~ 1024文字ブラックリストGRN
userIdstring~ 128文字ユーザーID
targetUserIdsList<string>ブラックリストのユーザーIDリスト
createdAtlong作成日時
updatedAtlong最終更新日時
revisionlong0~ 9223372036854775805リビジョン

FollowUser

有効化条件必須デフォルト値の制限説明
userIdstring~ 128文字ユーザーID
publicProfilestring~ 1024文字公開されるプロフィール
followerProfilestring~ 1024文字フォロワー向けに公開されるプロフィール

FriendUser

有効化条件必須デフォルト値の制限説明
userIdstring~ 128文字ユーザーID
publicProfilestring~ 1024文字公開されるプロフィール
friendProfilestring~ 1024文字フレンド向けに公開されるプロフィール

FriendRequest

有効化条件必須デフォルト値の制限説明
userIdstring~ 128文字送信元
targetUserIdstring~ 128文字送信先

SendFriendRequest

有効化条件必須デフォルト値の制限説明
userIdstring~ 128文字送信元
targetUserIdstring~ 128文字送信先

ReceiveFriendRequest

有効化条件必須デフォルト値の制限説明
userIdstring~ 128文字送信元
targetUserIdstring~ 128文字送信先

PublicProfile

有効化条件必須デフォルト値の制限説明
userIdstring~ 128文字ユーザーID
publicProfilestring~ 1024文字公開されるプロフィール

ScriptSetting

有効化条件必須デフォルト値の制限説明
triggerScriptIdstring~ 1024文字スクリプトGRN
doneTriggerTargetTypeenum [’none’, ‘gs2_script’, ‘aws’]“none”~ 128文字完了通知の通知先
doneTriggerScriptIdstring{doneTriggerTargetType} == “gs2_script”~ 1024文字スクリプトGRN
doneTriggerQueueNamespaceIdstring{doneTriggerTargetType} == “gs2_script”~ 1024文字ネームスペースGRN

NotificationSetting

有効化条件必須デフォルト値の制限説明
gatewayNamespaceIdstring~ 1024文字ネームスペースGRN
enableTransferMobileNotificationbool?モバイルプッシュ通知へ転送するか
soundstring~ 1024文字モバイルプッシュ通知で使用するサウンドファイル名

LogSetting

有効化条件必須デフォルト値の制限説明
loggingNamespaceIdstring~ 1024文字ネームスペースGRN

メソッド

describeNamespaces

ネームスペースの一覧を取得

Request

有効化条件必須デフォルト値の制限説明
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<Namespace>ネームスペースのリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

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

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

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

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

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

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

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

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

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

ネームスペースを新規作成

Request

有効化条件必須デフォルト値の制限説明
namestring~ 32文字ネームスペース名
descriptionstring~ 1024文字説明文
followScriptScriptSettingフォローされたときに実行するスクリプト
unfollowScriptScriptSettingアンフォローされたときに実行するスクリプト
sendRequestScriptScriptSettingフレンドリクエストを発行したときに実行するスクリプト
cancelRequestScriptScriptSettingフレンドリクエストをキャンセルしたときに実行するスクリプト
acceptRequestScriptScriptSettingフレンドリクエストを承諾したときに実行するスクリプト
rejectRequestScriptScriptSettingフレンドリクエストを拒否したときに実行するスクリプト
deleteFriendScriptScriptSettingフレンドを削除したときに実行するスクリプト
updateProfileScriptScriptSettingプロフィールを更新したときに実行するスクリプト
followNotificationNotificationSettingフォローされたときのプッシュ通知
receiveRequestNotificationNotificationSettingフレンドリクエストが届いたときのプッシュ通知
acceptRequestNotificationNotificationSettingフレンドリクエストが承認されたときのプッシュ通知
logSettingLogSettingログの出力設定

Result

説明
itemNamespace作成したネームスペース

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
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 := friend.Gs2FriendRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &friend.CreateNamespaceRequest {
        Name: pointy.String("namespace1"),
        Description: nil,
        FollowScript: nil,
        UnfollowScript: nil,
        SendRequestScript: nil,
        CancelRequestScript: nil,
        AcceptRequestScript: nil,
        RejectRequestScript: nil,
        DeleteFriendScript: nil,
        UpdateProfileScript: nil,
        FollowNotification: nil,
        ReceiveRequestNotification: nil,
        AcceptRequestNotification: nil,
        LogSetting: &friend.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\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\CreateNamespaceRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName(self::namespace1)
            ->withDescription(null)
            ->withFollowScript(null)
            ->withUnfollowScript(null)
            ->withSendRequestScript(null)
            ->withCancelRequestScript(null)
            ->withAcceptRequestScript(null)
            ->withRejectRequestScript(null)
            ->withDeleteFriendScript(null)
            ->withUpdateProfileScript(null)
            ->withFollowNotification(null)
            ->withReceiveRequestNotification(null)
            ->withAcceptRequestNotification(null)
            ->withLogSetting((new \Gs2\Friend\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.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.CreateNamespaceRequest;
import io.gs2.friend.result.CreateNamespaceResult;

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

try {
    CreateNamespaceResult result = client.createNamespace(
        new CreateNamespaceRequest()
            .withName("namespace1")
            .withDescription(null)
            .withFollowScript(null)
            .withUnfollowScript(null)
            .withSendRequestScript(null)
            .withCancelRequestScript(null)
            .withAcceptRequestScript(null)
            .withRejectRequestScript(null)
            .withDeleteFriendScript(null)
            .withUpdateProfileScript(null)
            .withFollowNotification(null)
            .withReceiveRequestNotification(null)
            .withAcceptRequestNotification(null)
            .withLogSetting(new io.gs2.friend.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.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.CreateNamespaceRequest;
using Gs2.Gs2Friend.Result.CreateNamespaceResult;

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

AsyncResult<Gs2.Gs2Friend.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
    new Gs2.Gs2Friend.Request.CreateNamespaceRequest()
        .WithName("namespace1")
        .WithDescription(null)
        .WithFollowScript(null)
        .WithUnfollowScript(null)
        .WithSendRequestScript(null)
        .WithCancelRequestScript(null)
        .WithAcceptRequestScript(null)
        .WithRejectRequestScript(null)
        .WithDeleteFriendScript(null)
        .WithUpdateProfileScript(null)
        .WithFollowNotification(null)
        .WithReceiveRequestNotification(null)
        .WithAcceptRequestNotification(null)
        .WithLogSetting(new Gs2.Gs2Friend.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 Gs2Friend from '@/gs2/friend';

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

try {
    const result = await client.createNamespace(
        new Gs2Friend.CreateNamespaceRequest()
            .withName("namespace1")
            .withDescription(null)
            .withFollowScript(null)
            .withUnfollowScript(null)
            .withSendRequestScript(null)
            .withCancelRequestScript(null)
            .withAcceptRequestScript(null)
            .withRejectRequestScript(null)
            .withDeleteFriendScript(null)
            .withUpdateProfileScript(null)
            .withFollowNotification(null)
            .withReceiveRequestNotification(null)
            .withAcceptRequestNotification(null)
            .withLogSetting(new Gs2Friend.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 friend

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

try:
    result = client.create_namespace(
        friend.CreateNamespaceRequest()
            .with_name(self.hash1)
            .with_description(None)
            .with_follow_script(None)
            .with_unfollow_script(None)
            .with_send_request_script(None)
            .with_cancel_request_script(None)
            .with_accept_request_script(None)
            .with_reject_request_script(None)
            .with_delete_friend_script(None)
            .with_update_profile_script(None)
            .with_follow_notification(None)
            .with_receive_request_notification(None)
            .with_accept_request_notification(None)
            .with_log_setting(
                friend.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('friend')

api_result = client.create_namespace({
    name='namespace1',
    description=nil,
    followScript=nil,
    unfollowScript=nil,
    sendRequestScript=nil,
    cancelRequestScript=nil,
    acceptRequestScript=nil,
    rejectRequestScript=nil,
    deleteFriendScript=nil,
    updateProfileScript=nil,
    followNotification=nil,
    receiveRequestNotification=nil,
    acceptRequestNotification=nil,
    logSetting={
        loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
    },
})

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

result = api_result.result
item = result.item;

getNamespaceStatus

ネームスペースの状態を取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名

Result

説明
statusstring

実装例

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

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

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

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

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

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

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

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

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

ネームスペースを取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名

Result

説明
itemNamespaceネームスペース

実装例

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

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

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

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

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

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

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

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

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

ネームスペースを更新

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
descriptionstring~ 1024文字説明文
followScriptScriptSettingフォローされたときに実行するスクリプト
unfollowScriptScriptSettingアンフォローされたときに実行するスクリプト
sendRequestScriptScriptSettingフレンドリクエストを発行したときに実行するスクリプト
cancelRequestScriptScriptSettingフレンドリクエストをキャンセルしたときに実行するスクリプト
acceptRequestScriptScriptSettingフレンドリクエストを承諾したときに実行するスクリプト
rejectRequestScriptScriptSettingフレンドリクエストを拒否したときに実行するスクリプト
deleteFriendScriptScriptSettingフレンドを削除したときに実行するスクリプト
updateProfileScriptScriptSettingプロフィールを更新したときに実行するスクリプト
followNotificationNotificationSettingフォローされたときのプッシュ通知
receiveRequestNotificationNotificationSettingフレンドリクエストが届いたときのプッシュ通知
acceptRequestNotificationNotificationSettingフレンドリクエストが承認されたときのプッシュ通知
logSettingLogSettingログの出力設定

Result

説明
itemNamespace更新したネームスペース

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
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 := friend.Gs2FriendRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &friend.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace1"),
        Description: pointy.String("description1"),
        FollowScript: nil,
        UnfollowScript: nil,
        SendRequestScript: nil,
        CancelRequestScript: nil,
        AcceptRequestScript: nil,
        RejectRequestScript: nil,
        DeleteFriendScript: nil,
        UpdateProfileScript: nil,
        FollowNotification: nil,
        ReceiveRequestNotification: nil,
        AcceptRequestNotification: nil,
        LogSetting: &friend.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\Friend\Gs2FriendRestClient;
use Gs2\Friend\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")
            ->withFollowScript(null)
            ->withUnfollowScript(null)
            ->withSendRequestScript(null)
            ->withCancelRequestScript(null)
            ->withAcceptRequestScript(null)
            ->withRejectRequestScript(null)
            ->withDeleteFriendScript(null)
            ->withUpdateProfileScript(null)
            ->withFollowNotification(null)
            ->withReceiveRequestNotification(null)
            ->withAcceptRequestNotification(null)
            ->withLogSetting((new \Gs2\Friend\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.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.UpdateNamespaceRequest;
import io.gs2.friend.result.UpdateNamespaceResult;

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

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withFollowScript(null)
            .withUnfollowScript(null)
            .withSendRequestScript(null)
            .withCancelRequestScript(null)
            .withAcceptRequestScript(null)
            .withRejectRequestScript(null)
            .withDeleteFriendScript(null)
            .withUpdateProfileScript(null)
            .withFollowNotification(null)
            .withReceiveRequestNotification(null)
            .withAcceptRequestNotification(null)
            .withLogSetting(new io.gs2.friend.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.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.UpdateNamespaceRequest;
using Gs2.Gs2Friend.Result.UpdateNamespaceResult;

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

AsyncResult<Gs2.Gs2Friend.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
    new Gs2.Gs2Friend.Request.UpdateNamespaceRequest()
        .WithNamespaceName("namespace1")
        .WithDescription("description1")
        .WithFollowScript(null)
        .WithUnfollowScript(null)
        .WithSendRequestScript(null)
        .WithCancelRequestScript(null)
        .WithAcceptRequestScript(null)
        .WithRejectRequestScript(null)
        .WithDeleteFriendScript(null)
        .WithUpdateProfileScript(null)
        .WithFollowNotification(null)
        .WithReceiveRequestNotification(null)
        .WithAcceptRequestNotification(null)
        .WithLogSetting(new Gs2.Gs2Friend.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 Gs2Friend from '@/gs2/friend';

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

try {
    const result = await client.updateNamespace(
        new Gs2Friend.UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withFollowScript(null)
            .withUnfollowScript(null)
            .withSendRequestScript(null)
            .withCancelRequestScript(null)
            .withAcceptRequestScript(null)
            .withRejectRequestScript(null)
            .withDeleteFriendScript(null)
            .withUpdateProfileScript(null)
            .withFollowNotification(null)
            .withReceiveRequestNotification(null)
            .withAcceptRequestNotification(null)
            .withLogSetting(new Gs2Friend.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 friend

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

try:
    result = client.update_namespace(
        friend.UpdateNamespaceRequest()
            .with_namespace_name(self.hash1)
            .with_description('description1')
            .with_follow_script(None)
            .with_unfollow_script(None)
            .with_send_request_script(None)
            .with_cancel_request_script(None)
            .with_accept_request_script(None)
            .with_reject_request_script(None)
            .with_delete_friend_script(None)
            .with_update_profile_script(None)
            .with_follow_notification(None)
            .with_receive_request_notification(None)
            .with_accept_request_notification(None)
            .with_log_setting(
                friend.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('friend')

api_result = client.update_namespace({
    namespaceName='namespace1',
    description='description1',
    followScript=nil,
    unfollowScript=nil,
    sendRequestScript=nil,
    cancelRequestScript=nil,
    acceptRequestScript=nil,
    rejectRequestScript=nil,
    deleteFriendScript=nil,
    updateProfileScript=nil,
    followNotification=nil,
    receiveRequestNotification=nil,
    acceptRequestNotification=nil,
    logSetting={
        loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
    },
})

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

result = api_result.result
item = result.item;

deleteNamespace

ネームスペースを削除

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名

Result

説明
itemNamespace削除したネームスペース

実装例

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

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

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

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

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

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

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

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

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;

getProfile

プロフィールを取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
accessTokenstring~ 128文字ユーザーID

Result

説明
itemProfileプロフィール

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
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 := friend.Gs2FriendRestClient{
    Session: &session,
}
result, err := client.GetProfile(
    &friend.GetProfileRequest {
        NamespaceName: pointy.String("namespace2"),
        AccessToken: pointy.String("$access_token_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\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetProfileRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getProfile(
        (new GetProfileRequest())
            ->withNamespaceName(self::namespace2)
            ->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.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetProfileRequest;
import io.gs2.friend.result.GetProfileResult;

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

try {
    GetProfileResult result = client.getProfile(
        new GetProfileRequest()
            .withNamespaceName("namespace2")
            .withAccessToken("$access_token_0001")
    );
    Profile 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.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.GetProfileRequest;
using Gs2.Gs2Friend.Result.GetProfileResult;

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

AsyncResult<Gs2.Gs2Friend.Result.GetProfileResult> asyncResult = null;
yield return client.GetProfile(
    new Gs2.Gs2Friend.Request.GetProfileRequest()
        .WithNamespaceName("namespace2")
        .WithAccessToken("$access_token_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 Gs2Friend from '@/gs2/friend';

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

try {
    const result = await client.getProfile(
        new Gs2Friend.GetProfileRequest()
            .withNamespaceName("namespace2")
            .withAccessToken("$access_token_0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import friend

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

try:
    result = client.get_profile(
        friend.GetProfileRequest()
            .with_namespace_name(self.hash2)
            .with_access_token(self.access_token_0001)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('friend')

api_result = client.get_profile({
    namespaceName='namespace2',
    accessToken='$access_token_0001',
})

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

result = api_result.result
item = result.item;

getProfileByUserId

ユーザーIDを指定してプロフィールを取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
userIdstring~ 128文字ユーザーID

Result

説明
itemProfileプロフィール

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
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 := friend.Gs2FriendRestClient{
    Session: &session,
}
result, err := client.GetProfileByUserId(
    &friend.GetProfileByUserIdRequest {
        NamespaceName: pointy.String("namespace2"),
        UserId: pointy.String("user-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\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetProfileByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getProfileByUserId(
        (new GetProfileByUserIdRequest())
            ->withNamespaceName(self::namespace2)
            ->withUserId("user-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetProfileByUserIdRequest;
import io.gs2.friend.result.GetProfileByUserIdResult;

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

try {
    GetProfileByUserIdResult result = client.getProfileByUserId(
        new GetProfileByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-0001")
    );
    Profile 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.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.GetProfileByUserIdRequest;
using Gs2.Gs2Friend.Result.GetProfileByUserIdResult;

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

AsyncResult<Gs2.Gs2Friend.Result.GetProfileByUserIdResult> asyncResult = null;
yield return client.GetProfileByUserId(
    new Gs2.Gs2Friend.Request.GetProfileByUserIdRequest()
        .WithNamespaceName("namespace2")
        .WithUserId("user-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 Gs2Friend from '@/gs2/friend';

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

try {
    const result = await client.getProfileByUserId(
        new Gs2Friend.GetProfileByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import friend

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

try:
    result = client.get_profile_by_user_id(
        friend.GetProfileByUserIdRequest()
            .with_namespace_name(self.hash2)
            .with_user_id('user-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('friend')

api_result = client.get_profile_by_user_id({
    namespaceName='namespace2',
    userId='user-0001',
})

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

result = api_result.result
item = result.item;

updateProfile

プロフィールを更新

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
publicProfilestring~ 1024文字公開されるプロフィール
followerProfilestring~ 1024文字フォロワー向けに公開されるプロフィール
friendProfilestring~ 1024文字フレンド向けに公開されるプロフィール

Result

説明
itemProfile更新したプロフィール

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
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 := friend.Gs2FriendRestClient{
    Session: &session,
}
result, err := client.UpdateProfile(
    &friend.UpdateProfileRequest {
        NamespaceName: pointy.String("namespace2"),
        AccessToken: pointy.String("$access_token_0001"),
        PublicProfile: pointy.String("public"),
        FollowerProfile: pointy.String("follower"),
        FriendProfile: pointy.String("friend"),
    }
)
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\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\UpdateProfileRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateProfile(
        (new UpdateProfileRequest())
            ->withNamespaceName(self::namespace2)
            ->withAccessToken(self::$accessToken0001)
            ->withPublicProfile("public")
            ->withFollowerProfile("follower")
            ->withFriendProfile("friend")
    );
    $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.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.UpdateProfileRequest;
import io.gs2.friend.result.UpdateProfileResult;

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

try {
    UpdateProfileResult result = client.updateProfile(
        new UpdateProfileRequest()
            .withNamespaceName("namespace2")
            .withAccessToken("$access_token_0001")
            .withPublicProfile("public")
            .withFollowerProfile("follower")
            .withFriendProfile("friend")
    );
    Profile 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.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.UpdateProfileRequest;
using Gs2.Gs2Friend.Result.UpdateProfileResult;

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

AsyncResult<Gs2.Gs2Friend.Result.UpdateProfileResult> asyncResult = null;
yield return client.UpdateProfile(
    new Gs2.Gs2Friend.Request.UpdateProfileRequest()
        .WithNamespaceName("namespace2")
        .WithAccessToken("$access_token_0001")
        .WithPublicProfile("public")
        .WithFollowerProfile("follower")
        .WithFriendProfile("friend"),
    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 Gs2Friend from '@/gs2/friend';

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

try {
    const result = await client.updateProfile(
        new Gs2Friend.UpdateProfileRequest()
            .withNamespaceName("namespace2")
            .withAccessToken("$access_token_0001")
            .withPublicProfile("public")
            .withFollowerProfile("follower")
            .withFriendProfile("friend")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import friend

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

try:
    result = client.update_profile(
        friend.UpdateProfileRequest()
            .with_namespace_name(self.hash2)
            .with_access_token(self.access_token_0001)
            .with_public_profile('public')
            .with_follower_profile('follower')
            .with_friend_profile('friend')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('friend')

api_result = client.update_profile({
    namespaceName='namespace2',
    accessToken='$access_token_0001',
    publicProfile='public',
    followerProfile='follower',
    friendProfile='friend',
})

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

result = api_result.result
item = result.item;

updateProfileByUserId

ユーザーIDを指定してプロフィールを更新

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
userIdstring~ 128文字ユーザーID
publicProfilestring~ 1024文字公開されるプロフィール
followerProfilestring~ 1024文字フォロワー向けに公開されるプロフィール
friendProfilestring~ 1024文字フレンド向けに公開されるプロフィール

Result

説明
itemProfile更新したプロフィール

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
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 := friend.Gs2FriendRestClient{
    Session: &session,
}
result, err := client.UpdateProfileByUserId(
    &friend.UpdateProfileByUserIdRequest {
        NamespaceName: pointy.String("namespace2"),
        UserId: pointy.String("user-0001"),
        PublicProfile: pointy.String("public2"),
        FollowerProfile: pointy.String("follower2"),
        FriendProfile: pointy.String("friend2"),
    }
)
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\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\UpdateProfileByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateProfileByUserId(
        (new UpdateProfileByUserIdRequest())
            ->withNamespaceName(self::namespace2)
            ->withUserId("user-0001")
            ->withPublicProfile("public2")
            ->withFollowerProfile("follower2")
            ->withFriendProfile("friend2")
    );
    $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.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.UpdateProfileByUserIdRequest;
import io.gs2.friend.result.UpdateProfileByUserIdResult;

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

try {
    UpdateProfileByUserIdResult result = client.updateProfileByUserId(
        new UpdateProfileByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-0001")
            .withPublicProfile("public2")
            .withFollowerProfile("follower2")
            .withFriendProfile("friend2")
    );
    Profile 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.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.UpdateProfileByUserIdRequest;
using Gs2.Gs2Friend.Result.UpdateProfileByUserIdResult;

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

AsyncResult<Gs2.Gs2Friend.Result.UpdateProfileByUserIdResult> asyncResult = null;
yield return client.UpdateProfileByUserId(
    new Gs2.Gs2Friend.Request.UpdateProfileByUserIdRequest()
        .WithNamespaceName("namespace2")
        .WithUserId("user-0001")
        .WithPublicProfile("public2")
        .WithFollowerProfile("follower2")
        .WithFriendProfile("friend2"),
    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 Gs2Friend from '@/gs2/friend';

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

try {
    const result = await client.updateProfileByUserId(
        new Gs2Friend.UpdateProfileByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-0001")
            .withPublicProfile("public2")
            .withFollowerProfile("follower2")
            .withFriendProfile("friend2")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import friend

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

try:
    result = client.update_profile_by_user_id(
        friend.UpdateProfileByUserIdRequest()
            .with_namespace_name(self.hash2)
            .with_user_id('user-0001')
            .with_public_profile('public2')
            .with_follower_profile('follower2')
            .with_friend_profile('friend2')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('friend')

api_result = client.update_profile_by_user_id({
    namespaceName='namespace2',
    userId='user-0001',
    publicProfile='public2',
    followerProfile='follower2',
    friendProfile='friend2',
})

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

result = api_result.result
item = result.item;

deleteProfileByUserId

プロフィールを削除

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
userIdstring~ 128文字ユーザーID

Result

説明
itemProfile削除したプロフィール

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
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 := friend.Gs2FriendRestClient{
    Session: &session,
}
result, err := client.DeleteProfileByUserId(
    &friend.DeleteProfileByUserIdRequest {
        NamespaceName: pointy.String("namespace2"),
        UserId: pointy.String("user-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\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DeleteProfileByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteProfileByUserId(
        (new DeleteProfileByUserIdRequest())
            ->withNamespaceName(self::namespace2)
            ->withUserId("user-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DeleteProfileByUserIdRequest;
import io.gs2.friend.result.DeleteProfileByUserIdResult;

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

try {
    DeleteProfileByUserIdResult result = client.deleteProfileByUserId(
        new DeleteProfileByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-0001")
    );
    Profile 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.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DeleteProfileByUserIdRequest;
using Gs2.Gs2Friend.Result.DeleteProfileByUserIdResult;

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

AsyncResult<Gs2.Gs2Friend.Result.DeleteProfileByUserIdResult> asyncResult = null;
yield return client.DeleteProfileByUserId(
    new Gs2.Gs2Friend.Request.DeleteProfileByUserIdRequest()
        .WithNamespaceName("namespace2")
        .WithUserId("user-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 Gs2Friend from '@/gs2/friend';

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

try {
    const result = await client.deleteProfileByUserId(
        new Gs2Friend.DeleteProfileByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import friend

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

try:
    result = client.delete_profile_by_user_id(
        friend.DeleteProfileByUserIdRequest()
            .with_namespace_name(self.hash2)
            .with_user_id('user-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('friend')

api_result = client.delete_profile_by_user_id({
    namespaceName='namespace2',
    userId='user-0001',
})

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

result = api_result.result
item = result.item;

describeFriends

フレンド一覧を取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
withProfileboolfalseプロフィールも一緒に取得するか
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<FriendUser>フレンドのユーザーのリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
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 := friend.Gs2FriendRestClient{
    Session: &session,
}
result, err := client.DescribeFriends(
    &friend.DescribeFriendsRequest {
        NamespaceName: pointy.String("namespace2"),
        AccessToken: pointy.String("$access_token_0001"),
        WithProfile: nil,
        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\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeFriendsRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeFriends(
        (new DescribeFriendsRequest())
            ->withNamespaceName(self::namespace2)
            ->withAccessToken(self::$accessToken0001)
            ->withWithProfile(null)
            ->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.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeFriendsRequest;
import io.gs2.friend.result.DescribeFriendsResult;

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

try {
    DescribeFriendsResult result = client.describeFriends(
        new DescribeFriendsRequest()
            .withNamespaceName("namespace2")
            .withAccessToken("$access_token_0001")
            .withWithProfile(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<FriendUser> 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.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeFriendsRequest;
using Gs2.Gs2Friend.Result.DescribeFriendsResult;

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

AsyncResult<Gs2.Gs2Friend.Result.DescribeFriendsResult> asyncResult = null;
yield return client.DescribeFriends(
    new Gs2.Gs2Friend.Request.DescribeFriendsRequest()
        .WithNamespaceName("namespace2")
        .WithAccessToken("$access_token_0001")
        .WithWithProfile(null)
        .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 Gs2Friend from '@/gs2/friend';

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

try {
    const result = await client.describeFriends(
        new Gs2Friend.DescribeFriendsRequest()
            .withNamespaceName("namespace2")
            .withAccessToken("$access_token_0001")
            .withWithProfile(null)
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import friend

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

try:
    result = client.describe_friends(
        friend.DescribeFriendsRequest()
            .with_namespace_name(self.hash2)
            .with_access_token(self.access_token_0001)
            .with_with_profile(None)
            .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('friend')

api_result = client.describe_friends({
    namespaceName='namespace2',
    accessToken='$access_token_0001',
    withProfile=nil,
    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;

describeFriendsByUserId

ユーザーIDを指定してフレンド一覧を取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
userIdstring~ 128文字ユーザーID
withProfileboolfalseプロフィールも一緒に取得するか
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<FriendUser>フレンドのユーザーのリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
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 := friend.Gs2FriendRestClient{
    Session: &session,
}
result, err := client.DescribeFriendsByUserId(
    &friend.DescribeFriendsByUserIdRequest {
        NamespaceName: pointy.String("namespace2"),
        UserId: pointy.String("user-0001"),
        WithProfile: nil,
        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\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeFriendsByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeFriendsByUserId(
        (new DescribeFriendsByUserIdRequest())
            ->withNamespaceName(self::namespace2)
            ->withUserId("user-0001")
            ->withWithProfile(null)
            ->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.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeFriendsByUserIdRequest;
import io.gs2.friend.result.DescribeFriendsByUserIdResult;

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

try {
    DescribeFriendsByUserIdResult result = client.describeFriendsByUserId(
        new DescribeFriendsByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-0001")
            .withWithProfile(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<FriendUser> 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.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeFriendsByUserIdRequest;
using Gs2.Gs2Friend.Result.DescribeFriendsByUserIdResult;

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

AsyncResult<Gs2.Gs2Friend.Result.DescribeFriendsByUserIdResult> asyncResult = null;
yield return client.DescribeFriendsByUserId(
    new Gs2.Gs2Friend.Request.DescribeFriendsByUserIdRequest()
        .WithNamespaceName("namespace2")
        .WithUserId("user-0001")
        .WithWithProfile(null)
        .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 Gs2Friend from '@/gs2/friend';

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

try {
    const result = await client.describeFriendsByUserId(
        new Gs2Friend.DescribeFriendsByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-0001")
            .withWithProfile(null)
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import friend

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

try:
    result = client.describe_friends_by_user_id(
        friend.DescribeFriendsByUserIdRequest()
            .with_namespace_name(self.hash2)
            .with_user_id('user-0001')
            .with_with_profile(None)
            .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('friend')

api_result = client.describe_friends_by_user_id({
    namespaceName='namespace2',
    userId='user-0001',
    withProfile=nil,
    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;

describeBlackList

ブラックリストを取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<string>ブラックリストに登録されたユーザIDリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
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 := friend.Gs2FriendRestClient{
    Session: &session,
}
result, err := client.DescribeBlackList(
    &friend.DescribeBlackListRequest {
        NamespaceName: pointy.String("namespace2"),
        AccessToken: pointy.String("$access_token_0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeBlackListRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeBlackList(
        (new DescribeBlackListRequest())
            ->withNamespaceName(self::namespace2)
            ->withAccessToken(self::$accessToken0001)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeBlackListRequest;
import io.gs2.friend.result.DescribeBlackListResult;

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

try {
    DescribeBlackListResult result = client.describeBlackList(
        new DescribeBlackListRequest()
            .withNamespaceName("namespace2")
            .withAccessToken("$access_token_0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<String> 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.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeBlackListRequest;
using Gs2.Gs2Friend.Result.DescribeBlackListResult;

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

AsyncResult<Gs2.Gs2Friend.Result.DescribeBlackListResult> asyncResult = null;
yield return client.DescribeBlackList(
    new Gs2.Gs2Friend.Request.DescribeBlackListRequest()
        .WithNamespaceName("namespace2")
        .WithAccessToken("$access_token_0001")
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';

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

try {
    const result = await client.describeBlackList(
        new Gs2Friend.DescribeBlackListRequest()
            .withNamespaceName("namespace2")
            .withAccessToken("$access_token_0001")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import friend

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

try:
    result = client.describe_black_list(
        friend.DescribeBlackListRequest()
            .with_namespace_name(self.hash2)
            .with_access_token(self.access_token_0001)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('friend')

api_result = client.describe_black_list({
    namespaceName='namespace2',
    accessToken='$access_token_0001',
    pageToken=nil,
    limit=nil,
})

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

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

describeBlackListByUserId

ユーザーIDを指定してブラックリストを取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
userIdstring~ 128文字ユーザーID
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<string>ブラックリストに登録されたユーザIDリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
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 := friend.Gs2FriendRestClient{
    Session: &session,
}
result, err := client.DescribeBlackListByUserId(
    &friend.DescribeBlackListByUserIdRequest {
        NamespaceName: pointy.String("namespace2"),
        UserId: pointy.String("user-0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeBlackListByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeBlackListByUserId(
        (new DescribeBlackListByUserIdRequest())
            ->withNamespaceName(self::namespace2)
            ->withUserId("user-0001")
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeBlackListByUserIdRequest;
import io.gs2.friend.result.DescribeBlackListByUserIdResult;

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

try {
    DescribeBlackListByUserIdResult result = client.describeBlackListByUserId(
        new DescribeBlackListByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<String> 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.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeBlackListByUserIdRequest;
using Gs2.Gs2Friend.Result.DescribeBlackListByUserIdResult;

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

AsyncResult<Gs2.Gs2Friend.Result.DescribeBlackListByUserIdResult> asyncResult = null;
yield return client.DescribeBlackListByUserId(
    new Gs2.Gs2Friend.Request.DescribeBlackListByUserIdRequest()
        .WithNamespaceName("namespace2")
        .WithUserId("user-0001")
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';

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

try {
    const result = await client.describeBlackListByUserId(
        new Gs2Friend.DescribeBlackListByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import friend

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

try:
    result = client.describe_black_list_by_user_id(
        friend.DescribeBlackListByUserIdRequest()
            .with_namespace_name(self.hash2)
            .with_user_id('user-0001')
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('friend')

api_result = client.describe_black_list_by_user_id({
    namespaceName='namespace2',
    userId='user-0001',
    pageToken=nil,
    limit=nil,
})

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

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

registerBlackList

ブラックリストに登録

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
targetUserIdstring~ 128文字ユーザーID

Result

説明
itemBlackListブラックリスト

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
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 := friend.Gs2FriendRestClient{
    Session: &session,
}
result, err := client.RegisterBlackList(
    &friend.RegisterBlackListRequest {
        NamespaceName: pointy.String("namespace2"),
        AccessToken: pointy.String("$access_token_0001"),
        TargetUserId: pointy.String("user-0002"),
    }
)
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\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\RegisterBlackListRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->registerBlackList(
        (new RegisterBlackListRequest())
            ->withNamespaceName(self::namespace2)
            ->withAccessToken(self::$accessToken0001)
            ->withTargetUserId("user-0002")
    );
    $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.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.RegisterBlackListRequest;
import io.gs2.friend.result.RegisterBlackListResult;

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

try {
    RegisterBlackListResult result = client.registerBlackList(
        new RegisterBlackListRequest()
            .withNamespaceName("namespace2")
            .withAccessToken("$access_token_0001")
            .withTargetUserId("user-0002")
    );
    BlackList 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.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.RegisterBlackListRequest;
using Gs2.Gs2Friend.Result.RegisterBlackListResult;

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

AsyncResult<Gs2.Gs2Friend.Result.RegisterBlackListResult> asyncResult = null;
yield return client.RegisterBlackList(
    new Gs2.Gs2Friend.Request.RegisterBlackListRequest()
        .WithNamespaceName("namespace2")
        .WithAccessToken("$access_token_0001")
        .WithTargetUserId("user-0002"),
    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 Gs2Friend from '@/gs2/friend';

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

try {
    const result = await client.registerBlackList(
        new Gs2Friend.RegisterBlackListRequest()
            .withNamespaceName("namespace2")
            .withAccessToken("$access_token_0001")
            .withTargetUserId("user-0002")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import friend

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

try:
    result = client.register_black_list(
        friend.RegisterBlackListRequest()
            .with_namespace_name(self.hash2)
            .with_access_token(self.access_token_0001)
            .with_target_user_id('user-0002')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('friend')

api_result = client.register_black_list({
    namespaceName='namespace2',
    accessToken='$access_token_0001',
    targetUserId='user-0002',
})

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

result = api_result.result
item = result.item;

registerBlackListByUserId

ユーザーIDを指定してブラックリストに登録

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
userIdstring~ 128文字ユーザーID
targetUserIdstring~ 128文字ユーザーID

Result

説明
itemBlackListブラックリスト

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
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 := friend.Gs2FriendRestClient{
    Session: &session,
}
result, err := client.RegisterBlackListByUserId(
    &friend.RegisterBlackListByUserIdRequest {
        NamespaceName: pointy.String("namespace2"),
        UserId: pointy.String("user-0001"),
        TargetUserId: pointy.String("user-0002"),
    }
)
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\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\RegisterBlackListByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->registerBlackListByUserId(
        (new RegisterBlackListByUserIdRequest())
            ->withNamespaceName(self::namespace2)
            ->withUserId("user-0001")
            ->withTargetUserId("user-0002")
    );
    $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.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.RegisterBlackListByUserIdRequest;
import io.gs2.friend.result.RegisterBlackListByUserIdResult;

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

try {
    RegisterBlackListByUserIdResult result = client.registerBlackListByUserId(
        new RegisterBlackListByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-0001")
            .withTargetUserId("user-0002")
    );
    BlackList 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.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.RegisterBlackListByUserIdRequest;
using Gs2.Gs2Friend.Result.RegisterBlackListByUserIdResult;

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

AsyncResult<Gs2.Gs2Friend.Result.RegisterBlackListByUserIdResult> asyncResult = null;
yield return client.RegisterBlackListByUserId(
    new Gs2.Gs2Friend.Request.RegisterBlackListByUserIdRequest()
        .WithNamespaceName("namespace2")
        .WithUserId("user-0001")
        .WithTargetUserId("user-0002"),
    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 Gs2Friend from '@/gs2/friend';

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

try {
    const result = await client.registerBlackListByUserId(
        new Gs2Friend.RegisterBlackListByUserIdRequest()
            .withNamespaceName("namespace2")
            .withUserId("user-0001")
            .withTargetUserId("user-0002")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
<