# Kanallar

Kanallar için REST API rotaları.

## Kanalı getir (`getChannel`)

**`GET https://noluyo.net/api/v1/channels/{channel_id}`** (`GET /channels/{channel_id}`)

Çağıranın görebildiği bir kanalı döndürür. ViewChannel izni olmayan üye missing_access, sunucunun dışındaki biri unknown_channel alır.

- **Kimlik:** Bot token'ı (`Authorization: Bot <BOT_TOKEN>`)
- **Hız sınırı:** `read` (30 / 5s)

### Parametreler

| Ad | Konum | Tür | Zorunlu | Açıklama |
| --- | --- | --- | --- | --- |
| `channel_id` | `path` | `string` | evet | Kanal ID'si. |

### Örnek çağrılar

```bash
curl -X GET "https://noluyo.net/api/v1/channels/111500000000000100" \
  -H "Authorization: Bot $BOT_TOKEN"
```

```js
// JavaScript (noluyo-bot)
await bot.rest.getChannel("111500000000000100");
```

```py
# Python (noluyo_bot)
await bot.rest.get_channel("111500000000000100")
```

### Yanıt (200)

```json
{
  "id": "111500000000000100",
  "type": 0,
  "guild_id": "111500000000000000",
  "name": "genel",
  "topic": null,
  "position": 1,
  "parent_id": null,
  "nsfw": false,
  "last_message_id": "111600000000000000",
  "permission_overwrites": []
}
```

### Hata kodları

- **HTTP 401:** `unauthorized`
- **HTTP 403:** `missing_access`, `temporarily_banned`
- **HTTP 404:** `unknown_channel`
- **HTTP 429:** `rate_limited`
- **HTTP 503:** `maintenance`

## Kanalı güncelle (`updateChannel`)

**`PATCH https://noluyo.net/api/v1/channels/{channel_id}`** (`PATCH /channels/{channel_id}`)

Yalnızca gönderilen alanları değiştirir. topic ve rate_limit_per_user metin, bitrate ve user_limit ses kanalları içindir; parent_id aynı sunucudaki bir kategori olmalıdır, null kanalı kategorisinden çıkarır, kategorinin üst kategorisi olamaz.

- **Kimlik:** Bot token'ı (`Authorization: Bot <BOT_TOKEN>`)
- **İzinler:** `ManageChannels`
- **Hız sınırı:** `write` (10 / 10s)

### Parametreler

| Ad | Konum | Tür | Zorunlu | Açıklama |
| --- | --- | --- | --- | --- |
| `channel_id` | `path` | `string` | evet | Kanal ID'si. |

### Gövde alanları

| Alan | Tür | Zorunlu | Açıklama |
| --- | --- | --- | --- |
| `name` | `string` | - | (1–100) |
| `topic` | `string | null` | - | (<= 1024) |
| `position` | `integer` | - |  |
| `parent_id` | `ID | null` | - |  |
| `nsfw` | `boolean` | - |  |
| `bitrate` | `integer` | - | (8000–96000) |
| `user_limit` | `integer` | - | (0–99) |
| `rate_limit_per_user` | `integer` | - | (0–21600) |

### Örnek çağrılar

```bash
curl -X PATCH "https://noluyo.net/api/v1/channels/111500000000000100" \
  -H "Authorization: Bot $BOT_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"topic":"Hoş geldiniz"}'
```

```js
// JavaScript (noluyo-bot)
await bot.rest.updateChannel("111500000000000100", { topic: "Hoş geldiniz" });
```

```py
# Python (noluyo_bot)
await bot.rest.update_channel("111500000000000100", {"topic": "Hoş geldiniz"})
```

### Yanıt (200)

```json
{
  "id": "111500000000000100",
  "type": 0,
  "guild_id": "111500000000000000",
  "name": "genel",
  "topic": "Hoş geldiniz",
  "position": 1,
  "parent_id": null,
  "nsfw": false,
  "last_message_id": "111600000000000000",
  "permission_overwrites": [],
  "rate_limit_per_user": 5
}
```

### Hata kodları

- **HTTP 400:** `validation_failed`, `invalid_body`
- **HTTP 401:** `unauthorized`
- **HTTP 403:** `missing_access`, `missing_permissions`, `temporarily_banned`
- **HTTP 404:** `unknown_channel`
- **HTTP 413:** `body_too_large`
- **HTTP 429:** `rate_limited`
- **HTTP 503:** `maintenance`

## Kanalı sil (`deleteChannel`)

**`DELETE https://noluyo.net/api/v1/channels/{channel_id}`** (`DELETE /channels/{channel_id}`)

Kanalı siler ve silinen kanalın nesnesiyle yanıt verir.

- **Kimlik:** Bot token'ı (`Authorization: Bot <BOT_TOKEN>`)
- **İzinler:** `ManageChannels`
- **Hız sınırı:** `write` (10 / 10s)

### Parametreler

| Ad | Konum | Tür | Zorunlu | Açıklama |
| --- | --- | --- | --- | --- |
| `channel_id` | `path` | `string` | evet | Kanal ID'si. |

### Örnek çağrılar

```bash
curl -X DELETE "https://noluyo.net/api/v1/channels/111500000000000100" \
  -H "Authorization: Bot $BOT_TOKEN"
```

```js
// JavaScript (noluyo-bot)
await bot.rest.deleteChannel("111500000000000100");
```

```py
# Python (noluyo_bot)
await bot.rest.delete_channel("111500000000000100")
```

### Yanıt (200)

```json
{
  "id": "111500000000000100",
  "type": 0,
  "guild_id": "111500000000000000",
  "name": "genel",
  "topic": null,
  "position": 1,
  "parent_id": null,
  "nsfw": false,
  "last_message_id": "111600000000000000",
  "permission_overwrites": []
}
```

### Hata kodları

- **HTTP 401:** `unauthorized`
- **HTTP 403:** `missing_access`, `missing_permissions`, `temporarily_banned`
- **HTTP 404:** `unknown_channel`
- **HTTP 429:** `rate_limited`
- **HTTP 503:** `maintenance`

## Yazıyor göstergesini göster (`sendTyping`)

**`POST https://noluyo.net/api/v1/channels/{channel_id}/typing`** (`POST /channels/{channel_id}/typing`)

Kanaldaki kişilere botun yazdığını gösterir. Yalnızca metin kanallarında çalışır. İstek gövdesi yoktur.

- **Kimlik:** Bot token'ı (`Authorization: Bot <BOT_TOKEN>`)
- **İzinler:** `SendMessages`
- **Hız sınırı:** `write` (10 / 10s)

### Parametreler

| Ad | Konum | Tür | Zorunlu | Açıklama |
| --- | --- | --- | --- | --- |
| `channel_id` | `path` | `string` | evet | Kanal ID'si. |

### Örnek çağrılar

```bash
curl -X POST "https://noluyo.net/api/v1/channels/111500000000000100/typing" \
  -H "Authorization: Bot $BOT_TOKEN"
```

```js
// JavaScript (noluyo-bot)
await bot.rest.sendTyping("111500000000000100");
```

```py
# Python (noluyo_bot)
await bot.rest.send_typing("111500000000000100")
```

### Yanıt (204)

Yanıt gövdesi yok.

### Hata kodları

- **HTTP 400:** `invalid_channel_type`
- **HTTP 401:** `unauthorized`
- **HTTP 403:** `missing_access`, `missing_permissions`, `temporarily_banned`, `dm_closed`, `dm_window_closed`
- **HTTP 404:** `unknown_channel`
- **HTTP 429:** `rate_limited`
- **HTTP 503:** `maintenance`
