> For the complete documentation index, see [llms.txt](https://developer.eagle.cool/web-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.eagle.cool/web-api/ja-jp/api/tag-group.md).

# Tag Group

Tag Group API を使用すると、Eagle ライブラリ内のタググループの作成、管理、整理を行うことができます。

## エンドポイント一覧

| メソッド | エンドポイント                       | 説明           |
| ---- | ----------------------------- | ------------ |
| GET  | `/api/v2/tagGroup/get`        | 全タググループを一覧表示 |
| POST | `/api/v2/tagGroup/create`     | 新しいタググループを作成 |
| POST | `/api/v2/tagGroup/update`     | タググループを更新    |
| POST | `/api/v2/tagGroup/remove`     | タググループを削除    |
| POST | `/api/v2/tagGroup/addTags`    | グループにタグを追加   |
| POST | `/api/v2/tagGroup/removeTags` | グループからタグを削除  |

***

## GET /api/v2/tagGroup/get <a href="#list" id="list"></a>

すべてのタググループを一覧表示します。ページネーションされた結果を返します。

### クエリパラメータ

* `offset` integer（任意）-- ページネーションオフセット、デフォルト `0`
* `limit` integer（任意）-- ページネーションリミット、デフォルト `50`、最大 `1000`

### レスポンス

```json
{
    "status": "success",
    "data": {
        "data": [
            {
                "id": "TG_001",
                "name": "Design Styles",
                "color": "blue",
                "tags": ["flat", "material", "skeuomorphic"],
                "description": "Visual design styles"
            }
        ],
        "total": 5,
        "offset": 0,
        "limit": 50
    }
}
```

### 例

```javascript
await fetch("http://localhost:41595/api/v2/tagGroup/get").then(r => r.json());
```

***

## POST /api/v2/tagGroup/create <a href="#create" id="create"></a>

新しいタググループを作成します。

### リクエストボディ

* `name` string（必須）-- グループ名
* `tags` string\[]（必須）-- 含めるタグ名の配列
* `color` string（任意）-- グループの色
* `description` string（任意）-- グループの説明

### レスポンス

新しく作成されたタググループオブジェクトを返します。

```json
{
    "status": "success",
    "data": {
        "id": "NEW_GROUP_ID",
        "name": "Color Palette",
        "color": "",
        "tags": ["warm", "cool", "neutral"],
        "description": "Tags for color palettes"
    }
}
```

### 例

```javascript
await fetch("http://localhost:41595/api/v2/tagGroup/create", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
        name: "Color Palette",
        tags: ["warm", "cool", "neutral"],
        description: "Tags for color palettes"
    })
}).then(r => r.json());
```

***

## POST /api/v2/tagGroup/update <a href="#update" id="update"></a>

既存のタググループを更新します。

### リクエストボディ

* `id` string（必須）-- 更新するタググループの ID
* `name` string（必須）-- グループ名
* `tags` string\[]（必須）-- タグ名の完全な配列（既存のものを置換）
* `color` string（任意）-- グループの色
* `description` string（任意）-- グループの説明

### レスポンス

更新されたタググループオブジェクトを返します。

### 例

```javascript
await fetch("http://localhost:41595/api/v2/tagGroup/update", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
        id: "TG_001",
        name: "Updated Group Name",
        tags: ["tag1", "tag2", "tag3"],
        color: "green"
    })
}).then(r => r.json());
```

***

## POST /api/v2/tagGroup/remove <a href="#remove" id="remove"></a>

タググループを削除します。グループのみが削除され、タグ自体は削除されません。

### リクエストボディ

* `id` string（必須）-- 削除するタググループの ID

### レスポンス

```json
{
    "status": "success",
    "data": true
}
```

### 例

```javascript
await fetch("http://localhost:41595/api/v2/tagGroup/remove", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ id: "TG_001" })
}).then(r => r.json());
```

***

## POST /api/v2/tagGroup/addTags <a href="#add-tags" id="add-tags"></a>

既存のタググループにタグを追加します。

### リクエストボディ

* `groupId` string（必須）-- タググループの ID
* `tags` string\[]（必須）-- 追加するタグ名
* `removeFromSource` boolean（任意）-- `true` に設定すると、タグを現在のグループから削除してからこのグループに追加します

### レスポンス

更新されたタググループオブジェクトを返します。

### 例

```javascript
await fetch("http://localhost:41595/api/v2/tagGroup/addTags", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
        groupId: "TG_001",
        tags: ["minimalist", "modern"]
    })
}).then(r => r.json());
```

***

## POST /api/v2/tagGroup/removeTags <a href="#remove-tags" id="remove-tags"></a>

タググループからタグを削除します。タグ自体は削除されず、グループからの関連付けのみが解除されます。

### リクエストボディ

* `groupId` string（必須）-- タググループの ID
* `tags` string\[]（必須）-- グループから削除するタグ名

### レスポンス

更新されたタググループオブジェクトを返します。

### 例

```javascript
await fetch("http://localhost:41595/api/v2/tagGroup/removeTags", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
        groupId: "TG_001",
        tags: ["outdated-tag"]
    })
}).then(r => r.json());
```

***

## タググループのプロパティ <a href="#properties" id="properties"></a>

API から返されるタググループには以下のプロパティが含まれます：

| プロパティ         | 型         | 説明           |
| ------------- | --------- | ------------ |
| `id`          | string    | 一意のタググループ ID |
| `name`        | string    | グループ名        |
| `color`       | string    | グループの色       |
| `tags`        | string\[] | グループ内のタグ名の配列 |
| `description` | string    | グループの説明      |
