# Folders

## Список папок

`GET /folders`

```json
{
  "tags": [
    "Folders"
  ],
  "summary": "Список папок",
  "description": "Унікальні непорожні теги папок серед постійних профілів.",
  "responses": {
    "200": {
      "description": "Назви папок.",
      "content": {
        "application/json": {
          "schema": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "work",
              "scrapers"
            ]
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  }
}
```

## Перейменувати папку

`PATCH /folders/{folder}`

```json
{
  "tags": [
    "Folders"
  ],
  "summary": "Перейменувати папку",
  "description": "Перевішує тег на всіх профілях у папці. Повертає кількість задіяних профілів.",
  "parameters": [
    {
      "name": "folder",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "name"
          ],
          "properties": {
            "name": {
              "type": "string",
              "description": "Нова назва папки."
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Перейменовано.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "renamed_to": {
                "type": "string"
              },
              "profiles": {
                "type": "integer",
                "description": "Кількість перетегованих профілів."
              }
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  }
}
```

## Видалити папку

`DELETE /folders/{folder}`

```json
{
  "tags": [
    "Folders"
  ],
  "summary": "Видалити папку",
  "description": "Видаляє тег папки. При `delete_profiles=true` профілі всередині теж\nвидаляються; інакше вони переходять до «Усі» (тег знімається).\n",
  "parameters": [
    {
      "name": "folder",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "delete_profiles",
      "in": "query",
      "required": false,
      "description": "Видалити профілі з папки (за замовчуванням false = зняти тег).",
      "schema": {
        "type": "boolean",
        "default": false
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Видалено.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "deleted_folder": {
                "type": "string"
              },
              "delete_profiles": {
                "type": "boolean"
              },
              "profiles": {
                "type": "integer",
                "description": "Кількість задіяних профілів."
              }
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  }
}
```

## Створити профіль у папці

`POST /folders/{folder}/profiles`

```json
{
  "tags": [
    "Folders"
  ],
  "summary": "Створити профіль у папці",
  "description": "Те саме, що `POST /profiles`, але папка береться з шляху\n(переоприділяє `folder` у тілі запиту).\n",
  "parameters": [
    {
      "name": "folder",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/CreateProfileRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Метадані створеного профілю.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ProfileMeta"
          }
        }
      }
    },
    "400": {
      "description": "Відсутній або не є об'єктом `fingerprint`, або нерозбірлива строка проксі.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  }
}
```
