GS2-Friend SDK for Game Engine API リファレンス

ゲームエンジン向け GS2-Friend SDK の モデルの仕様 と API のリファレンス

モデル

EzProfile

プロフィール

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

プロフィールは公開範囲ごとに設定することが可能で、3種類あります。

  • friend フレンド関係が成立している相手に閲覧可能な内容
  • follow フォローされている相手が閲覧可能な内容
  • public 誰でも閲覧可能な内容
有効化条件必須デフォルト値の制限説明
userIdstring
~ 128文字ユーザーID
publicProfilestring~ 1024文字公開されるプロフィール
関係性に関わらずすべてのプレイヤーに表示されるプロフィール情報です。通常、表示名、アバター、その他公開可能な情報に使用されます。
followerProfilestring~ 1024文字フォロワー向けに公開されるプロフィール
このユーザーをフォローしているプレイヤーにのみ表示されるプロフィール情報です。公開プロフィールよりも詳細な情報(ゲームプレイ統計やステータスメッセージなど)を含むことができます。
friendProfilestring~ 1024文字フレンド向けに公開されるプロフィール
相互フレンド関係が成立しているプレイヤーにのみ表示されるプロフィール情報です。最もプライベートなプロフィールレベルで、連絡先やプライベートメッセージなどの個人情報の共有に適しています。

EzBlackList

ブラックリスト

プレイヤーがブロックしたユーザーのリストを管理します。ブロックされたユーザーはこのプレイヤーにフレンドリクエストやフォローリクエストを送信できなくなり、望まないインタラクションを制御するメカニズムを提供します。

有効化条件必須デフォルト値の制限説明
userIdstring
~ 128文字ユーザーID
targetUserIdsList<string>0 ~ 1000 itemsブラックリストのユーザーIDリスト
このプレイヤーがブロックしたユーザー ID のリストです。ブロックされたユーザーはこのプレイヤーにフレンドリクエストやフォローリクエストを送信できません。

EzFollowUser

フォローユーザー

現在のユーザーがフォローしているユーザーを表します。フォロー対象ユーザーの公開プロフィールとフォロワーレベルのプロフィール情報へのアクセスを提供し、これはフォロワーには表示されますが一般には公開されません。

有効化条件必須デフォルト値の制限説明
userIdstring
~ 128文字ユーザーID
publicProfilestring~ 1024文字公開されるプロフィール
フォロー対象ユーザーの公開プロフィール情報で、すべてのプレイヤーがアクセスできます。
followerProfilestring~ 1024文字フォロワー向けに公開されるプロフィール
フォロワーにのみ表示されるフォロー対象ユーザーのプロフィール情報です。公開プロフィールよりも詳細な情報を含みます。

EzFriendUser

フレンドユーザー

現在のユーザーと相互フレンド関係が成立しているユーザーを表します。フレンドの公開プロフィールとフレンドレベルのプロフィール情報へのアクセスを提供し、これは確認済みのフレンドにのみ表示されます。

有効化条件必須デフォルト値の制限説明
userIdstring
~ 128文字ユーザーID
publicProfilestring~ 1024文字公開されるプロフィール
フレンドの公開プロフィール情報で、すべてのプレイヤーがアクセスできます。
friendProfilestring~ 1024文字フレンド向けに公開されるプロフィール
確認済みのフレンドにのみ表示されるフレンドのプロフィール情報です。公開プロフィールよりもプライベートな情報を含みます。

EzFriendRequest

フレンドリクエスト

2人のプレイヤー間のフレンドリクエストを表します。送信者のユーザー ID、受信者のユーザー ID、および表示用の送信者の公開プロフィールを含みます。

有効化条件必須デフォルト値の制限説明
userIdstring
~ 128文字フレンドリクエストを送信したユーザーID
targetUserIdstring
~ 128文字フレンドリクエストを送信されたユーザーID
publicProfilestring~ 1024文字公開されるプロフィール
フレンドリクエスト送信者の公開プロフィールです。受信者が誰がフレンド申請しているかを識別できるよう、表示用に含まれます。

EzPublicProfile

公開プロフィール

ユーザーの公開プロフィール情報の読み取り専用ビューです。フレンドやフォロー関係を必要とせず、任意のユーザーについて取得できます。検索結果、リーダーボード、その他の公開コンテキストでプレイヤー情報を表示するために使用されます。

有効化条件必須デフォルト値の制限説明
userIdstring
~ 128文字ユーザーID
publicProfilestring~ 1024文字公開されるプロフィール
ユーザーの公開プロフィール内容です。フレンドやフォロワーの関係を必要とせずにアクセスできます。

メソッド

getProfile

プレイヤー自身のプロフィールを取得する

プレイヤー自身のプロフィールを、3つの公開レベルすべて含めて取得します:

  • 公開プロフィール: 誰でも見られる情報(プレイヤー名、アバターなど)
  • フォロワー向けプロフィール: フォローしてくれている人だけに見える情報(プレイスタイル、好きなチームなど)
  • フレンド向けプロフィール: 相互フレンドだけに見える情報(本名、連絡先など)
    「マイプロフィール」や「プロフィール編集」画面で、プレイヤーが自分のプロフィール情報を確認・管理できるようにするために使います。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession

Result

説明
itemEzProfileプロフィール

実装例

    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.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->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 callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Profile(
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Friend::Model::FProfile> value) {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    Domain->Unsubscribe(CallbackId);

getPublicProfile

他のプレイヤーの公開プロフィールを取得する

指定したプレイヤーのプロフィールのうち、公開部分のみを取得します。フォローやフレンドの関係に関係なく、誰でも見られる情報です。
たとえば表示名、アバター、レベルなどが返されますが、フォロワー限定やフレンド限定のプロフィールデータは含まれません。
ランキング、チャット、マッチング結果などで他のプレイヤーの名前をタップした際に、プレイヤーカードやミニプロフィールを表示するのに使います。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
userIdstring
~ 128文字ユーザーID

Result

説明
itemEzPublicProfile公開プロフィール

実装例

    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.ModelFuture();
    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 callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);
    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);

updateProfile

プレイヤー自身のプロフィールを更新する

プレイヤーのプロフィールを3つの公開レベルで更新します:

  • publicProfile: すべてのプレイヤーに表示される情報(表示名、レベル、アバターアイコンなど)
  • followerProfile: フォロワーだけに表示される追加情報(「ギルドメンバー募集中!」など)
  • friendProfile: フレンドだけに表示されるプライベートな情報(Discord ID、スケジュールなど)
    各フィールドは自由形式の文字列なので、テキストやJSONデータなど何でも保存できます。設定画面やプロフィール編集画面からプレイヤーがプロフィールを編集する際に使います。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
publicProfilestring~ 1024文字公開されるプロフィール
関係性に関わらずすべてのプレイヤーに表示されるプロフィール情報です。通常、表示名、アバター、その他公開可能な情報に使用されます。
followerProfilestring~ 1024文字フォロワー向けに公開されるプロフィール
このユーザーをフォローしているプレイヤーにのみ表示されるプロフィール情報です。公開プロフィールよりも詳細な情報(ゲームプレイ統計やステータスメッセージなど)を含むことができます。
friendProfilestring~ 1024文字フレンド向けに公開されるプロフィール
相互フレンド関係が成立しているプレイヤーにのみ表示されるプロフィール情報です。最もプライベートなプロフィールレベルで、連絡先やプライベートメッセージなどの個人情報の共有に適しています。

Result

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

実装例

    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.UpdateProfileFuture(
        publicProfile: "public",
        followerProfile: "follower",
        friendProfile: "friend"
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    var future2 = future.Result.ModelFuture();
    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(
        GameSession
    )->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 (Future2->GetTask().IsError())
    {
        return Future2->GetTask().Error();
    }
    const auto Result = Future2->GetTask().Result();

describeFollowUsers

プレイヤーがフォローしているプレイヤーの一覧を取得する

現在のプレイヤーがフォローしているすべてのプレイヤーを取得します。
フォローは一方向の関係です。相手の承認なしにフォローできる、SNSのフォローのような仕組みです。
withProfile を true にすると、フォロー先プレイヤーのフォロワー向けプロフィール(フォロワーに公開している追加情報)も一緒に返されます。
「フォロー中」リスト画面を構築して、プレイヤーが自分のフォロー一覧を確認できるようにするのに使います。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
withProfileboolfalseプロフィールも一緒に取得するか
limitint301 ~ 1000データの取得件数
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン

Result

説明
itemsList<EzFollowUser>フォローしているユーザーのリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Follow(
        withProfile: true
    );
    var items = await domain.FollowsAsync(
    ).ToListAsync();
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Follow(
        withProfile: true
    );
    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(
        GameSession
    )->Follow(
        true // withProfile
    );
    const auto It = Domain->Follows(
    );
    TArray<Gs2::UE5::Friend::Model::FEzFollowUserPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }

follow

他のプレイヤーをフォローする

指定したプレイヤーを現在のプレイヤーのフォローリストに追加します。
フォローは相手の承認が不要な一方向のアクションです。SNSのフォローと同じ仕組みです。
フォロー後、対象プレイヤーのフォロワー向けプロフィール情報(フォロワーに公開している追加情報)を見られるようになります。
他のプレイヤーのプロフィール画面、検索結果、ランキング画面などの「フォロー」ボタンに使います。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
targetUserIdstring
~ 128文字フォローしたい相手のユーザーID
withProfilebool
falseプロフィールも一緒に取得するか

Result

説明
itemEzFollowUserフォローしたユーザ

実装例

    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Follow(
        withProfile: true
    );
    var result = await domain.FollowAsync(
        targetUserId: "user-0002"
    );
    var item = await result.ModelAsync();
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Follow(
        withProfile: true
    );
    var future = domain.FollowFuture(
        targetUserId: "user-0002"
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    var future2 = future.Result.ModelFuture();
    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(
        GameSession
    )->Follow(
        true // withProfile
    );
    const auto Future = Domain->Follow(
        "user-0002" // targetUserId
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }

    // obtain changed values / result values
    const auto Future2 = Future->GetTask().Result()->Model();
    Future2->StartSynchronousTask();
    if (Future2->GetTask().IsError())
    {
        return Future2->GetTask().Error();
    }
    const auto Result = Future2->GetTask().Result();

getFollowUser

特定のプレイヤーをフォローしているか確認する

現在のプレイヤーのフォローリストから特定のプレイヤーを取得します。
対象プレイヤーがフォローリストにいれば、その情報が返されます。withProfile を true にすると、フォロワー向けプロフィールも含まれます。
プレイヤーがすでに相手をフォローしているか確認するのに使います。たとえば、他のプレイヤーのプロフィール画面で「フォロー中 / フォローする」ボタンの表示を切り替えるのに便利です。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
withProfileboolfalseプロフィールも一緒に取得するか
targetUserIdstring
~ 128文字ユーザーID

Result

説明
itemEzFollowUserフォローしているユーザー

実装例

    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Follow(
        withProfile: true
    ).FollowUser(
        targetUserId: "user-0002"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Follow(
        withProfile: true
    ).FollowUser(
        targetUserId: "user-0002"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Follow(
        true // withProfile
    )->FollowUser(
        "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
    ).Follow(
        withProfile: true
    ).FollowUser(
        targetUserId: "user-0002"
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Follow(
        withProfile: true
    ).FollowUser(
        targetUserId: "user-0002"
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Follow(
        true // withProfile
    )->FollowUser(
        "user-0002" // targetUserId
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Friend::Model::FFollowUser> value) {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    Domain->Unsubscribe(CallbackId);

unfollow

プレイヤーのフォローを解除する

指定したプレイヤーを現在のプレイヤーのフォローリストから削除します。
フォロー解除後、対象プレイヤーのフォロワー向けプロフィール情報が見られなくなります。
フォロー中のプレイヤーのプロフィール画面や「フォロー中」リスト画面の「フォロー解除」ボタンに使います。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
targetUserIdstring
~ 128文字ユーザーID
withProfilebool
falseプロフィールも一緒に取得するか

Result

説明
itemEzFollowUserアンフォローしたユーザ

実装例

    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Follow(
        withProfile: true
    ).FollowUser(
        targetUserId: "user-0002"
    );
    var result = await domain.UnfollowAsync(
    );
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Follow(
        withProfile: true
    ).FollowUser(
        targetUserId: "user-0002"
    );
    var future = domain.UnfollowFuture(
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Follow(
        true // withProfile
    )->FollowUser(
        "user-0002" // targetUserId
    );
    const auto Future = Domain->Unfollow(
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
    const auto Result = Future->GetTask().Result();

deleteFriend

フレンドリストからプレイヤーを削除する

指定したプレイヤーを現在のプレイヤーのフレンドリストから削除し、相互フレンド関係を解除します。
削除後、お互いのフレンド向けプロフィール情報が見られなくなります。
フレンドのプロフィール画面や詳細画面の「フレンド解除」ボタンに使います。相手側もフレンド関係が解除されるため、確認ダイアログの表示をおすすめします。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
targetUserIdstring
~ 128文字ユーザーID
withProfilebool
falseプロフィールも一緒に取得するか

Result

説明
itemEzFriendUser削除したフレンドのユーザー

実装例

    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Friend(
        withProfile: true
    );
    var result = await domain.DeleteFriendAsync(
        targetUserId: "user-0002"
    );
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Friend(
        withProfile: true
    );
    var future = domain.DeleteFriendFuture(
        targetUserId: "user-0002"
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Friend(
        true // withProfile
    );
    const auto Future = Domain->DeleteFriend(
        "user-0002" // targetUserId
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
    const auto Result = Future->GetTask().Result();

describeFriends

プレイヤーのフレンドリストを取得する

現在のプレイヤーと相互フレンドになっているすべてのプレイヤーを取得します。
フォロー(一方向)とは異なり、フレンドはフレンドリクエストが承認されて成立する双方向の関係です。
withProfile を true にすると、各フレンドのフレンド向けプロフィール(最もプライベートなレベルのプロフィール情報)も一緒に返されます。
「フレンド」リスト画面を構築するのに使います。たとえば、フレンドの名前、アバター、オンライン状態などを表示できます。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
withProfileboolfalseプロフィールも一緒に取得するか
limitint301 ~ 1000データの取得件数
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン

Result

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

実装例

    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var items = await domain.FriendsAsync(
        withProfile: true
    ).ToListAsync();
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var it = domain.Friends(
        withProfile: true
    );
    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(
        GameSession
    );
    const auto It = Domain->Friends(
        true // withProfile
    );
    TArray<Gs2::UE5::Friend::Model::FEzFriendUserPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
値の変更イベントハンドリング
    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 callbackId = domain.SubscribeFriends(
        () => {
            // リストの要素が変化した時に呼び出される
        }
    );

    // イベントハンドリングを停止
    domain.UnsubscribeFriends(callbackId);
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->SubscribeFriends(
        []() {
            // リストの要素が変化した時に呼び出される
        }
    );

    // イベントハンドリングを停止
    Domain->UnsubscribeFriends(CallbackId);

getFriend

特定のフレンドの情報を取得する

現在のプレイヤーのフレンドリストから特定のプレイヤーの情報を取得します。
withProfile を true にすると、フレンドのフレンド向けプロフィール(最もプライベートなレベルのプロフィール情報)も返されます。
フレンドの詳細画面を表示する際に使います。たとえば、フレンドのプロフィール全体、ステータス、「フレンド解除」や「メッセージを送る」などのオプションを表示できます。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
targetUserIdstring
~ 128文字ユーザーID
withProfileboolfalseプロフィールも一緒に取得するか

Result

説明
itemEzFriendUserフレンドのユーザー

実装例

    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Friend(
        withProfile: true
    ).FriendUser(
        targetUserId: "user-0002"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Friend(
        withProfile: true
    ).FriendUser(
        targetUserId: "user-0002"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Friend(
        true // 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: true
    ).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: true
    ).FriendUser(
        targetUserId: "user-0002"
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Friend(
        true // withProfile
    )->FriendUser(
        "user-0002" // targetUserId
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Friend::Model::FFriendUser> value) {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    Domain->Unsubscribe(CallbackId);

deleteRequest

送信済みフレンドリクエストをキャンセルする

プレイヤーが送信したフレンドリクエストを、相手が返答する前にキャンセルします。
リクエストは送信者の送信ボックスと受信者の受信箱の両方から削除されます。
送信済みリクエスト画面や、すでにリクエスト送信済みのプレイヤーのプロフィール画面の「リクエストをキャンセル」ボタンに使います。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
targetUserIdstring
~ 128文字ユーザーID

Result

説明
itemEzFriendRequest削除したフレンドリクエスト

実装例

    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.DeleteRequestFuture(
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->SendFriendRequest(
        "user-0002" // targetUserId
    );
    const auto Future = Domain->DeleteRequest(
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
    const auto Result = Future->GetTask().Result();

describeSendRequests

送信済みフレンドリクエストの一覧を取得する

現在のプレイヤーが送信した、まだ返答待ちのフレンドリクエストをすべて取得します。
各リクエストには誰にいつ送ったかが表示されます。プレイヤーは気が変わったら送信済みリクエストをキャンセルできます。
「送信済みリクエスト」画面を構築するのに使います。たとえば「プレイヤーBの返答を待っています… [キャンセル]」のように表示できます。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession

Result

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

実装例

    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(
        GameSession
    );
    const auto It = Domain->SendRequests(
    );
    TArray<Gs2::UE5::Friend::Model::FEzFriendRequestPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }

getSendRequest

特定の送信済みフレンドリクエストを取得する

現在のプレイヤーが特定のプレイヤーに送信したフレンドリクエストの詳細を取得します。
特定のリクエストの状態を表示する際に使います。たとえば、特定のプレイヤーへのリクエストがまだ保留中かどうかを確認したり、プレイヤープロフィール画面でリクエストの詳細を表示するのに使えます。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
targetUserIdstring
~ 128文字ユーザーID

Result

説明
itemEzFriendRequestフレンドリクエスト

実装例

    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.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->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 callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->SendFriendRequest(
        "user-0002" // targetUserId
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Friend::Model::FSendFriendRequest> value) {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    Domain->Unsubscribe(CallbackId);

sendRequest

他のプレイヤーにフレンドリクエストを送信する

指定したプレイヤーにフレンドリクエストを送信します。リクエストは相手の受信箱に届き、承認または拒否できます。
承認されると、お互いが相互フレンドになり、フレンド向けプロフィール情報を見られるようになります。
注意: すでにフレンドが1000人いる場合はリクエストを送信できません。また、未承諾のリクエストが存在する場合、最も古い未承諾リクエストが自動的に取り下げられて新しいリクエストが送信されます。
他のプレイヤーのプロフィール画面や検索結果の「フレンドリクエストを送る」ボタンに使います。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
targetUserIdstring
~ 128文字フレンドになりたい相手のユーザーID

Result

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

実装例

    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.SendRequestFuture(
        targetUserId: "user-0002"
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    var future2 = future.Result.ModelFuture();
    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(
        GameSession
    );
    const auto Future = Domain->SendRequest(
        "user-0002" // targetUserId
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }

    // obtain changed values / result values
    const auto Future2 = Future->GetTask().Result()->Model();
    Future2->StartSynchronousTask();
    if (Future2->GetTask().IsError())
    {
        return Future2->GetTask().Error();
    }
    const auto Result = Future2->GetTask().Result();

accept

フレンドリクエストを承認する

指定したプレイヤーからのフレンドリクエストを承認します。
承認すると相互フレンド関係が成立し、お互いのフレンドリストに追加されて、フレンド向けプロフィール情報を見られるようになります。
フレンドリクエスト通知や受信箱画面の「承認」ボタンに使います。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
fromUserIdstring
~ 128文字ユーザーID

Result

説明
itemEzFriendRequest承諾したフレンドリクエスト

実装例

    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).ReceiveFriendRequest(
        fromUserId: "user-0002"
    );
    var result = await domain.AcceptAsync(
    );
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).ReceiveFriendRequest(
        fromUserId: "user-0002"
    );
    var future = domain.AcceptFuture(
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->ReceiveFriendRequest(
        nullptr, // targetUserId
        "user-0002" // fromUserId
    );
    const auto Future = Domain->Accept(
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
    const auto Result = Future->GetTask().Result();

describeReceiveRequests

届いているフレンドリクエストの一覧を取得する

他のプレイヤーから現在のプレイヤーに送信された、返答待ちのフレンドリクエストをすべて取得します。
各リクエストには誰がいつ送ったかが表示されます。プレイヤーはそれぞれ承認または拒否できます。
「フレンドリクエスト」の受信箱画面を構築するのに使います。たとえば「プレイヤーAがフレンドになりたがっています! [承認] [拒否]」のように表示できます。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession

Result

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

実装例

    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(
        GameSession
    );
    const auto It = Domain->ReceiveRequests(
    );
    TArray<Gs2::UE5::Friend::Model::FEzFriendRequestPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }

getReceiveRequest

特定のフレンドリクエストの詳細を取得する

特定の送信者からのフレンドリクエストの詳細を取得します。
フレンドリクエストの詳細画面を表示する際に使います。たとえば、送信者のプロフィールやリクエスト送信日時を表示し、「承認」「拒否」ボタンを配置する画面に使えます。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
fromUserIdstring
~ 128文字ユーザーID

Result

説明
itemEzFriendRequestフレンドリクエスト

実装例

    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.ModelFuture();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->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 callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->ReceiveFriendRequest(
        nullptr, // targetUserId
        "user-0002" // fromUserId
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Friend::Model::FReceiveFriendRequest> value) {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    Domain->Unsubscribe(CallbackId);

reject

フレンドリクエストを拒否する

指定したプレイヤーからのフレンドリクエストを拒否します。
リクエストは削除され、フレンド関係は成立しません。拒否されたことは送信者に通知されません。
フレンドリクエスト通知や受信箱画面の「拒否」や「断る」ボタンに使います。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
fromUserIdstring
~ 128文字ユーザーID

Result

説明
itemEzFriendRequest拒否したフレンドリクエスト

実装例

    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).ReceiveFriendRequest(
        fromUserId: "user-0002"
    );
    var result = await domain.RejectAsync(
    );
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).ReceiveFriendRequest(
        fromUserId: "user-0002"
    );
    var future = domain.RejectFuture(
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    const auto Domain = Gs2->Friend->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->ReceiveFriendRequest(
        nullptr, // targetUserId
        "user-0002" // fromUserId
    );
    const auto Future = Domain->Reject(
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
    const auto Result = Future->GetTask().Result();

getBlackList

プレイヤーのブロックリストを取得する

現在のプレイヤーがブロックしたユーザーIDの一覧を取得します。
ブロックされたプレイヤーは、現在のプレイヤーにフレンドリクエストを送ったりフォローしたりできなくなります。
「ブロック中のプレイヤー」管理画面を構築するのに使います。以前ブロックした相手を確認したり、ブロック解除したりできる画面に使えます。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession

Result

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

実装例

    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var items = await domain.BlackListUsersAsync(
    ).ToListAsync();
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var it = domain.BlackListUsers(
    );

    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(
        GameSession
    );
    const auto It = Domain->BlackListUsers(
    );

    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }

registerBlackList

プレイヤーをブロックする

指定したプレイヤーを現在のプレイヤーのブロックリストに追加します。
ブロックすると、対象プレイヤーは現在のプレイヤーにフレンドリクエストを送ったりフォローしたりできなくなります。
他のプレイヤーのプロフィール画面や通報・モデレーションメニューの「ブロック」ボタンに使います。プレイヤーが不要なやり取りから身を守るのに役立ちます。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
targetUserIdstring
~ 128文字ユーザーID

Result

説明
itemEzBlackListブラックリスト

実装例

    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.RegisterBlackListFuture(
        targetUserId: "user-0002"
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    var future2 = future.Result.ModelFuture();
    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(
        GameSession
    )->BlackList(
    );
    const auto Future = Domain->RegisterBlackList(
        "user-0002" // targetUserId
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }

    // obtain changed values / result values
    const auto Future2 = Future->GetTask().Result()->Model();
    Future2->StartSynchronousTask();
    if (Future2->GetTask().IsError())
    {
        return Future2->GetTask().Error();
    }
    const auto Result = Future2->GetTask().Result();

unregisterBlackList

プレイヤーのブロックを解除する

指定したプレイヤーを現在のプレイヤーのブロックリストから削除します。
ブロック解除後、対象プレイヤーは再び現在のプレイヤーにフレンドリクエストを送ったりフォローしたりできるようになります。
ブロック中のプレイヤー管理画面やブロック中プレイヤーのプロフィール画面の「ブロック解除」ボタンに使います。

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring
~ 128文字ネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
gameSessionGameSession
GameSession
targetUserIdstring
~ 128文字ユーザーID

Result

説明
itemEzBlackListブラックリスト

実装例

    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.UnregisterBlackListFuture(
        targetUserId: "user-0002"
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    var future2 = future.Result.ModelFuture();
    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(
        GameSession
    )->BlackList(
    );
    const auto Future = Domain->UnregisterBlackList(
        "user-0002" // targetUserId
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }

    // obtain changed values / result values
    const auto Future2 = Future->GetTask().Result()->Model();
    Future2->StartSynchronousTask();
    if (Future2->GetTask().IsError())
    {
        return Future2->GetTask().Error();
    }
    const auto Result = Future2->GetTask().Result();

イベントハンドラ

OnFollowNotification

フォローされたときに使用するプッシュ通知

名前説明
namespaceNamestringネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
userIdstringユーザーID
fromUserIdstringユーザーID

実装例

    gs2.Friend.OnFollowNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
    gs2.Friend.OnFollowNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
    Gs2->Friend->OnFollowNotification().AddLambda([](const auto Notification)
    {
        const auto NamespaceName = Notification->NamespaceNameValue;
        const auto UserId = Notification->UserIdValue;
        const auto FromUserId = Notification->FromUserIdValue;
    });

OnAcceptRequestNotification

フレンドリクエストが承認されたときに使用するプッシュ通知

名前説明
namespaceNamestringネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
userIdstringユーザーID
targetUserIdstringユーザーID

実装例

    gs2.Friend.OnAcceptRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var targetUserId = notification.TargetUserId;
    };
    gs2.Friend.OnAcceptRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var targetUserId = notification.TargetUserId;
    };
    Gs2->Friend->OnAcceptRequestNotification().AddLambda([](const auto Notification)
    {
        const auto NamespaceName = Notification->NamespaceNameValue;
        const auto UserId = Notification->UserIdValue;
        const auto TargetUserId = Notification->TargetUserIdValue;
    });

OnRejectRequestNotification

フレンドリクエストが拒否されたときに使用するプッシュ通知

名前説明
namespaceNamestringネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
userIdstringユーザーID
targetUserIdstringユーザーID

実装例

    gs2.Friend.OnRejectRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var targetUserId = notification.TargetUserId;
    };
    gs2.Friend.OnRejectRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var targetUserId = notification.TargetUserId;
    };
    Gs2->Friend->OnRejectRequestNotification().AddLambda([](const auto Notification)
    {
        const auto NamespaceName = Notification->NamespaceNameValue;
        const auto UserId = Notification->UserIdValue;
        const auto TargetUserId = Notification->TargetUserIdValue;
    });

OnDeleteFriendNotification

フレンドが削除されたときに使用するプッシュ通知

名前説明
namespaceNamestringネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
userIdstringユーザーID
fromUserIdstringユーザーID

実装例

    gs2.Friend.OnDeleteFriendNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
    gs2.Friend.OnDeleteFriendNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
    Gs2->Friend->OnDeleteFriendNotification().AddLambda([](const auto Notification)
    {
        const auto NamespaceName = Notification->NamespaceNameValue;
        const auto UserId = Notification->UserIdValue;
        const auto FromUserId = Notification->FromUserIdValue;
    });

OnReceiveRequestNotification

フレンドリクエストが届いたときに使用するプッシュ通知

名前説明
namespaceNamestringネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
userIdstringユーザーID
fromUserIdstringユーザーID

実装例

    gs2.Friend.OnReceiveRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
    gs2.Friend.OnReceiveRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
    Gs2->Friend->OnReceiveRequestNotification().AddLambda([](const auto Notification)
    {
        const auto NamespaceName = Notification->NamespaceNameValue;
        const auto UserId = Notification->UserIdValue;
        const auto FromUserId = Notification->FromUserIdValue;
    });

OnCancelRequestNotification

受け取ったフレンドリクエストがキャンセルされたときに使用するプッシュ通知

名前説明
namespaceNamestringネームスペース名
ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。
userIdstringユーザーID
fromUserIdstringユーザーID

実装例

    gs2.Friend.OnCancelRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
    gs2.Friend.OnCancelRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
    Gs2->Friend->OnCancelRequestNotification().AddLambda([](const auto Notification)
    {
        const auto NamespaceName = Notification->NamespaceNameValue;
        const auto UserId = Notification->UserIdValue;
        const auto FromUserId = Notification->FromUserIdValue;
    });