GS2-Friend SDK for Game Engine API リファレンス
モデル
EzProfile
プロフィール
プロフィールはゲームプレイヤーに関する情報を格納します。
プロフィールは公開範囲ごとに設定することが可能で、3種類あります。
friend フレンド関係が成立している相手に閲覧可能な内容
follow フォローされている相手が閲覧可能な内容
public 誰でも閲覧可能な内容
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
userId | string | ✓ | | ~ 128文字 | ユーザーID |
publicProfile | string | | | ~ 1024文字 | 公開されるプロフィール |
followerProfile | string | | | ~ 1024文字 | フォロワー向けに公開されるプロフィール |
friendProfile | string | | | ~ 1024文字 | フレンド向けに公開されるプロフィール |
EzBlackList
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
userId | string | ✓ | | ~ 128文字 | ユーザーID |
targetUserIds | List<string> | | | | ブラックリストのユーザーIDリスト |
EzFollowUser
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
userId | string | ✓ | | ~ 128文字 | ユーザーID |
publicProfile | string | | | ~ 1024文字 | 公開されるプロフィール |
followerProfile | string | | | ~ 1024文字 | フォロワー向けに公開されるプロフィール |
EzFriendUser
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
userId | string | ✓ | | ~ 128文字 | ユーザーID |
publicProfile | string | | | ~ 1024文字 | 公開されるプロフィール |
friendProfile | string | | | ~ 1024文字 | フレンド向けに公開されるプロフィール |
EzFriendRequest
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
userId | string | ✓ | | ~ 128文字 | 送信元 |
targetUserId | string | ✓ | | ~ 128文字 | 送信先 |
EzPublicProfile
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
userId | string | ✓ | | ~ 128文字 | ユーザーID |
publicProfile | string | | | ~ 1024文字 | 公開されるプロフィール |
メソッド
getProfile
自分のプロフィールを取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Profile(
);
var item = await domain.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Profile(
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Profile(
);
const auto Future = Domain.Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
値の変更イベントハンドリング
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Profile(
);
// イベントハンドリングを開始
var callbackId = domain.Subscribe(
value => {
// 値が変化した時に呼び出される
// value には変更後の値が渡ってくる
}
);
// イベントハンドリングを停止
domain.Unsubscribe(callbackId);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Profile(
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Profile(
);
// イベントハンドリングを開始
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Friend::Model::FProfile> value) {
// 値が変化した時に呼び出される
// value には変更後の値が渡ってくる
}
);
// イベントハンドリングを停止
Domain->Unsubscribe(CallbackId);
Warning
このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。
ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。
そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
getPublicProfile
他人の公開プロフィールを取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).User(
userId: "user-0001"
).PublicProfile(
);
var item = await domain.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).User(
userId: "user-0001"
).PublicProfile(
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->User(
"user-0001" // userId
)->PublicProfile(
);
const auto Future = Domain.Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
値の変更イベントハンドリング
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).User(
userId: "user-0001"
).PublicProfile(
);
// イベントハンドリングを開始
var callbackId = domain.Subscribe(
value => {
// 値が変化した時に呼び出される
// value には変更後の値が渡ってくる
}
);
// イベントハンドリングを停止
domain.Unsubscribe(callbackId);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).User(
userId: "user-0001"
).PublicProfile(
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->User(
"user-0001" // userId
)->PublicProfile(
);
// イベントハンドリングを開始
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Friend::Model::FPublicProfile> value) {
// 値が変化した時に呼び出される
// value には変更後の値が渡ってくる
}
);
// イベントハンドリングを停止
Domain->Unsubscribe(CallbackId);
Warning
このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。
ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。
そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
updateProfile
自分のプロフィールを更新
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
publicProfile | string | | | ~ 1024文字 | 公開されるプロフィール |
followerProfile | string | | | ~ 1024文字 | フォロワー向けに公開されるプロフィール |
friendProfile | string | | | ~ 1024文字 | フレンド向けに公開されるプロフィール |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Profile(
);
var result = await domain.UpdateProfileAsync(
publicProfile: "public",
followerProfile: "follower",
friendProfile: "friend"
);
var item = await result.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Profile(
);
var future = domain.UpdateProfile(
publicProfile: "public",
followerProfile: "follower",
friendProfile: "friend"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.Model();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Profile(
);
const auto Future = Domain->UpdateProfile(
"public", // publicProfile
"follower", // followerProfile
"friend" // friendProfile
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
describeFollowUsers
フォローしたプレイヤーリストを取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
withProfile | bool | ✓ | false | | プロフィールも一緒に取得するか |
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
pageToken | string | | | ~ 1024文字 | データの取得を開始する位置を指定するトークン |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.FollowsAsync(
).ToListAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Follows(
);
List<EzFollowUser> items = new List<EzFollowUser>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->Follows( // withProfile
);
for (auto Item : *It)
{
}
follow
他プレイヤーをフォローする
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
targetUserId | string | ✓ | | ~ 128文字 | フォローしたい相手のユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).FollowUser(
targetUserId: "user-0002",
withProfile: true
);
var result = await domain.FollowAsync(
);
var item = await result.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).FollowUser(
targetUserId: "user-0002",
withProfile: true
);
var future = domain.Follow(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.Model();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->FollowUser(
"user-0002", // targetUserId
true // withProfile
);
const auto Future = Domain->Follow(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
getFollowUser
フォローしたプレイヤーを取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
withProfile | bool | ✓ | false | | プロフィールも一緒に取得するか |
targetUserId | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).FollowUser(
targetUserId: "user-0002",
withProfile: null
);
var item = await domain.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).FollowUser(
targetUserId: "user-0002",
withProfile: null
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->FollowUser(
"user-0002", // targetUserId
nullptr // withProfile
);
const auto Future = Domain.Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
値の変更イベントハンドリング
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).FollowUser(
targetUserId: "user-0002",
withProfile: null
);
// イベントハンドリングを開始
var callbackId = domain.Subscribe(
value => {
// 値が変化した時に呼び出される
// value には変更後の値が渡ってくる
}
);
// イベントハンドリングを停止
domain.Unsubscribe(callbackId);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).FollowUser(
targetUserId: "user-0002",
withProfile: null
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->FollowUser(
"user-0002", // targetUserId
nullptr // withProfile
);
// イベントハンドリングを開始
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Friend::Model::FFollowUser> value) {
// 値が変化した時に呼び出される
// value には変更後の値が渡ってくる
}
);
// イベントハンドリングを停止
Domain->Unsubscribe(CallbackId);
Warning
このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。
ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。
そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
unfollow
フォローしている相手をアンフォローする
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
targetUserId | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).FollowUser(
targetUserId: "user-0002",
withProfile: null
);
var result = await domain.UnfollowAsync(
);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).FollowUser(
targetUserId: "user-0002",
withProfile: null
);
var future = domain.Unfollow(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->FollowUser(
"user-0002", // targetUserId
nullptr // withProfile
);
const auto Future = Domain->Unfollow(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
deleteFriend
フレンドを削除
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
targetUserId | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: null
).FriendUser(
targetUserId: "user-0002"
);
var result = await domain.DeleteFriendAsync(
);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: null
).FriendUser(
targetUserId: "user-0002"
);
var future = domain.DeleteFriend(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Friend(
nullptr // withProfile
)->FriendUser(
"user-0002" // targetUserId
);
const auto Future = Domain->DeleteFriend(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
describeFriends
フレンドの一覧を取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
withProfile | bool | ✓ | false | | プロフィールも一緒に取得するか |
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
pageToken | string | | | ~ 1024文字 | データの取得を開始する位置を指定するトークン |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.FriendsAsync(
).ToListAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Friends(
);
List<EzFriendUser> items = new List<EzFriendUser>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->Friends( // withProfile
);
for (auto Item : *It)
{
}
値の変更イベントハンドリング
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
// イベントハンドリングを開始
var callbackId = domain.SubscribeFriends(
() => {
// リストの要素が変化した時に呼び出される
}
);
// イベントハンドリングを停止
domain.UnsubscribeFriends(callbackId);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Friends(
);
List<EzFriendUser> items = new List<EzFriendUser>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
// イベントハンドリングを開始
const auto CallbackId = Domain->SubscribeFriends(
[]() {
// リストの要素が変化した時に呼び出される
}
);
// イベントハンドリングを停止
Domain->UnsubscribeFriends(CallbackId);
Warning
このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。
ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。
そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
getFriend
フレンドを取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
targetUserId | string | ✓ | | ~ 128文字 | ユーザーID |
withProfile | bool | ✓ | false | | プロフィールも一緒に取得するか |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: null
).FriendUser(
targetUserId: "user-0002"
);
var item = await domain.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: null
).FriendUser(
targetUserId: "user-0002"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Friend(
nullptr // withProfile
)->FriendUser(
"user-0002" // targetUserId
);
const auto Future = Domain.Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
値の変更イベントハンドリング
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: null
).FriendUser(
targetUserId: "user-0002"
);
// イベントハンドリングを開始
var callbackId = domain.Subscribe(
value => {
// 値が変化した時に呼び出される
// value には変更後の値が渡ってくる
}
);
// イベントハンドリングを停止
domain.Unsubscribe(callbackId);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: null
).FriendUser(
targetUserId: "user-0002"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Friend(
nullptr // withProfile
)->FriendUser(
"user-0002" // targetUserId
);
// イベントハンドリングを開始
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Friend::Model::FFriendUser> value) {
// 値が変化した時に呼び出される
// value には変更後の値が渡ってくる
}
);
// イベントハンドリングを停止
Domain->Unsubscribe(CallbackId);
Warning
このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。
ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。
そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
deleteRequest
フレンドリクエストを削除
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
targetUserId | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).SendFriendRequest(
targetUserId: "user-0002"
);
var result = await domain.DeleteRequestAsync(
);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).SendFriendRequest(
targetUserId: "user-0002"
);
var future = domain.DeleteRequest(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->SendFriendRequest(
"user-0002" // targetUserId
);
const auto Future = Domain->DeleteRequest(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
describeSendRequests
送信したフレンドリクエストの一覧を取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.SendRequestsAsync(
).ToListAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.SendRequests(
);
List<EzFriendRequest> items = new List<EzFriendRequest>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->SendRequests(
);
for (auto Item : *It)
{
}
getSendRequest
送信したフレンドリクエストを取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
targetUserId | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).SendFriendRequest(
targetUserId: "user-0002"
);
var item = await domain.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).SendFriendRequest(
targetUserId: "user-0002"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->SendFriendRequest(
"user-0002" // targetUserId
);
const auto Future = Domain.Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
値の変更イベントハンドリング
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).SendFriendRequest(
targetUserId: "user-0002"
);
// イベントハンドリングを開始
var callbackId = domain.Subscribe(
value => {
// 値が変化した時に呼び出される
// value には変更後の値が渡ってくる
}
);
// イベントハンドリングを停止
domain.Unsubscribe(callbackId);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).SendFriendRequest(
targetUserId: "user-0002"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->SendFriendRequest(
"user-0002" // targetUserId
);
// イベントハンドリングを開始
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Friend::Model::FSendFriendRequest> value) {
// 値が変化した時に呼び出される
// value には変更後の値が渡ってくる
}
);
// イベントハンドリングを停止
Domain->Unsubscribe(CallbackId);
Warning
このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。
ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。
そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
sendRequest
送信したフレンドリクエストを取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
targetUserId | string | ✓ | | ~ 128文字 | フレンドになりたい相手のユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var result = await domain.SendRequestAsync(
targetUserId: "user-0002"
);
var item = await result.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var future = domain.SendRequest(
targetUserId: "user-0002"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.Model();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto Future = Domain->SendRequest(
"user-0002"
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
accept
フレンドリクエストを承認
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
fromUserId | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
var result = await domain.AcceptAsync(
);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
var future = domain.Accept(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->ReceiveFriendRequest(
nullptr, // targetUserId
"user-0002" // fromUserId
);
const auto Future = Domain->Accept(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
describeReceiveRequests
受信したフレンドリクエスト一覧を取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.ReceiveRequestsAsync(
).ToListAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.ReceiveRequests(
);
List<EzFriendRequest> items = new List<EzFriendRequest>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->ReceiveRequests(
);
for (auto Item : *It)
{
}
getReceiveRequest
受信したフレンドリクエストを取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
fromUserId | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
var item = await domain.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->ReceiveFriendRequest(
nullptr, // targetUserId
"user-0002" // fromUserId
);
const auto Future = Domain.Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
値の変更イベントハンドリング
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
// イベントハンドリングを開始
var callbackId = domain.Subscribe(
value => {
// 値が変化した時に呼び出される
// value には変更後の値が渡ってくる
}
);
// イベントハンドリングを停止
domain.Unsubscribe(callbackId);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->ReceiveFriendRequest(
nullptr, // targetUserId
"user-0002" // fromUserId
);
// イベントハンドリングを開始
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Friend::Model::FReceiveFriendRequest> value) {
// 値が変化した時に呼び出される
// value には変更後の値が渡ってくる
}
);
// イベントハンドリングを停止
Domain->Unsubscribe(CallbackId);
Warning
このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。
ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。
そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
reject
フレンドリクエストを拒否
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
fromUserId | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
var result = await domain.RejectAsync(
);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
var future = domain.Reject(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->ReceiveFriendRequest(
nullptr, // targetUserId
"user-0002" // fromUserId
);
const auto Future = Domain->Reject(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
getBlackList
ブラックリストを取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
Result
| 型 | 説明 |
---|
items | List<string> | ブラックリストに登録されたユーザIDリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.BlackListsAsync(
).ToListAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.BlackLists(
);
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->BlackLists(
);
for (auto Item : *It)
{
}
registerBlackList
ブラックリストにユーザを登録
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
targetUserId | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).BlackList(
);
var result = await domain.RegisterBlackListAsync(
targetUserId: "user-0002"
);
var item = await result.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).BlackList(
);
var future = domain.RegisterBlackList(
targetUserId: "user-0002"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.Model();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->BlackList(
);
const auto Future = Domain->RegisterBlackList(
"user-0002"
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
unregisterBlackList
ブラックリストからユーザを削除
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
targetUserId | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).BlackList(
);
var result = await domain.UnregisterBlackListAsync(
targetUserId: "user-0002"
);
var item = await result.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).BlackList(
);
var future = domain.UnregisterBlackList(
targetUserId: "user-0002"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.Model();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->BlackList(
);
const auto Future = Domain->UnregisterBlackList(
"user-0002"
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
イベントハンドラ
OnFollowNotification
フォローされたときに使用する通知
名前 | 型 | 説明 |
---|
namespaceName | string | ネームスペース名 |
fromUserId | string | ユーザーID |
実装例
gs2.Friend.OnFollowNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var fromUserId = notification.FromUserId;
};
gs2.Friend.OnFollowNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var fromUserId = notification.FromUserId;
};
Gs2->Friend->OnFollowNotification().AddLambda([](const auto Notification)
{
const auto NamespaceName = Notification->NamespaceNameValue;
const auto FromUserId = Notification->FromUserIdValue;
});
OnAcceptRequestNotification
フレンドリクエストが承認されたときに使用する通知
名前 | 型 | 説明 |
---|
namespaceName | string | ネームスペース名 |
targetUserId | string | ユーザーID |
実装例
gs2.Friend.OnAcceptRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var targetUserId = notification.TargetUserId;
};
gs2.Friend.OnAcceptRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var targetUserId = notification.TargetUserId;
};
Gs2->Friend->OnAcceptRequestNotification().AddLambda([](const auto Notification)
{
const auto NamespaceName = Notification->NamespaceNameValue;
const auto TargetUserId = Notification->TargetUserIdValue;
});
OnReceiveRequestNotification
フレンドリクエストが届いたときに使用する通知
名前 | 型 | 説明 |
---|
namespaceName | string | ネームスペース名 |
fromUserId | string | ユーザーID |
実装例
gs2.Friend.OnReceiveRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var fromUserId = notification.FromUserId;
};
gs2.Friend.OnReceiveRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var fromUserId = notification.FromUserId;
};
Gs2->Friend->OnReceiveRequestNotification().AddLambda([](const auto Notification)
{
const auto NamespaceName = Notification->NamespaceNameValue;
const auto FromUserId = Notification->FromUserIdValue;
});