LinkController - applebiter/gnatwriter GitHub Wiki

Link controller encapsulates link management functionality.

create_link()

create_link(url: str, title: str) -> Link

Takes a URL and a title, and returns a Link.

update_link()

update_link(link_id: int, url: str, title: str) -> Type[Link]

Takes a Link id, a URL, and a title. Returns the updated Link.

delete_link()

delete_link(link_id: int) -> bool

Takes a Link id and returns True if the specified Link is deleted from the database.

get_link_by_id()

get_link_by_id(link_id: int) -> Type[Link] | None

Takes a Link id and returns its matching Link if found, None otherwise.

get_links_by_story_id()

get_links_by_story_id(story_id: int) -> List[Type[Link]]

Takes a Story id and returns a list of Links associated with the specified Story.

get_all_links()

get_all_links() -> List[Type[Link]]

Returns a list of all Links belonging to the user.

get_all_links_page()

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

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

search_links()

search_links(search: str) -> List[Type[Link]]

Takes a search term and returns a list of matching Links, if any.