> For the complete documentation index, see [llms.txt](/llms.txt)

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

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



## モデル

### EzProfile

プロフィール<br>

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

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

- friend フレンド関係が成立している相手に閲覧可能な内容<br>
- follow フォローされている相手が閲覧可能な内容<br>
- public 誰でも閲覧可能な内容

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| userId | string |  | ✓ |  |  ~ 128文字 | ユーザーID |
| publicProfile | string |  |  |  |  ~ 1024文字 | 公開されるプロフィール<br>関係性に関わらずすべてのプレイヤーに表示されるプロフィール情報です。通常、表示名、アバター、その他公開可能な情報に使用されます。 |
| followerProfile | string |  |  |  |  ~ 1024文字 | フォロワー向けに公開されるプロフィール<br>このユーザーをフォローしているプレイヤーにのみ表示されるプロフィール情報です。公開プロフィールよりも詳細な情報（ゲームプレイ統計やステータスメッセージなど）を含むことができます。 |
| friendProfile | string |  |  |  |  ~ 1024文字 | フレンド向けに公開されるプロフィール<br>相互フレンド関係が成立しているプレイヤーにのみ表示されるプロフィール情報です。最もプライベートなプロフィールレベルで、連絡先やプライベートメッセージなどの個人情報の共有に適しています。 |

**関連するメソッド:**
getProfile - プレイヤー自身のプロフィールを取得する
updateProfile - プレイヤー自身のプロフィールを更新する


---

### EzBlackList

ブラックリスト<br>

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

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

**関連するメソッド:**
registerBlackList - プレイヤーをブロックする
unregisterBlackList - プレイヤーのブロックを解除する


---

### EzFollowUser

フォローユーザー<br>

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

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

**関連するメソッド:**
describeFollowUsers - プレイヤーがフォローしているプレイヤーの一覧を取得する
follow - 他のプレイヤーをフォローする
getFollowUser - 特定のプレイヤーをフォローしているか確認する
unfollow - プレイヤーのフォローを解除する


---

### EzFriendUser

フレンドユーザー<br>

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

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

**関連するメソッド:**
deleteFriend - フレンドリストからプレイヤーを削除する
describeFriends - プレイヤーのフレンドリストを取得する
getFriend - 特定のフレンドの情報を取得する


---

### EzFriendRequest

フレンドリクエスト<br>

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

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

**関連するメソッド:**
deleteRequest - 送信済みフレンドリクエストをキャンセルする
describeSendRequests - 送信済みフレンドリクエストの一覧を取得する
getSendRequest - 特定の送信済みフレンドリクエストを取得する
sendRequest - 他のプレイヤーにフレンドリクエストを送信する
accept - フレンドリクエストを承認する
describeReceiveRequests - 届いているフレンドリクエストの一覧を取得する
getReceiveRequest - 特定のフレンドリクエストの詳細を取得する
reject - フレンドリクエストを拒否する


---

### EzPublicProfile

公開プロフィール<br>

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

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

**関連するメソッド:**
getPublicProfile - 他のプレイヤーの公開プロフィールを取得する


---

## メソッド

### getProfile

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzProfile](#ezprofile) | プロフィール|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Profile(
    );
    var item = await domain.ModelAsync();

```

**Unity (Vanilla)**
```cs
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Profile(
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;

```

**Unreal Engine 5**
```cpp
    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;
    }

```


##### 値の変更イベントハンドリング




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Profile(
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);

```

**Unity (Vanilla)**
```cs
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Profile(
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);

```

**Unreal Engine 5**
```cpp
    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);

```


{{% alert title="Warning" color="warning" %}}このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。

ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。

そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
{{% /alert %}}

---

### getPublicProfile

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzPublicProfile](#ezpublicprofile) | 公開プロフィール|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).User(
        userId: "user-0001"
    ).PublicProfile(
    );
    var item = await domain.ModelAsync();

```

**Unity (Vanilla)**
```cs
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).User(
        userId: "user-0001"
    ).PublicProfile(
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;

```

**Unreal Engine 5**
```cpp
    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;
    }

```


##### 値の変更イベントハンドリング




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).User(
        userId: "user-0001"
    ).PublicProfile(
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);

```

**Unity (Vanilla)**
```cs
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).User(
        userId: "user-0001"
    ).PublicProfile(
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);

```

**Unreal Engine 5**
```cpp
    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);

```


{{% alert title="Warning" color="warning" %}}このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。

ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。

そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
{{% /alert %}}

---

### updateProfile

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzProfile](#ezprofile) | 更新したプロフィール|

#### 実装例




**Unity (UniTask)**
```csharp
    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();

```

**Unity (Vanilla)**
```cs
    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;

```

**Unreal Engine 5**
```cpp
    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

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

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

#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| gameSession | GameSession | | ✓|  |  | GameSession |
| withProfile | bool |  | | false |  | プロフィールも一緒に取得するか |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;EzFollowUser&gt;](#ezfollowuser) | フォローしているユーザーのリスト|
| nextPageToken | string | リストの続きを取得するためのページトークン|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Follow(
        withProfile: true
    );
    var items = await domain.FollowsAsync(
    ).ToListAsync();

```

**Unity (Vanilla)**
```cs
    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;
        }
    }

```

**Unreal Engine 5**
```cpp
    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

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzFollowUser](#ezfollowuser) | フォローしたユーザ|

#### 実装例




**Unity (UniTask)**
```csharp
    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();

```

**Unity (Vanilla)**
```cs
    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;

```

**Unreal Engine 5**
```cpp
    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

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzFollowUser](#ezfollowuser) | フォローしているユーザー|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Follow(
        withProfile: true
    ).FollowUser(
        targetUserId: "user-0002"
    );
    var item = await domain.ModelAsync();

```

**Unity (Vanilla)**
```cs
    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;

```

**Unreal Engine 5**
```cpp
    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;
    }

```


##### 値の変更イベントハンドリング




**Unity (UniTask)**
```csharp
    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);

```

**Unity (Vanilla)**
```cs
    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);

```

**Unreal Engine 5**
```cpp
    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);

```


{{% alert title="Warning" color="warning" %}}このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。

ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。

そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
{{% /alert %}}

---

### unfollow

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzFollowUser](#ezfollowuser) | アンフォローしたユーザ|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Follow(
        withProfile: true
    ).FollowUser(
        targetUserId: "user-0002"
    );
    var result = await domain.UnfollowAsync(
    );

```

**Unity (Vanilla)**
```cs
    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;
    }

```

**Unreal Engine 5**
```cpp
    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

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzFriendUser](#ezfrienduser) | 削除したフレンドのユーザー|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Friend(
        withProfile: true
    );
    var result = await domain.DeleteFriendAsync(
        targetUserId: "user-0002"
    );

```

**Unity (Vanilla)**
```cs
    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;
    }

```

**Unreal Engine 5**
```cpp
    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

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

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

#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| gameSession | GameSession | | ✓|  |  | GameSession |
| withProfile | bool |  | | false |  | プロフィールも一緒に取得するか |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;EzFriendUser&gt;](#ezfrienduser) | フレンドのユーザーのリスト|
| nextPageToken | string | リストの続きを取得するためのページトークン|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var items = await domain.FriendsAsync(
        withProfile: true
    ).ToListAsync();

```

**Unity (Vanilla)**
```cs
    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;
        }
    }

```

**Unreal Engine 5**
```cpp
    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());
    }

```


##### 値の変更イベントハンドリング




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.SubscribeFriends(
        () => {
            // リストの要素が変化した時に呼び出される
        }
    );

    // イベントハンドリングを停止
    domain.UnsubscribeFriends(callbackId);

```

**Unity (Vanilla)**
```cs
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.SubscribeFriends(
        () => {
            // リストの要素が変化した時に呼び出される
        }
    );

    // イベントハンドリングを停止
    domain.UnsubscribeFriends(callbackId);

```

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

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

```


{{% alert title="Warning" color="warning" %}}このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。

ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。

そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
{{% /alert %}}

---

### getFriend

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzFriendUser](#ezfrienduser) | フレンドのユーザー|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Friend(
        withProfile: true
    ).FriendUser(
        targetUserId: "user-0002"
    );
    var item = await domain.ModelAsync();

```

**Unity (Vanilla)**
```cs
    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;

```

**Unreal Engine 5**
```cpp
    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;
    }

```


##### 値の変更イベントハンドリング




**Unity (UniTask)**
```csharp
    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);

```

**Unity (Vanilla)**
```cs
    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);

```

**Unreal Engine 5**
```cpp
    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);

```


{{% alert title="Warning" color="warning" %}}このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。

ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。

そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
{{% /alert %}}

---

### deleteRequest

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzFriendRequest](#ezfriendrequest) | 削除したフレンドリクエスト|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).SendFriendRequest(
        targetUserId: "user-0002"
    );
    var result = await domain.DeleteRequestAsync(
    );

```

**Unity (Vanilla)**
```cs
    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;
    }

```

**Unreal Engine 5**
```cpp
    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

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;EzFriendRequest&gt;](#ezfriendrequest) | フレンドリクエストのリスト|
| nextPageToken | string | リストの続きを取得するためのページトークン|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var items = await domain.SendRequestsAsync(
    ).ToListAsync();

```

**Unity (Vanilla)**
```cs
    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;
        }
    }

```

**Unreal Engine 5**
```cpp
    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

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzFriendRequest](#ezfriendrequest) | フレンドリクエスト|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).SendFriendRequest(
        targetUserId: "user-0002"
    );
    var item = await domain.ModelAsync();

```

**Unity (Vanilla)**
```cs
    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;

```

**Unreal Engine 5**
```cpp
    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;
    }

```


##### 値の変更イベントハンドリング




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

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);

```

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

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);

```

**Unreal Engine 5**
```cpp
    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);

```


{{% alert title="Warning" color="warning" %}}このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。

ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。

そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
{{% /alert %}}

---

### sendRequest

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzFriendRequest](#ezfriendrequest) | 送信したフレンドリクエスト|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var result = await domain.SendRequestAsync(
        targetUserId: "user-0002"
    );
    var item = await result.ModelAsync();

```

**Unity (Vanilla)**
```cs
    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;

```

**Unreal Engine 5**
```cpp
    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

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzFriendRequest](#ezfriendrequest) | 承諾したフレンドリクエスト|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).ReceiveFriendRequest(
        fromUserId: "user-0002"
    );
    var result = await domain.AcceptAsync(
    );

```

**Unity (Vanilla)**
```cs
    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;
    }

```

**Unreal Engine 5**
```cpp
    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

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;EzFriendRequest&gt;](#ezfriendrequest) | フレンドリクエストのリスト|
| nextPageToken | string | リストの続きを取得するためのページトークン|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var items = await domain.ReceiveRequestsAsync(
    ).ToListAsync();

```

**Unity (Vanilla)**
```cs
    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;
        }
    }

```

**Unreal Engine 5**
```cpp
    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

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzFriendRequest](#ezfriendrequest) | フレンドリクエスト|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).ReceiveFriendRequest(
        targetUserId: null,
        fromUserId: "user-0002"
    );
    var item = await domain.ModelAsync();

```

**Unity (Vanilla)**
```cs
    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;

```

**Unreal Engine 5**
```cpp
    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;
    }

```


##### 値の変更イベントハンドリング




**Unity (UniTask)**
```csharp
    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);

```

**Unity (Vanilla)**
```cs
    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);

```

**Unreal Engine 5**
```cpp
    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);

```


{{% alert title="Warning" color="warning" %}}このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。

ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。

そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
{{% /alert %}}

---

### reject

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzFriendRequest](#ezfriendrequest) | 拒否したフレンドリクエスト|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).ReceiveFriendRequest(
        fromUserId: "user-0002"
    );
    var result = await domain.RejectAsync(
    );

```

**Unity (Vanilla)**
```cs
    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;
    }

```

**Unreal Engine 5**
```cpp
    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

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | List&lt;string&gt; | ブラックリストに登録されたユーザーIDリスト|
| nextPageToken | string | リストの続きを取得するためのページトークン|

#### 実装例




**Unity (UniTask)**
```csharp
    var domain = gs2.Friend.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var items = await domain.BlackListUsersAsync(
    ).ToListAsync();

```

**Unity (Vanilla)**
```cs
    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;
        }
    }

```

**Unreal Engine 5**
```cpp
    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

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzBlackList](#ezblacklist) | ブラックリスト|

#### 実装例




**Unity (UniTask)**
```csharp
    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();

```

**Unity (Vanilla)**
```cs
    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;

```

**Unreal Engine 5**
```cpp
    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

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

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

#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [EzBlackList](#ezblacklist) | ブラックリスト|

#### 実装例




**Unity (UniTask)**
```csharp
    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();

```

**Unity (Vanilla)**
```cs
    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;

```

**Unreal Engine 5**
```cpp
    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

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

 | 名前 | 型 | 説明 |
| --- | --- | --- |
| namespaceName | string |ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。|
| userId | string |ユーザーID|
| fromUserId | string |ユーザーID|

#### 実装例





**Unity (UniTask)**
```csharp

    gs2.Friend.OnFollowNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
```

**Unity (Vanilla)**
```cs

    gs2.Friend.OnFollowNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
```

**Unreal Engine 5**
```cpp

    Gs2->Friend->OnFollowNotification().AddLambda([](const auto Notification)
    {
        const auto NamespaceName = Notification->NamespaceNameValue;
        const auto UserId = Notification->UserIdValue;
        const auto FromUserId = Notification->FromUserIdValue;
    });
```


---

### OnAcceptRequestNotification

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

 | 名前 | 型 | 説明 |
| --- | --- | --- |
| namespaceName | string |ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。|
| userId | string |ユーザーID|
| targetUserId | string |ユーザーID|

#### 実装例





**Unity (UniTask)**
```csharp

    gs2.Friend.OnAcceptRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var targetUserId = notification.TargetUserId;
    };
```

**Unity (Vanilla)**
```cs

    gs2.Friend.OnAcceptRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var targetUserId = notification.TargetUserId;
    };
```

**Unreal Engine 5**
```cpp

    Gs2->Friend->OnAcceptRequestNotification().AddLambda([](const auto Notification)
    {
        const auto NamespaceName = Notification->NamespaceNameValue;
        const auto UserId = Notification->UserIdValue;
        const auto TargetUserId = Notification->TargetUserIdValue;
    });
```


---

### OnRejectRequestNotification

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

 | 名前 | 型 | 説明 |
| --- | --- | --- |
| namespaceName | string |ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。|
| userId | string |ユーザーID|
| targetUserId | string |ユーザーID|

#### 実装例





**Unity (UniTask)**
```csharp

    gs2.Friend.OnRejectRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var targetUserId = notification.TargetUserId;
    };
```

**Unity (Vanilla)**
```cs

    gs2.Friend.OnRejectRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var targetUserId = notification.TargetUserId;
    };
```

**Unreal Engine 5**
```cpp

    Gs2->Friend->OnRejectRequestNotification().AddLambda([](const auto Notification)
    {
        const auto NamespaceName = Notification->NamespaceNameValue;
        const auto UserId = Notification->UserIdValue;
        const auto TargetUserId = Notification->TargetUserIdValue;
    });
```


---

### OnDeleteFriendNotification

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

 | 名前 | 型 | 説明 |
| --- | --- | --- |
| namespaceName | string |ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。|
| userId | string |ユーザーID|
| fromUserId | string |ユーザーID|

#### 実装例





**Unity (UniTask)**
```csharp

    gs2.Friend.OnDeleteFriendNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
```

**Unity (Vanilla)**
```cs

    gs2.Friend.OnDeleteFriendNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
```

**Unreal Engine 5**
```cpp

    Gs2->Friend->OnDeleteFriendNotification().AddLambda([](const auto Notification)
    {
        const auto NamespaceName = Notification->NamespaceNameValue;
        const auto UserId = Notification->UserIdValue;
        const auto FromUserId = Notification->FromUserIdValue;
    });
```


---

### OnReceiveRequestNotification

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

 | 名前 | 型 | 説明 |
| --- | --- | --- |
| namespaceName | string |ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。|
| userId | string |ユーザーID|
| fromUserId | string |ユーザーID|

#### 実装例





**Unity (UniTask)**
```csharp

    gs2.Friend.OnReceiveRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
```

**Unity (Vanilla)**
```cs

    gs2.Friend.OnReceiveRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
```

**Unreal Engine 5**
```cpp

    Gs2->Friend->OnReceiveRequestNotification().AddLambda([](const auto Notification)
    {
        const auto NamespaceName = Notification->NamespaceNameValue;
        const auto UserId = Notification->UserIdValue;
        const auto FromUserId = Notification->FromUserIdValue;
    });
```


---

### OnCancelRequestNotification

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

 | 名前 | 型 | 説明 |
| --- | --- | --- |
| namespaceName | string |ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。|
| userId | string |ユーザーID|
| fromUserId | string |ユーザーID|

#### 実装例





**Unity (UniTask)**
```csharp

    gs2.Friend.OnCancelRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
```

**Unity (Vanilla)**
```cs

    gs2.Friend.OnCancelRequestNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var fromUserId = notification.FromUserId;
    };
```

**Unreal Engine 5**
```cpp

    Gs2->Friend->OnCancelRequestNotification().AddLambda([](const auto Notification)
    {
        const auto NamespaceName = Notification->NamespaceNameValue;
        const auto UserId = Notification->UserIdValue;
        const auto FromUserId = Notification->FromUserIdValue;
    });
```


---



