markEpisodeWatched
Marks a single episode as watched or unwatched.TMDB ID of the TV show
Season number
Episode number within the season
Whether the episode is watched (true) or unwatched (false)
Behavior
- Creates a new episode progress record if it doesn’t exist (when marking as watched)
- Updates existing record if the watched state changes
- Does not create a record when unmarking if no record exists
- Requires user authentication
markSeasonEpisodesWatched
Batch marks multiple episodes in a season as watched or unwatched.TMDB ID of the TV show
Season number
Array of episode numbers to mark
Whether episodes are watched (true) or unwatched (false)
Behavior
- Processes each episode in the array
- Only updates records where the watched state actually changes
- Does not create records when unmarking if they don’t exist
- Optimized for batch operations (e.g., marking entire seasons)
markShowEpisodesAndStatus
Batch marks episodes across multiple seasons and updates the show’s progress status in a single transaction. This is the most efficient way to mark multiple seasons.TMDB ID of the TV show
Type of media (should be “tv”)
Whether episodes are watched (true) or unwatched (false)
Progress status to set on the show: “want-to-watch”, “watching”, or “finished”
Overall show progress percentage (0-100)
Show title
URL to show poster image
Show rating
Show release date
Show description/overview
Behavior
- Updates the show’s
watch_itemsrecord with progress status and percentage - Bulk-fetches all existing episode progress records in one query for efficiency
- Only writes database changes for episodes whose watched state actually changed
- Replaces the N+1 pattern of calling
setProgressStatus+markSeasonEpisodesWatchedper season - Creates new watch item if the show isn’t tracked yet
getAllWatchedEpisodes
Retrieves all watched episodes for a specific TV show.TMDB ID of the TV show
Array of episode progress records
Unique identifier for the episode progress record
ID of the user who watched the episode
TMDB ID of the TV show
Season number
Episode number
Whether the episode is watched
Timestamp of last update
Behavior
- Returns empty array if user is not authenticated
- Returns all episode progress records for the show (both watched and unwatched)
- Useful for displaying watch progress and determining which episodes have been seen
getAllEpisodeProgress
Retrieves all episode progress records for the current user across all TV shows.Array of all episode progress records for the user
Unique identifier for the episode progress record
ID of the user
TMDB ID of the TV show
Season number
Episode number
Whether the episode is watched
Timestamp of last update
Behavior
- Returns empty array if user is not authenticated
- Returns all episode progress across all TV shows
- Useful for syncing progress data or displaying global statistics
syncEpisodeProgressItem
Syncs a single episode’s watch state. Similar tomarkEpisodeWatched but designed for sync operations.
TMDB ID of the TV show
Season number
Episode number within the season
Whether the episode is watched (true) or unwatched (false)
Behavior
- Identical to
markEpisodeWatchedin functionality - Creates or updates episode progress record
- Only updates if watched state changes
- Does not create record when unmarking if none exists
