EventController - applebiter/gnatwriter GitHub Wiki

Event controller encapsulates event management functionality.

create_event()

create_event(
    title: str, description: str = None, start_datetime: str = None,
    end_datetime: str = None
) -> Event

Takes a title at minimum, with the rest of the arguments being optional. Returns an Event.

update_event()

update_event(
    event_id: int, title: str, description: str, start_datetime: str,
    end_datetime: str
) -> Type[Event]

Takes an Event id, title and optionally other arguments. Returns the updated Event.

delete_event()

delete_event(event_id: int) -> bool

Takes an Event id and returns True if the Event is deleted from the database.

get_all_events()

get_all_events() -> List[Type[Event]]

Returns a list of all Events in the database belonging to the user.

get_all_events_page()

get_all_events_page(page: int, per_page: int) -> List[Type[Event]]

Takes a page number and an integer describing how many Events to return per page of results. Returns a list of Events corresponding to the specified page.

append_characters_to_event()

append_characters_to_event(event_id: int, character_ids: list) -> Type[Event]

Takes an Event id and a list containing one or more Character ids. Returns the updated Event.

get_characters_by_event_id()

get_characters_by_event_id(event_id: int) -> List[Type[Character]]

Takes an Event id and returns a list of Characters associated with the specified Event.

get_characters_page_by_event_id()

get_characters_page_by_event_id(event_id: int, page: int, per_page: int) -> List[Type[Character]]

Takes an Event id, a page number, and an integer describing how many Events to return per page of results. Returns a list of Events representing that page.

append_locations_to_event()

append_locations_to_event(event_id: int, location_ids: list) -> Type[Event]

Takes an Event id and a list containing one or more Location ids. Returns the updated Event, now associated with the specified Location(s).

get_locations_by_event_id()

get_locations_by_event_id(event_id: int) -> List[Type[Location]]

Takes an Event id and returns a list of associated Locations, if any.

append_links_to_event()

append_links_to_event(event_id: int, link_ids: list) -> Type[Event]

Takes an Event id and one or more Link ids. Returns the updated Event.

get_links_by_event_id()

get_links_by_event_id(event_id: int) -> List[Type[Link]]

Takes an Event id and returns a list of Links with which it is associated.

get_links_page_by_event_id()

get_links_page_by_event_id(event_id: int, page: int, per_page: int) -> List[Type[Link]]

Takes an Event id, a page number, and an integer describing how many Links to return per page of results. Returns a list containing the corresponding Links.

append_notes_to_event()

append_notes_to_event(event_id: int, note_ids: list) -> Type[Event]

Takes an Event id and one or more Note ids. Returns the updated Event.

get_notes_by_event_id()

get_notes_by_event_id(event_id: int) -> List[Type[Note]]

Takes an Event id and returns a list of all associated Notes.

get_notes_page_by_event_id()

get_notes_page_by_event_id(event_id: int, page: int, per_page: int) -> List[Type[Note]]

Takes an Event 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.