ImageController - applebiter/gnatwriter GitHub Wiki
Image controller encapsulates image management functionality.
create_image()
create_image(
filename: str, dirname: str, size_in_bytes: int, mime_type: str,
caption: str = None
) -> Image
Takes arguments specifying the filename, the absolute path to the directory where to find it, the image file's size in bytes, its MIME type, and optionally, a caption to describe it. Returns an Image.
update_image()
update_image(image_id: int, caption: str = None) -> Type[Image]
Takes an Image id and affords only the possibility of changing the caption value. Returns the updated Image.
delete_image()
delete_image(image_id: int) -> bool
Takes an Image id and returns True if the Image is successfully deleted from the database.
get_all_images()
get_all_images() -> List[Type[Image]]
Returns a list of all Images belonging to the user.
get_all_images_page()
get_all_images_page(page: int, per_page: int) -> List[Type[Image]]
Takes a page number and an integer describing how many Images to return per page of results. returns a list of Images corresponding to that page.
search_images()
search_images(search: str) -> List[Type[Image]]
Takes a search term and returns a list of Images in the database matching the term and belonging to the user.
get_images_by_character_id()
get_images_by_character_id(character_id: int) -> List[Type[Image]]
Takes a Character id and returns a list of associated Images, if any.
get_images_page_by_character_id()
get_images_page_by_character_id(character_id: int, page: int, per_page: int) -> List[Type[Image]]
Takes a Character id, a page number, and an integer describing how many Images to return per page of results. Returns a list containing that page's worth of Images.
get_images_by_location_id()
get_images_by_location_id(location_id: int) -> List[Type[Image]]
Takes a Location id and returns a list of Images associated with that Location, if any.
get_images_page_by_location_id()
get_images_page_by_location_id(location_id: int, page: int, per_page: int) -> List[Type[Image]]
Takes a Location id, a page number, and an integer describing how many Images to return per page of results. Returns a list of Images corresponding to that page.