View Source ShortcutApi.StoriesBehavior behaviour (shortcut_api_ex v1.0.5)

Behavior for Shortcut API Stories operations.

This module defines the callbacks required for interacting with Shortcut Stories API endpoints. Implementations of this behavior should provide the logic for each function to handle API requests according to the Shortcut API documentation.

Each function requires a valid Shortcut API token and operates on story data, facilitating creating, retrieving, updating, and deleting stories.

Callbacks

  • get_story/2: Retrieves a single story by its ID.
  • create_story/2: Creates a new story with the provided parameters.
  • update_story/3: Updates an existing story identified by its ID.
  • delete_story/2: Deletes a story by its ID.

Summary

Callbacks

create_story(token, params)

@callback create_story(token :: String.t(), params :: map()) ::
  {:ok, map() | [map()]} | {:error, any()}

delete_story(token, story_id)

@callback delete_story(token :: String.t(), story_id :: pos_integer()) ::
  {:ok, map() | [map()]} | {:error, any()}

get_story(token, story_id)

@callback get_story(token :: String.t(), story_id :: pos_integer()) ::
  {:ok, map() | [map()]} | {:error, any()}

update_story(token, story_id, params)

@callback update_story(token :: String.t(), story_id :: pos_integer(), params :: map()) ::
  {:ok, map() | [map()]} | {:error, any()}