# Sunucular

Sunucular; API'de sunucuya guild denir.

## Sunucuyu getir (`getGuild`)

**`GET https://noluyo.net/api/v1/guilds/{guild_id}`** (`GET /guilds/{guild_id}`)

Sunucuyu tüm rolleriyle döndürür. Üye olmayan çağıran unknown_guild alır; böylece sunucunun var olup olmadığı açığa çıkmaz.

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

### Parametreler

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

### Örnek çağrılar

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

```js
// JavaScript (noluyo-bot)
await bot.rest.getGuild("111500000000000000");
```

```py
# Python (noluyo_bot)
await bot.rest.get_guild("111500000000000000")
```

### Yanıt (200)

```json
{
  "id": "111500000000000000",
  "name": "Örnek Sunucu",
  "icon": null,
  "banner": null,
  "description": null,
  "owner_id": "111400000000000500",
  "created_at": "2026-11-04T16:21:11.569Z",
  "features": [],
  "roles": [
    {
      "id": "111500000000000000",
      "name": "@everyone",
      "color": 0,
      "hoist": false,
      "mentionable": false,
      "position": 0,
      "permissions": "1071698529857",
      "auto_assign": false
    },
    {
      "id": "111550000000000000",
      "name": "Örnek Bot",
      "color": 0,
      "hoist": false,
      "mentionable": false,
      "position": 1,
      "permissions": "68672",
      "auto_assign": false,
      "application_id": "111540000000000000"
    }
  ],
  "discoverable": false,
  "discovery_category": null,
  "join_channel_id": null,
  "leave_channel_id": null
}
```

### Hata kodları

- **HTTP 401:** `unauthorized`
- **HTTP 403:** `temporarily_banned`
- **HTTP 404:** `unknown_guild`
- **HTTP 429:** `rate_limited`
- **HTTP 503:** `maintenance`

## Sunucunun kanallarını listele (`listGuildChannels`)

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

Çağıranın ViewChannel iznine sahip olduğu kanal ve kategorileri döndürür. Diğerleri hata vermeden listeden çıkarılır.

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

### Parametreler

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

### Örnek çağrılar

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

```js
// JavaScript (noluyo-bot)
await bot.rest.listGuildChannels("111500000000000000");
```

```py
# Python (noluyo_bot)
await bot.rest.list_guild_channels("111500000000000000")
```

### 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:** `temporarily_banned`
- **HTTP 404:** `unknown_guild`
- **HTTP 429:** `rate_limited`
- **HTTP 503:** `maintenance`

## Kanal oluştur (`createChannel`)

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

Metin kanalı (tür 0, varsayılan), ses kanalı (2) veya kategori (4) oluşturur. topic ve rate_limit_per_user metin kanalları, bitrate ve user_limit ses kanalları içindir. permission_overwrites verilmezse kategoriye konan kanal kategorinin izin geçersiz kılmalarıyla başlar. Bir geçersiz kılma, yalnızca çağıranın sahip olduğu izinlere dokunabilir.

- **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 |
| --- | --- | --- | --- | --- |
| `guild_id` | `path` | `string` | evet | Sunucu ID'si. |

### Gövde alanları

| Alan | Tür | Zorunlu | Açıklama |
| --- | --- | --- | --- |
| `name` | `string` | evet | (1–100) |
| `type` | `integer` | - | (0, 2, 4 · = 0) |
| `topic` | `string | null` | - | (<= 1024) |
| `position` | `integer` | - |  |
| `parent_id` | `ID` | - | 64 bitlik ID; yanıtta da istekte de her zaman metin olarak yazılır. ID'ler oluşturulma zamanına göre sıralanır. |
| `nsfw` | `boolean` | - |  |
| `bitrate` | `integer` | - | (8000–96000 · = 64000) |
| `user_limit` | `integer` | - | (0–99 · = 0) |
| `rate_limit_per_user` | `integer` | - | (0–21600) |
| `permission_overwrites` | `Overwrite[]` | - | (<= 100) |

### Örnek çağrılar

```bash
curl -X POST "https://noluyo.net/api/v1/guilds/111500000000000000/channels" \
  -H "Authorization: Bot $BOT_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"name":"duyurular","type":0}'
```

```js
// JavaScript (noluyo-bot)
await bot.rest.createChannel("111500000000000000", { name: "duyurular", type: 0 });
```

```py
# Python (noluyo_bot)
await bot.rest.create_channel("111500000000000000", {"name": "duyurular", "type": 0})
```

### Yanıt (201)

```json
{
  "id": "111500000000000100",
  "type": 0,
  "guild_id": "111500000000000000",
  "name": "duyurular",
  "topic": "Önemli haberler",
  "position": 1,
  "parent_id": null,
  "nsfw": false,
  "last_message_id": null,
  "permission_overwrites": [],
  "rate_limit_per_user": 30
}
```

### Hata kodları

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