# tagGroup（タグ グループ）

```javascript
// すべてのタググループを取得
const tagGroups = (await eagle.tagGroup.get());
```

## メソッド <a href="#z1a5y" id="z1a5y"></a>

## get() <a href="#x9nu2" id="x9nu2"></a>

すべてのタググループを取得します。

* 戻り値 `Promise<tagGroups: Object[]>` - tagGroupsのクエリ結果。

```javascript
const tagGroups = (await eagle.tagGroup.get());
```

## create(options) <a href="#x9nu2" id="x9nu2"></a>

すべてのタググループを取得します。

* 戻り値 `Promise<tagGroup: Object>` - 新しく作成されたタググループ

```javascript
await eagle.tagGroup.create({
    name: "new group",
    color: "red",
    tags: ["tag1", "tag2"],
    description: "グループの説明"  // Eagle 4.0 build18+
});
```

***

**インスタンスメソッド**

## save() <a href="#x9nu2" id="x9nu2"></a>

タググループの変更を保存します。

* 戻り値 `Promise<tagGroup: Object>` - 保存結果。

```javascript
const tagGroups = (await eagle.tagGroup.get());
const tagGroup = tagGroups[0];

tagGroup.name = "new name";
tagGroup.color = "red"; // red, orange, yellow, green, aqua, blue, purple, pink
tagGroup.tags = ["tag1", "tag2"];
tagGroup.description = "グループの説明";  // Eagle 4.0 build18+

await tagGroup.save();
```

## remove() <a href="#x9nu2" id="x9nu2"></a>

タググループを削除します。

* 戻り値 `Promise<result: boolean>` - 削除が成功したかどうか

```javascript
const tagGroups = (await eagle.tagGroup.get());
const tagGroup = tagGroups[0];

await tagGroup.remove();
```

## addTags(options) <a href="#addtags" id="addtags"></a>

グループにタグを増分で追加します。完全なタグ配列を渡す必要はありません。

* `options` Object - オプションパラメータ
  * `tags` string\[] - 追加するタグ名の配列
  * `removeFromSource` boolean (オプション) - 元のグループからタグを削除するかどうか、デフォルトは `false`
    * `false`：タグを追加のみ（タグは複数のグループに存在可能）
    * `true`：タグを移動（元のグループから削除）
* 戻り値 `Promise<tagGroup: Object>` - 更新されたタググループ

```javascript
const tagGroups = (await eagle.tagGroup.get());
const tagGroup = tagGroups[0];

// タグを追加（複数のグループに存在可能）
await tagGroup.addTags({
    tags: ['UI', 'UX', 'Typography']
});

// タグを移動（元のグループから削除）
await tagGroup.addTags({
    tags: ['Branding'],
    removeFromSource: true
});
```

{% hint style="info" %}
ヒント：`addTags()` メソッドは Eagle 4.0 build18 以上のバージョンが必要です。
{% endhint %}

## removeTags(options) <a href="#removetags" id="removetags"></a>

グループから指定したタグを削除します。

* `options` Object - オプションパラメータ
  * `tags` string\[] - 削除するタグ名の配列
* 戻り値 `Promise<tagGroup: Object>` - 更新されたタググループ

```javascript
const tagGroups = (await eagle.tagGroup.get());
const tagGroup = tagGroups[0];

// グループからタグを削除
await tagGroup.removeTags({
    tags: ['Outdated', 'Draft']
});
```

{% hint style="info" %}
ヒント：`removeTags()` メソッドは Eagle 4.0 build18 以上のバージョンが必要です。
{% endhint %}

{% hint style="warning" %}
注意：このメソッドはグループからタグを削除するだけです。タグ自体の削除やアイテムのタグには影響しません。
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.eagle.cool/plugin-api/ja-jp/api/tag-group.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
