> ## 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.

# Articles

> List, retrieve, and iterate framework articles with the Law4Devs TypeScript SDK.

## Overview

Articles are the primary normative units of each EU regulation. Each article belongs to one framework and may contain multiple numbered paragraphs. Articles can also be tagged and cross-referenced to related articles.

***

## Methods

### `list()`

Returns a page of article summaries for a framework.

```typescript theme={null}
const page = await client.articles.list('gdpr', { page: 1, perPage: 20 });

console.log(`GDPR has ${page.meta.total} articles`);

for (const article of page.data) {
  console.log(`Art. ${article.articleNumber}: ${article.title} (${article.paragraphCount} paragraphs)`);
}
```

**Parameters**

| Parameter       | Type     | Default  | Description                   |
| --------------- | -------- | -------- | ----------------------------- |
| `frameworkSlug` | `string` | required | Framework slug, e.g. `"gdpr"` |
| `page`          | `number` | `1`      | Page number                   |
| `perPage`       | `number` | `20`     | Items per page (1–100)        |

**Returns** `Promise<Page<ArticleSummary>>`

***

### `get()`

Fetch the full content of a single article including all paragraphs.

```typescript theme={null}
const article = await client.articles.get('gdpr', 5);

console.log(`Art. ${article.articleNumber}: ${article.title}`);
console.log(article.content);

for (const para of article.paragraphs) {
  console.log(`  [${para.paragraphRef}] ${para.content}`);
}
```

**Parameters**

| Parameter       | Type     | Description    |
| --------------- | -------- | -------------- |
| `frameworkSlug` | `string` | Framework slug |
| `articleNumber` | `number` | Article number |

**Returns** `Promise<Article>`

***

### `related()`

Fetch articles related to a given article (cross-references and thematic links).

```typescript theme={null}
const related = await client.articles.related('gdpr', 5);

console.log(`${related.meta.total} articles related to GDPR Art. 5`);
for (const article of related.data) {
  console.log(`  Art. ${article.articleNumber}: ${article.title}`);
}
```

**Parameters**

| Parameter       | Type     | Description    |
| --------------- | -------- | -------------- |
| `frameworkSlug` | `string` | Framework slug |
| `articleNumber` | `number` | Article number |

**Returns** `Promise<Page<ArticleSummary>>`

***

### `iter()`

Iterate over all articles in a framework without managing pagination.

```typescript theme={null}
for await (const article of client.articles.iter('gdpr')) {
  const tagList = article.tags.map(t => t.slug).join(', ');
  console.log(`Art. ${article.articleNumber}: ${article.title} [${tagList}]`);
}
```

**Parameters** — same options as `list()` (except `frameworkSlug` is the first positional argument and `page` is managed internally).

**Returns** `AsyncGenerator<ArticleSummary>`

***

## Models

### `ArticleSummary`

Returned by `list()`, `related()`, and `iter()`.

| Field            | Type             | Description                        |
| ---------------- | ---------------- | ---------------------------------- |
| `id`             | `number`         | Internal numeric ID                |
| `frameworkSlug`  | `string`         | Parent framework slug              |
| `articleNumber`  | `number`         | Article number                     |
| `title`          | `string \| null` | Article title                      |
| `position`       | `number`         | Display order within the framework |
| `paragraphCount` | `number`         | Number of paragraphs               |
| `tags`           | `Tag[]`          | Tags applied to the article        |

### `Article`

Returned by `get()`. Extends `ArticleSummary` with:

| Field        | Type                 | Description               |
| ------------ | -------------------- | ------------------------- |
| `content`    | `string \| null`     | Full article text         |
| `paragraphs` | `ArticleParagraph[]` | Structured paragraph list |

### `ArticleParagraph`

| Field          | Type     | Description                             |
| -------------- | -------- | --------------------------------------- |
| `paragraphRef` | `string` | Paragraph reference, e.g. `"1"`, `"2a"` |
| `content`      | `string` | Paragraph text                          |
| `position`     | `number` | Display order within the article        |

***

## Example: find all articles tagged "data-breach"

```typescript theme={null}
const breachArticles: string[] = [];

for await (const article of client.articles.iter('gdpr')) {
  const hasTag = article.tags.some(t => t.slug === 'data-breach');
  if (hasTag) {
    breachArticles.push(`Art. ${article.articleNumber}: ${article.title}`);
  }
}

console.log('Data-breach articles:', breachArticles);
```
