BibliographyController - applebiter/gnatwriter GitHub Wiki
Bibliography controller encapsulates bibliography management functionality.
create_bibliography()
create_bibliography(
story_id: int, title: str, pages: str = None,
publication_date: str = None, other_text: str = None
) -> Bibliography
Takes the story id, title, and optionally the pages from which the referenced work was excerpted, the publication date, and "other_text" which could be present in a reference. Returns a Bibliography object.
update_bibliography()
update_bibliography(
bibliography_id: int, story_id: int, title: str,
pages: str = None, publication_date: str = None, other_text: str = None
) -> Type[Bibliography]
Takes in the same arguments as the create_bibliography
method above, with the addition of the Bibliography id. Returns the updated Bibliography object.
delete_bibliography()
delete_bibliography(bibliography_id: int) -> bool
Takes a Bibliography id and returns True when the matching Bibliography object is deleted.
get_bibliography_by_id()
get_bibliography_by_id(bibliography_id: int) -> Type[Bibliography] | None
Takes a Bibliography id and returns its matching Bibliography if found, None otherwise.
get_bibliography_by_title()
get_bibliography_by_title(title: str) -> Type[Bibliography] | None
Takes the title of a work referenced and returns its matching Bibliography if dound, None otherwise.
get_bibliography_count()
get_bibliography_count() -> int
Returns the total number of references in the database attached to all of the user's stories.
get_all_bibliographies()
get_all_bibliographies() -> List[Bibliography]
Returns all references in the database attached to all of the user's stories.
get_bibliographies_page()
get_bibliographies_page(page: int, per_page: int) -> List[Bibliography]
Takes a page number and the number of Bibliographies that constitute a page. Returns a page of results from a large result set. Uses a generator internally to yield a specified page's worth of results at a time.
get_bibliographies_by_story_id()
get_bibliographies_by_story_id(story_id: int) -> List[Bibliography]
Returns all references belonging to a specified Story.
get_bibliographies_page_by_story_id()
get_bibliographies_page_by_story_id(story_id: int, page: int, per_page: int) -> List[Bibliography]
Get a page's worth of references belonging to a specified Story.
search_bibliographies()
search_bibliographies(search: str) -> List[Bibliography]
Takes a search term and returns a list of Bibliography objects that match, if any.
search_bibliographies_by_story_id()
search_bibliographies_by_story_id(story_id: int, search: str) -> List[Bibliography]
Takes a search terms and returns a list of Bibliography objects belonging to the specified Story and matching the search term, if any.
add_author()
add_author(bibliography_id: int, name: str, initials: str) -> BibliographyAuthor
Takes the id of a Bibliography, an author name and their initials. Returns a new BibliographyAuthor object.
remove_author()
remove_author(author_id: int) -> bool
Takes an id and matches it against BibliographyAuthor ids in the database, returns True if the record is deleted, False otherwise.