API referenceresources

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

NameTypeDefaultDescription
httpHttpClientThe client's HTTP client.
tenant_codestrThe tenant whose published content is read.

list_page()

list_page(collection: str, params: Mapping[str, Any]) -> Any

Read one page of a collection.

Parameters

NameTypeDefaultDescription
collectionstrThe collection slug, such as "release-notes".
paramsMapping[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]) -> Any

Read one document of a collection by its slug.

Parameters

NameTypeDefaultDescription
collectionstrThe collection slug.
slugstrThe document slug.
paramsMapping[str, Any]Optional locale.

Returns

  • Any: The document.

Raises

  • OvokValidationError: slug is empty.

CmsDocumentsResource

CmsDocumentsResource(delivery: CmsDelivery)

Documents of any published CMS collection; access it as ovok.cms.documents.

Parameters

NameTypeDefaultDescription
deliveryCmsDeliveryThe tenant-scoped CMS reader.

list()

list(collection: str, params: Mapping[str, Any] | None = None) -> Page[Any]

List a collection's documents.

Parameters

NameTypeDefaultDescription
collectionstrThe collection slug.
paramsMapping[str, Any] | NoneNoneOptional 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) -> Any

Read one document by its slug.

Parameters

NameTypeDefaultDescription
collectionstrThe collection slug.
slugstrThe document slug.
paramsMapping[str, Any] | NoneNoneOptional locale.

Returns

  • Any: The document.

Raises

  • OvokValidationError: slug is empty.

ReleaseNotesResource

ReleaseNotesResource(documents: CmsDocumentsResource)

Published release notes; access it as ovok.cms.release_notes.

Parameters

NameTypeDefaultDescription
documentsCmsDocumentsResourceThe CMS documents resource.

list()

list(params: Mapping[str, Any] | None = None) -> Page[Any]

List release notes, newest first unless params sets sort.

Parameters

NameTypeDefaultDescription
paramsMapping[str, Any] | NoneNoneOptional 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(slug: str, params: Mapping[str, Any] | None = None) -> Any

Read a legal page, such as the terms or privacy policy, by its slug.

Parameters

NameTypeDefaultDescription
slugstrThe legal page slug.
paramsMapping[str, Any] | NoneNoneOptional locale.

Returns

  • Any: The legal page document.

Raises

  • OvokValidationError: slug is 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

NameTypeDefaultDescription
localestr | NoneNoneA 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

On this page