# CMS resource

Canonical page: https://docs.ovok.com/flutter-sdk/reference/ovok_sdk/cms-resource

{/* Generated by scripts/generate_reference.dart; do not edit. */}

## CmsDocumentsResource [#cmsdocumentsresource]

```dart
class CmsDocumentsResource
```

Published documents of any CMS collection. Reached through `ovok.cms.documents`.

`locale` takes an app language ("de-DE") or a CMS locale ("de"); an
unsupported language reads as "en".

### Constructors [#constructors]

#### CmsDocumentsResource.new [#cmsdocumentsresourcenew]

```dart
CmsDocumentsResource(HttpClient http, String tenantCode)
```

Built by `Ovok`; use `ovok.cms.documents` instead.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `http` | `HttpClient` | positional |  |
| `tenantCode` | `String` | positional |  |

### Methods [#methods]

#### CmsDocumentsResource.list [#cmsdocumentsresourcelist]

```dart
Future<Page<JsonMap>> list(String collection, [QueryParams params = const {}])
```

Lists the published documents of `collection`.

Calls `GET v1/public/cms/collections/{collection}/items`. `params` takes
`locale`, `page`, `limit` and `sort`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `collection` | `String` | positional |  |
| `params` | `QueryParams` | optional positional | `const {}` |

Returns `Future<Page<Map<String, dynamic>>>`.

#### CmsDocumentsResource.retrieve [#cmsdocumentsresourceretrieve]

```dart
Future<JsonMap> retrieve(
  String collection,
  String slug, [
  QueryParams params = const {},
])
```

Retrieves the document `slug` of `collection`.

Calls `GET v1/public/cms/collections/{collection}/items/{slug}`.
Throws [`OvokValidationException`](/flutter-sdk/reference/ovok_sdk/ovok-exception#ovokvalidationexception) when `slug` is empty.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `collection` | `String` | positional |  |
| `slug` | `String` | positional |  |
| `params` | `QueryParams` | optional positional | `const {}` |

Returns `Future<Map<String, dynamic>>`.


## CmsReleaseNotesResource [#cmsreleasenotesresource]

```dart
class CmsReleaseNotesResource
```

Published release notes. Reached through `ovok.cms.releaseNotes`.

### Constructors [#constructors-1]

#### CmsReleaseNotesResource.new [#cmsreleasenotesresourcenew]

```dart
CmsReleaseNotesResource(HttpClient http, String tenantCode)
```

Built by `Ovok`; use `ovok.cms.releaseNotes` instead.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `http` | `HttpClient` | positional |  |
| `tenantCode` | `String` | positional |  |

### Methods [#methods-1]

#### CmsReleaseNotesResource.list [#cmsreleasenotesresourcelist]

```dart
Future<Page<JsonMap>> list([QueryParams params = const {}])
```

Lists the `release-notes` collection, sorted by `-publishedAt` unless
`params` names a `sort`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `params` | `QueryParams` | optional positional | `const {}` |

Returns `Future<Page<Map<String, dynamic>>>`.


## CmsResource [#cmsresource]

```dart
class CmsResource
```

Published CMS documents, legal pages and translations. Reached through `ovok.cms`.

Reads go to `v1/public/cms/collections`, always as the client's tenant, so
they work before sign-in.

Every request throws an [`OvokException`](/flutter-sdk/reference/ovok_sdk/ovok-exception#ovokexception) subclass when it fails.

### Constructors [#constructors-2]

#### CmsResource.new [#cmsresourcenew]

```dart
CmsResource(HttpClient http, String tenantCode)
```

Built by `Ovok`; use `ovok.cms` instead.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `http` | `HttpClient` | positional |  |
| `tenantCode` | `String` | positional |  |

### Properties [#properties]

#### CmsResource.documents [#cmsresourcedocuments]

```dart
final CmsDocumentsResource documents
```

Published documents of any collection.

#### CmsResource.releaseNotes [#cmsresourcereleasenotes]

```dart
final CmsReleaseNotesResource releaseNotes
```

Published release notes, newest first.

### Methods [#methods-2]

#### CmsResource.legalPage [#cmsresourcelegalpage]

```dart
Future<JsonMap> legalPage(String slug, [QueryParams params = const {}])
```

Retrieves a legal page by `slug`, such as "terms-and-conditions" or "data-privacy".

Reads the `legal-pages` collection; readable before sign-in.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `slug` | `String` | positional |  |
| `params` | `QueryParams` | optional positional | `const {}` |

Returns `Future<Map<String, dynamic>>`.

#### CmsResource.translations [#cmsresourcetranslations]

```dart
Future<JsonMap> translations([String? locale])
```

Retrieves the `translations` collection as one tree, readable before sign-in.

Each document's slug is a group holding each row's `value` at its `key`,
nested at the dots; the first row wins. Reads at most 20 pages of 50.
Nothing is kept on the device.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `locale` | `String?` | optional positional |  |

Returns `Future<Map<String, dynamic>>`.
