GS2-Friend SDK API リファレンス
モデル
Namespace
ネームスペース
ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。
GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceId | string | ✓ | ~ 1024文字 | ネームスペースGRN | ||
name | string | ✓ | ~ 128文字 | ネームスペース名 | ||
description | string | ~ 1024文字 | 説明文 | |||
followScript | ScriptSetting | フォローされたときに実行するスクリプト | ||||
unfollowScript | ScriptSetting | アンフォローされたときに実行するスクリプト | ||||
sendRequestScript | ScriptSetting | フレンドリクエストを発行したときに実行するスクリプト | ||||
cancelRequestScript | ScriptSetting | フレンドリクエストをキャンセルしたときに実行するスクリプト | ||||
acceptRequestScript | ScriptSetting | フレンドリクエストを承諾したときに実行するスクリプト | ||||
rejectRequestScript | ScriptSetting | フレンドリクエストを拒否したときに実行するスクリプト | ||||
deleteFriendScript | ScriptSetting | フレンドを削除したときに実行するスクリプト | ||||
updateProfileScript | ScriptSetting | プロフィールを更新したときに実行するスクリプト | ||||
followNotification | NotificationSetting | フォローされたときのプッシュ通知 | ||||
receiveRequestNotification | NotificationSetting | ✓ | フレンドリクエストが届いたときのプッシュ通知 | |||
cancelRequestNotification | NotificationSetting | ✓ | 受け取ったフレンドリクエストがキャンセルされたときのプッシュ通知 | |||
acceptRequestNotification | NotificationSetting | ✓ | フレンドリクエストが承認されたときのプッシュ通知 | |||
rejectRequestNotification | NotificationSetting | ✓ | フレンドリクエストが拒否されたときのプッシュ通知 | |||
deleteFriendNotification | NotificationSetting | ✓ | フレンドが削除されたときのプッシュ通知 | |||
logSetting | LogSetting | ログの出力設定 | ||||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
関連するメソッド
describeNamespaces createNamespace getNamespace updateNamespace deleteNamespace
Profile
プロフィール
プロフィールはゲームプレイヤーに関する情報を格納します。
プロフィールは公開範囲ごとに設定することが可能で、3種類あります。
- friend フレンド関係が成立している相手に閲覧可能な内容
- follow フォローされている相手が閲覧可能な内容
- public 誰でも閲覧可能な内容
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
profileId | string | ✓ | ~ 1024文字 | プロフィールGRN | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
publicProfile | string | ~ 1024文字 | 公開されるプロフィール | |||
followerProfile | string | ~ 1024文字 | フォロワー向けに公開されるプロフィール | |||
friendProfile | string | ~ 1024文字 | フレンド向けに公開されるプロフィール | |||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
関連するメソッド
getProfile getProfileByUserId updateProfile updateProfileByUserId deleteProfileByUserId updateProfileByStampSheet
Follow
フォロー
フォローとは単方向のゲームプレイヤー間の関係です。
フォローリクエストを送信すると直ちに関係が成立します。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
followId | string | ✓ | ~ 1024文字 | フォローGRN | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserIds | List<string> | ~ 1000 items | フォローしているユーザーIDリスト | |||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
Friend
フレンド
フレンドとは双方向で承認されたゲームプレイヤー間の関係です。
フレンド関係を成立させるには一方がリクエストを送信し、もう一方が承認する必要があります。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
friendId | string | ✓ | ~ 1024文字 | フレンドGRN | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserIds | List<string> | ~ 1000 items | フレンドのユーザーIDリスト | |||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
SendBox
送信ボックス
送信したフレンドリクエストのリスト
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
sendBoxId | string | ✓ | ~ 1024文字 | フレンドリクエストの受信ボックスGRN | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserIds | List<string> | ~ 1000 items | フレンドリクエストの宛先ユーザーIDリスト | |||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
Inbox
受信ボックス
受信したフレンドリクエストのリスト
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
inboxId | string | ✓ | ~ 1024文字 | フレンドリクエストの受信ボックスGRN | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
fromUserIds | List<string> | ~ 1000 items | フレンドリクエストを送ってきたユーザーIDリスト | |||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
BlackList
ブラックリスト
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
blackListId | string | ✓ | ~ 1024文字 | ブラックリストGRN | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserIds | List<string> | ~ 10000 items | ブラックリストのユーザーIDリスト | |||
createdAt | long | ✓ | 現在時刻 | 作成日時 (UNIX時間 単位:ミリ秒) | ||
updatedAt | long | ✓ | 現在時刻 | 最終更新日時 (UNIX時間 単位:ミリ秒) | ||
revision | long | 0 | ~ 9223372036854775805 | リビジョン |
関連するメソッド
registerBlackList registerBlackListByUserId unregisterBlackList unregisterBlackListByUserId
FollowUser
フォローしているユーザー
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
publicProfile | string | ~ 1024文字 | 公開されるプロフィール | |||
followerProfile | string | ~ 1024文字 | フォロワー向けに公開されるプロフィール |
関連するメソッド
describeFollows describeFollowsByUserId getFollow getFollowByUserId follow followByUserId unfollow unfollowByUserId
FriendUser
フレンドのユーザー
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
publicProfile | string | ~ 1024文字 | 公開されるプロフィール | |||
friendProfile | string | ~ 1024文字 | フレンド向けに公開されるプロフィール |
関連するメソッド
describeFriends describeFriendsByUserId getFriend getFriendByUserId addFriend addFriendByUserId deleteFriend deleteFriendByUserId
FriendRequest
フレンドリクエスト
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | 送信元 | ||
targetUserId | string | ✓ | ~ 128文字 | 送信先 |
関連するメソッド
describeSendRequests describeSendRequestsByUserId getSendRequest getSendRequestByUserId sendRequest sendRequestByUserId deleteRequest deleteRequestByUserId describeReceiveRequests describeReceiveRequestsByUserId getReceiveRequest getReceiveRequestByUserId acceptRequest acceptRequestByUserId rejectRequest rejectRequestByUserId
SendFriendRequest
送信したフレンドリクエスト
フレンドの登録を申請中である状態を表すエンティティです。
該当ユーザーがほかのユーザーに対して送信したフレンドリクエストです。
送信先のユーザーが承認を行うとフレンドリクエストは削除され、フレンドリストに登録されます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | 送信元 | ||
targetUserId | string | ✓ | ~ 128文字 | 送信先 |
ReceiveFriendRequest
受信したフレンドリクエスト
フレンドの登録申請を受け付けた状態であることを表すエンティティです。
該当ユーザーがほかのユーザーから受信したフレンドリクエストです。
該当ユーザーが承認を行うとフレンドリクエストは削除され、フレンドリストに登録されます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | 送信元 | ||
targetUserId | string | ✓ | ~ 128文字 | 送信先 |
PublicProfile
誰でも閲覧可能なプロフィール
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
publicProfile | string | ~ 1024文字 | 公開されるプロフィール |
関連するメソッド
ScriptSetting
スクリプト設定
GS2 ではマイクロサービスのイベントに関連づけて、カスタムスクリプトを実行することができます。
このモデルは、スクリプトの実行をトリガーするための設定を保持します。
スクリプトの実行方式は大きく2種類あり、それは「同期実行」と「非同期実行」です。
同期実行は、スクリプトの実行が完了するまで処理がブロックされます。
かわりに、スクリプトの実行結果を使ってAPIの実行を止めたり、APIの結果を改ざんすることができます。
一方、非同期実行は、スクリプトの実行が完了するまで処理がブロックされません。
かわりに、スクリプトの実行結果を使ってAPIの実行を止めたり、APIの結果を改ざんすることはできません。
しかし、非同期実行は、スクリプトの実行が完了するまで処理がブロックされないため、APIの応答に影響を与えないため、原則非同期実行を使用することをおすすめします。
非同期実行には実行方式が2種類あり、GS2-Script と Amazon EventBridge があります。
Amazon EventBridge を使用することで、Lua 以外の言語で処理を記述することができます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
triggerScriptId | string | ~ 1024文字 | スクリプトGRN | |||||||||||
doneTriggerTargetType | 文字列列挙型 enum { “none”, “gs2_script”, “aws” } | ✓ | “none” | ~ 128文字 | 完了通知の通知先
| |||||||||
doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024文字 | スクリプトGRN doneTriggerTargetType が “gs2_script” であれば 有効 | ||||||||||
doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024文字 | ネームスペースGRN doneTriggerTargetType が “gs2_script” であれば 有効 |
関連するメソッド
関連するモデル
NotificationSetting
プッシュ通知に関する設定
GS2 のマイクロサービス内で何らかのイベントが発生した際に、プッシュ通知を送信するための設定です。
ここでいうプッシュ通知は GS2-Gateway の提供する WebSocket インターフェースを経由した処理であり、スマートフォンのプッシュ通知とは性質が異なります。
たとえば、マッチメイキングが完了した時やフレンドリクエストが届いた時など、ゲームクライアントの操作とは関係なく状態が変化した際に GS2-Gateway を経由してプッシュ通知をすることで、ゲームクライアントは状態の変化を検知することができます。
GS2-Gateway のプッシュ通知は通知先のデバイスがオフラインだった時に追加の処理としてモバイルプッシュ通知を送信できます。
モバイルプッシュ通知をうまく利用すれば、マッチメイキング中にゲームを終了しても、モバイルプッシュ通知を使用してプレイヤーに通知し、ゲームに戻ってくるフローを実現できる可能性があります。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
gatewayNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:gateway:default” | ~ 1024文字 | プッシュ通知に使用する GS2-Gateway のネームスペース | |
enableTransferMobileNotification | bool? | false | モバイルプッシュ通知へ転送するか | |||
sound | string | {enableTransferMobileNotification} == true | ~ 1024文字 | モバイルプッシュ通知で使用するサウンドファイル名 enableTransferMobileNotification が true であれば 有効 |
関連するメソッド
関連するモデル
LogSetting
ログの書き出し設定
ログデータの書き出し設定を管理します。この型は、ログデータを書き出すために使用されるログ名前空間の識別子(Namespace ID)を保持します。
ログ名前空間IDは、ログデータを集約し、保存する対象の GS2-Log の名前空間を指定します。
この設定を通じて、この名前空間以下のAPIリクエスト・レスポンスログデータが対象の GS2-Log へ出力されるようになります。
GS2-Log にはリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
loggingNamespaceId | string | ✓ | ~ 1024文字 | ネームスペースGRN |
関連するメソッド
関連するモデル
メソッド
describeNamespaces
ネームスペースの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | List<Namespace> | ネームスペースのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
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;
client = gs2('friend')
api_result_handler = client.describe_namespaces_async({
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
name | string | ✓ | ~ 128文字 | ネームスペース名 | ||
description | string | ~ 1024文字 | 説明文 | |||
followScript | ScriptSetting | フォローされたときに実行するスクリプト | ||||
unfollowScript | ScriptSetting | アンフォローされたときに実行するスクリプト | ||||
sendRequestScript | ScriptSetting | フレンドリクエストを発行したときに実行するスクリプト | ||||
cancelRequestScript | ScriptSetting | フレンドリクエストをキャンセルしたときに実行するスクリプト | ||||
acceptRequestScript | ScriptSetting | フレンドリクエストを承諾したときに実行するスクリプト | ||||
rejectRequestScript | ScriptSetting | フレンドリクエストを拒否したときに実行するスクリプト | ||||
deleteFriendScript | ScriptSetting | フレンドを削除したときに実行するスクリプト | ||||
updateProfileScript | ScriptSetting | プロフィールを更新したときに実行するスクリプト | ||||
followNotification | NotificationSetting | フォローされたときのプッシュ通知 | ||||
receiveRequestNotification | NotificationSetting | ✓ | フレンドリクエストが届いたときのプッシュ通知 | |||
cancelRequestNotification | NotificationSetting | ✓ | 受け取ったフレンドリクエストがキャンセルされたときのプッシュ通知 | |||
acceptRequestNotification | NotificationSetting | ✓ | フレンドリクエストが承認されたときのプッシュ通知 | |||
rejectRequestNotification | NotificationSetting | ✓ | フレンドリクエストが拒否されたときのプッシュ通知 | |||
deleteFriendNotification | NotificationSetting | ✓ | フレンドが削除されたときのプッシュ通知 | |||
logSetting | LogSetting | ログの出力設定 |
Result
型 | 説明 | |
---|---|---|
item | Namespace | 作成したネームスペース |
実装例
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("namespace-0001"),
Description: nil,
FollowScript: nil,
UnfollowScript: nil,
SendRequestScript: nil,
CancelRequestScript: nil,
AcceptRequestScript: nil,
RejectRequestScript: nil,
DeleteFriendScript: nil,
UpdateProfileScript: nil,
FollowNotification: nil,
ReceiveRequestNotification: nil,
CancelRequestNotification: nil,
AcceptRequestNotification: nil,
RejectRequestNotification: nil,
DeleteFriendNotification: nil,
LogSetting: &friend.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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("namespace-0001")
->withDescription(null)
->withFollowScript(null)
->withUnfollowScript(null)
->withSendRequestScript(null)
->withCancelRequestScript(null)
->withAcceptRequestScript(null)
->withRejectRequestScript(null)
->withDeleteFriendScript(null)
->withUpdateProfileScript(null)
->withFollowNotification(null)
->withReceiveRequestNotification(null)
->withCancelRequestNotification(null)
->withAcceptRequestNotification(null)
->withRejectRequestNotification(null)
->withDeleteFriendNotification(null)
->withLogSetting((new \Gs2\Friend\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace-0001")
.withDescription(null)
.withFollowScript(null)
.withUnfollowScript(null)
.withSendRequestScript(null)
.withCancelRequestScript(null)
.withAcceptRequestScript(null)
.withRejectRequestScript(null)
.withDeleteFriendScript(null)
.withUpdateProfileScript(null)
.withFollowNotification(null)
.withReceiveRequestNotification(null)
.withCancelRequestNotification(null)
.withAcceptRequestNotification(null)
.withRejectRequestNotification(null)
.withDeleteFriendNotification(null)
.withLogSetting(new io.gs2.friend.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.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("namespace-0001")
.WithDescription(null)
.WithFollowScript(null)
.WithUnfollowScript(null)
.WithSendRequestScript(null)
.WithCancelRequestScript(null)
.WithAcceptRequestScript(null)
.WithRejectRequestScript(null)
.WithDeleteFriendScript(null)
.WithUpdateProfileScript(null)
.WithFollowNotification(null)
.WithReceiveRequestNotification(null)
.WithCancelRequestNotification(null)
.WithAcceptRequestNotification(null)
.WithRejectRequestNotification(null)
.WithDeleteFriendNotification(null)
.WithLogSetting(new Gs2.Gs2Friend.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace-0001")
.withDescription(null)
.withFollowScript(null)
.withUnfollowScript(null)
.withSendRequestScript(null)
.withCancelRequestScript(null)
.withAcceptRequestScript(null)
.withRejectRequestScript(null)
.withDeleteFriendScript(null)
.withUpdateProfileScript(null)
.withFollowNotification(null)
.withReceiveRequestNotification(null)
.withCancelRequestNotification(null)
.withAcceptRequestNotification(null)
.withRejectRequestNotification(null)
.withDeleteFriendNotification(null)
.withLogSetting(new Gs2Friend.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import 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('namespace-0001')
.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_cancel_request_notification(None)
.with_accept_request_notification(None)
.with_reject_request_notification(None)
.with_delete_friend_notification(None)
.with_log_setting(
friend.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.create_namespace({
name="namespace-0001",
description=nil,
followScript=nil,
unfollowScript=nil,
sendRequestScript=nil,
cancelRequestScript=nil,
acceptRequestScript=nil,
rejectRequestScript=nil,
deleteFriendScript=nil,
updateProfileScript=nil,
followNotification=nil,
receiveRequestNotification=nil,
cancelRequestNotification=nil,
acceptRequestNotification=nil,
rejectRequestNotification=nil,
deleteFriendNotification=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.create_namespace_async({
name="namespace-0001",
description=nil,
followScript=nil,
unfollowScript=nil,
sendRequestScript=nil,
cancelRequestScript=nil,
acceptRequestScript=nil,
rejectRequestScript=nil,
deleteFriendScript=nil,
updateProfileScript=nil,
followNotification=nil,
receiveRequestNotification=nil,
cancelRequestNotification=nil,
acceptRequestNotification=nil,
rejectRequestNotification=nil,
deleteFriendNotification=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
status | string |
実装例
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("namespace-0001"),
}
)
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("namespace-0001")
);
$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("namespace-0001")
);
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("namespace-0001"),
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("namespace-0001")
);
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('namespace-0001')
)
status = result.status
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_namespace_status({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
status = result.status;
client = gs2('friend')
api_result_handler = client.get_namespace_status_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
item | Namespace | ネームスペース |
実装例
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("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace-0001")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.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("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace-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_namespace(
friend.GetNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_namespace({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.get_namespace_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
description | string | ~ 1024文字 | 説明文 | |||
followScript | ScriptSetting | フォローされたときに実行するスクリプト | ||||
unfollowScript | ScriptSetting | アンフォローされたときに実行するスクリプト | ||||
sendRequestScript | ScriptSetting | フレンドリクエストを発行したときに実行するスクリプト | ||||
cancelRequestScript | ScriptSetting | フレンドリクエストをキャンセルしたときに実行するスクリプト | ||||
acceptRequestScript | ScriptSetting | フレンドリクエストを承諾したときに実行するスクリプト | ||||
rejectRequestScript | ScriptSetting | フレンドリクエストを拒否したときに実行するスクリプト | ||||
deleteFriendScript | ScriptSetting | フレンドを削除したときに実行するスクリプト | ||||
updateProfileScript | ScriptSetting | プロフィールを更新したときに実行するスクリプト | ||||
followNotification | NotificationSetting | フォローされたときのプッシュ通知 | ||||
receiveRequestNotification | NotificationSetting | ✓ | フレンドリクエストが届いたときのプッシュ通知 | |||
cancelRequestNotification | NotificationSetting | ✓ | 受け取ったフレンドリクエストがキャンセルされたときのプッシュ通知 | |||
acceptRequestNotification | NotificationSetting | ✓ | フレンドリクエストが承認されたときのプッシュ通知 | |||
rejectRequestNotification | NotificationSetting | ✓ | フレンドリクエストが拒否されたときのプッシュ通知 | |||
deleteFriendNotification | NotificationSetting | ✓ | フレンドが削除されたときのプッシュ通知 | |||
logSetting | LogSetting | ログの出力設定 |
Result
型 | 説明 | |
---|---|---|
item | Namespace | 更新したネームスペース |
実装例
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("namespace-0001"),
Description: pointy.String("description1"),
FollowScript: nil,
UnfollowScript: nil,
SendRequestScript: nil,
CancelRequestScript: nil,
AcceptRequestScript: nil,
RejectRequestScript: nil,
DeleteFriendScript: nil,
UpdateProfileScript: nil,
FollowNotification: nil,
ReceiveRequestNotification: nil,
CancelRequestNotification: nil,
AcceptRequestNotification: nil,
RejectRequestNotification: nil,
DeleteFriendNotification: nil,
LogSetting: &friend.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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("namespace-0001")
->withDescription("description1")
->withFollowScript(null)
->withUnfollowScript(null)
->withSendRequestScript(null)
->withCancelRequestScript(null)
->withAcceptRequestScript(null)
->withRejectRequestScript(null)
->withDeleteFriendScript(null)
->withUpdateProfileScript(null)
->withFollowNotification(null)
->withReceiveRequestNotification(null)
->withCancelRequestNotification(null)
->withAcceptRequestNotification(null)
->withRejectRequestNotification(null)
->withDeleteFriendNotification(null)
->withLogSetting((new \Gs2\Friend\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace-0001")
.withDescription("description1")
.withFollowScript(null)
.withUnfollowScript(null)
.withSendRequestScript(null)
.withCancelRequestScript(null)
.withAcceptRequestScript(null)
.withRejectRequestScript(null)
.withDeleteFriendScript(null)
.withUpdateProfileScript(null)
.withFollowNotification(null)
.withReceiveRequestNotification(null)
.withCancelRequestNotification(null)
.withAcceptRequestNotification(null)
.withRejectRequestNotification(null)
.withDeleteFriendNotification(null)
.withLogSetting(new io.gs2.friend.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.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("namespace-0001")
.WithDescription("description1")
.WithFollowScript(null)
.WithUnfollowScript(null)
.WithSendRequestScript(null)
.WithCancelRequestScript(null)
.WithAcceptRequestScript(null)
.WithRejectRequestScript(null)
.WithDeleteFriendScript(null)
.WithUpdateProfileScript(null)
.WithFollowNotification(null)
.WithReceiveRequestNotification(null)
.WithCancelRequestNotification(null)
.WithAcceptRequestNotification(null)
.WithRejectRequestNotification(null)
.WithDeleteFriendNotification(null)
.WithLogSetting(new Gs2.Gs2Friend.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace-0001")
.withDescription("description1")
.withFollowScript(null)
.withUnfollowScript(null)
.withSendRequestScript(null)
.withCancelRequestScript(null)
.withAcceptRequestScript(null)
.withRejectRequestScript(null)
.withDeleteFriendScript(null)
.withUpdateProfileScript(null)
.withFollowNotification(null)
.withReceiveRequestNotification(null)
.withCancelRequestNotification(null)
.withAcceptRequestNotification(null)
.withRejectRequestNotification(null)
.withDeleteFriendNotification(null)
.withLogSetting(new Gs2Friend.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import 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('namespace-0001')
.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_cancel_request_notification(None)
.with_accept_request_notification(None)
.with_reject_request_notification(None)
.with_delete_friend_notification(None)
.with_log_setting(
friend.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.update_namespace({
namespaceName="namespace-0001",
description="description1",
followScript=nil,
unfollowScript=nil,
sendRequestScript=nil,
cancelRequestScript=nil,
acceptRequestScript=nil,
rejectRequestScript=nil,
deleteFriendScript=nil,
updateProfileScript=nil,
followNotification=nil,
receiveRequestNotification=nil,
cancelRequestNotification=nil,
acceptRequestNotification=nil,
rejectRequestNotification=nil,
deleteFriendNotification=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.update_namespace_async({
namespaceName="namespace-0001",
description="description1",
followScript=nil,
unfollowScript=nil,
sendRequestScript=nil,
cancelRequestScript=nil,
acceptRequestScript=nil,
rejectRequestScript=nil,
deleteFriendScript=nil,
updateProfileScript=nil,
followNotification=nil,
receiveRequestNotification=nil,
cancelRequestNotification=nil,
acceptRequestNotification=nil,
rejectRequestNotification=nil,
deleteFriendNotification=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 |
Result
型 | 説明 | |
---|---|---|
item | Namespace | 削除したネームスペース |
実装例
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("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace-0001")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.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("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace-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_namespace(
friend.DeleteNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.delete_namespace({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.delete_namespace_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getServiceVersion
マイクロサービスのバージョンを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
---|
Result
型 | 説明 | |
---|---|---|
item | string | バージョン |
実装例
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.GetServiceVersion(
&friend.GetServiceVersionRequest {
}
)
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\GetServiceVersionRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getServiceVersion(
(new GetServiceVersionRequest())
);
$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.GetServiceVersionRequest;
import io.gs2.friend.result.GetServiceVersionResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetServiceVersionResult result = client.getServiceVersion(
new GetServiceVersionRequest()
);
String 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.GetServiceVersionRequest;
using Gs2.Gs2Friend.Result.GetServiceVersionResult;
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.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
new Gs2.Gs2Friend.Request.GetServiceVersionRequest(),
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.getServiceVersion(
new Gs2Friend.GetServiceVersionRequest()
);
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_service_version(
friend.GetServiceVersionRequest()
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_service_version({
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.get_service_version_async({
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
dumpUserDataByUserId
指定したユーザーIDに紐づくデータのダンプを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 |
---|
実装例
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.DumpUserDataByUserId(
&friend.DumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->dumpUserDataByUserId(
(new DumpUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DumpUserDataByUserIdRequest;
import io.gs2.friend.result.DumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DumpUserDataByUserIdResult result = client.dumpUserDataByUserId(
new DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DumpUserDataByUserIdRequest;
using Gs2.Gs2Friend.Result.DumpUserDataByUserIdResult;
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.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
new Gs2.Gs2Friend.Request.DumpUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as 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.dumpUserDataByUserId(
new Gs2Friend.DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} 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.dump_user_data_by_user_id(
friend.DumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.dump_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
client = gs2('friend')
api_result_handler = client.dump_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
checkDumpUserDataByUserId
指定したユーザーIDに紐づくデータのダンプが完了しているか確認
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
url | string | 出力データのURL |
実装例
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.CheckDumpUserDataByUserId(
&friend.CheckDumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.Url
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\CheckDumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->checkDumpUserDataByUserId(
(new CheckDumpUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$url = $result->getUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.friend.result.CheckDumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
CheckDumpUserDataByUserIdResult result = client.checkDumpUserDataByUserId(
new CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
String url = result.getUrl();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.CheckDumpUserDataByUserIdRequest;
using Gs2.Gs2Friend.Result.CheckDumpUserDataByUserIdResult;
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.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
new Gs2.Gs2Friend.Request.CheckDumpUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;
import Gs2Core from '@/gs2/core';
import * as 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.checkDumpUserDataByUserId(
new Gs2Friend.CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} 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.check_dump_user_data_by_user_id(
friend.CheckDumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.check_dump_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
client = gs2('friend')
api_result_handler = client.check_dump_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
cleanUserDataByUserId
指定したユーザーIDに紐づくデータのダンプを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 |
---|
実装例
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.CleanUserDataByUserId(
&friend.CleanUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\CleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->cleanUserDataByUserId(
(new CleanUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.CleanUserDataByUserIdRequest;
import io.gs2.friend.result.CleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
CleanUserDataByUserIdResult result = client.cleanUserDataByUserId(
new CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.CleanUserDataByUserIdRequest;
using Gs2.Gs2Friend.Result.CleanUserDataByUserIdResult;
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.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
new Gs2.Gs2Friend.Request.CleanUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as 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.cleanUserDataByUserId(
new Gs2Friend.CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} 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.clean_user_data_by_user_id(
friend.CleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.clean_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
client = gs2('friend')
api_result_handler = client.clean_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
checkCleanUserDataByUserId
指定したユーザーIDに紐づくデータのダンプが完了しているか確認
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 |
---|
実装例
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.CheckCleanUserDataByUserId(
&friend.CheckCleanUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\CheckCleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->checkCleanUserDataByUserId(
(new CheckCleanUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.friend.result.CheckCleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
CheckCleanUserDataByUserIdResult result = client.checkCleanUserDataByUserId(
new CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.CheckCleanUserDataByUserIdRequest;
using Gs2.Gs2Friend.Result.CheckCleanUserDataByUserIdResult;
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.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
new Gs2.Gs2Friend.Request.CheckCleanUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as 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.checkCleanUserDataByUserId(
new Gs2Friend.CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} 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.check_clean_user_data_by_user_id(
friend.CheckCleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.check_clean_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
client = gs2('friend')
api_result_handler = client.check_clean_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
prepareImportUserDataByUserId
指定したユーザーIDに紐づくデータのインポートを開始
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
uploadToken | string | アップロード後に結果を反映する際に使用するトークン |
uploadUrl | string | ユーザーデータアップロード処理の実行に使用するURL |
実装例
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.PrepareImportUserDataByUserId(
&friend.PrepareImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\PrepareImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->prepareImportUserDataByUserId(
(new PrepareImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$uploadToken = $result->getUploadToken();
$uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.friend.result.PrepareImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
PrepareImportUserDataByUserIdResult result = client.prepareImportUserDataByUserId(
new PrepareImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
String uploadToken = result.getUploadToken();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.PrepareImportUserDataByUserIdRequest;
using Gs2.Gs2Friend.Result.PrepareImportUserDataByUserIdResult;
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.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
new Gs2.Gs2Friend.Request.PrepareImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;
import Gs2Core from '@/gs2/core';
import * as 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.prepareImportUserDataByUserId(
new Gs2Friend.PrepareImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const uploadToken = result.getUploadToken();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.prepare_import_user_data_by_user_id(
friend.PrepareImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
upload_token = result.upload_token
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.prepare_import_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;
client = gs2('friend')
api_result_handler = client.prepare_import_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;
importUserDataByUserId
指定したユーザーIDに紐づくデータのインポートを開始
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
uploadToken | string | ✓ | ~ 1024文字 | アップロード準備で受け取ったトークン | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 |
---|
実装例
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.ImportUserDataByUserId(
&friend.ImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\ImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->importUserDataByUserId(
(new ImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withUploadToken("upload-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.ImportUserDataByUserIdRequest;
import io.gs2.friend.result.ImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
ImportUserDataByUserIdResult result = client.importUserDataByUserId(
new ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.ImportUserDataByUserIdRequest;
using Gs2.Gs2Friend.Result.ImportUserDataByUserIdResult;
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.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
new Gs2.Gs2Friend.Request.ImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithUploadToken("upload-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as 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.importUserDataByUserId(
new Gs2Friend.ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} 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.import_user_data_by_user_id(
friend.ImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_upload_token('upload-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.import_user_data_by_user_id({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
client = gs2('friend')
api_result_handler = client.import_user_data_by_user_id_async({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
checkImportUserDataByUserId
指定したユーザーIDに紐づくデータのインポートが完了しているか確認
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
uploadToken | string | ✓ | ~ 1024文字 | アップロード準備で受け取ったトークン | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
url | string | 出力ログのURL |
実装例
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.CheckImportUserDataByUserId(
&friend.CheckImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.Url
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\CheckImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->checkImportUserDataByUserId(
(new CheckImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withUploadToken("upload-0001")
->withTimeOffsetToken(null)
);
$url = $result->getUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.CheckImportUserDataByUserIdRequest;
import io.gs2.friend.result.CheckImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
CheckImportUserDataByUserIdResult result = client.checkImportUserDataByUserId(
new CheckImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
String url = result.getUrl();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.CheckImportUserDataByUserIdRequest;
using Gs2.Gs2Friend.Result.CheckImportUserDataByUserIdResult;
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.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
new Gs2.Gs2Friend.Request.CheckImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithUploadToken("upload-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;
import Gs2Core from '@/gs2/core';
import * as 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.checkImportUserDataByUserId(
new Gs2Friend.CheckImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.check_import_user_data_by_user_id(
friend.CheckImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_upload_token('upload-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.check_import_user_data_by_user_id({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
client = gs2('friend')
api_result_handler = client.check_import_user_data_by_user_id_async({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
url = result.url;
getProfile
プロフィールを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン |
Result
型 | 説明 | |
---|---|---|
item | Profile | プロフィール |
実装例
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("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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("namespace-0001")
->withAccessToken("accessToken-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.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("namespace-0001")
.withAccessToken("accessToken-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("namespace-0001")
.WithAccessToken("accessToken-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace-0001")
.withAccessToken("accessToken-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('namespace-0001')
.with_access_token('accessToken-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_profile({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.get_profile_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | Profile | プロフィール |
実装例
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("namespace-0001"),
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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("namespace-0001")
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
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("namespace-0001")
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
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('namespace-0001')
.with_user_id('user-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_profile_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.get_profile_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
publicProfile | string | ~ 1024文字 | 公開されるプロフィール | |||
followerProfile | string | ~ 1024文字 | フォロワー向けに公開されるプロフィール | |||
friendProfile | string | ~ 1024文字 | フレンド向けに公開されるプロフィール |
Result
型 | 説明 | |
---|---|---|
item | Profile | 更新したプロフィール |
実装例
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("namespace-0001"),
AccessToken: pointy.String("accessToken-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("namespace-0001")
->withAccessToken("accessToken-0001")
->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("namespace-0001")
.withAccessToken("accessToken-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("namespace-0001")
.WithAccessToken("accessToken-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("namespace-0001")
.withAccessToken("accessToken-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('namespace-0001')
.with_access_token('accessToken-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="namespace-0001",
accessToken="accessToken-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;
client = gs2('friend')
api_result_handler = client.update_profile_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
publicProfile="public",
followerProfile="follower",
friendProfile="friend",
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
publicProfile | string | ~ 1024文字 | 公開されるプロフィール | |||
followerProfile | string | ~ 1024文字 | フォロワー向けに公開されるプロフィール | |||
friendProfile | string | ~ 1024文字 | フレンド向けに公開されるプロフィール | |||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | Profile | 更新したプロフィール |
実装例
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("namespace-0001"),
UserId: pointy.String("user-0001"),
PublicProfile: pointy.String("public2"),
FollowerProfile: pointy.String("follower2"),
FriendProfile: pointy.String("friend2"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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("namespace-0001")
->withUserId("user-0001")
->withPublicProfile("public2")
->withFollowerProfile("follower2")
->withFriendProfile("friend2")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace-0001")
.withUserId("user-0001")
.withPublicProfile("public2")
.withFollowerProfile("follower2")
.withFriendProfile("friend2")
.withTimeOffsetToken(null)
);
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("namespace-0001")
.WithUserId("user-0001")
.WithPublicProfile("public2")
.WithFollowerProfile("follower2")
.WithFriendProfile("friend2")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace-0001")
.withUserId("user-0001")
.withPublicProfile("public2")
.withFollowerProfile("follower2")
.withFriendProfile("friend2")
.withTimeOffsetToken(null)
);
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('namespace-0001')
.with_user_id('user-0001')
.with_public_profile('public2')
.with_follower_profile('follower2')
.with_friend_profile('friend2')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.update_profile_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
publicProfile="public2",
followerProfile="follower2",
friendProfile="friend2",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.update_profile_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
publicProfile="public2",
followerProfile="follower2",
friendProfile="friend2",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | Profile | 削除したプロフィール |
実装例
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("namespace-0001"),
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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("namespace-0001")
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
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("namespace-0001")
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
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('namespace-0001')
.with_user_id('user-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.delete_profile_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.delete_profile_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateProfileByStampSheet
入手アクションとしてプロフィールを更新
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
stampSheet | string | ✓ | ~ 5242880文字 | トランザクション | ||
keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN |
Result
型 | 説明 | |
---|---|---|
item | Profile | 更新したプロフィール |
実装例
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.UpdateProfileByStampSheet(
&friend.UpdateProfileByStampSheetRequest {
StampSheet: pointy.String("stampSheet"),
KeyId: pointy.String("key-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\UpdateProfileByStampSheetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateProfileByStampSheet(
(new UpdateProfileByStampSheetRequest())
->withStampSheet("stampSheet")
->withKeyId("key-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.UpdateProfileByStampSheetRequest;
import io.gs2.friend.result.UpdateProfileByStampSheetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
UpdateProfileByStampSheetResult result = client.updateProfileByStampSheet(
new UpdateProfileByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-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.UpdateProfileByStampSheetRequest;
using Gs2.Gs2Friend.Result.UpdateProfileByStampSheetResult;
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.UpdateProfileByStampSheetResult> asyncResult = null;
yield return client.UpdateProfileByStampSheet(
new Gs2.Gs2Friend.Request.UpdateProfileByStampSheetRequest()
.WithStampSheet("stampSheet")
.WithKeyId("key-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.updateProfileByStampSheet(
new Gs2Friend.UpdateProfileByStampSheetRequest()
.withStampSheet("stampSheet")
.withKeyId("key-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.update_profile_by_stamp_sheet(
friend.UpdateProfileByStampSheetRequest()
.with_stamp_sheet('stampSheet')
.with_key_id('key-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.update_profile_by_stamp_sheet({
stampSheet="stampSheet",
keyId="key-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.update_profile_by_stamp_sheet_async({
stampSheet="stampSheet",
keyId="key-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
withProfile | bool | ✓ | false | プロフィールも一緒に取得するか | ||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | List<FriendUser> | フレンドのユーザーのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
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("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
WithProfile: pointy.Bool(true),
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("namespace-0001")
->withAccessToken("accessToken-0001")
->withWithProfile(True)
->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("namespace-0001")
.withAccessToken("accessToken-0001")
.withWithProfile(true)
.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("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithWithProfile(true)
.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("namespace-0001")
.withAccessToken("accessToken-0001")
.withWithProfile(true)
.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('namespace-0001')
.with_access_token('accessToken-0001')
.with_with_profile(True)
.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="namespace-0001",
accessToken="accessToken-0001",
withProfile=true,
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;
client = gs2('friend')
api_result_handler = client.describe_friends_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
withProfile=true,
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
withProfile | bool | ✓ | false | プロフィールも一緒に取得するか | ||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 | |
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
items | List<FriendUser> | フレンドのユーザーのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
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("namespace-0001"),
UserId: pointy.String("user-0001"),
WithProfile: pointy.Bool(true),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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("namespace-0001")
->withUserId("user-0001")
->withWithProfile(True)
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace-0001")
.withUserId("user-0001")
.withWithProfile(true)
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(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("namespace-0001")
.WithUserId("user-0001")
.WithWithProfile(true)
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as 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("namespace-0001")
.withUserId("user-0001")
.withWithProfile(true)
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import 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('namespace-0001')
.with_user_id('user-0001')
.with_with_profile(True)
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.describe_friends_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
withProfile=true,
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('friend')
api_result_handler = client.describe_friends_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
withProfile=true,
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | List<string> | ブラックリストに登録されたユーザIDリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
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("namespace-0001"),
AccessToken: pointy.String("accessToken-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("namespace-0001")
->withAccessToken("accessToken-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.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("namespace-0001")
.withAccessToken("accessToken-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("namespace-0001")
.WithAccessToken("accessToken-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("namespace-0001")
.withAccessToken("accessToken-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('namespace-0001')
.with_access_token('accessToken-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="namespace-0001",
accessToken="accessToken-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;
client = gs2('friend')
api_result_handler = client.describe_black_list_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 | |
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
items | List<string> | ブラックリストに登録されたユーザIDリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
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("namespace-0001"),
UserId: pointy.String("user-0001"),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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("namespace-0001")
->withUserId("user-0001")
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace-0001")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(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("namespace-0001")
.WithUserId("user-0001")
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as 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("namespace-0001")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import 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('namespace-0001')
.with_user_id('user-0001')
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.describe_black_list_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('friend')
api_result_handler = client.describe_black_list_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID |
Result
型 | 説明 | |
---|---|---|
item | BlackList | ブラックリスト |
実装例
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("namespace-0001"),
AccessToken: pointy.String("accessToken-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("namespace-0001")
->withAccessToken("accessToken-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.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("namespace-0001")
.withAccessToken("accessToken-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("namespace-0001")
.WithAccessToken("accessToken-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("namespace-0001")
.withAccessToken("accessToken-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('namespace-0001')
.with_access_token('accessToken-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="namespace-0001",
accessToken="accessToken-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;
client = gs2('friend')
api_result_handler = client.register_black_list_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
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
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | BlackList | ブラックリスト |
実装例
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("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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("namespace-0001")
->withUserId("user-0001")
->withTargetUserId("user-0002")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
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("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId("user-0002")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
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_by_user_id(
friend.RegisterBlackListByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id('user-0002')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.register_black_list_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.register_black_list_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
unregisterBlackList
ブラックリストからユーザを削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID |
Result
型 | 説明 | |
---|---|---|
item | BlackList | ブラックリスト |
実装例
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.UnregisterBlackList(
&friend.UnregisterBlackListRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-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\UnregisterBlackListRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->unregisterBlackList(
(new UnregisterBlackListRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-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.UnregisterBlackListRequest;
import io.gs2.friend.result.UnregisterBlackListResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
UnregisterBlackListResult result = client.unregisterBlackList(
new UnregisterBlackListRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-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.UnregisterBlackListRequest;
using Gs2.Gs2Friend.Result.UnregisterBlackListResult;
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.UnregisterBlackListResult> asyncResult = null;
yield return client.UnregisterBlackList(
new Gs2.Gs2Friend.Request.UnregisterBlackListRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-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.unregisterBlackList(
new Gs2Friend.UnregisterBlackListRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-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.unregister_black_list(
friend.UnregisterBlackListRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.unregister_black_list({
namespaceName="namespace-0001",
accessToken="accessToken-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;
client = gs2('friend')
api_result_handler = client.unregister_black_list_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
unregisterBlackListByUserId
ユーザーIDを指定してブラックリストからユーザを削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | BlackList | ブラックリスト |
実装例
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.UnregisterBlackListByUserId(
&friend.UnregisterBlackListByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\UnregisterBlackListByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->unregisterBlackListByUserId(
(new UnregisterBlackListByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId("user-0002")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.UnregisterBlackListByUserIdRequest;
import io.gs2.friend.result.UnregisterBlackListByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
UnregisterBlackListByUserIdResult result = client.unregisterBlackListByUserId(
new UnregisterBlackListByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
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.UnregisterBlackListByUserIdRequest;
using Gs2.Gs2Friend.Result.UnregisterBlackListByUserIdResult;
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.UnregisterBlackListByUserIdResult> asyncResult = null;
yield return client.UnregisterBlackListByUserId(
new Gs2.Gs2Friend.Request.UnregisterBlackListByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId("user-0002")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.unregisterBlackListByUserId(
new Gs2Friend.UnregisterBlackListByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
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.unregister_black_list_by_user_id(
friend.UnregisterBlackListByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id('user-0002')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.unregister_black_list_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.unregister_black_list_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
describeFollows
フォローの一覧取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
withProfile | bool | ✓ | false | プロフィールも一緒に取得するか | ||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | List<FollowUser> | フォローしているユーザーのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
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.DescribeFollows(
&friend.DescribeFollowsRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
WithProfile: pointy.Bool(true),
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\DescribeFollowsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeFollows(
(new DescribeFollowsRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withWithProfile(True)
->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.DescribeFollowsRequest;
import io.gs2.friend.result.DescribeFollowsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeFollowsResult result = client.describeFollows(
new DescribeFollowsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withWithProfile(true)
.withPageToken(null)
.withLimit(null)
);
List<FollowUser> 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.DescribeFollowsRequest;
using Gs2.Gs2Friend.Result.DescribeFollowsResult;
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.DescribeFollowsResult> asyncResult = null;
yield return client.DescribeFollows(
new Gs2.Gs2Friend.Request.DescribeFollowsRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithWithProfile(true)
.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.describeFollows(
new Gs2Friend.DescribeFollowsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withWithProfile(true)
.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_follows(
friend.DescribeFollowsRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_with_profile(True)
.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_follows({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
withProfile=true,
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;
client = gs2('friend')
api_result_handler = client.describe_follows_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
withProfile=true,
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
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;
describeFollowsByUserId
ユーザーIDを指定してフォローの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
withProfile | bool | ✓ | false | プロフィールも一緒に取得するか | ||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 | |
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
items | List<FollowUser> | フォローしているユーザーのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
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.DescribeFollowsByUserId(
&friend.DescribeFollowsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
WithProfile: pointy.Bool(true),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeFollowsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeFollowsByUserId(
(new DescribeFollowsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withWithProfile(True)
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeFollowsByUserIdRequest;
import io.gs2.friend.result.DescribeFollowsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeFollowsByUserIdResult result = client.describeFollowsByUserId(
new DescribeFollowsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withWithProfile(true)
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<FollowUser> 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.DescribeFollowsByUserIdRequest;
using Gs2.Gs2Friend.Result.DescribeFollowsByUserIdResult;
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.DescribeFollowsByUserIdResult> asyncResult = null;
yield return client.DescribeFollowsByUserId(
new Gs2.Gs2Friend.Request.DescribeFollowsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithWithProfile(true)
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as 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.describeFollowsByUserId(
new Gs2Friend.DescribeFollowsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withWithProfile(true)
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import 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_follows_by_user_id(
friend.DescribeFollowsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_with_profile(True)
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.describe_follows_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
withProfile=true,
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('friend')
api_result_handler = client.describe_follows_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
withProfile=true,
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
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;
getFollow
フォローを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID | ||
withProfile | bool | ✓ | false | プロフィールも一緒に取得するか |
Result
型 | 説明 | |
---|---|---|
item | FollowUser | フォローしているユーザー |
実装例
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.GetFollow(
&friend.GetFollowRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TargetUserId: pointy.String("user-0002"),
WithProfile: pointy.Bool(true),
}
)
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\GetFollowRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getFollow(
(new GetFollowRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTargetUserId("user-0002")
->withWithProfile(True)
);
$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.GetFollowRequest;
import io.gs2.friend.result.GetFollowResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetFollowResult result = client.getFollow(
new GetFollowRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
);
FollowUser 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.GetFollowRequest;
using Gs2.Gs2Friend.Result.GetFollowResult;
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.GetFollowResult> asyncResult = null;
yield return client.GetFollow(
new Gs2.Gs2Friend.Request.GetFollowRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTargetUserId("user-0002")
.WithWithProfile(true),
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.getFollow(
new Gs2Friend.GetFollowRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
);
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_follow(
friend.GetFollowRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
.with_with_profile(True)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_follow({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
withProfile=true,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.get_follow_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
withProfile=true,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getFollowByUserId
ユーザーIDを指定してフォローを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID | ||
withProfile | bool | ✓ | false | プロフィールも一緒に取得するか | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | FollowUser | フォローしているユーザー |
実装例
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.GetFollowByUserId(
&friend.GetFollowByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
WithProfile: pointy.Bool(true),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetFollowByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getFollowByUserId(
(new GetFollowByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId("user-0002")
->withWithProfile(True)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetFollowByUserIdRequest;
import io.gs2.friend.result.GetFollowByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetFollowByUserIdResult result = client.getFollowByUserId(
new GetFollowByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
.withTimeOffsetToken(null)
);
FollowUser 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.GetFollowByUserIdRequest;
using Gs2.Gs2Friend.Result.GetFollowByUserIdResult;
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.GetFollowByUserIdResult> asyncResult = null;
yield return client.GetFollowByUserId(
new Gs2.Gs2Friend.Request.GetFollowByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId("user-0002")
.WithWithProfile(true)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.getFollowByUserId(
new Gs2Friend.GetFollowByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
.withTimeOffsetToken(null)
);
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_follow_by_user_id(
friend.GetFollowByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id('user-0002')
.with_with_profile(True)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_follow_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
withProfile=true,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.get_follow_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
withProfile=true,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
follow
フォローする
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
targetUserId | string | ✓ | ~ 128文字 | フォローしたい相手のユーザーID |
Result
型 | 説明 | |
---|---|---|
item | FollowUser | フォローしたユーザ |
実装例
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.Follow(
&friend.FollowRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-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\FollowRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->follow(
(new FollowRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-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.FollowRequest;
import io.gs2.friend.result.FollowResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
FollowResult result = client.follow(
new FollowRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
FollowUser 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.FollowRequest;
using Gs2.Gs2Friend.Result.FollowResult;
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.FollowResult> asyncResult = null;
yield return client.Follow(
new Gs2.Gs2Friend.Request.FollowRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-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.follow(
new Gs2Friend.FollowRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-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.follow(
friend.FollowRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.follow({
namespaceName="namespace-0001",
accessToken="accessToken-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;
client = gs2('friend')
api_result_handler = client.follow_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
followByUserId
ユーザーIDを指定してフォロー
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserId | string | ✓ | ~ 128文字 | フォローしたい相手のユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | FollowUser | フォローしたユーザ |
実装例
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.FollowByUserId(
&friend.FollowByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\FollowByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->followByUserId(
(new FollowByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.FollowByUserIdRequest;
import io.gs2.friend.result.FollowByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
FollowByUserIdResult result = client.followByUserId(
new FollowByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
FollowUser 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.FollowByUserIdRequest;
using Gs2.Gs2Friend.Result.FollowByUserIdResult;
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.FollowByUserIdResult> asyncResult = null;
yield return client.FollowByUserId(
new Gs2.Gs2Friend.Request.FollowByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.followByUserId(
new Gs2Friend.FollowByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
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.follow_by_user_id(
friend.FollowByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.follow_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.follow_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
unfollow
アンフォロー
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID |
Result
型 | 説明 | |
---|---|---|
item | FollowUser | アンフォローしたユーザ |
実装例
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.Unfollow(
&friend.UnfollowRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-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\UnfollowRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->unfollow(
(new UnfollowRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-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.UnfollowRequest;
import io.gs2.friend.result.UnfollowResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
UnfollowResult result = client.unfollow(
new UnfollowRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
FollowUser 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.UnfollowRequest;
using Gs2.Gs2Friend.Result.UnfollowResult;
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.UnfollowResult> asyncResult = null;
yield return client.Unfollow(
new Gs2.Gs2Friend.Request.UnfollowRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-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.unfollow(
new Gs2Friend.UnfollowRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-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.unfollow(
friend.UnfollowRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.unfollow({
namespaceName="namespace-0001",
accessToken="accessToken-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;
client = gs2('friend')
api_result_handler = client.unfollow_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
unfollowByUserId
ユーザーIDを指定してアンフォロー
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | FollowUser | アンフォローしたユーザ |
実装例
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.UnfollowByUserId(
&friend.UnfollowByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\UnfollowByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->unfollowByUserId(
(new UnfollowByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.UnfollowByUserIdRequest;
import io.gs2.friend.result.UnfollowByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
UnfollowByUserIdResult result = client.unfollowByUserId(
new UnfollowByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
FollowUser 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.UnfollowByUserIdRequest;
using Gs2.Gs2Friend.Result.UnfollowByUserIdResult;
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.UnfollowByUserIdResult> asyncResult = null;
yield return client.UnfollowByUserId(
new Gs2.Gs2Friend.Request.UnfollowByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.unfollowByUserId(
new Gs2Friend.UnfollowByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
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.unfollow_by_user_id(
friend.UnfollowByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.unfollow_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.unfollow_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getFriend
フレンドを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID | ||
withProfile | bool | ✓ | false | プロフィールも一緒に取得するか |
Result
型 | 説明 | |
---|---|---|
item | FriendUser | フレンドのユーザー |
実装例
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.GetFriend(
&friend.GetFriendRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TargetUserId: pointy.String("user-0002"),
WithProfile: pointy.Bool(true),
}
)
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\GetFriendRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getFriend(
(new GetFriendRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTargetUserId("user-0002")
->withWithProfile(True)
);
$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.GetFriendRequest;
import io.gs2.friend.result.GetFriendResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetFriendResult result = client.getFriend(
new GetFriendRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
);
FriendUser 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.GetFriendRequest;
using Gs2.Gs2Friend.Result.GetFriendResult;
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.GetFriendResult> asyncResult = null;
yield return client.GetFriend(
new Gs2.Gs2Friend.Request.GetFriendRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTargetUserId("user-0002")
.WithWithProfile(true),
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.getFriend(
new Gs2Friend.GetFriendRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
);
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_friend(
friend.GetFriendRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
.with_with_profile(True)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_friend({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
withProfile=true,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.get_friend_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
withProfile=true,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getFriendByUserId
ユーザーIDを指定してフレンドを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID | ||
withProfile | bool | ✓ | false | プロフィールも一緒に取得するか | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | FriendUser | フレンドのユーザー |
実装例
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.GetFriendByUserId(
&friend.GetFriendByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
WithProfile: pointy.Bool(true),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetFriendByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getFriendByUserId(
(new GetFriendByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId("user-0002")
->withWithProfile(True)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetFriendByUserIdRequest;
import io.gs2.friend.result.GetFriendByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetFriendByUserIdResult result = client.getFriendByUserId(
new GetFriendByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
.withTimeOffsetToken(null)
);
FriendUser 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.GetFriendByUserIdRequest;
using Gs2.Gs2Friend.Result.GetFriendByUserIdResult;
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.GetFriendByUserIdResult> asyncResult = null;
yield return client.GetFriendByUserId(
new Gs2.Gs2Friend.Request.GetFriendByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId("user-0002")
.WithWithProfile(true)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.getFriendByUserId(
new Gs2Friend.GetFriendByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
.withTimeOffsetToken(null)
);
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_friend_by_user_id(
friend.GetFriendByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id('user-0002')
.with_with_profile(True)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_friend_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
withProfile=true,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.get_friend_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
withProfile=true,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
addFriend
フレンドを追加
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID |
Result
型 | 説明 | |
---|---|---|
item | FriendUser | 追加したフレンドのユーザー |
実装例
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.AddFriend(
&friend.AddFriendRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-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\AddFriendRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->addFriend(
(new AddFriendRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-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.AddFriendRequest;
import io.gs2.friend.result.AddFriendResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
AddFriendResult result = client.addFriend(
new AddFriendRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
FriendUser 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.AddFriendRequest;
using Gs2.Gs2Friend.Result.AddFriendResult;
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.AddFriendResult> asyncResult = null;
yield return client.AddFriend(
new Gs2.Gs2Friend.Request.AddFriendRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-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.addFriend(
new Gs2Friend.AddFriendRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-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.add_friend(
friend.AddFriendRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.add_friend({
namespaceName="namespace-0001",
accessToken="accessToken-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;
client = gs2('friend')
api_result_handler = client.add_friend_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
addFriendByUserId
ユーザーIDを指定してフレンドを追加
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | FriendUser | 追加したフレンドのユーザー |
実装例
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.AddFriendByUserId(
&friend.AddFriendByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\AddFriendByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->addFriendByUserId(
(new AddFriendByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId("user-0002")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.AddFriendByUserIdRequest;
import io.gs2.friend.result.AddFriendByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
AddFriendByUserIdResult result = client.addFriendByUserId(
new AddFriendByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
FriendUser 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.AddFriendByUserIdRequest;
using Gs2.Gs2Friend.Result.AddFriendByUserIdResult;
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.AddFriendByUserIdResult> asyncResult = null;
yield return client.AddFriendByUserId(
new Gs2.Gs2Friend.Request.AddFriendByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId("user-0002")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.addFriendByUserId(
new Gs2Friend.AddFriendByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
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.add_friend_by_user_id(
friend.AddFriendByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id('user-0002')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.add_friend_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.add_friend_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
deleteFriend
フレンドを削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID |
Result
型 | 説明 | |
---|---|---|
item | FriendUser | 削除したフレンドのユーザー |
実装例
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.DeleteFriend(
&friend.DeleteFriendRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-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\DeleteFriendRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteFriend(
(new DeleteFriendRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-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.DeleteFriendRequest;
import io.gs2.friend.result.DeleteFriendResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DeleteFriendResult result = client.deleteFriend(
new DeleteFriendRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
FriendUser 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.DeleteFriendRequest;
using Gs2.Gs2Friend.Result.DeleteFriendResult;
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.DeleteFriendResult> asyncResult = null;
yield return client.DeleteFriend(
new Gs2.Gs2Friend.Request.DeleteFriendRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-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.deleteFriend(
new Gs2Friend.DeleteFriendRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-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.delete_friend(
friend.DeleteFriendRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.delete_friend({
namespaceName="namespace-0001",
accessToken="accessToken-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;
client = gs2('friend')
api_result_handler = client.delete_friend_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
deleteFriendByUserId
ユーザーIDを指定してフレンドを削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | FriendUser | 削除したフレンドのユーザー |
実装例
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.DeleteFriendByUserId(
&friend.DeleteFriendByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DeleteFriendByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteFriendByUserId(
(new DeleteFriendByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId("user-0002")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DeleteFriendByUserIdRequest;
import io.gs2.friend.result.DeleteFriendByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DeleteFriendByUserIdResult result = client.deleteFriendByUserId(
new DeleteFriendByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
FriendUser 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.DeleteFriendByUserIdRequest;
using Gs2.Gs2Friend.Result.DeleteFriendByUserIdResult;
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.DeleteFriendByUserIdResult> asyncResult = null;
yield return client.DeleteFriendByUserId(
new Gs2.Gs2Friend.Request.DeleteFriendByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId("user-0002")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.deleteFriendByUserId(
new Gs2Friend.DeleteFriendByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
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_friend_by_user_id(
friend.DeleteFriendByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id('user-0002')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.delete_friend_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.delete_friend_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
describeSendRequests
送信したフレンドリクエストの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | List<FriendRequest> | フレンドリクエストのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
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.DescribeSendRequests(
&friend.DescribeSendRequestsRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-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\DescribeSendRequestsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeSendRequests(
(new DescribeSendRequestsRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-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.DescribeSendRequestsRequest;
import io.gs2.friend.result.DescribeSendRequestsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeSendRequestsResult result = client.describeSendRequests(
new DescribeSendRequestsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withPageToken(null)
.withLimit(null)
);
List<FriendRequest> 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.DescribeSendRequestsRequest;
using Gs2.Gs2Friend.Result.DescribeSendRequestsResult;
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.DescribeSendRequestsResult> asyncResult = null;
yield return client.DescribeSendRequests(
new Gs2.Gs2Friend.Request.DescribeSendRequestsRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-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.describeSendRequests(
new Gs2Friend.DescribeSendRequestsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-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_send_requests(
friend.DescribeSendRequestsRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-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_send_requests({
namespaceName="namespace-0001",
accessToken="accessToken-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;
client = gs2('friend')
api_result_handler = client.describe_send_requests_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
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;
describeSendRequestsByUserId
ユーザーIDを指定して送信したフレンドリクエストの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 | |
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
items | List<FriendRequest> | フレンドリクエストのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
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.DescribeSendRequestsByUserId(
&friend.DescribeSendRequestsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeSendRequestsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeSendRequestsByUserId(
(new DescribeSendRequestsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeSendRequestsByUserIdRequest;
import io.gs2.friend.result.DescribeSendRequestsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeSendRequestsByUserIdResult result = client.describeSendRequestsByUserId(
new DescribeSendRequestsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<FriendRequest> 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.DescribeSendRequestsByUserIdRequest;
using Gs2.Gs2Friend.Result.DescribeSendRequestsByUserIdResult;
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.DescribeSendRequestsByUserIdResult> asyncResult = null;
yield return client.DescribeSendRequestsByUserId(
new Gs2.Gs2Friend.Request.DescribeSendRequestsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as 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.describeSendRequestsByUserId(
new Gs2Friend.DescribeSendRequestsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import 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_send_requests_by_user_id(
friend.DescribeSendRequestsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.describe_send_requests_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('friend')
api_result_handler = client.describe_send_requests_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
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;
getSendRequest
送信したフレンドリクエストを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID |
Result
型 | 説明 | |
---|---|---|
item | FriendRequest | フレンドリクエスト |
実装例
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.GetSendRequest(
&friend.GetSendRequestRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-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\GetSendRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getSendRequest(
(new GetSendRequestRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-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.GetSendRequestRequest;
import io.gs2.friend.result.GetSendRequestResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetSendRequestResult result = client.getSendRequest(
new GetSendRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
FriendRequest 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.GetSendRequestRequest;
using Gs2.Gs2Friend.Result.GetSendRequestResult;
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.GetSendRequestResult> asyncResult = null;
yield return client.GetSendRequest(
new Gs2.Gs2Friend.Request.GetSendRequestRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-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.getSendRequest(
new Gs2Friend.GetSendRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-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.get_send_request(
friend.GetSendRequestRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_send_request({
namespaceName="namespace-0001",
accessToken="accessToken-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;
client = gs2('friend')
api_result_handler = client.get_send_request_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getSendRequestByUserId
ユーザーIDを指定して送信したフレンドリクエストを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | FriendRequest | フレンドリクエスト |
実装例
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.GetSendRequestByUserId(
&friend.GetSendRequestByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetSendRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getSendRequestByUserId(
(new GetSendRequestByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetSendRequestByUserIdRequest;
import io.gs2.friend.result.GetSendRequestByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetSendRequestByUserIdResult result = client.getSendRequestByUserId(
new GetSendRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
FriendRequest 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.GetSendRequestByUserIdRequest;
using Gs2.Gs2Friend.Result.GetSendRequestByUserIdResult;
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.GetSendRequestByUserIdResult> asyncResult = null;
yield return client.GetSendRequestByUserId(
new Gs2.Gs2Friend.Request.GetSendRequestByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.getSendRequestByUserId(
new Gs2Friend.GetSendRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
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_send_request_by_user_id(
friend.GetSendRequestByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_send_request_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.get_send_request_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
sendRequest
フレンドリクエストを送信
自分の「現在のフレンド」の数が1000に達している場合は新しくリクエストを送信できません。
「未承諾フレンドリクエスト」が1個以上存在する場合は、最も古い「未承諾フレンドリクエスト」を取り下げて新しいリクエストを送信します。
フレンドリクエストを受け付ける側も、「未承諾のフレンドリクエスト」が1000件存在する場合は、最も古い「未承諾のフレンドリクエスト」を取り下げて新しいリクエストを受け入れます。
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
targetUserId | string | ✓ | ~ 128文字 | フレンドになりたい相手のユーザーID |
Result
型 | 説明 | |
---|---|---|
item | FriendRequest | 送信したフレンドリクエスト |
実装例
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.SendRequest(
&friend.SendRequestRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-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\SendRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->sendRequest(
(new SendRequestRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-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.SendRequestRequest;
import io.gs2.friend.result.SendRequestResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
SendRequestResult result = client.sendRequest(
new SendRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
FriendRequest 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.SendRequestRequest;
using Gs2.Gs2Friend.Result.SendRequestResult;
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.SendRequestResult> asyncResult = null;
yield return client.SendRequest(
new Gs2.Gs2Friend.Request.SendRequestRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-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.sendRequest(
new Gs2Friend.SendRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-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.send_request(
friend.SendRequestRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.send_request({
namespaceName="namespace-0001",
accessToken="accessToken-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;
client = gs2('friend')
api_result_handler = client.send_request_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
sendRequestByUserId
ユーザーIDを指定してフレンドリクエストを送信
自分の「現在のフレンド」の数が1000に達している場合は新しくリクエストを送信できません。
「未承諾フレンドリクエスト」が1個以上存在する場合は、最も古い「未承諾フレンドリクエスト」を取り下げて新しいリクエストを送信します。
フレンドリクエストを受け付ける側も、「未承諾のフレンドリクエスト」が1000件存在する場合は、最も古い「未承諾のフレンドリクエスト」を取り下げて新しいリクエストを受け入れます。
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserId | string | ✓ | ~ 128文字 | フレンドになりたい相手のユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | FriendRequest | 送信したフレンドリクエスト |
実装例
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.SendRequestByUserId(
&friend.SendRequestByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\SendRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->sendRequestByUserId(
(new SendRequestByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.SendRequestByUserIdRequest;
import io.gs2.friend.result.SendRequestByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
SendRequestByUserIdResult result = client.sendRequestByUserId(
new SendRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
FriendRequest 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.SendRequestByUserIdRequest;
using Gs2.Gs2Friend.Result.SendRequestByUserIdResult;
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.SendRequestByUserIdResult> asyncResult = null;
yield return client.SendRequestByUserId(
new Gs2.Gs2Friend.Request.SendRequestByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.sendRequestByUserId(
new Gs2Friend.SendRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
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.send_request_by_user_id(
friend.SendRequestByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.send_request_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.send_request_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
deleteRequest
フレンドリクエストを削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID |
Result
型 | 説明 | |
---|---|---|
item | FriendRequest | 削除したフレンドリクエスト |
実装例
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.DeleteRequest(
&friend.DeleteRequestRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-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\DeleteRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteRequest(
(new DeleteRequestRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-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.DeleteRequestRequest;
import io.gs2.friend.result.DeleteRequestResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DeleteRequestResult result = client.deleteRequest(
new DeleteRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
FriendRequest 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.DeleteRequestRequest;
using Gs2.Gs2Friend.Result.DeleteRequestResult;
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.DeleteRequestResult> asyncResult = null;
yield return client.DeleteRequest(
new Gs2.Gs2Friend.Request.DeleteRequestRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-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.deleteRequest(
new Gs2Friend.DeleteRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-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.delete_request(
friend.DeleteRequestRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.delete_request({
namespaceName="namespace-0001",
accessToken="accessToken-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;
client = gs2('friend')
api_result_handler = client.delete_request_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
deleteRequestByUserId
ユーザーIDを指定してフレンドリクエストを削除
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
targetUserId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | FriendRequest | 削除したフレンドリクエスト |
実装例
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.DeleteRequestByUserId(
&friend.DeleteRequestByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DeleteRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteRequestByUserId(
(new DeleteRequestByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DeleteRequestByUserIdRequest;
import io.gs2.friend.result.DeleteRequestByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DeleteRequestByUserIdResult result = client.deleteRequestByUserId(
new DeleteRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
FriendRequest 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.DeleteRequestByUserIdRequest;
using Gs2.Gs2Friend.Result.DeleteRequestByUserIdResult;
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.DeleteRequestByUserIdResult> asyncResult = null;
yield return client.DeleteRequestByUserId(
new Gs2.Gs2Friend.Request.DeleteRequestByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.deleteRequestByUserId(
new Gs2Friend.DeleteRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
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_request_by_user_id(
friend.DeleteRequestByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.delete_request_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.delete_request_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
describeReceiveRequests
受信したフレンドリクエストの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
型 | 説明 | |
---|---|---|
items | List<FriendRequest> | フレンドリクエストのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
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.DescribeReceiveRequests(
&friend.DescribeReceiveRequestsRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-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\DescribeReceiveRequestsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeReceiveRequests(
(new DescribeReceiveRequestsRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-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.DescribeReceiveRequestsRequest;
import io.gs2.friend.result.DescribeReceiveRequestsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeReceiveRequestsResult result = client.describeReceiveRequests(
new DescribeReceiveRequestsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withPageToken(null)
.withLimit(null)
);
List<FriendRequest> 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.DescribeReceiveRequestsRequest;
using Gs2.Gs2Friend.Result.DescribeReceiveRequestsResult;
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.DescribeReceiveRequestsResult> asyncResult = null;
yield return client.DescribeReceiveRequests(
new Gs2.Gs2Friend.Request.DescribeReceiveRequestsRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-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.describeReceiveRequests(
new Gs2Friend.DescribeReceiveRequestsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-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_receive_requests(
friend.DescribeReceiveRequestsRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-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_receive_requests({
namespaceName="namespace-0001",
accessToken="accessToken-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;
client = gs2('friend')
api_result_handler = client.describe_receive_requests_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
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;
describeReceiveRequestsByUserId
ユーザーIDを指定して受信したフレンドリクエストの一覧を取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
pageToken | string | ~ 1024文字 | データの取得を開始する位置を指定するトークン | |||
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 | |
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
items | List<FriendRequest> | フレンドリクエストのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
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.DescribeReceiveRequestsByUserId(
&friend.DescribeReceiveRequestsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeReceiveRequestsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeReceiveRequestsByUserId(
(new DescribeReceiveRequestsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeReceiveRequestsByUserIdRequest;
import io.gs2.friend.result.DescribeReceiveRequestsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeReceiveRequestsByUserIdResult result = client.describeReceiveRequestsByUserId(
new DescribeReceiveRequestsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<FriendRequest> 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.DescribeReceiveRequestsByUserIdRequest;
using Gs2.Gs2Friend.Result.DescribeReceiveRequestsByUserIdResult;
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.DescribeReceiveRequestsByUserIdResult> asyncResult = null;
yield return client.DescribeReceiveRequestsByUserId(
new Gs2.Gs2Friend.Request.DescribeReceiveRequestsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as 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.describeReceiveRequestsByUserId(
new Gs2Friend.DescribeReceiveRequestsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import 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_receive_requests_by_user_id(
friend.DescribeReceiveRequestsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.describe_receive_requests_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('friend')
api_result_handler = client.describe_receive_requests_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
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;
getReceiveRequest
受信したフレンドリクエストを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
fromUserId | string | ✓ | ~ 128文字 | ユーザーID |
Result
型 | 説明 | |
---|---|---|
item | FriendRequest | フレンドリクエスト |
実装例
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.GetReceiveRequest(
&friend.GetReceiveRequestRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
FromUserId: 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\GetReceiveRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getReceiveRequest(
(new GetReceiveRequestRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withFromUserId("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.GetReceiveRequestRequest;
import io.gs2.friend.result.GetReceiveRequestResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetReceiveRequestResult result = client.getReceiveRequest(
new GetReceiveRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withFromUserId("user-0002")
);
FriendRequest 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.GetReceiveRequestRequest;
using Gs2.Gs2Friend.Result.GetReceiveRequestResult;
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.GetReceiveRequestResult> asyncResult = null;
yield return client.GetReceiveRequest(
new Gs2.Gs2Friend.Request.GetReceiveRequestRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithFromUserId("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.getReceiveRequest(
new Gs2Friend.GetReceiveRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withFromUserId("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.get_receive_request(
friend.GetReceiveRequestRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_from_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_receive_request({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
fromUserId="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;
client = gs2('friend')
api_result_handler = client.get_receive_request_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
fromUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getReceiveRequestByUserId
ユーザーIDを指定して受信したフレンドリクエストを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
fromUserId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | FriendRequest | フレンドリクエスト |
実装例
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.GetReceiveRequestByUserId(
&friend.GetReceiveRequestByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
FromUserId: pointy.String("user-0002"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetReceiveRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getReceiveRequestByUserId(
(new GetReceiveRequestByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withFromUserId("user-0002")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetReceiveRequestByUserIdRequest;
import io.gs2.friend.result.GetReceiveRequestByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetReceiveRequestByUserIdResult result = client.getReceiveRequestByUserId(
new GetReceiveRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withFromUserId("user-0002")
.withTimeOffsetToken(null)
);
FriendRequest 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.GetReceiveRequestByUserIdRequest;
using Gs2.Gs2Friend.Result.GetReceiveRequestByUserIdResult;
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.GetReceiveRequestByUserIdResult> asyncResult = null;
yield return client.GetReceiveRequestByUserId(
new Gs2.Gs2Friend.Request.GetReceiveRequestByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithFromUserId("user-0002")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.getReceiveRequestByUserId(
new Gs2Friend.GetReceiveRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withFromUserId("user-0002")
.withTimeOffsetToken(null)
);
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_receive_request_by_user_id(
friend.GetReceiveRequestByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_from_user_id('user-0002')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_receive_request_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
fromUserId="user-0002",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.get_receive_request_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
fromUserId="user-0002",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
acceptRequest
フレンドリクエストを承諾
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
fromUserId | string | ✓ | ~ 128文字 | ユーザーID |
Result
型 | 説明 | |
---|---|---|
item | FriendRequest | 承諾したフレンドリクエスト |
実装例
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.AcceptRequest(
&friend.AcceptRequestRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
FromUserId: 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\AcceptRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->acceptRequest(
(new AcceptRequestRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withFromUserId("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.AcceptRequestRequest;
import io.gs2.friend.result.AcceptRequestResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
AcceptRequestResult result = client.acceptRequest(
new AcceptRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withFromUserId("user-0002")
);
FriendRequest 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.AcceptRequestRequest;
using Gs2.Gs2Friend.Result.AcceptRequestResult;
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.AcceptRequestResult> asyncResult = null;
yield return client.AcceptRequest(
new Gs2.Gs2Friend.Request.AcceptRequestRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithFromUserId("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.acceptRequest(
new Gs2Friend.AcceptRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withFromUserId("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.accept_request(
friend.AcceptRequestRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_from_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.accept_request({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
fromUserId="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;
client = gs2('friend')
api_result_handler = client.accept_request_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
fromUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
acceptRequestByUserId
ユーザーIDを指定してフレンドリクエストを承諾
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
fromUserId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | FriendRequest | 承諾したフレンドリクエスト |
実装例
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.AcceptRequestByUserId(
&friend.AcceptRequestByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
FromUserId: pointy.String("user-0002"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\AcceptRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->acceptRequestByUserId(
(new AcceptRequestByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withFromUserId("user-0002")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.AcceptRequestByUserIdRequest;
import io.gs2.friend.result.AcceptRequestByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
AcceptRequestByUserIdResult result = client.acceptRequestByUserId(
new AcceptRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withFromUserId("user-0002")
.withTimeOffsetToken(null)
);
FriendRequest 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.AcceptRequestByUserIdRequest;
using Gs2.Gs2Friend.Result.AcceptRequestByUserIdResult;
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.AcceptRequestByUserIdResult> asyncResult = null;
yield return client.AcceptRequestByUserId(
new Gs2.Gs2Friend.Request.AcceptRequestByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithFromUserId("user-0002")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.acceptRequestByUserId(
new Gs2Friend.AcceptRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withFromUserId("user-0002")
.withTimeOffsetToken(null)
);
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.accept_request_by_user_id(
friend.AcceptRequestByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_from_user_id('user-0002')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.accept_request_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
fromUserId="user-0002",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.accept_request_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
fromUserId="user-0002",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
rejectRequest
フレンドリクエストを拒否
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
fromUserId | string | ✓ | ~ 128文字 | ユーザーID |
Result
型 | 説明 | |
---|---|---|
item | FriendRequest | 拒否したフレンドリクエスト |
実装例
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.RejectRequest(
&friend.RejectRequestRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
FromUserId: 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\RejectRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->rejectRequest(
(new RejectRequestRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withFromUserId("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.RejectRequestRequest;
import io.gs2.friend.result.RejectRequestResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
RejectRequestResult result = client.rejectRequest(
new RejectRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withFromUserId("user-0002")
);
FriendRequest 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.RejectRequestRequest;
using Gs2.Gs2Friend.Result.RejectRequestResult;
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.RejectRequestResult> asyncResult = null;
yield return client.RejectRequest(
new Gs2.Gs2Friend.Request.RejectRequestRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithFromUserId("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.rejectRequest(
new Gs2Friend.RejectRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withFromUserId("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.reject_request(
friend.RejectRequestRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_from_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.reject_request({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
fromUserId="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;
client = gs2('friend')
api_result_handler = client.reject_request_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
fromUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
rejectRequestByUserId
ユーザーIDを指定してフレンドリクエストを拒否
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
fromUserId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | FriendRequest | 拒否したフレンドリクエスト |
実装例
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.RejectRequestByUserId(
&friend.RejectRequestByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
FromUserId: pointy.String("user-0002"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\RejectRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->rejectRequestByUserId(
(new RejectRequestByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withFromUserId("user-0002")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.RejectRequestByUserIdRequest;
import io.gs2.friend.result.RejectRequestByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
RejectRequestByUserIdResult result = client.rejectRequestByUserId(
new RejectRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withFromUserId("user-0002")
.withTimeOffsetToken(null)
);
FriendRequest 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.RejectRequestByUserIdRequest;
using Gs2.Gs2Friend.Result.RejectRequestByUserIdResult;
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.RejectRequestByUserIdResult> asyncResult = null;
yield return client.RejectRequestByUserId(
new Gs2.Gs2Friend.Request.RejectRequestByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithFromUserId("user-0002")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.rejectRequestByUserId(
new Gs2Friend.RejectRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withFromUserId("user-0002")
.withTimeOffsetToken(null)
);
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.reject_request_by_user_id(
friend.RejectRequestByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_from_user_id('user-0002')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.reject_request_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
fromUserId="user-0002",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.reject_request_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
fromUserId="user-0002",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getPublicProfile
公開プロフィールを取得
Request
型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
---|---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
userId | string | ✓ | ~ 128文字 | ユーザーID | ||
timeOffsetToken | string | ~ 1024文字 | タイムオフセットトークン |
Result
型 | 説明 | |
---|---|---|
item | PublicProfile | 公開プロフィール |
実装例
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.GetPublicProfile(
&friend.GetPublicProfileRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetPublicProfileRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getPublicProfile(
(new GetPublicProfileRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetPublicProfileRequest;
import io.gs2.friend.result.GetPublicProfileResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetPublicProfileResult result = client.getPublicProfile(
new GetPublicProfileRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
PublicProfile 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.GetPublicProfileRequest;
using Gs2.Gs2Friend.Result.GetPublicProfileResult;
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.GetPublicProfileResult> asyncResult = null;
yield return client.GetPublicProfile(
new Gs2.Gs2Friend.Request.GetPublicProfileRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as 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.getPublicProfile(
new Gs2Friend.GetPublicProfileRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
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_public_profile(
friend.GetPublicProfileRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_public_profile({
namespaceName="namespace-0001",
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
client = gs2('friend')
api_result_handler = client.get_public_profile_async({
namespaceName="namespace-0001",
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;