snip.api.books

Books API wrapper.

This module provides functions to interact with the books endpoints of the Snip API.

As reference see also the [official API documentation](https://snip.roentgen.physik.uni-goettingen.de/apidocs/books).

Functions

create_book(token, title[, comment])

Create a new book.

get_book(token, book_id)

Retrieve a specific book by its ID.

get_books(token)

Retrieve all books the user has access to.

get_collaborators(token, book_id)

Retrieve all collaborators for a specific book by its ID.

invite_collaborator(token, book_id, email)

Invite a new collaborator to a specific book by its ID.

remove_collaborator(token, book_id, ...[, ...])

Remove a collaborator from a specific book by its ID.

update_collaborator(token, book_id, collaborator)

Update the collaborators for a specific book by its ID.

Classes

BasePermissionTypedDict

Base permission structure with common fields for all permission types.

BookTypedDict

Book entity with all its properties.

GroupPermissionTypedDict

Group-specific permission structure.

UserPermissionTypedDict

User-specific permission structure.

Module Functions

snip.api.books.create_book(token: AccountToken, title: str, comment: str | None = None) BookTypedDict

Create a new book.

snip.api.books.get_book(token: AccountToken | BookToken, book_id: int) BookTypedDict

Retrieve a specific book by its ID.

snip.api.books.get_books(token: AccountToken) list[BookTypedDict]

Retrieve all books the user has access to.

snip.api.books.get_collaborators(token: AccountToken | BookToken, book_id: int) list[UserPermissionTypedDict | GroupPermissionTypedDict]

Retrieve all collaborators for a specific book by its ID.

snip.api.books.invite_collaborator(token: AccountToken | BookToken, book_id: int, email: str) dict

Invite a new collaborator to a specific book by its ID.

snip.api.books.remove_collaborator(token: AccountToken | BookToken, book_id: int, collaborator_id: int, collaborator_type: Literal['user', 'group', 'invite'] = 'user') None

Remove a collaborator from a specific book by its ID.

snip.api.books.update_collaborator(token: AccountToken | BookToken, book_id: int, collaborator: UserPermissionTypedDict | GroupPermissionTypedDict) None

Update the collaborators for a specific book by its ID.

This may also be used to add new collaborators.