ovok_sdk.resources.cms
Published CMS content for the configured tenant: documents, legal pages and translations.
- Stable unknown
- Release candidate since 0.1.0-rc.4
- Development since 0.1.0-dev.25+2ba84b0
Published CMS content for the configured tenant: documents, legal pages and translations.
CmsDelivery
CmsDelivery(http: HttpClient, tenant_code: str)Reads public CMS collections, adding the configured tenant to every request.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
http | HttpClient | The client's HTTP client. | |
tenant_code | str | The tenant whose published content is read. |
list_page()
list_page(collection: str, params: Mapping[str, Any]) -> AnyRead one page of a collection.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
collection | str | The collection slug, such as "release-notes". | |
params | Mapping[str, Any] | Optional locale, page, limit and sort. |
Returns
Any: The Payload CMS page:{docs, totalDocs, nextPage, ...}.
retrieve()
retrieve(collection: str, slug: str, params: Mapping[str, Any]) -> AnyRead one document of a collection by its slug.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
collection | str | The collection slug. | |
slug | str | The document slug. | |
params | Mapping[str, Any] | Optional locale. |
Returns
Any: The document.
Raises
OvokValidationError:slugis empty.
CmsDocumentsResource
CmsDocumentsResource(delivery: CmsDelivery)Documents of any published CMS collection; access it as ovok.cms.documents.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
delivery | CmsDelivery | The tenant-scoped CMS reader. |
list()
list(collection: str, params: Mapping[str, Any] | None = None) -> Page[Any]List a collection's documents.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
collection | str | The collection slug. | |
params | Mapping[str, Any] | None | None | Optional locale, page (1-based first page), limit and sort. |
Returns
Page[Any]: A page of documents that loads later pages on demand.
retrieve()
retrieve(collection: str, slug: str, params: Mapping[str, Any] | None = None) -> AnyRead one document by its slug.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
collection | str | The collection slug. | |
slug | str | The document slug. | |
params | Mapping[str, Any] | None | None | Optional locale. |
Returns
Any: The document.
Raises
OvokValidationError:slugis empty.
ReleaseNotesResource
ReleaseNotesResource(documents: CmsDocumentsResource)Published release notes; access it as ovok.cms.release_notes.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
documents | CmsDocumentsResource | The CMS documents resource. |
list()
list(params: Mapping[str, Any] | None = None) -> Page[Any]List release notes, newest first unless params sets sort.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
params | Mapping[str, Any] | None | None | Optional locale, page, limit and sort. |
Returns
Page[Any]: A page of release notes.
CmsResource
CmsResource(http: HttpClient, tenant_code: str)Published CMS content for the configured tenant.
Created by Ovok; access it as ovok.cms.
legal_page()
legal_page(slug: str, params: Mapping[str, Any] | None = None) -> AnyRead a legal page, such as the terms or privacy policy, by its slug.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
slug | str | The legal page slug. | |
params | Mapping[str, Any] | None | None | Optional locale. |
Returns
Any: The legal page document.
Raises
OvokValidationError:slugis empty.
translations()
translations(locale: str | None = None) -> dict[str, Any]Read every translation string as a nested dictionary.
Keys are the document slug followed by the dotted key's parts. The first value wins on duplicates; reading stops after 20 pages of 50 documents.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
locale | str | None | None | A language tag such as "de-CH"; unsupported languages fall back to "en". |
Returns
dict[str, Any]: The translation tree, such as{"common": {"buttons": {"save": "Save"}}}.
Examples
>>> strings = ovok.cms.translations("de")
>>> strings["common"]["buttons"]["save"]Last updated on