LocationController - applebiter/gnatwriter GitHub Wiki
Location controller encapsulates location management functionality.
create_location()
create_location(
title: str, description: str = None, address: str = None,
city: str = None, state: str = None, country: str = None,
zip_code: str = None, latitude: float = None,
longitude: float = None
) -> Location
Takes a title, and optionally takes several location-related data points. Returns the new Location.
update_location()
def update_location(
location_id: int, title: str, description: str = None,
address: str = None, city: str = None, state: str = None,
country: str = None, zip_code: str = None, latitude: float = None,
longitude: float = None
) -> Type[Location]
Takes a Location id and a title, and optionally takes several location-related data points. Returns the updated Location.
delete_location()
delete_location(location_id: int) -> bool
Takes a Location id and returns True if the specified Location is deleted from the database. Note that Location objects are complex, and all subordinate Links, Notes, and associations with Events will be deleted from the database as well.
get_all_locations()
get_all_locations() -> List[Type[Location]]
Returns a list containing all Locations in the database belonging to the user.
get_all_locations_page()
get_all_locations_page(page: int, per_page: int) -> List[Type[Location]]
search_locations_by_title_and_description()
search_locations_by_title_and_description(search: str) -> List[Type[Location]]
Takes a search term and attempts to match it against Locations using the title and description attributes. Returns a list of Locations matching the search term, if any.
search_locations_by_address()
search_locations_by_address(search: str) -> List[Type[Location]]
Takes a search term and returns a list of Locations having matching addresses, if any.
search_locations_by_city()
search_locations_by_city(search: str) -> List[Type[Location]]
Takes a search term and returns a list of Locations having cities matching the term, if any.
search_locations_by_state()
search_locations_by_state(search: str) -> List[Type[Location]]
Takes a search term and returns a list of Locations having the state attribute match the term, if any.
search_locations_by_country()
search_locations_by_country(search: str) -> List[Type[Location]]
Takes a search term and returns a list of Locations having matching country attributes, if any.
search_locations_by_zip_code()
search_locations_by_zip_code(search: str) -> List[Type[Location]]
Takes a search term and returns a list of Locations having matching zip_code attributes, if any.
append_images_to_location()
append_images_to_location(location_id: int, image_ids: list) -> Type[Location]
Takes a Location id and a list one containing one or more Image ids. Returns the updated Location.
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 the specified 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 the specified page.
append_links_to_location()
append_links_to_location(location_id: int, link_ids: list) -> Type[Location]
Takes a Location id and a list containing one or more Link ids. Returns the updated Location.
get_links_by_location_id()
get_links_by_location_id(location_id: int) -> List[Type[Link]]
Takes a Location id and returns a list of the associated Images, if any.
get_links_page_by_location_id()
get_links_page_by_location_id(location_id: int, page: int, per_page: int) -> List[Type[Link]]
Takes a Location id, a page number, and an integer describing how many Links to return per page of results. Returns a list of Links corresponding to that page.
append_notes_to_location()
append_notes_to_location(location_id: int, note_ids: list) -> Type[Location]
Takes a Location id and a list containing one or more Note ids. Returns the updated Location.
get_notes_by_location_id()
get_notes_by_location_id(location_id: int) -> List[Type[Note]]
Takes a Location id and returns a list of all Notes associated with the specified Location, if any.
get_notes_page_by_location_id()
get_notes_page_by_location_id(location_id: int, page: int, per_page: int) -> List[Type[Note]]
Takes a Location id, a page number, and an integer describing how many Notes to return per page of results. Returns a list of Notes corresponding to the specified page.