# Bookmarks

## 列出书签

`GET /bookmarks`

```json
{
  "tags": [
    "Bookmarks"
  ],
  "summary": "列出书签",
  "responses": {
    "200": {
      "description": "每个书签，跨文件夹。",
      "content": {
        "application/json": {
          "schema": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Bookmark"
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  }
}
```

## 创建或更新书签

`POST /bookmarks`

```json
{
  "tags": [
    "Bookmarks"
  ],
  "summary": "创建或更新书签",
  "description": "提供 `id` 时更新对应书签，否则创建新书签。\n\n绑定到文件夹的书签会显示在该文件夹中每个配置文件的书签栏里，位置为 **ShardX** 文件夹。`folder: \"\"` 表示所有配置文件。系统只管理这个文件夹，不会修改操作者在配置文件中保存的其他书签。\n\n更改会在配置文件下次启动时应用。文件会在浏览器读取前写入，因此正在运行的配置文件不会立即看到更改。",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/BookmarkRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "保存的书签。",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Bookmark"
          }
        }
      }
    },
    "400": {
      "description": "需要 `url`。",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  }
}
```

## 删除书签

`DELETE /bookmarks/{id}`

```json
{
  "tags": [
    "Bookmarks"
  ],
  "summary": "删除书签",
  "description": "它会在下次发布时留下其个人资料。",
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "已删除。",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "deleted": {
                "type": "boolean",
                "example": true
              },
              "id": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  }
}
```
