> ## Documentation Index
> Fetch the complete documentation index at: https://docs.law4devs.eu/llms.txt
> Use this file to discover all available pages before exploring further.

# Tags

> List and retrieve compliance tags with the Law4Devs Java SDK.

## Overview

Tags are semantic labels that categorise articles and requirements by topic (e.g. `data-breach`, `encryption`, `audit`). Use `client.tags()` to list and fetch them.

***

## Methods

### `list()`

Returns the first page of all available tags.

```java theme={null}
Page<Tag> page = client.tags().list();

for (Tag t : page.data()) {
    System.out.println(t.slug() + " — " + t.name());
}
```

**Returns** `Page<Tag>`

***

### `list(int page, int perPage)`

Fetch a specific page with custom page size.

```java theme={null}
Page<Tag> page = client.tags().list(1, 50);
```

**Parameters**

| Parameter | Type  | Default | Description              |
| --------- | ----- | ------- | ------------------------ |
| `page`    | `int` | `1`     | Page number (1-indexed)  |
| `perPage` | `int` | `20`    | Items per page (max 100) |

**Returns** `Page<Tag>`

***

### `get()`

Fetch a single tag by slug.

```java theme={null}
Tag tag = client.tags().get("data-breach");

System.out.println(tag.name());        // Data Breach
System.out.println(tag.description()); // Requirements related to data breach...
```

**Parameters**

| Parameter | Type     | Description                    |
| --------- | -------- | ------------------------------ |
| `slug`    | `String` | Tag slug, e.g. `"data-breach"` |

**Returns** `Tag`

***

### `iter()`

Lazily iterate all tags.

```java theme={null}
for (Tag t : client.tags().iter()) {
    System.out.println(t.slug() + ": " + t.name());
}
```

**Returns** `Iterable<Tag>`

***

## Model

### `Tag`

| Field            | Type     | Description                               |
| ---------------- | -------- | ----------------------------------------- |
| `id()`           | `int`    | Internal numeric ID                       |
| `slug()`         | `String` | URL-safe identifier, e.g. `"data-breach"` |
| `name()`         | `String` | Human-readable tag name                   |
| `description()`  | `String` | What this tag covers                      |
| `articleCount()` | `int`    | Number of tagged articles                 |

***

## Examples

### Print all available tags

```java theme={null}
for (Tag t : client.tags().iter()) {
    System.out.printf("%-25s %d articles%n", t.name(), t.articleCount());
}
```

### Build a tag index

```java theme={null}
var index = new java.util.LinkedHashMap<String, Tag>();
for (Tag t : client.tags().iter()) {
    index.put(t.slug(), t);
}

Tag breach = index.get("data-breach");
System.out.println(breach.name() + " covers " + breach.articleCount() + " articles");
```
