Skip to content

Models

ReadwiseBook dataclass

Represents a Readwise book.

Attributes:

Name Type Description
id str

The book's ID.

title str

The book's title.

author str

The book's author.

category str

The book's category.

source str

The book's source.

num_highlights int

The number of highlights for the book.

last_highlight_at datetime | None

The date and time of the last highlight for the book.

updated datetime | None

The date and time the book was last updated.

cover_image_url str

The URL of the book's cover image.

highlights_url str

The URL of the book's highlights.

source_url str

The URL of the book's source.

asin str

The book's ASIN.

tags list[ReadwiseTag]

The book's tags.

document_note str

The book's document note.

Source code in readwise/models.py
@dataclass
class ReadwiseBook:
    '''
    Represents a Readwise book.

    Attributes:
        id: The book's ID.
        title: The book's title.
        author: The book's author.
        category: The book's category.
        source: The book's source.
        num_highlights: The number of highlights for the book.
        last_highlight_at: The date and time of the last highlight for the book.
        updated: The date and time the book was last updated.
        cover_image_url: The URL of the book's cover image.
        highlights_url: The URL of the book's highlights.
        source_url: The URL of the book's source.
        asin: The book's ASIN.
        tags: The book's tags.
        document_note: The book's document note.
    '''

    id: str
    title: str
    author: str
    category: str
    source: str
    num_highlights: int
    last_highlight_at: datetime | None
    updated: datetime | None
    cover_image_url: str
    highlights_url: str
    source_url: str
    asin: str
    tags: list[ReadwiseTag]
    document_note: str

ReadwiseHighlight dataclass

Represents a Readwise highlight.

Attributes:

Name Type Description
id str

The highlight's ID.

text str

The highlight's text.

note str

The highlight's note.

location int

The highlight's location.

location_type str

The highlight's location type.

url str | None

The highlight's URL.

color str

The highlight's color.

updated datetime | None

The date and time the highlight was last updated.

book_id str

The ID of the book the highlight is from.

tags list[ReadwiseTag]

The highlight's tags.

Source code in readwise/models.py
@dataclass
class ReadwiseHighlight:
    '''
    Represents a Readwise highlight.

    Attributes:
        id: The highlight's ID.
        text: The highlight's text.
        note: The highlight's note.
        location: The highlight's location.
        location_type: The highlight's location type.
        url: The highlight's URL.
        color: The highlight's color.
        updated: The date and time the highlight was last updated.
        book_id: The ID of the book the highlight is from.
        tags: The highlight's tags.
    '''

    id: str
    text: str
    note: str
    location: int
    location_type: str
    url: str | None
    color: str
    updated: datetime | None
    book_id: str
    tags: list[ReadwiseTag]

ReadwiseTag dataclass

Represents a Readwise tag.

Attributes:

Name Type Description
id str

The tag's ID.

name str

The tag's name.

Source code in readwise/models.py
@dataclass
class ReadwiseTag:
    '''Represents a Readwise tag.

    Attributes:
        id: The tag's ID.
        name: The tag's name.
    '''

    id: str
    name: str