thoth.thoth_models

Attributes

here

Classes

ThothTitle

A title entry for a Thoth work.

ThothAbstract

An abstract entry for a Thoth work.

ThothContribution

A contributor entry for a Thoth work.

ThothSubject

A subject/keyword entry for a Thoth work.

ThothPublication

A publication record (PDF, EPUB, etc.) for a Thoth work.

ThothPublisher

Publisher information for a Thoth imprint.

ThothImprint

Imprint information for a Thoth work.

ThothBook

A single book record as returned by the Thoth GraphQL API books endpoint.

Module Contents

class thoth.thoth_models.ThothTitle(/, **data: Any)

Bases: pydantic.BaseModel

A title entry for a Thoth work.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

title_id: str = ''
locale_code: str = ''
full_title: str = ''
title: str = ''
subtitle: str = ''
canonical: bool = False
class thoth.thoth_models.ThothAbstract(/, **data: Any)

Bases: pydantic.BaseModel

An abstract entry for a Thoth work.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

abstract_id: str = ''
locale_code: str = ''
content: str = ''
abstract_type: str = ''
canonical: bool = False
class thoth.thoth_models.ThothContribution(/, **data: Any)

Bases: pydantic.BaseModel

A contributor entry for a Thoth work.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

contribution_id: str = ''
contribution_type: str = ''
full_name: str = ''
contribution_ordinal: int = 0
class thoth.thoth_models.ThothSubject(/, **data: Any)

Bases: pydantic.BaseModel

A subject/keyword entry for a Thoth work.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

subject_id: str = ''
subject_type: str = ''
subject_code: str = ''
subject_ordinal: int = 0
class thoth.thoth_models.ThothPublication(/, **data: Any)

Bases: pydantic.BaseModel

A publication record (PDF, EPUB, etc.) for a Thoth work.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

publication_id: str = ''
publication_type: str = ''
isbn: str | None = None
class thoth.thoth_models.ThothPublisher(/, **data: Any)

Bases: pydantic.BaseModel

Publisher information for a Thoth imprint.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

publisher_id: str = ''
publisher_name: str = ''
publisher_shortname: str = ''
publisher_url: str = ''
class thoth.thoth_models.ThothImprint(/, **data: Any)

Bases: pydantic.BaseModel

Imprint information for a Thoth work.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

imprint_id: str = ''
imprint_name: str = ''
publisher: ThothPublisher | None = None
class thoth.thoth_models.ThothBook(/, **data: Any)

Bases: pydantic.BaseModel

A single book record as returned by the Thoth GraphQL API books endpoint.

The books endpoint uses WORK_LIST_FIELDS, which includes titles, abstracts, contributions, subjects, and imprint, but does not include the license field (that requires fetching the full work via work_by_id).

Endpoint: POST https://api.thoth.pub/graphql Docs: https://api.thoth.pub

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

work_id: str = ''
work_type: str = ''
work_status: str = ''
doi: str | None = None
publication_date: str | None = None
place: str = ''
updated_at: str = ''
titles: list[ThothTitle] = []
abstracts: list[ThothAbstract] = []
contributions: list[ThothContribution] = []
subjects: list[ThothSubject] = []
publications: list[ThothPublication] = []
imprint: ThothImprint | None = None
canonical_title() str

Return the canonical full title, falling back to the first title.

canonical_abstract() str

Return the canonical abstract content, falling back to the first.

author_names() list[str]

Return author full names sorted by contribution ordinal.

keyword_subjects() list[str]

Return KEYWORD-type subject codes (free-text keywords).

property source_url: str

Return the DOI URL, or the Thoth work page as a fallback.

property publisher_name: str

Return the publisher name from the imprint, if available.

thoth.thoth_models.here