# 친구

## 친구 관리

Game Chat은 친구를 초대하고 관리하는 기능을 제공하여 사용자 간의 소셜 네트워킹을 용이하게 합니다. \
이 시스템을 통해 사용자는 친구를 초대, 수락, 거절, 삭제하는 등의 다양한 친구 관리 작업을 수행할 수 있습니다. 아래는 친구 관리 기능의 주요 세부 사항과 각 기능의 사용 방법입니다.

## 친구 목록 <a href="#undefined" id="undefined"></a>

사용자의 친구 목록을 조회할 수 있으며, 특정 상태의 친구만 필터링하여 조회할 수도 있습니다. 목록은 페이징 옵션을 통해 관리되므로 많은 수의 사용자를 효과적으로 관리할 수 있습니다.

```csharp
Hashtable filter = new Hashtable
{
    { "status", "accepted" },
};
Hashtable sort = new Hashtable
{
    { "created_at", -1 },
};
Hashtable option = new Hashtable
{
    { "offset", 0 },
    { "per_page", 10 },
};
var friends = await nc.getFriendships(filter, sort, option);
```

* **filter**: 조회할 친구의 상태(예: "accepted")를 기준으로 필터링합니다.
* **sort**: 결과를 정렬하는 기준을 설정합니다. 여기서는 생성 시간 기준 내림차순으로 정렬합니다.
* **option**: 조회할 데이터의 범위를 설정합니다. `offset`은 데이터 시작 위치, `per_page`는 페이지당 반환할 항목 수입니다.

## 초대 <a href="#undefined" id="undefined"></a>

특정 사용자를 친구로 초대합니다. 초대받은 사용자는 이 요청을 수락하거나 거절할 수 있습니다.

```csharp
var response = await nc.requestFriend(friendId);
```

* **friendId**: 초대하고자 하는 사용자의 식별자입니다.

## 수락 <a href="#undefined" id="undefined"></a>

받은 친구 초대를 수락합니다. 이를 통해 두 사용자는 상호 친구 관계가 됩니다.

```csharp
var response = await nc.acceptFriend(friendId);
```

* **friendId**: 수락할 친구 초대의 사용자 식별자입니다.

## 리젝 <a href="#undefined" id="undefined"></a>

받은 친구 초대를 거절합니다. 이 요청을 거절하면 상대방과 친구 관계가 이루어지지 않습니다.

```csharp
var response = await nc.rejectFriend(friendId);
```

* **friendId**: 거절할 친구 초대의 사용자 식별자입니다.

## 삭제 <a href="#undefined" id="undefined"></a>

친구 목록에서 특정 사용자를 삭제합니다. 이 작업은 친구 상태나 초대 상태와 관계없이 수행될 수 있습니다.

```csharp
var response = await nc.removeFriend(friendId);
```

* **friendId**: 삭제할 친구의 사용자 식별자입니다.

친구 관리 기능은 사용자 간의 상호작용을 촉진하고, 네트워킹을 강화하는 데 중요한 역할을 합니다. 이 기능을 통해 사용자는 자신의 소셜 네트워크를 보다 쉽게 확장하고 관리할 수 있습니다.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gamechat.me/basics/game-chat-v3/game-chat/v3/undefined-5.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
