From b91133e764b875674aaac035788cb0e93840649a Mon Sep 17 00:00:00 2001 From: Vlad Jerca Date: Thu, 16 Jul 2026 21:17:07 +0200 Subject: [PATCH 1/3] docs(api): document public API and add JSR publish workflow Raises the JSR score toward 100 by covering the remaining checks: - Module doc + `@example` on the `mod.ts` entrypoint, plus a package README (readme/module-doc, examples, module-docs-in-all-entrypoints). - JSDoc on every exported symbol (schemas, inferred model types, contracts, factories, client helpers) - 100% symbol coverage, up from 0%. The comments are carried into the generated declarations, so JSR sees them. - GitHub Actions workflow that publishes to JSR via OIDC, which records provenance (public transparency log entry) on the next release. --- .github/workflows/publish.yml | 36 ++++++++++ projects/api/README.md | 65 +++++++++++++++++++ projects/api/deno.json | 1 + projects/api/mod.ts | 25 ++++++- projects/api/src/Environment.ts | 1 + .../api/src/contracts/_internal/builder.ts | 4 ++ .../request/bulkMediaRequestSchema.ts | 1 + .../request/commentsSortParamsSchema.ts | 1 + .../_internal/request/countryParamsSchema.ts | 1 + .../request/extendedMediaQuerySchema.ts | 1 + .../request/extendedPeopleQuerySchema.ts | 1 + .../request/extendedProfileQuerySchema.ts | 1 + .../request/extendedQuerySchemaFactory.ts | 1 + .../request/extendedWatchNowQuerySchema.ts | 1 + .../request/hideFilterParamsSchema.ts | 1 + .../_internal/request/idParamsSchema.ts | 1 + .../_internal/request/idsRequestSchema.ts | 4 ++ .../_internal/request/ignoreQuerySchema.ts | 1 + .../request/internalIdParamsSchema.ts | 1 + .../_internal/request/languageParamsSchema.ts | 1 + .../_internal/request/languageQuerySchema.ts | 1 + .../request/lifetimeStatsQuerySchema.ts | 1 + .../_internal/request/limitlessQuerySchema.ts | 1 + .../_internal/request/linksQuerySchema.ts | 1 + .../request/mediaFilterParamsSchema.ts | 1 + .../request/mediaReportRequestSchema.ts | 1 + .../_internal/request/pageQuerySchema.ts | 1 + .../_internal/request/periodParamsSchema.ts | 1 + .../request/recentPeriodParamsSchema.ts | 1 + .../_internal/request/refreshQuerySchema.ts | 1 + .../request/reportRequestSchemaFactory.ts | 1 + .../request/smartListFiltersSchema.ts | 1 + .../_internal/request/smartListWriteSchema.ts | 1 + .../_internal/request/sortQuerySchema.ts | 1 + .../_internal/request/statsQuerySchema.ts | 1 + .../_internal/request/watchNowParamsSchema.ts | 1 + .../response/characterResponseSchema.ts | 1 + .../response/commentResponseSchema.ts | 1 + .../response/crewPositionResponseSchema.ts | 1 + .../response/distributionResponseSchema.ts | 1 + .../response/episodeIdsResponseSchema.ts | 1 + .../response/episodeResponseSchema.ts | 2 + .../response/episodeStatsResponseSchema.ts | 1 + .../episodeTranslationResponseSchema.ts | 1 + .../_internal/response/genreEnumSchema.ts | 1 + .../response/imagesResponseSchema.ts | 1 + .../_internal/response/jobsResponseSchema.ts | 1 + .../response/justWatchLinkResponseSchema.ts | 1 + .../_internal/response/likeResponseSchema.ts | 1 + .../response/listAddResponseSchema.ts | 1 + .../response/listMetadataResponseSchema.ts | 1 + .../response/listPrivacyEnumSchema.ts | 1 + .../response/listRemoveResponseSchema.ts | 1 + .../_internal/response/listResponseSchema.ts | 1 + .../_internal/response/listSortSchema.ts | 1 + .../_internal/response/listTypeSchema.ts | 1 + .../response/listedMediaResponseSchema.ts | 2 + .../response/listedMovieResponseSchema.ts | 1 + .../response/listedShowResponseSchema.ts | 1 + .../response/mediaColorsResponseSchema.ts | 1 + .../movieCertificationResponseSchema.ts | 1 + .../response/movieIdsResponseSchema.ts | 1 + .../_internal/response/movieResponseSchema.ts | 2 + .../response/movieStatsResponseSchema.ts | 1 + .../response/peopleResponseSchema.ts | 3 + .../response/profileResponseSchema.ts | 1 + .../response/progressResponseSchema.ts | 1 + .../response/ratingsResponseSchema.ts | 1 + .../response/reactionsResponseSchema.ts | 4 ++ .../response/seasonIdsResponseSchema.ts | 1 + .../response/sentimentsResponseSchema.ts | 1 + .../showCertificationResponseSchema.ts | 1 + .../response/showIdsResponseSchema.ts | 1 + .../_internal/response/showResponseSchema.ts | 2 + .../response/showStatsResponseSchema.ts | 1 + .../response/smartListCreateResponseSchema.ts | 1 + .../smartListDefinitionResponseSchema.ts | 1 + .../response/smartListItemResponseSchema.ts | 1 + .../response/socialIdsResponseSchema.ts | 1 + .../_internal/response/sortDirectionSchema.ts | 1 + .../_internal/response/statsResponseSchema.ts | 1 + .../response/statusResponseSchema.ts | 1 + .../response/streamingIdsResponseSchema.ts | 1 + .../response/studioResponseSchema.ts | 1 + .../response/translationResponseSchema.ts | 1 + .../_internal/response/upNextSortBySchema.ts | 1 + .../_internal/response/videoResponseSchema.ts | 1 + .../_internal/response/videoTypeEnumSchema.ts | 1 + .../response/watchNowRankResponseSchema.ts | 1 + .../response/watchNowResponseSchema.ts | 2 + .../response/watchedStatsResponseSchema.ts | 1 + projects/api/src/contracts/calendars/index.ts | 5 ++ .../schema/request/calendarParamsSchema.ts | 1 + .../response/calendarMovieResponseSchema.ts | 1 + .../calendarShowListResponseSchema.ts | 1 + .../api/src/contracts/certifications/index.ts | 3 + .../movieCertificationsResponseSchema.ts | 1 + .../showCertificationsResponseSchema.ts | 1 + projects/api/src/contracts/checkin/index.ts | 6 ++ .../request/movieCheckinRequestSchema.ts | 1 + .../schema/request/sharingRequestSchema.ts | 1 + .../request/showCheckinRequestSchema.ts | 1 + .../response/checkin409ErrorResponse.ts | 1 + .../response/movieCheckinResponseSchema.ts | 1 + .../response/showCheckinResponseSchema.ts | 1 + projects/api/src/contracts/comments/index.ts | 7 ++ .../requests/commentPostParamsSchema.ts | 1 + .../requests/commentReplyParamsSchema.ts | 1 + .../requests/commentReportRequestSchema.ts | 1 + projects/api/src/contracts/countries/index.ts | 3 + .../src/contracts/enums/crewPositionSchema.ts | 1 + .../src/contracts/enums/genreOptionSchema.ts | 1 + projects/api/src/contracts/enums/index.ts | 6 ++ .../src/contracts/enums/mediaStatusSchema.ts | 1 + .../src/contracts/enums/reactionsSchema.ts | 1 + .../contracts/enums/upNextSortOptionSchema.ts | 1 + .../src/contracts/enums/videoTypeSchema.ts | 1 + projects/api/src/contracts/episodes/index.ts | 1 + projects/api/src/contracts/genres/index.ts | 3 + projects/api/src/contracts/languages/index.ts | 3 + projects/api/src/contracts/lists/index.ts | 3 + .../lists/schema/listReportRequestSchema.ts | 1 + .../schema/prominentListResponseSchema.ts | 1 + projects/api/src/contracts/media/index.ts | 4 ++ .../mediaAnticipatedResponseSchema.ts | 1 + .../response/mediaPopularResponseSchema.ts | 1 + .../response/mediaTrendingResponseSchema.ts | 1 + projects/api/src/contracts/models/index.ts | 25 +++++++ projects/api/src/contracts/movies/index.ts | 13 ++++ .../movieAnticipatedResponseSchema.ts | 1 + .../schema/response/movieHotResponseSchema.ts | 1 + .../response/movieStreamingResponseSchema.ts | 1 + .../response/movieTrendingResponseSchema.ts | 1 + .../response/movieWatchedResponseSchema.ts | 1 + projects/api/src/contracts/networks/index.ts | 3 + projects/api/src/contracts/notes/index.ts | 4 ++ projects/api/src/contracts/oauth/index.ts | 7 ++ .../oauth/schema/request/codeRequestSchema.ts | 1 + .../request/deviceTokenRequestSchema.ts | 1 + .../oauth/schema/request/tokenBaseSchema.ts | 1 + .../schema/request/tokenRefreshSchema.ts | 1 + .../schema/request/tokenRequestSchema.ts | 1 + .../schema/response/codeResponseSchema.ts | 1 + .../schema/response/tokenResponseSchema.ts | 1 + projects/api/src/contracts/people/index.ts | 5 ++ .../request/peopleReportRequestSchema.ts | 1 + .../peopleMovieCreditsResponseSchema.ts | 1 + .../peopleShowCreditsResponseSchema.ts | 1 + .../schema/response/personResponseSchema.ts | 1 + .../src/contracts/recommendations/index.ts | 4 ++ .../schema/request/hideParamsSchema.ts | 1 + .../request/recommendationsQuerySchema.ts | 1 + .../response/recommendedMovieResponse.ts | 1 + .../response/recommendedShowResponse.ts | 1 + .../response/userProfileWithNotesSchema.ts | 1 + projects/api/src/contracts/scrobble/index.ts | 5 ++ .../request/episodeScrobbleRequestSchema.ts | 3 +- .../request/movieScrobbleRequestSchema.ts | 3 +- .../response/episodeScrobbleResponseSchema.ts | 1 + .../response/movieScrobbleResponseSchema.ts | 1 + projects/api/src/contracts/search/index.ts | 10 +++ .../request/recentSearchRequestSchema.ts | 1 + .../schema/request/searchEngineSchema.ts | 1 + .../schema/request/searchQuerySchema.ts | 1 + .../schema/request/searchTypeParamFactory.ts | 1 + .../request/trendingSearchTypeParamFactory.ts | 1 + .../response/searchListResponseSchema.ts | 1 + .../response/searchMovieResponseSchema.ts | 1 + .../response/searchPersonResponseSchema.ts | 1 + .../response/searchResultResponseSchema.ts | 1 + .../response/searchShowResponseSchema.ts | 1 + .../trendingSearchMovieResponseSchema.ts | 1 + .../trendingSearchPersonResponseSchema.ts | 1 + .../response/trendingSearchResponseSchema.ts | 1 + .../trendingSearchShowResponseSchema.ts | 1 + projects/api/src/contracts/seasons/index.ts | 1 + projects/api/src/contracts/shows/index.ts | 14 ++++ .../schema/request/episodeParamsSchema.ts | 1 + .../schema/request/seasonParamsSchema.ts | 1 + .../schema/request/showQueryParamsSchema.ts | 1 + .../schema/response/seasonResponseSchema.ts | 1 + .../response/showAnticipatedResponseSchema.ts | 1 + .../schema/response/showHotResponseSchema.ts | 1 + .../response/showProgressResponseSchema.ts | 1 + .../response/showStreamingResponseSchema.ts | 1 + .../response/showTrendingResponseSchema.ts | 1 + .../response/showWatchedResponseSchema.ts | 1 + .../api/src/contracts/smart_lists/index.ts | 2 + .../contracts/social_recommendations/index.ts | 1 + projects/api/src/contracts/sync/index.ts | 23 +++++++ .../schema/request/availableOnEnumSchema.ts | 1 + .../schema/request/collectionParamSchema.ts | 1 + .../schema/request/favoritesParamSchema.ts | 1 + .../schema/request/historyIdsRequestSchema.ts | 1 + .../request/historyRemoveRequestSchema.ts | 1 + .../sync/schema/request/minimalParamSchema.ts | 1 + .../schema/request/playbackIdParamsSchema.ts | 1 + .../schema/request/progressParamsSchema.ts | 1 + .../sync/schema/request/ratingsParamSchema.ts | 2 + .../request/removeRatingsParamSchema.ts | 1 + .../schema/request/upNextIntentQuerySchema.ts | 1 + .../collectionMinimalResponseSchema.ts | 2 + .../response/collectionResponseSchema.ts | 4 ++ .../response/favoritesRemoveResponseSchema.ts | 1 + .../response/favoritesResponseSchema.ts | 1 + .../response/historyRemoveResponseSchema.ts | 1 + .../schema/response/historyResponseSchema.ts | 1 + .../response/lastActivitiesResponseSchema.ts | 1 + .../response/movieProgressResponseSchema.ts | 1 + .../schema/response/ratingsResponseSchema.ts | 1 + .../response/removeRatingsResponseSchema.ts | 1 + .../schema/response/upNextResponseSchema.ts | 1 + projects/api/src/contracts/team/index.ts | 2 + .../response/teamMemberResponseSchema.ts | 1 + projects/api/src/contracts/traktContract.ts | 1 + projects/api/src/contracts/users/index.ts | 44 +++++++++++++ .../schema/request/addFilterRequestSchema.ts | 1 + .../schema/request/avatarRequestSchema.ts | 1 + .../request/commentOnTypeParamsSchema.ts | 1 + .../schema/request/commentTypeParamsSchema.ts | 1 + .../schema/request/commentsRequestSchema.ts | 1 + .../schema/request/coverRequestSchema.ts | 1 + .../schema/request/createListRequestSchema.ts | 1 + .../schema/request/dateRangeParamsSchema.ts | 1 + .../schema/request/filterIdParamsSchema.ts | 1 + .../schema/request/hiddenParamsSchema.ts | 1 + .../schema/request/hiddenSectionSchema.ts | 1 + .../schema/request/hiddenShowRequestSchema.ts | 1 + .../request/historyItemIdParamsSchema.ts | 1 + .../request/listCommentsSortParamsSchema.ts | 1 + .../users/schema/request/listParamsSchema.ts | 1 + .../schema/request/listUpdateRequestSchema.ts | 1 + .../request/monthInReviewParamsSchema.ts | 1 + .../request/plexConnectRequestSchema.ts | 1 + .../schema/request/plexServerParamsSchema.ts | 1 + .../request/plexSettingsUpdateSchema.ts | 1 + .../schema/request/plexSyncRequestSchema.ts | 1 + .../schema/request/profileParamsSchema.ts | 1 + .../schema/request/reorderRequestSchema.ts | 1 + .../schema/request/sectionParamsSchema.ts | 1 + .../schema/request/settingsRequestSchema.ts | 1 + .../request/socialActivityParamsSchema.ts | 1 + .../users/schema/request/sortParamsSchema.ts | 2 + .../schema/request/syncIdParamsSchema.ts | 1 + .../schema/request/syncTypeParamsSchema.ts | 1 + .../schema/request/userReportRequestSchema.ts | 1 + .../request/yearInReviewParamsSchema.ts | 1 + .../response/activityHistoryResponseSchema.ts | 1 + .../response/addFilterResponseSchema.ts | 1 + .../response/blockedUserResponseSchema.ts | 1 + .../episodeActivityHistoryResponseSchema.ts | 1 + .../response/favoritedMoviesResponseSchema.ts | 1 + .../response/favoritedShowsResponseSchema.ts | 1 + .../schema/response/filterResponseSchema.ts | 1 + .../schema/response/followResponseSchema.ts | 1 + .../schema/response/followerResponseSchema.ts | 1 + .../schema/response/friendResponseSchema.ts | 1 + .../response/hiddenAddResponseSchema.ts | 1 + .../response/hiddenRemoveResponseSchema.ts | 1 + .../response/hiddenShowResponseSchema.ts | 1 + .../schema/response/historyActionSchema.ts | 1 + .../response/likedItemResponseSchema.ts | 4 +- .../response/monthInReviewResponseSchema.ts | 2 + .../movieActivityHistoryResponseSchema.ts | 1 + .../response/plexConnectResponseSchema.ts | 1 + .../response/plexErrorResponseSchema.ts | 1 + .../plexServerAccountsResponseSchema.ts | 3 + .../response/plexServersResponseSchema.ts | 2 + .../response/plexSettingsResponseSchema.ts | 12 ++++ .../response/ratedItemResponseSchema.ts | 1 + .../response/reactedCommentResponseSchema.ts | 1 + .../response/reorderListResponseSchema.ts | 1 + .../response/reorderListsResponseSchema.ts | 1 + .../schema/response/requestsResponseSchema.ts | 1 + .../schema/response/settingsResponseSchema.ts | 1 + .../showActivityHistoryResponseSchema.ts | 1 + .../response/socialActivityResponseSchema.ts | 1 + .../schema/response/syncItemResponseSchema.ts | 2 + .../schema/response/syncResponseSchema.ts | 1 + .../response/userCommentResponseSchema.ts | 1 + .../response/userStatsResponseSchema.ts | 1 + .../schema/response/watchActionSchema.ts | 1 + .../watchedMoviesMinimalResponseSchema.ts | 1 + .../response/watchedMoviesResponseSchema.ts | 1 + .../watchedShowsMinimalResponseSchema.ts | 1 + .../response/watchedShowsResponseSchema.ts | 1 + .../schema/response/watchingResponseSchema.ts | 1 + .../response/yearInReviewResponseSchema.ts | 1 + .../contracts/users/subroutes/favorites.ts | 3 + .../src/contracts/users/subroutes/filters.ts | 3 + .../src/contracts/users/subroutes/hidden.ts | 3 + .../src/contracts/users/subroutes/history.ts | 5 ++ .../src/contracts/users/subroutes/ratings.ts | 2 + .../src/contracts/users/subroutes/requests.ts | 2 + .../contracts/users/subroutes/smartLists.ts | 4 ++ .../contracts/users/subroutes/userLists.ts | 8 +++ .../src/contracts/users/subroutes/watched.ts | 5 ++ .../contracts/users/subroutes/watchlist.ts | 1 + projects/api/src/contracts/watchnow/index.ts | 3 + .../response/watchNowSourcesResponseSchema.ts | 2 + projects/api/src/contracts/younify/index.ts | 4 ++ .../schema/request/connectRequestSchema.ts | 1 + .../schema/request/refreshParamsSchema.ts | 1 + .../schema/request/serviceIdParamsSchema.ts | 1 + .../schema/response/connectResponseSchema.ts | 1 + .../response/connectionResponseSchema.ts | 1 + projects/api/src/index.ts | 22 +++++++ projects/api/src/types/CombinationsFrom.ts | 1 + 308 files changed, 704 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 projects/api/README.md diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..6325711c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,36 @@ +name: The Rite of Ascension aka Publish to JSR + +on: + release: + types: [published] + workflow_dispatch: + +concurrency: + group: publish-jsr + cancel-in-progress: false + +jobs: + publish: + name: The Offering aka Publish @trakt/api + runs-on: ubuntu-latest + permissions: + contents: read + # Required for JSR provenance via OIDC. + id-token: write + steps: + - name: The Oracle's Gaze aka Checkout Code + uses: actions/checkout@v4 + + - name: The Summoning aka Setup Deno + uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + + - name: The Sacred Assembly aka Install Dependencies + run: deno task install + + - name: The Transcription aka Generate Static Types + run: cd projects/api && deno task build:types + + - name: The Offering aka Publish + run: cd projects/api && deno publish diff --git a/projects/api/README.md b/projects/api/README.md new file mode 100644 index 00000000..b6739883 --- /dev/null +++ b/projects/api/README.md @@ -0,0 +1,65 @@ +# @trakt/api + +Fully typed [ts-rest](https://ts-rest.com) contract and client for the +[Trakt API](https://trakt.docs.apiary.io), backed by Zod schemas. + +`traktApi()` returns a client with precise request/response types for every +endpoint. The individual Zod schemas and inferred model types are also exported +for validation and reuse. + +## Install + +```sh +deno add jsr:@trakt/api +``` + +## Usage + +```ts +import { traktApi } from '@trakt/api'; + +const client = traktApi({ apiKey: '' }); + +const res = await client.movies.summary({ params: { id: 'tron-legacy-2010' } }); +if (res.status === 200) { + console.log(res.body.title); // fully typed +} +``` + +### Environment + +By default the client targets production. Pass an `environment` to override: + +```ts +import { Environment, traktApi } from '@trakt/api'; + +const staging = traktApi({ + apiKey: '', + environment: Environment.staging, +}); +``` + +### Cancellation + +Pass `cancellable: true` so a newer request with the same `cancellationId` +aborts the in-flight one: + +```ts +const client = traktApi({ apiKey: '', cancellable: true }); +``` + +## Schemas and types + +Every endpoint's request and response is a Zod schema, and the inferred model +types are exported alongside the contract: + +```ts +import { type MovieResponse, movieResponseSchema } from '@trakt/api'; + +const movie: MovieResponse = movieResponseSchema.parse(await someFetch()); +``` + +## Contract + +The raw ts-rest contract is exported as `traktContract` for use with any +ts-rest-compatible server or client. diff --git a/projects/api/deno.json b/projects/api/deno.json index 25cb108b..4831b540 100644 --- a/projects/api/deno.json +++ b/projects/api/deno.json @@ -18,6 +18,7 @@ "include": [ "mod.ts", "deno.json", + "README.md", "src", "types" ], diff --git a/projects/api/mod.ts b/projects/api/mod.ts index 124748ba..47b0c458 100644 --- a/projects/api/mod.ts +++ b/projects/api/mod.ts @@ -1,5 +1,26 @@ -// Published entry point. -// +/** + * Fully typed [ts-rest](https://ts-rest.com) contract and client for the + * [Trakt API](https://trakt.docs.apiary.io), backed by Zod schemas. + * + * `traktApi()` returns a client with precise request/response types for every + * endpoint; the individual Zod schemas and inferred model types are also + * exported for validation and reuse. + * + * @example + * ```ts + * import { traktApi } from '@trakt/api'; + * + * const client = traktApi({ apiKey: '' }); + * + * const res = await client.movies.summary({ params: { id: 'tron-legacy-2010' } }); + * if (res.status === 200) { + * console.log(res.body.title); // fully typed + * } + * ``` + * + * @module + */ + // Runtime comes from `./src/index.ts`; the public types come from the // precomputed static declarations in `./types` (generated by // `deno task build:types`). Serving explicit declarations instead of the diff --git a/projects/api/src/Environment.ts b/projects/api/src/Environment.ts index 328e5f46..66773e21 100644 --- a/projects/api/src/Environment.ts +++ b/projects/api/src/Environment.ts @@ -1,3 +1,4 @@ +/** Trakt API environment base URLs to target with {@link traktApi}. */ export enum Environment { production_private = 'https://apiz.trakt.tv', production = 'https://api.trakt.tv', diff --git a/projects/api/src/contracts/_internal/builder.ts b/projects/api/src/contracts/_internal/builder.ts index afb8297d..0f6d8a01 100644 --- a/projects/api/src/contracts/_internal/builder.ts +++ b/projects/api/src/contracts/_internal/builder.ts @@ -2,14 +2,18 @@ import { initContract } from '@ts-rest/core'; // Explicit type keeps JSR/tsc from inlining ts-rest's internal (unnameable) // contract type into the emitted declarations. +/** Builder. */ export const builder: ReturnType = initContract(); +/** The auth requirement type. */ export type AuthRequirement = 'none' | 'optional' | 'required'; +/** The trakt route metadata type. */ export type TraktRouteMetadata = { auth?: AuthRequirement; }; +/** Auth metadata. */ export function authMetadata(auth: AuthRequirement): TraktRouteMetadata { return { auth }; } diff --git a/projects/api/src/contracts/_internal/request/bulkMediaRequestSchema.ts b/projects/api/src/contracts/_internal/request/bulkMediaRequestSchema.ts index b9e8ee29..94501601 100644 --- a/projects/api/src/contracts/_internal/request/bulkMediaRequestSchema.ts +++ b/projects/api/src/contracts/_internal/request/bulkMediaRequestSchema.ts @@ -62,6 +62,7 @@ const addEpisodeToHistorySchema = z ids: episodeIdsRequestSchema, }).merge(watchedAtSchema); +/** Zod schema for the bulk media request. */ export const bulkMediaRequestSchema = z.object({ movies: z.array(addMovieToHistorySchema).nullish(), shows: z.array(addShowToHistorySchema).nullish(), diff --git a/projects/api/src/contracts/_internal/request/commentsSortParamsSchema.ts b/projects/api/src/contracts/_internal/request/commentsSortParamsSchema.ts index 3b92fd1b..834f6814 100644 --- a/projects/api/src/contracts/_internal/request/commentsSortParamsSchema.ts +++ b/projects/api/src/contracts/_internal/request/commentsSortParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the comments sort parameters. */ export const commentsSortParamsSchema = z.object({ sort: z.enum([ 'newest', diff --git a/projects/api/src/contracts/_internal/request/countryParamsSchema.ts b/projects/api/src/contracts/_internal/request/countryParamsSchema.ts index 271ef54c..1b66cabd 100644 --- a/projects/api/src/contracts/_internal/request/countryParamsSchema.ts +++ b/projects/api/src/contracts/_internal/request/countryParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the country parameters. */ export const countryParamsSchema = z.object({ country: z.string().optional().openapi({ description: '2 character country code.', diff --git a/projects/api/src/contracts/_internal/request/extendedMediaQuerySchema.ts b/projects/api/src/contracts/_internal/request/extendedMediaQuerySchema.ts index 6f9a23b5..97a02ab8 100644 --- a/projects/api/src/contracts/_internal/request/extendedMediaQuerySchema.ts +++ b/projects/api/src/contracts/_internal/request/extendedMediaQuerySchema.ts @@ -1,5 +1,6 @@ import { extendedQuerySchemaFactory } from './extendedQuerySchemaFactory.ts'; +/** Zod schema for the extended media query parameters. */ export const extendedMediaQuerySchema = extendedQuerySchemaFactory< ['full', 'images', 'colors', 'streaming_ids'] >(); diff --git a/projects/api/src/contracts/_internal/request/extendedPeopleQuerySchema.ts b/projects/api/src/contracts/_internal/request/extendedPeopleQuerySchema.ts index 86407719..05573d66 100644 --- a/projects/api/src/contracts/_internal/request/extendedPeopleQuerySchema.ts +++ b/projects/api/src/contracts/_internal/request/extendedPeopleQuerySchema.ts @@ -1,5 +1,6 @@ import { extendedQuerySchemaFactory } from './extendedQuerySchemaFactory.ts'; +/** Zod schema for the extended people query parameters. */ export const extendedPeopleQuerySchema = extendedQuerySchemaFactory< ['full', 'images'] >(); diff --git a/projects/api/src/contracts/_internal/request/extendedProfileQuerySchema.ts b/projects/api/src/contracts/_internal/request/extendedProfileQuerySchema.ts index ddf4ba3b..c2ea76d0 100644 --- a/projects/api/src/contracts/_internal/request/extendedProfileQuerySchema.ts +++ b/projects/api/src/contracts/_internal/request/extendedProfileQuerySchema.ts @@ -1,5 +1,6 @@ import { extendedQuerySchemaFactory } from './extendedQuerySchemaFactory.ts'; +/** Zod schema for the extended profile query parameters. */ export const extendedProfileQuerySchema = extendedQuerySchemaFactory< ['full', 'images', 'vip'] >(); diff --git a/projects/api/src/contracts/_internal/request/extendedQuerySchemaFactory.ts b/projects/api/src/contracts/_internal/request/extendedQuerySchemaFactory.ts index 921a46df..4579bc2f 100644 --- a/projects/api/src/contracts/_internal/request/extendedQuerySchemaFactory.ts +++ b/projects/api/src/contracts/_internal/request/extendedQuerySchemaFactory.ts @@ -1,6 +1,7 @@ import type { CombinationsFrom } from '../../../types/CombinationsFrom.ts'; import { z } from '../z.ts'; +/** Extended query schema factory. */ export const extendedQuerySchemaFactory = (): z.ZodObject<{ extended: z.ZodOptional>>>; }> => diff --git a/projects/api/src/contracts/_internal/request/extendedWatchNowQuerySchema.ts b/projects/api/src/contracts/_internal/request/extendedWatchNowQuerySchema.ts index c06bbfbe..06619f45 100644 --- a/projects/api/src/contracts/_internal/request/extendedWatchNowQuerySchema.ts +++ b/projects/api/src/contracts/_internal/request/extendedWatchNowQuerySchema.ts @@ -1,5 +1,6 @@ import { extendedQuerySchemaFactory } from './extendedQuerySchemaFactory.ts'; +/** Zod schema for the extended watch now query parameters. */ export const extendedWatchNowQuerySchema = extendedQuerySchemaFactory< ['streaming_ranks'] >(); diff --git a/projects/api/src/contracts/_internal/request/hideFilterParamsSchema.ts b/projects/api/src/contracts/_internal/request/hideFilterParamsSchema.ts index b0b2ad74..7b923e03 100644 --- a/projects/api/src/contracts/_internal/request/hideFilterParamsSchema.ts +++ b/projects/api/src/contracts/_internal/request/hideFilterParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the hide filter parameters. */ export const hideFilterParamsSchema = z.object({ hide: z.enum([ 'unwatched', diff --git a/projects/api/src/contracts/_internal/request/idParamsSchema.ts b/projects/api/src/contracts/_internal/request/idParamsSchema.ts index ab93cd0b..5e27c22b 100644 --- a/projects/api/src/contracts/_internal/request/idParamsSchema.ts +++ b/projects/api/src/contracts/_internal/request/idParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the id parameters. */ export const idParamsSchema = z.object({ id: z.string().openapi({ description: 'The slug of the resource.', diff --git a/projects/api/src/contracts/_internal/request/idsRequestSchema.ts b/projects/api/src/contracts/_internal/request/idsRequestSchema.ts index ecd9ab19..ed666e34 100644 --- a/projects/api/src/contracts/_internal/request/idsRequestSchema.ts +++ b/projects/api/src/contracts/_internal/request/idsRequestSchema.ts @@ -26,6 +26,7 @@ const episodeIdsSchema = allMediaIdsSchema.omit({ tmdb: true, }); +/** Zod schema for the show ids request. */ export const showIdsRequestSchema = z.union([ showMediaIdsSchema.extend({ trakt: z.number().int() }), showMediaIdsSchema.extend({ slug: z.string() }), @@ -34,6 +35,7 @@ export const showIdsRequestSchema = z.union([ showMediaIdsSchema.extend({ tvdb: z.number().int() }), ]); +/** Zod schema for the movie ids request. */ export const movieIdsRequestSchema = z.union([ movieMediaIdsSchema.extend({ trakt: z.number().int() }), movieMediaIdsSchema.extend({ slug: z.string() }), @@ -41,12 +43,14 @@ export const movieIdsRequestSchema = z.union([ movieMediaIdsSchema.extend({ tmdb: z.number().int() }), ]); +/** Zod schema for the season ids request. */ export const seasonIdsRequestSchema = z.union([ seasonIdsSchema.extend({ trakt: z.number().int() }), seasonIdsSchema.extend({ tmdb: z.string() }), seasonIdsSchema.extend({ tvdb: z.number().int() }), ]); +/** Zod schema for the episode ids request. */ export const episodeIdsRequestSchema = z.union([ episodeIdsSchema.extend({ trakt: z.number().int() }), episodeIdsSchema.extend({ tvdb: z.number().int() }), diff --git a/projects/api/src/contracts/_internal/request/ignoreQuerySchema.ts b/projects/api/src/contracts/_internal/request/ignoreQuerySchema.ts index a066a2fc..805a51af 100644 --- a/projects/api/src/contracts/_internal/request/ignoreQuerySchema.ts +++ b/projects/api/src/contracts/_internal/request/ignoreQuerySchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the ignore query parameters. */ export const ignoreQuerySchema = z.object({ ignore_watched: z.boolean().nullish().openapi({ description: 'Ignore watched items.', diff --git a/projects/api/src/contracts/_internal/request/internalIdParamsSchema.ts b/projects/api/src/contracts/_internal/request/internalIdParamsSchema.ts index d845082a..9a7f24e6 100644 --- a/projects/api/src/contracts/_internal/request/internalIdParamsSchema.ts +++ b/projects/api/src/contracts/_internal/request/internalIdParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the internal id parameters. */ export const internalIdParamsSchema = z.object({ id: z.string(), }); diff --git a/projects/api/src/contracts/_internal/request/languageParamsSchema.ts b/projects/api/src/contracts/_internal/request/languageParamsSchema.ts index 86321f43..6e5dfb2b 100644 --- a/projects/api/src/contracts/_internal/request/languageParamsSchema.ts +++ b/projects/api/src/contracts/_internal/request/languageParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the language parameters. */ export const languageParamsSchema = z.object({ language: z.string().openapi({ description: '2 character language code' }), }); diff --git a/projects/api/src/contracts/_internal/request/languageQuerySchema.ts b/projects/api/src/contracts/_internal/request/languageQuerySchema.ts index e22516ef..6b3bdffb 100644 --- a/projects/api/src/contracts/_internal/request/languageQuerySchema.ts +++ b/projects/api/src/contracts/_internal/request/languageQuerySchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the language query parameters. */ export const languageQuerySchema = z.object({ language: z.string().nullish().openapi({ description: 'Filter comments to a 2 character language code', diff --git a/projects/api/src/contracts/_internal/request/lifetimeStatsQuerySchema.ts b/projects/api/src/contracts/_internal/request/lifetimeStatsQuerySchema.ts index 8cfd7175..aea100b7 100644 --- a/projects/api/src/contracts/_internal/request/lifetimeStatsQuerySchema.ts +++ b/projects/api/src/contracts/_internal/request/lifetimeStatsQuerySchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the lifetime stats query parameters. */ export const lifetimeStatsQuerySchema = z.object({ lifetime_stats: z.boolean().optional().openapi({ description: diff --git a/projects/api/src/contracts/_internal/request/limitlessQuerySchema.ts b/projects/api/src/contracts/_internal/request/limitlessQuerySchema.ts index 4bfae39a..9158d4e6 100644 --- a/projects/api/src/contracts/_internal/request/limitlessQuerySchema.ts +++ b/projects/api/src/contracts/_internal/request/limitlessQuerySchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the limitless query parameters. */ export const limitlessQuerySchema = z.object({ limit: z.number() .int() diff --git a/projects/api/src/contracts/_internal/request/linksQuerySchema.ts b/projects/api/src/contracts/_internal/request/linksQuerySchema.ts index b5a2eff3..c59e4a84 100644 --- a/projects/api/src/contracts/_internal/request/linksQuerySchema.ts +++ b/projects/api/src/contracts/_internal/request/linksQuerySchema.ts @@ -1,6 +1,7 @@ import type { CombinationsFrom } from '../../../types/CombinationsFrom.ts'; import { z } from '../z.ts'; +/** Zod schema for the links query parameters. */ export const linksQuerySchema = z.object({ links: z.custom>() .nullish(), diff --git a/projects/api/src/contracts/_internal/request/mediaFilterParamsSchema.ts b/projects/api/src/contracts/_internal/request/mediaFilterParamsSchema.ts index c11617db..56baa023 100644 --- a/projects/api/src/contracts/_internal/request/mediaFilterParamsSchema.ts +++ b/projects/api/src/contracts/_internal/request/mediaFilterParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the media filter parameters. */ export const mediaFilterParamsSchema = z.object({ watchnow: z.enum([ 'favorites', diff --git a/projects/api/src/contracts/_internal/request/mediaReportRequestSchema.ts b/projects/api/src/contracts/_internal/request/mediaReportRequestSchema.ts index 8fe1d830..b57834c1 100644 --- a/projects/api/src/contracts/_internal/request/mediaReportRequestSchema.ts +++ b/projects/api/src/contracts/_internal/request/mediaReportRequestSchema.ts @@ -1,5 +1,6 @@ import { reportRequestSchemaFactory } from './reportRequestSchemaFactory.ts'; +/** Zod schema for the media report request. */ export const mediaReportRequestSchema = reportRequestSchemaFactory( [ 'duplicate', diff --git a/projects/api/src/contracts/_internal/request/pageQuerySchema.ts b/projects/api/src/contracts/_internal/request/pageQuerySchema.ts index cade1ee4..368f5668 100644 --- a/projects/api/src/contracts/_internal/request/pageQuerySchema.ts +++ b/projects/api/src/contracts/_internal/request/pageQuerySchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the page query parameters. */ export const pageQuerySchema = z.object({ page: z.number().int().nullish().openapi({ description: 'The page number to retrieve', diff --git a/projects/api/src/contracts/_internal/request/periodParamsSchema.ts b/projects/api/src/contracts/_internal/request/periodParamsSchema.ts index 4d6c3316..49dccee5 100644 --- a/projects/api/src/contracts/_internal/request/periodParamsSchema.ts +++ b/projects/api/src/contracts/_internal/request/periodParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the period parameters. */ export const periodParamsSchema = z.object({ period: z.enum([ 'daily', diff --git a/projects/api/src/contracts/_internal/request/recentPeriodParamsSchema.ts b/projects/api/src/contracts/_internal/request/recentPeriodParamsSchema.ts index f7b16ddf..d0500ee0 100644 --- a/projects/api/src/contracts/_internal/request/recentPeriodParamsSchema.ts +++ b/projects/api/src/contracts/_internal/request/recentPeriodParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the recent period parameters. */ export const recentPeriodParamsSchema = z.object({ period: z.enum([ 'daily', diff --git a/projects/api/src/contracts/_internal/request/refreshQuerySchema.ts b/projects/api/src/contracts/_internal/request/refreshQuerySchema.ts index 72481105..5c8da78f 100644 --- a/projects/api/src/contracts/_internal/request/refreshQuerySchema.ts +++ b/projects/api/src/contracts/_internal/request/refreshQuerySchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the refresh query parameters. */ export const refreshQuerySchema = z.object({ images: z.boolean().nullish().openapi({ description: 'Also queue a refresh of the resource images.', diff --git a/projects/api/src/contracts/_internal/request/reportRequestSchemaFactory.ts b/projects/api/src/contracts/_internal/request/reportRequestSchemaFactory.ts index e5ca563b..af3acd9c 100644 --- a/projects/api/src/contracts/_internal/request/reportRequestSchemaFactory.ts +++ b/projects/api/src/contracts/_internal/request/reportRequestSchemaFactory.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Report request schema factory. */ export const reportRequestSchemaFactory = < const T extends readonly [string, ...string[]], >(reasons: T) => diff --git a/projects/api/src/contracts/_internal/request/smartListFiltersSchema.ts b/projects/api/src/contracts/_internal/request/smartListFiltersSchema.ts index f939a55d..c741a783 100644 --- a/projects/api/src/contracts/_internal/request/smartListFiltersSchema.ts +++ b/projects/api/src/contracts/_internal/request/smartListFiltersSchema.ts @@ -3,6 +3,7 @@ import { z } from '../z.ts'; const list = z.array(z.string()); const range = z.array(z.number()).max(2); +/** Zod schema for smart list filters. */ export const smartListFiltersSchema = z.object({ genres: list.optional(), subgenres: list.optional(), diff --git a/projects/api/src/contracts/_internal/request/smartListWriteSchema.ts b/projects/api/src/contracts/_internal/request/smartListWriteSchema.ts index b3e9526b..fd71a2ad 100644 --- a/projects/api/src/contracts/_internal/request/smartListWriteSchema.ts +++ b/projects/api/src/contracts/_internal/request/smartListWriteSchema.ts @@ -1,6 +1,7 @@ import { z } from '../z.ts'; import { smartListFiltersSchema } from './smartListFiltersSchema.ts'; +/** Zod schema for smart list write. */ export const smartListWriteSchema = z.object({ name: z.string().min(1), source: z.enum([ diff --git a/projects/api/src/contracts/_internal/request/sortQuerySchema.ts b/projects/api/src/contracts/_internal/request/sortQuerySchema.ts index 9cf48054..238f72bc 100644 --- a/projects/api/src/contracts/_internal/request/sortQuerySchema.ts +++ b/projects/api/src/contracts/_internal/request/sortQuerySchema.ts @@ -1,6 +1,7 @@ import { sortDirectionSchema } from '../response/sortDirectionSchema.ts'; import { z } from '../z.ts'; +/** Zod schema for the sort query parameters. */ export const sortQuerySchema = z.object({ sort_by: z.string().nullish().openapi({ description: 'The field to sort by', diff --git a/projects/api/src/contracts/_internal/request/statsQuerySchema.ts b/projects/api/src/contracts/_internal/request/statsQuerySchema.ts index 49c56103..9bb94360 100644 --- a/projects/api/src/contracts/_internal/request/statsQuerySchema.ts +++ b/projects/api/src/contracts/_internal/request/statsQuerySchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the stats query parameters. */ export const statsQuerySchema = z.object({ include_stats: z.boolean().nullish().openapi({ description: 'Whether to include stats in the response', diff --git a/projects/api/src/contracts/_internal/request/watchNowParamsSchema.ts b/projects/api/src/contracts/_internal/request/watchNowParamsSchema.ts index 76e2d872..a7fec7c8 100644 --- a/projects/api/src/contracts/_internal/request/watchNowParamsSchema.ts +++ b/projects/api/src/contracts/_internal/request/watchNowParamsSchema.ts @@ -1,6 +1,7 @@ import { z } from '../z.ts'; import { countryParamsSchema } from './countryParamsSchema.ts'; +/** Zod schema for the watch now parameters. */ export const watchNowParamsSchema = z.object({ id: z.string().or(z.number().int()).openapi({ description: diff --git a/projects/api/src/contracts/_internal/response/characterResponseSchema.ts b/projects/api/src/contracts/_internal/response/characterResponseSchema.ts index 25bfc297..635a2303 100644 --- a/projects/api/src/contracts/_internal/response/characterResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/characterResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the character response. */ export const characterResponseSchema = z.object({ character: z.string(), characters: z.array(z.string()), diff --git a/projects/api/src/contracts/_internal/response/commentResponseSchema.ts b/projects/api/src/contracts/_internal/response/commentResponseSchema.ts index adf080da..fd81a95c 100644 --- a/projects/api/src/contracts/_internal/response/commentResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/commentResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../z.ts'; import { profileResponseSchema } from './profileResponseSchema.ts'; +/** Zod schema for the comment response. */ export const commentResponseSchema = z.object({ id: z.number().int(), parent_id: z.number().int(), diff --git a/projects/api/src/contracts/_internal/response/crewPositionResponseSchema.ts b/projects/api/src/contracts/_internal/response/crewPositionResponseSchema.ts index 0b821b26..cbace42a 100644 --- a/projects/api/src/contracts/_internal/response/crewPositionResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/crewPositionResponseSchema.ts @@ -1,5 +1,6 @@ import { asString, z } from '../z.ts'; +/** Zod schema for the crew position response. */ export const crewPositionResponseSchema = asString(z.enum([ 'acting', 'production', diff --git a/projects/api/src/contracts/_internal/response/distributionResponseSchema.ts b/projects/api/src/contracts/_internal/response/distributionResponseSchema.ts index 38496a83..9d05e51c 100644 --- a/projects/api/src/contracts/_internal/response/distributionResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/distributionResponseSchema.ts @@ -1,5 +1,6 @@ import { float, z } from '../z.ts'; +/** Zod schema for the distribution response. */ export const distributionResponseSchema = z.object({ 1: float(z.number()), 2: float(z.number()), diff --git a/projects/api/src/contracts/_internal/response/episodeIdsResponseSchema.ts b/projects/api/src/contracts/_internal/response/episodeIdsResponseSchema.ts index 5b3ba259..8a9f3fa6 100644 --- a/projects/api/src/contracts/_internal/response/episodeIdsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/episodeIdsResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../z.ts'; import { streamingIdsResponseSchema } from './streamingIdsResponseSchema.ts'; +/** Zod schema for the episode ids response. */ export const episodeIdsResponseSchema = z.object({ trakt: z.number().int(), tvdb: z.number().int().nullish(), diff --git a/projects/api/src/contracts/_internal/response/episodeResponseSchema.ts b/projects/api/src/contracts/_internal/response/episodeResponseSchema.ts index 44b4cc2f..b2057cb5 100644 --- a/projects/api/src/contracts/_internal/response/episodeResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/episodeResponseSchema.ts @@ -2,6 +2,7 @@ import { float, z } from '../z.ts'; import { episodeIdsResponseSchema } from './episodeIdsResponseSchema.ts'; import { showResponseSchema } from './showResponseSchema.ts'; +/** Zod schema for the episode response. */ export const episodeResponseSchema = z.object({ season: z.number().int(), number: z.number().int(), @@ -73,6 +74,7 @@ export const episodeResponseSchema = z.object({ .nullish(), }); +/** Zod schema for the typed episode response. */ export const typedEpisodeResponseSchema = z.object({ type: z.literal('episode'), episode: episodeResponseSchema, diff --git a/projects/api/src/contracts/_internal/response/episodeStatsResponseSchema.ts b/projects/api/src/contracts/_internal/response/episodeStatsResponseSchema.ts index 277bcee3..97fc8d5c 100644 --- a/projects/api/src/contracts/_internal/response/episodeStatsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/episodeStatsResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the episode stats response. */ export const episodeStatsResponseSchema = z.object({ watchers: z.number().int(), plays: z.number().int(), diff --git a/projects/api/src/contracts/_internal/response/episodeTranslationResponseSchema.ts b/projects/api/src/contracts/_internal/response/episodeTranslationResponseSchema.ts index c3da674d..e3eeb153 100644 --- a/projects/api/src/contracts/_internal/response/episodeTranslationResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/episodeTranslationResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the episode translation response. */ export const episodeTranslationResponseSchema = z.array( z.object({ title: z.string().nullish(), diff --git a/projects/api/src/contracts/_internal/response/genreEnumSchema.ts b/projects/api/src/contracts/_internal/response/genreEnumSchema.ts index 9509d5c2..68a7b644 100644 --- a/projects/api/src/contracts/_internal/response/genreEnumSchema.ts +++ b/projects/api/src/contracts/_internal/response/genreEnumSchema.ts @@ -1,5 +1,6 @@ import { asString, z } from '../z.ts'; +/** Zod schema for genre enum. */ export const genreEnumSchema = asString(z.enum([ 'action', 'adventure', diff --git a/projects/api/src/contracts/_internal/response/imagesResponseSchema.ts b/projects/api/src/contracts/_internal/response/imagesResponseSchema.ts index 4ffc07ff..60ba63d4 100644 --- a/projects/api/src/contracts/_internal/response/imagesResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/imagesResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the images response. */ export const imagesResponseSchema = z .object({ fanart: z.array(z.string()), diff --git a/projects/api/src/contracts/_internal/response/jobsResponseSchema.ts b/projects/api/src/contracts/_internal/response/jobsResponseSchema.ts index 89e536cb..85493380 100644 --- a/projects/api/src/contracts/_internal/response/jobsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/jobsResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the jobs response. */ export const jobsResponseSchema = z.object({ job: z.string(), jobs: z.array(z.string()), diff --git a/projects/api/src/contracts/_internal/response/justWatchLinkResponseSchema.ts b/projects/api/src/contracts/_internal/response/justWatchLinkResponseSchema.ts index 05fe3fbe..f2082e9f 100644 --- a/projects/api/src/contracts/_internal/response/justWatchLinkResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/justWatchLinkResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the just watch link response. */ export const justWatchLinkResponseSchema = z.record( z.string(), z.string(), diff --git a/projects/api/src/contracts/_internal/response/likeResponseSchema.ts b/projects/api/src/contracts/_internal/response/likeResponseSchema.ts index 7b75ee52..e7bfa889 100644 --- a/projects/api/src/contracts/_internal/response/likeResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/likeResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../z.ts'; import { profileResponseSchema } from './profileResponseSchema.ts'; +/** Zod schema for the like response. */ export const likeResponseSchema = z.object({ liked_at: z.string().datetime(), user: profileResponseSchema, diff --git a/projects/api/src/contracts/_internal/response/listAddResponseSchema.ts b/projects/api/src/contracts/_internal/response/listAddResponseSchema.ts index 1d8dff8e..eb965798 100644 --- a/projects/api/src/contracts/_internal/response/listAddResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/listAddResponseSchema.ts @@ -2,6 +2,7 @@ import { bulkMediaRequestSchema } from '../request/bulkMediaRequestSchema.ts'; import { z } from '../z.ts'; import { mediaMutationCountsSchema } from './mediaMutationCountsSchema.ts'; +/** Zod schema for the list add response. */ export const listAddResponseSchema = z.object({ added: mediaMutationCountsSchema, existing: mediaMutationCountsSchema, diff --git a/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts b/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts index 518796d7..48a17df2 100644 --- a/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the list metadata response. */ export const listMetadataResponseSchema = z.object({ rank: z.number().int(), id: z.number().int(), diff --git a/projects/api/src/contracts/_internal/response/listPrivacyEnumSchema.ts b/projects/api/src/contracts/_internal/response/listPrivacyEnumSchema.ts index 6bdcaa53..ceef0675 100644 --- a/projects/api/src/contracts/_internal/response/listPrivacyEnumSchema.ts +++ b/projects/api/src/contracts/_internal/response/listPrivacyEnumSchema.ts @@ -1,5 +1,6 @@ import { asString, z } from '../z.ts'; +/** Zod schema for list privacy enum. */ export const listPrivacyEnumSchema = asString(z.enum([ 'private', 'public', diff --git a/projects/api/src/contracts/_internal/response/listRemoveResponseSchema.ts b/projects/api/src/contracts/_internal/response/listRemoveResponseSchema.ts index b64d7c13..412edab2 100644 --- a/projects/api/src/contracts/_internal/response/listRemoveResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/listRemoveResponseSchema.ts @@ -2,6 +2,7 @@ import { bulkMediaRequestSchema } from '../request/bulkMediaRequestSchema.ts'; import { z } from '../z.ts'; import { mediaMutationCountsSchema } from './mediaMutationCountsSchema.ts'; +/** Zod schema for the list remove response. */ export const listRemoveResponseSchema = z.object({ deleted: mediaMutationCountsSchema, not_found: bulkMediaRequestSchema, diff --git a/projects/api/src/contracts/_internal/response/listResponseSchema.ts b/projects/api/src/contracts/_internal/response/listResponseSchema.ts index a6156788..36eceae6 100644 --- a/projects/api/src/contracts/_internal/response/listResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/listResponseSchema.ts @@ -4,6 +4,7 @@ import { listPrivacyEnumSchema } from './listPrivacyEnumSchema.ts'; import { profileResponseSchema } from './profileResponseSchema.ts'; import { sortDirectionSchema } from './sortDirectionSchema.ts'; +/** Zod schema for the list response. */ export const listResponseSchema = z.object({ name: z.string(), description: z.string().nullish(), diff --git a/projects/api/src/contracts/_internal/response/listSortSchema.ts b/projects/api/src/contracts/_internal/response/listSortSchema.ts index 7bd28eb1..477a3147 100644 --- a/projects/api/src/contracts/_internal/response/listSortSchema.ts +++ b/projects/api/src/contracts/_internal/response/listSortSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for list sort. */ export const listSortSchema = z.object({ sort: z.enum([ 'popular', diff --git a/projects/api/src/contracts/_internal/response/listTypeSchema.ts b/projects/api/src/contracts/_internal/response/listTypeSchema.ts index 6bae3aa3..c8f1bd20 100644 --- a/projects/api/src/contracts/_internal/response/listTypeSchema.ts +++ b/projects/api/src/contracts/_internal/response/listTypeSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for list type. */ export const listTypeSchema = z.object({ type: z.enum([ 'all', diff --git a/projects/api/src/contracts/_internal/response/listedMediaResponseSchema.ts b/projects/api/src/contracts/_internal/response/listedMediaResponseSchema.ts index c6090cd3..c3057654 100644 --- a/projects/api/src/contracts/_internal/response/listedMediaResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/listedMediaResponseSchema.ts @@ -31,11 +31,13 @@ const listedEpisodeSchema = listMetadataResponseSchema show: showResponseSchema.nullish(), })); +/** Zod schema for the listed media response. */ export const listedMediaResponseSchema = z.union([ listedMovieSchema, listedShowSchema, ]); +/** Zod schema for the listed all response. */ export const listedAllResponseSchema = z.union([ listedMovieSchema, listedShowSchema, diff --git a/projects/api/src/contracts/_internal/response/listedMovieResponseSchema.ts b/projects/api/src/contracts/_internal/response/listedMovieResponseSchema.ts index dbbe5119..1e7bfa98 100644 --- a/projects/api/src/contracts/_internal/response/listedMovieResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/listedMovieResponseSchema.ts @@ -1,5 +1,6 @@ import { listMetadataResponseSchema } from './listMetadataResponseSchema.ts'; import { typedMovieResponseSchema } from './movieResponseSchema.ts'; +/** Zod schema for the listed movie response. */ export const listedMovieResponseSchema = listMetadataResponseSchema .merge(typedMovieResponseSchema); diff --git a/projects/api/src/contracts/_internal/response/listedShowResponseSchema.ts b/projects/api/src/contracts/_internal/response/listedShowResponseSchema.ts index f9972fcd..58d3b3f9 100644 --- a/projects/api/src/contracts/_internal/response/listedShowResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/listedShowResponseSchema.ts @@ -1,5 +1,6 @@ import { listMetadataResponseSchema } from './listMetadataResponseSchema.ts'; import { typedShowResponseSchema } from './showResponseSchema.ts'; +/** Zod schema for the listed show response. */ export const listedShowResponseSchema = listMetadataResponseSchema .merge(typedShowResponseSchema); diff --git a/projects/api/src/contracts/_internal/response/mediaColorsResponseSchema.ts b/projects/api/src/contracts/_internal/response/mediaColorsResponseSchema.ts index c3adb4bb..03ab9442 100644 --- a/projects/api/src/contracts/_internal/response/mediaColorsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/mediaColorsResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the media colors response. */ export const mediaColorsResponseSchema = z.object({ poster: z.array(z.string()).nullish(), }); diff --git a/projects/api/src/contracts/_internal/response/movieCertificationResponseSchema.ts b/projects/api/src/contracts/_internal/response/movieCertificationResponseSchema.ts index 6cf8eb9c..373caad8 100644 --- a/projects/api/src/contracts/_internal/response/movieCertificationResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/movieCertificationResponseSchema.ts @@ -1,5 +1,6 @@ import { asString, z } from '../z.ts'; +/** Zod schema for the movie certification response. */ export const movieCertificationResponseSchema = asString(z.enum([ // In the data, there are entries with the value 'undefined' 'undefined', diff --git a/projects/api/src/contracts/_internal/response/movieIdsResponseSchema.ts b/projects/api/src/contracts/_internal/response/movieIdsResponseSchema.ts index c7b2941d..0679fe70 100644 --- a/projects/api/src/contracts/_internal/response/movieIdsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/movieIdsResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../z.ts'; import { streamingIdsResponseSchema } from './streamingIdsResponseSchema.ts'; +/** Zod schema for the movie ids response. */ export const movieIdsResponseSchema = z.object({ trakt: z.number().int(), slug: z.string(), diff --git a/projects/api/src/contracts/_internal/response/movieResponseSchema.ts b/projects/api/src/contracts/_internal/response/movieResponseSchema.ts index e9d1d094..e9eed851 100644 --- a/projects/api/src/contracts/_internal/response/movieResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/movieResponseSchema.ts @@ -7,6 +7,7 @@ import { movieIdsResponseSchema } from './movieIdsResponseSchema.ts'; import { socialIdsResponseSchema } from './socialIdsResponseSchema.ts'; import { statusResponseSchema } from './statusResponseSchema.ts'; +/** Zod schema for the movie response. */ export const movieResponseSchema = z.object({ title: z.string(), year: z.number().int().nullish(), @@ -110,6 +111,7 @@ export const movieResponseSchema = z.object({ social_ids: socialIdsResponseSchema.nullish(), }); +/** Zod schema for the typed movie response. */ export const typedMovieResponseSchema = z.object({ type: z.literal('movie'), movie: movieResponseSchema, diff --git a/projects/api/src/contracts/_internal/response/movieStatsResponseSchema.ts b/projects/api/src/contracts/_internal/response/movieStatsResponseSchema.ts index f947e957..4b5d4184 100644 --- a/projects/api/src/contracts/_internal/response/movieStatsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/movieStatsResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../z.ts'; import { episodeStatsResponseSchema } from './episodeStatsResponseSchema.ts'; +/** Zod schema for the movie stats response. */ export const movieStatsResponseSchema = episodeStatsResponseSchema.extend({ favorited: z.number().int(), recommended: z.number().int(), diff --git a/projects/api/src/contracts/_internal/response/peopleResponseSchema.ts b/projects/api/src/contracts/_internal/response/peopleResponseSchema.ts index d3e1fac5..d6a45f51 100644 --- a/projects/api/src/contracts/_internal/response/peopleResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/peopleResponseSchema.ts @@ -8,6 +8,7 @@ const headshotSchema = z.object({ headshot: z.array(z.string()), }); +/** Zod schema for the cast response. */ export const castResponseSchema = z.object({ episode_count: z.number().int().nullish(), person: personResponseSchema, @@ -17,6 +18,7 @@ export const castResponseSchema = z.object({ images: headshotSchema.nullish(), }).merge(characterResponseSchema); +/** Zod schema for the crew response. */ export const crewResponseSchema = z.object({ person: personResponseSchema, episode_count: z.number().int().nullish(), @@ -26,6 +28,7 @@ export const crewResponseSchema = z.object({ images: headshotSchema.nullish(), }).merge(jobsResponseSchema); +/** Zod schema for the people response. */ export const peopleResponseSchema = z.object({ cast: z.array(castResponseSchema).nullish(), crew: z.record( diff --git a/projects/api/src/contracts/_internal/response/profileResponseSchema.ts b/projects/api/src/contracts/_internal/response/profileResponseSchema.ts index 14798040..dc46aa52 100644 --- a/projects/api/src/contracts/_internal/response/profileResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/profileResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../z.ts'; // FIXME: split up in user profile, and official user +/** Zod schema for the profile response. */ export const profileResponseSchema = z.object({ username: z.string(), private: z.boolean(), diff --git a/projects/api/src/contracts/_internal/response/progressResponseSchema.ts b/projects/api/src/contracts/_internal/response/progressResponseSchema.ts index 04bc7382..e7065cc1 100644 --- a/projects/api/src/contracts/_internal/response/progressResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/progressResponseSchema.ts @@ -2,6 +2,7 @@ import { z } from '../z.ts'; import { episodeResponseSchema } from './episodeResponseSchema.ts'; import { statsResponseSchema } from './statsResponseSchema.ts'; +/** Zod schema for the progress response. */ export const progressResponseSchema = z.object({ aired: z.number().int(), completed: z.number().int(), diff --git a/projects/api/src/contracts/_internal/response/ratingsResponseSchema.ts b/projects/api/src/contracts/_internal/response/ratingsResponseSchema.ts index c5666d32..1deaf903 100644 --- a/projects/api/src/contracts/_internal/response/ratingsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/ratingsResponseSchema.ts @@ -6,6 +6,7 @@ const externalRatingsResponseSchema = z.object({ link: z.string().nullish(), }); +/** Zod schema for the ratings response. */ export const ratingsResponseSchema = z.object({ trakt: z.object({ rating: float(z.number()), diff --git a/projects/api/src/contracts/_internal/response/reactionsResponseSchema.ts b/projects/api/src/contracts/_internal/response/reactionsResponseSchema.ts index c24f7002..ea2446b6 100644 --- a/projects/api/src/contracts/_internal/response/reactionsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/reactionsResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../z.ts'; import { profileResponseSchema } from './profileResponseSchema.ts'; +/** Zod schema for reaction enum. */ export const reactionEnumSchema = z.enum([ 'like', 'dislike', @@ -11,12 +12,14 @@ export const reactionEnumSchema = z.enum([ 'spoiler', ]); +/** Zod schema for the reactions summary response. */ export const reactionsSummaryResponseSchema = z.object({ reaction_count: z.number().int(), user_count: z.number().int(), distribution: z.record(reactionEnumSchema, z.number().int()), }); +/** Zod schema for the reactions response. */ export const reactionsResponseSchema = z.object({ reacted_at: z.string().datetime(), reaction: z.object({ @@ -25,6 +28,7 @@ export const reactionsResponseSchema = z.object({ user: profileResponseSchema, }); +/** Zod schema for reaction type. */ export const reactionTypeSchema = z.object({ reaction_type: reactionEnumSchema, }); diff --git a/projects/api/src/contracts/_internal/response/seasonIdsResponseSchema.ts b/projects/api/src/contracts/_internal/response/seasonIdsResponseSchema.ts index 3dd11170..bfc8f63c 100644 --- a/projects/api/src/contracts/_internal/response/seasonIdsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/seasonIdsResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the season ids response. */ export const seasonIdsResponseSchema = z.object({ trakt: z.number().int(), tvdb: z.number().int().nullish(), diff --git a/projects/api/src/contracts/_internal/response/sentimentsResponseSchema.ts b/projects/api/src/contracts/_internal/response/sentimentsResponseSchema.ts index 4b7c981d..61614fbf 100644 --- a/projects/api/src/contracts/_internal/response/sentimentsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/sentimentsResponseSchema.ts @@ -5,6 +5,7 @@ const sentimentResponseSchema = z.object({ comment_ids: z.array(z.number().int()).nullish(), }); +/** Zod schema for the sentiments response. */ export const sentimentsResponseSchema = z.object({ bad: sentimentResponseSchema.array(), good: sentimentResponseSchema.array(), diff --git a/projects/api/src/contracts/_internal/response/showCertificationResponseSchema.ts b/projects/api/src/contracts/_internal/response/showCertificationResponseSchema.ts index 9e2ad296..4274ebc7 100644 --- a/projects/api/src/contracts/_internal/response/showCertificationResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/showCertificationResponseSchema.ts @@ -1,5 +1,6 @@ import { asString, z } from '../z.ts'; +/** Zod schema for the show certification response. */ export const showCertificationResponseSchema = asString(z.enum([ 'TV-14', 'TV-Y7', diff --git a/projects/api/src/contracts/_internal/response/showIdsResponseSchema.ts b/projects/api/src/contracts/_internal/response/showIdsResponseSchema.ts index 0612fbe6..0d877cd4 100644 --- a/projects/api/src/contracts/_internal/response/showIdsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/showIdsResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../z.ts'; import { episodeIdsResponseSchema } from './episodeIdsResponseSchema.ts'; +/** Zod schema for the show ids response. */ export const showIdsResponseSchema = episodeIdsResponseSchema.extend({ slug: z.string(), }); diff --git a/projects/api/src/contracts/_internal/response/showResponseSchema.ts b/projects/api/src/contracts/_internal/response/showResponseSchema.ts index 447e8781..e8958c5b 100644 --- a/projects/api/src/contracts/_internal/response/showResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/showResponseSchema.ts @@ -7,6 +7,7 @@ import { showIdsResponseSchema } from './showIdsResponseSchema.ts'; import { socialIdsResponseSchema } from './socialIdsResponseSchema.ts'; import { statusResponseSchema } from './statusResponseSchema.ts'; +/** Zod schema for the show response. */ export const showResponseSchema = z.object({ title: z.string(), year: z.number().int().nullish(), @@ -121,6 +122,7 @@ export const showResponseSchema = z.object({ social_ids: socialIdsResponseSchema.nullish(), }); +/** Zod schema for the typed show response. */ export const typedShowResponseSchema = z.object({ type: z.literal('show'), show: showResponseSchema, diff --git a/projects/api/src/contracts/_internal/response/showStatsResponseSchema.ts b/projects/api/src/contracts/_internal/response/showStatsResponseSchema.ts index 1b42b17d..6c1040b7 100644 --- a/projects/api/src/contracts/_internal/response/showStatsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/showStatsResponseSchema.ts @@ -1,3 +1,4 @@ import { movieStatsResponseSchema } from './movieStatsResponseSchema.ts'; +/** Zod schema for the show stats response. */ export const showStatsResponseSchema = movieStatsResponseSchema; diff --git a/projects/api/src/contracts/_internal/response/smartListCreateResponseSchema.ts b/projects/api/src/contracts/_internal/response/smartListCreateResponseSchema.ts index d6da7f12..bf746ea1 100644 --- a/projects/api/src/contracts/_internal/response/smartListCreateResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/smartListCreateResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the smart list create response. */ export const smartListCreateResponseSchema = z.object({ ids: z.object({ trakt: z.number().int(), diff --git a/projects/api/src/contracts/_internal/response/smartListDefinitionResponseSchema.ts b/projects/api/src/contracts/_internal/response/smartListDefinitionResponseSchema.ts index 2b9dd99a..5c5d91b4 100644 --- a/projects/api/src/contracts/_internal/response/smartListDefinitionResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/smartListDefinitionResponseSchema.ts @@ -1,6 +1,7 @@ import { smartListFiltersSchema } from '../request/smartListFiltersSchema.ts'; import { z } from '../z.ts'; +/** Zod schema for the smart list definition response. */ export const smartListDefinitionResponseSchema = z.object({ name: z.string(), privacy: z.string(), diff --git a/projects/api/src/contracts/_internal/response/smartListItemResponseSchema.ts b/projects/api/src/contracts/_internal/response/smartListItemResponseSchema.ts index dc81853f..e8ab5312 100644 --- a/projects/api/src/contracts/_internal/response/smartListItemResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/smartListItemResponseSchema.ts @@ -2,6 +2,7 @@ import { listedMovieResponseSchema } from './listedMovieResponseSchema.ts'; import { listedShowResponseSchema } from './listedShowResponseSchema.ts'; import { z } from '../z.ts'; +/** Zod schema for the smart list item response. */ export const smartListItemResponseSchema = z.object({ rank: z.number().int(), type: z.string(), diff --git a/projects/api/src/contracts/_internal/response/socialIdsResponseSchema.ts b/projects/api/src/contracts/_internal/response/socialIdsResponseSchema.ts index abf1ba6e..ee0d563a 100644 --- a/projects/api/src/contracts/_internal/response/socialIdsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/socialIdsResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the social ids response. */ export const socialIdsResponseSchema = z.object({ twitter: z.string().nullish(), facebook: z.string().nullish(), diff --git a/projects/api/src/contracts/_internal/response/sortDirectionSchema.ts b/projects/api/src/contracts/_internal/response/sortDirectionSchema.ts index 2bc173c0..dc6e6a3b 100644 --- a/projects/api/src/contracts/_internal/response/sortDirectionSchema.ts +++ b/projects/api/src/contracts/_internal/response/sortDirectionSchema.ts @@ -1,3 +1,4 @@ import { z } from '../z.ts'; +/** Zod schema for sort direction. */ export const sortDirectionSchema = z.enum(['asc', 'desc']); diff --git a/projects/api/src/contracts/_internal/response/statsResponseSchema.ts b/projects/api/src/contracts/_internal/response/statsResponseSchema.ts index 8d719e60..98d17bc0 100644 --- a/projects/api/src/contracts/_internal/response/statsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/statsResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the stats response. */ export const statsResponseSchema = z.object({ play_count: z.number().int(), minutes_watched: z.number().int(), diff --git a/projects/api/src/contracts/_internal/response/statusResponseSchema.ts b/projects/api/src/contracts/_internal/response/statusResponseSchema.ts index 769d3825..1607dfb5 100644 --- a/projects/api/src/contracts/_internal/response/statusResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/statusResponseSchema.ts @@ -1,5 +1,6 @@ import { asString, z } from '../z.ts'; +/** Zod schema for the status response. */ export const statusResponseSchema = asString(z.enum([ 'released', 'planned', diff --git a/projects/api/src/contracts/_internal/response/streamingIdsResponseSchema.ts b/projects/api/src/contracts/_internal/response/streamingIdsResponseSchema.ts index d79cbe8d..0f57a7cf 100644 --- a/projects/api/src/contracts/_internal/response/streamingIdsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/streamingIdsResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the streaming ids response. */ export const streamingIdsResponseSchema = z.object({ guid: z.string().nullish(), slug: z.string().nullish(), diff --git a/projects/api/src/contracts/_internal/response/studioResponseSchema.ts b/projects/api/src/contracts/_internal/response/studioResponseSchema.ts index 228019ae..4488c840 100644 --- a/projects/api/src/contracts/_internal/response/studioResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/studioResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the studio response. */ export const studioResponseSchema = z.object({ name: z.string(), country: z.string().nullish(), diff --git a/projects/api/src/contracts/_internal/response/translationResponseSchema.ts b/projects/api/src/contracts/_internal/response/translationResponseSchema.ts index ba234262..f5c2e692 100644 --- a/projects/api/src/contracts/_internal/response/translationResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/translationResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the translation response. */ export const translationResponseSchema = z.array( z.object({ title: z.string().nullish(), diff --git a/projects/api/src/contracts/_internal/response/upNextSortBySchema.ts b/projects/api/src/contracts/_internal/response/upNextSortBySchema.ts index 6e0eb3d3..8dd1b75b 100644 --- a/projects/api/src/contracts/_internal/response/upNextSortBySchema.ts +++ b/projects/api/src/contracts/_internal/response/upNextSortBySchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for up next sort by. */ export const upNextSortBySchema = z.enum([ 'activity', 'added', diff --git a/projects/api/src/contracts/_internal/response/videoResponseSchema.ts b/projects/api/src/contracts/_internal/response/videoResponseSchema.ts index cf6ae2ad..767e7708 100644 --- a/projects/api/src/contracts/_internal/response/videoResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/videoResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../z.ts'; import { videoTypeEnumSchema } from './videoTypeEnumSchema.ts'; +/** Zod schema for the video response. */ export const videoResponseSchema = z.object({ title: z.string(), url: z.string(), diff --git a/projects/api/src/contracts/_internal/response/videoTypeEnumSchema.ts b/projects/api/src/contracts/_internal/response/videoTypeEnumSchema.ts index a4c27275..a89367ed 100644 --- a/projects/api/src/contracts/_internal/response/videoTypeEnumSchema.ts +++ b/projects/api/src/contracts/_internal/response/videoTypeEnumSchema.ts @@ -1,5 +1,6 @@ import { asString, z } from '../z.ts'; +/** Zod schema for video type enum. */ export const videoTypeEnumSchema = asString(z.enum([ 'trailer', 'clip', diff --git a/projects/api/src/contracts/_internal/response/watchNowRankResponseSchema.ts b/projects/api/src/contracts/_internal/response/watchNowRankResponseSchema.ts index 1ef9f3f0..d51fc3cb 100644 --- a/projects/api/src/contracts/_internal/response/watchNowRankResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/watchNowRankResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the watch now rank response. */ export const watchNowRankResponseSchema = z.object({ rank: z.number().int().nullish(), delta: z.number().int().nullish(), diff --git a/projects/api/src/contracts/_internal/response/watchNowResponseSchema.ts b/projects/api/src/contracts/_internal/response/watchNowResponseSchema.ts index 50487c28..09f889e2 100644 --- a/projects/api/src/contracts/_internal/response/watchNowResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/watchNowResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../z.ts'; import { watchNowRankResponseSchema } from './watchNowRankResponseSchema.ts'; +/** Zod schema for the watch now service response. */ export const watchNowServiceResponseSchema = z.object({ source: z.string(), link: z.string(), @@ -33,6 +34,7 @@ export const watchNowServiceResponseSchema = z.object({ }).nullish(), }); +/** Zod schema for the watch now response. */ export const watchNowResponseSchema = z.record( z.string(), z.object({ diff --git a/projects/api/src/contracts/_internal/response/watchedStatsResponseSchema.ts b/projects/api/src/contracts/_internal/response/watchedStatsResponseSchema.ts index 412be3a7..ec2692bb 100644 --- a/projects/api/src/contracts/_internal/response/watchedStatsResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/watchedStatsResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../z.ts'; +/** Zod schema for the watched stats response. */ export const watchedStatsResponseSchema = z.object({ watcher_count: z.number().int(), play_count: z.number().int(), diff --git a/projects/api/src/contracts/calendars/index.ts b/projects/api/src/contracts/calendars/index.ts index 8ac5083d..859c5f3c 100644 --- a/projects/api/src/contracts/calendars/index.ts +++ b/projects/api/src/contracts/calendars/index.ts @@ -15,6 +15,7 @@ const groupQuery = z.object({ }), }); +/** ts-rest contract for the `calendars` endpoints. */ export const calendars = builder.router({ shows: { summary: 'Get shows', @@ -194,15 +195,19 @@ Returns upcoming series premieres during the requested UTC date range that are t }, { pathPrefix: '/calendars' }); export { calendarRequestParamsSchema }; +/** The calendar parameters. */ export type CalendarParams = z.infer; export { calendarShowResponseSchema }; +/** The calendar show response payload. */ export type CalendarShowResponse = z.infer< typeof calendarShowResponseSchema >; export { calendarMovieResponseSchema }; +/** The calendar movie response payload. */ export type CalendarMovieResponse = z.infer; export { hotReleaseResponseSchema }; +/** The hot release response payload. */ export type HotReleaseResponse = z.infer; diff --git a/projects/api/src/contracts/calendars/schema/request/calendarParamsSchema.ts b/projects/api/src/contracts/calendars/schema/request/calendarParamsSchema.ts index a034d251..5af6e192 100644 --- a/projects/api/src/contracts/calendars/schema/request/calendarParamsSchema.ts +++ b/projects/api/src/contracts/calendars/schema/request/calendarParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the calendar request parameters. */ export const calendarRequestParamsSchema = z.object({ target: z.enum(['my', 'all']).openapi({ description: diff --git a/projects/api/src/contracts/calendars/schema/response/calendarMovieResponseSchema.ts b/projects/api/src/contracts/calendars/schema/response/calendarMovieResponseSchema.ts index bae2b584..3bb66a98 100644 --- a/projects/api/src/contracts/calendars/schema/response/calendarMovieResponseSchema.ts +++ b/projects/api/src/contracts/calendars/schema/response/calendarMovieResponseSchema.ts @@ -1,6 +1,7 @@ import { movieResponseSchema } from '../../../_internal/response/movieResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the calendar movie response. */ export const calendarMovieResponseSchema = z.object({ released: z.string(), movie: movieResponseSchema, diff --git a/projects/api/src/contracts/calendars/schema/response/calendarShowListResponseSchema.ts b/projects/api/src/contracts/calendars/schema/response/calendarShowListResponseSchema.ts index 14994732..34ba4f67 100644 --- a/projects/api/src/contracts/calendars/schema/response/calendarShowListResponseSchema.ts +++ b/projects/api/src/contracts/calendars/schema/response/calendarShowListResponseSchema.ts @@ -2,6 +2,7 @@ import { showResponseSchema } from '../../../_internal/response/showResponseSche import { z } from '../../../_internal/z.ts'; import { calendarEpisodeResponseSchema } from './calendarEpisodeResponseSchema.ts'; +/** Zod schema for the calendar show response. */ export const calendarShowResponseSchema = z.object({ first_aired: z.string(), episode: calendarEpisodeResponseSchema, diff --git a/projects/api/src/contracts/certifications/index.ts b/projects/api/src/contracts/certifications/index.ts index 2d9a4c61..bc23b2e8 100644 --- a/projects/api/src/contracts/certifications/index.ts +++ b/projects/api/src/contracts/certifications/index.ts @@ -11,6 +11,7 @@ const certificationTypeParamsSchema = z.object({ ), }); +/** ts-rest contract for the `certifications` endpoints. */ export const certifications = builder.router({ list: { summary: 'Get certifications', @@ -52,9 +53,11 @@ export const certifications = builder.router({ export { movieCertificationsResponseSchema, showCertificationsResponseSchema }; +/** The movie certifications response payload. */ export type MovieCertificationsResponse = z.infer< typeof movieCertificationsResponseSchema >; +/** The show certifications response payload. */ export type ShowCertificationsResponse = z.infer< typeof showCertificationsResponseSchema >; diff --git a/projects/api/src/contracts/certifications/schema/movieCertificationsResponseSchema.ts b/projects/api/src/contracts/certifications/schema/movieCertificationsResponseSchema.ts index 6a399469..ceb377b4 100644 --- a/projects/api/src/contracts/certifications/schema/movieCertificationsResponseSchema.ts +++ b/projects/api/src/contracts/certifications/schema/movieCertificationsResponseSchema.ts @@ -14,6 +14,7 @@ const certificationResponseSchema = z.object({ description: z.string(), }); +/** Zod schema for the movie certifications response. */ export const movieCertificationsResponseSchema = z.object({ us: certificationResponseSchema.array(), }); diff --git a/projects/api/src/contracts/certifications/schema/showCertificationsResponseSchema.ts b/projects/api/src/contracts/certifications/schema/showCertificationsResponseSchema.ts index bc0fa9e2..ac7af0d8 100644 --- a/projects/api/src/contracts/certifications/schema/showCertificationsResponseSchema.ts +++ b/projects/api/src/contracts/certifications/schema/showCertificationsResponseSchema.ts @@ -16,6 +16,7 @@ const certificationResponseSchema = z.object({ description: z.string(), }); +/** Zod schema for the show certifications response. */ export const showCertificationsResponseSchema = z.object({ us: certificationResponseSchema.array(), }); diff --git a/projects/api/src/contracts/checkin/index.ts b/projects/api/src/contracts/checkin/index.ts index b1e4d49e..feb34a4a 100644 --- a/projects/api/src/contracts/checkin/index.ts +++ b/projects/api/src/contracts/checkin/index.ts @@ -6,6 +6,7 @@ import { checkin409ErrorResponse } from './schema/response/checkin409ErrorRespon import { movieCheckinResponseSchema } from './schema/response/movieCheckinResponseSchema.ts'; import { showCheckinResponseSchema } from './schema/response/showCheckinResponseSchema.ts'; +/** ts-rest contract for the `checkin` endpoints. */ export const checkin = builder.router({ start: { summary: 'Check into an item', @@ -57,16 +58,21 @@ Removes any active checkins, no need to provide a specific item.`, }); export { showCheckinRequestSchema }; +/** The show checkin request payload. */ export type ShowCheckinRequest = z.infer; export { showCheckinResponseSchema }; +/** The show checkin response payload. */ export type ShowCheckinResponse = z.infer; export { movieCheckinRequestSchema }; +/** The movie checkin request payload. */ export type MovieCheckinRequest = z.infer; export { movieCheckinResponseSchema }; +/** The movie checkin response payload. */ export type MovieCheckinResponse = z.infer; export { checkin409ErrorResponse }; +/** The checkin409 error response payload. */ export type Checkin409ErrorResponse = z.infer; diff --git a/projects/api/src/contracts/checkin/schema/request/movieCheckinRequestSchema.ts b/projects/api/src/contracts/checkin/schema/request/movieCheckinRequestSchema.ts index 0597b76e..6604eea8 100644 --- a/projects/api/src/contracts/checkin/schema/request/movieCheckinRequestSchema.ts +++ b/projects/api/src/contracts/checkin/schema/request/movieCheckinRequestSchema.ts @@ -4,6 +4,7 @@ import { import { z } from '../../../_internal/z.ts'; import { sharingRequestSchema } from './sharingRequestSchema.ts'; +/** Zod schema for the movie checkin request. */ export const movieCheckinRequestSchema = z.object({ movie: z.object({ title: z.string().nullish(), diff --git a/projects/api/src/contracts/checkin/schema/request/sharingRequestSchema.ts b/projects/api/src/contracts/checkin/schema/request/sharingRequestSchema.ts index 7e0f74bd..0d6aba43 100644 --- a/projects/api/src/contracts/checkin/schema/request/sharingRequestSchema.ts +++ b/projects/api/src/contracts/checkin/schema/request/sharingRequestSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the sharing request. */ export const sharingRequestSchema = z .object({ twitter: z.boolean().nullish(), diff --git a/projects/api/src/contracts/checkin/schema/request/showCheckinRequestSchema.ts b/projects/api/src/contracts/checkin/schema/request/showCheckinRequestSchema.ts index 4fd0b008..5ac941ab 100644 --- a/projects/api/src/contracts/checkin/schema/request/showCheckinRequestSchema.ts +++ b/projects/api/src/contracts/checkin/schema/request/showCheckinRequestSchema.ts @@ -31,6 +31,7 @@ const episodeWithShowCheckinRequestSchema = z.object({ message: z.string().nullish(), }); +/** Zod schema for the show checkin request. */ export const showCheckinRequestSchema = z.union([ episodeCheckinRequestSchema, showAbsoluteCheckinRequestSchema, diff --git a/projects/api/src/contracts/checkin/schema/response/checkin409ErrorResponse.ts b/projects/api/src/contracts/checkin/schema/response/checkin409ErrorResponse.ts index 67fc871f..4b811959 100644 --- a/projects/api/src/contracts/checkin/schema/response/checkin409ErrorResponse.ts +++ b/projects/api/src/contracts/checkin/schema/response/checkin409ErrorResponse.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Checkin409 error response. */ export const checkin409ErrorResponse = z.object({ expires_at: z.string({ description: 'Timestamp which is when the user can check in again.', diff --git a/projects/api/src/contracts/checkin/schema/response/movieCheckinResponseSchema.ts b/projects/api/src/contracts/checkin/schema/response/movieCheckinResponseSchema.ts index 69ce019f..4501f009 100644 --- a/projects/api/src/contracts/checkin/schema/response/movieCheckinResponseSchema.ts +++ b/projects/api/src/contracts/checkin/schema/response/movieCheckinResponseSchema.ts @@ -1,6 +1,7 @@ import { movieIdsResponseSchema } from '../../../_internal/response/movieIdsResponseSchema.ts'; import { int64, z } from '../../../_internal/z.ts'; +/** Zod schema for the movie checkin response. */ export const movieCheckinResponseSchema = z.object({ id: int64(z.number().int()), watched_at: z.string().datetime(), diff --git a/projects/api/src/contracts/checkin/schema/response/showCheckinResponseSchema.ts b/projects/api/src/contracts/checkin/schema/response/showCheckinResponseSchema.ts index c98a54b5..5bd6b0be 100644 --- a/projects/api/src/contracts/checkin/schema/response/showCheckinResponseSchema.ts +++ b/projects/api/src/contracts/checkin/schema/response/showCheckinResponseSchema.ts @@ -2,6 +2,7 @@ import { episodeIdsResponseSchema } from '../../../_internal/response/episodeIds import { showIdsResponseSchema } from '../../../_internal/response/showIdsResponseSchema.ts'; import { int64, z } from '../../../_internal/z.ts'; +/** Zod schema for the show checkin response. */ export const showCheckinResponseSchema = z.object({ id: int64(z.number().int()), watched_at: z.string().datetime(), diff --git a/projects/api/src/contracts/comments/index.ts b/projects/api/src/contracts/comments/index.ts index 7a2e77a3..b78f511b 100644 --- a/projects/api/src/contracts/comments/index.ts +++ b/projects/api/src/contracts/comments/index.ts @@ -327,6 +327,7 @@ The \`sharing\` object is optional and will apply the user's settings if not sen }, }); +/** ts-rest contract for the `comments` endpoints. */ export const comments = builder.router({ ...ENTITY_LEVEL, ...GLOBAL_LEVEL, @@ -343,12 +344,18 @@ export { reactionTypeSchema, }; +/** The comment reply parameters. */ export type CommentReplyParams = z.infer; +/** The comment post parameters. */ export type CommentPostParams = z.infer; +/** The comment report request payload. */ export type CommentReportRequest = z.infer; +/** The reactions summary response payload. */ export type ReactionsSummaryResponse = z.infer< typeof reactionsSummaryResponseSchema >; +/** The reactions response payload. */ export type ReactionsResponse = z.infer; +/** The reaction type type. */ export type ReactionType = z.infer; diff --git a/projects/api/src/contracts/comments/schema/requests/commentPostParamsSchema.ts b/projects/api/src/contracts/comments/schema/requests/commentPostParamsSchema.ts index 111064cf..27863ddd 100644 --- a/projects/api/src/contracts/comments/schema/requests/commentPostParamsSchema.ts +++ b/projects/api/src/contracts/comments/schema/requests/commentPostParamsSchema.ts @@ -7,6 +7,7 @@ const idOnlySchema = z.object({ }), }).nullish(); +/** Zod schema for the comment post parameters. */ export const commentPostParamsSchema = commentReplyParamsSchema.and( z.union([ z.object({ movie: idOnlySchema }), diff --git a/projects/api/src/contracts/comments/schema/requests/commentReplyParamsSchema.ts b/projects/api/src/contracts/comments/schema/requests/commentReplyParamsSchema.ts index 8de4255e..c4cf120e 100644 --- a/projects/api/src/contracts/comments/schema/requests/commentReplyParamsSchema.ts +++ b/projects/api/src/contracts/comments/schema/requests/commentReplyParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the comment reply parameters. */ export const commentReplyParamsSchema = z.object({ comment: z.string(), spoiler: z.boolean(), diff --git a/projects/api/src/contracts/comments/schema/requests/commentReportRequestSchema.ts b/projects/api/src/contracts/comments/schema/requests/commentReportRequestSchema.ts index a58c7d18..1db745a7 100644 --- a/projects/api/src/contracts/comments/schema/requests/commentReportRequestSchema.ts +++ b/projects/api/src/contracts/comments/schema/requests/commentReportRequestSchema.ts @@ -1,5 +1,6 @@ import { reportRequestSchemaFactory } from '../../../_internal/request/reportRequestSchemaFactory.ts'; +/** Zod schema for the comment report request. */ export const commentReportRequestSchema = reportRequestSchemaFactory( [ 'spoilers', diff --git a/projects/api/src/contracts/countries/index.ts b/projects/api/src/contracts/countries/index.ts index 15540c9a..e9e1b90f 100644 --- a/projects/api/src/contracts/countries/index.ts +++ b/projects/api/src/contracts/countries/index.ts @@ -5,11 +5,13 @@ const countryTypeParamsSchema = z.object({ type: z.string().describe('Media type to return countries for.'), }); +/** Zod schema for the country response. */ export const countryResponseSchema = z.object({ name: z.string(), code: z.string(), }); +/** ts-rest contract for the `countries` endpoints. */ export const countries = builder.router({ list: { summary: 'Get countries', @@ -25,4 +27,5 @@ export const countries = builder.router({ pathPrefix: '/countries', }); +/** The country response payload. */ export type CountryResponse = z.infer; diff --git a/projects/api/src/contracts/enums/crewPositionSchema.ts b/projects/api/src/contracts/enums/crewPositionSchema.ts index 01424e3a..179b14da 100644 --- a/projects/api/src/contracts/enums/crewPositionSchema.ts +++ b/projects/api/src/contracts/enums/crewPositionSchema.ts @@ -1,3 +1,4 @@ import { crewPositionResponseSchema } from '../_internal/response/crewPositionResponseSchema.ts'; +/** Zod schema for crew position. */ export const crewPositionSchema = crewPositionResponseSchema; diff --git a/projects/api/src/contracts/enums/genreOptionSchema.ts b/projects/api/src/contracts/enums/genreOptionSchema.ts index d00392f2..0586dd4d 100644 --- a/projects/api/src/contracts/enums/genreOptionSchema.ts +++ b/projects/api/src/contracts/enums/genreOptionSchema.ts @@ -1,3 +1,4 @@ import { genreEnumSchema } from '../_internal/response/genreEnumSchema.ts'; +/** Zod schema for genre option. */ export const genreOptionSchema = genreEnumSchema; diff --git a/projects/api/src/contracts/enums/index.ts b/projects/api/src/contracts/enums/index.ts index 8d6ec213..8503815d 100644 --- a/projects/api/src/contracts/enums/index.ts +++ b/projects/api/src/contracts/enums/index.ts @@ -7,19 +7,25 @@ import { upNextSortOptionSchema } from './upNextSortOptionSchema.ts'; import { videoTypeSchema } from './videoTypeSchema.ts'; export { crewPositionSchema }; +/** The crew position type. */ export type CrewPosition = z.infer; export { genreOptionSchema }; +/** The genre option type. */ export type GenreOption = z.infer; export { mediaStatusSchema }; +/** The media status type. */ export type MediaStatus = z.infer; export { reactionsSchema }; +/** The reactions type. */ export type Reactions = z.infer; export { upNextSortOptionSchema }; +/** The up next sort option type. */ export type UpNextSortOption = z.infer; export { videoTypeSchema }; +/** The video type type. */ export type VideoType = z.infer; diff --git a/projects/api/src/contracts/enums/mediaStatusSchema.ts b/projects/api/src/contracts/enums/mediaStatusSchema.ts index fd0b64da..7cad0118 100644 --- a/projects/api/src/contracts/enums/mediaStatusSchema.ts +++ b/projects/api/src/contracts/enums/mediaStatusSchema.ts @@ -1,3 +1,4 @@ import { statusResponseSchema } from '../_internal/response/statusResponseSchema.ts'; +/** Zod schema for media status. */ export const mediaStatusSchema = statusResponseSchema; diff --git a/projects/api/src/contracts/enums/reactionsSchema.ts b/projects/api/src/contracts/enums/reactionsSchema.ts index bc95524f..2d8eb23c 100644 --- a/projects/api/src/contracts/enums/reactionsSchema.ts +++ b/projects/api/src/contracts/enums/reactionsSchema.ts @@ -1,3 +1,4 @@ import { reactionEnumSchema } from '../_internal/response/reactionsResponseSchema.ts'; +/** Zod schema for reactions. */ export const reactionsSchema = reactionEnumSchema; diff --git a/projects/api/src/contracts/enums/upNextSortOptionSchema.ts b/projects/api/src/contracts/enums/upNextSortOptionSchema.ts index ed750e15..abbafaff 100644 --- a/projects/api/src/contracts/enums/upNextSortOptionSchema.ts +++ b/projects/api/src/contracts/enums/upNextSortOptionSchema.ts @@ -1,3 +1,4 @@ import { upNextSortBySchema } from '../_internal/response/upNextSortBySchema.ts'; +/** Zod schema for up next sort option. */ export const upNextSortOptionSchema = upNextSortBySchema; diff --git a/projects/api/src/contracts/enums/videoTypeSchema.ts b/projects/api/src/contracts/enums/videoTypeSchema.ts index 20b8c8ed..6db491d7 100644 --- a/projects/api/src/contracts/enums/videoTypeSchema.ts +++ b/projects/api/src/contracts/enums/videoTypeSchema.ts @@ -1,3 +1,4 @@ import { videoTypeEnumSchema } from '../_internal/response/videoTypeEnumSchema.ts'; +/** Zod schema for video type. */ export const videoTypeSchema = videoTypeEnumSchema; diff --git a/projects/api/src/contracts/episodes/index.ts b/projects/api/src/contracts/episodes/index.ts index a5fb7a9c..5a5deeee 100644 --- a/projects/api/src/contracts/episodes/index.ts +++ b/projects/api/src/contracts/episodes/index.ts @@ -7,6 +7,7 @@ import { watchNowParamsSchema } from '../_internal/request/watchNowParamsSchema. import { watchNowResponseSchema } from '../_internal/response/watchNowResponseSchema.ts'; import { z } from '../_internal/z.ts'; +/** ts-rest contract for the `episodes` endpoints. */ export const episodes = builder.router({ watchnow: { summary: 'Get episode watch now sources', diff --git a/projects/api/src/contracts/genres/index.ts b/projects/api/src/contracts/genres/index.ts index 3bab4fbb..bb8a3fe7 100644 --- a/projects/api/src/contracts/genres/index.ts +++ b/projects/api/src/contracts/genres/index.ts @@ -6,6 +6,7 @@ const genreTypeParamsSchema = z.object({ type: z.string().describe('Media type to return genres for.'), }); +/** Zod schema for the genre response. */ export const genreResponseSchema = z.object({ name: z.string(), slug: z.string(), @@ -15,6 +16,7 @@ export const genreResponseSchema = z.object({ })).optional(), }); +/** ts-rest contract for the `genres` endpoints. */ export const genres = builder.router({ list: { summary: 'Get genres', @@ -35,4 +37,5 @@ Send \`?extended=subgenres\` to get a list of subgenres for each genre. You can pathPrefix: '/genres', }); +/** The genre response payload. */ export type GenreResponse = z.infer; diff --git a/projects/api/src/contracts/languages/index.ts b/projects/api/src/contracts/languages/index.ts index 14f0a7ae..67007897 100644 --- a/projects/api/src/contracts/languages/index.ts +++ b/projects/api/src/contracts/languages/index.ts @@ -5,11 +5,13 @@ const languageTypeParamsSchema = z.object({ type: z.string().describe('Media type to return languages for.'), }); +/** Zod schema for the language response. */ export const languageResponseSchema = z.object({ name: z.string(), code: z.string(), }); +/** ts-rest contract for the `languages` endpoints. */ export const languages = builder.router({ list: { summary: 'Get languages', @@ -25,4 +27,5 @@ export const languages = builder.router({ pathPrefix: '/languages', }); +/** The language response payload. */ export type LanguageResponse = z.infer; diff --git a/projects/api/src/contracts/lists/index.ts b/projects/api/src/contracts/lists/index.ts index 7d9c39b6..c706955b 100644 --- a/projects/api/src/contracts/lists/index.ts +++ b/projects/api/src/contracts/lists/index.ts @@ -279,6 +279,7 @@ Returns popular lists ordered by long-term activity. Use \`type\`, pagination, a }, }); +/** ts-rest contract for the `lists` endpoints. */ export const lists = builder.router({ ...GLOBAL_LEVEL, ...ENTITY_LEVEL, @@ -288,7 +289,9 @@ export const lists = builder.router({ export { prominentListResponseSchema }; +/** The prominent list response payload. */ export type ProminentListResponse = z.infer; export { listReportRequestSchema }; +/** The list report request payload. */ export type ListReportRequest = z.infer; diff --git a/projects/api/src/contracts/lists/schema/listReportRequestSchema.ts b/projects/api/src/contracts/lists/schema/listReportRequestSchema.ts index a31dc78b..a186e387 100644 --- a/projects/api/src/contracts/lists/schema/listReportRequestSchema.ts +++ b/projects/api/src/contracts/lists/schema/listReportRequestSchema.ts @@ -1,5 +1,6 @@ import { reportRequestSchemaFactory } from '../../_internal/request/reportRequestSchemaFactory.ts'; +/** Zod schema for the list report request. */ export const listReportRequestSchema = reportRequestSchemaFactory( [ 'duplicate', diff --git a/projects/api/src/contracts/lists/schema/prominentListResponseSchema.ts b/projects/api/src/contracts/lists/schema/prominentListResponseSchema.ts index cf1b1a13..0a9d0060 100644 --- a/projects/api/src/contracts/lists/schema/prominentListResponseSchema.ts +++ b/projects/api/src/contracts/lists/schema/prominentListResponseSchema.ts @@ -1,6 +1,7 @@ import { listResponseSchema } from '../../_internal/response/listResponseSchema.ts'; import { z } from '../../_internal/z.ts'; +/** Zod schema for the prominent list response. */ export const prominentListResponseSchema = z.object({ like_count: z.number().int(), comment_count: z.number().int(), diff --git a/projects/api/src/contracts/media/index.ts b/projects/api/src/contracts/media/index.ts index ffcb13a7..14ea180e 100644 --- a/projects/api/src/contracts/media/index.ts +++ b/projects/api/src/contracts/media/index.ts @@ -8,6 +8,7 @@ import { mediaAnticipatedResponseSchema } from './schema/response/mediaAnticipat import { mediaPopularResponseSchema } from './schema/response/mediaPopularResponseSchema.ts'; import { mediaTrendingResponseSchema } from './schema/response/mediaTrendingResponseSchema.ts'; +/** ts-rest contract for the `media` endpoints. */ export const media = builder.router({ trending: { summary: 'Get trending media', @@ -55,8 +56,11 @@ Returns popular movies and shows. Results can be filtered by media fields or ign pathPrefix: '/media', }); +/** The media popular response payload. */ export type MediaPopularResponse = z.infer; +/** The media trending response payload. */ export type MediaTrendingResponse = z.infer; +/** The media anticipated response payload. */ export type MediaAnticipatedResponse = z.infer< typeof mediaAnticipatedResponseSchema >; diff --git a/projects/api/src/contracts/media/schema/response/mediaAnticipatedResponseSchema.ts b/projects/api/src/contracts/media/schema/response/mediaAnticipatedResponseSchema.ts index 2481cf53..bfdee061 100644 --- a/projects/api/src/contracts/media/schema/response/mediaAnticipatedResponseSchema.ts +++ b/projects/api/src/contracts/media/schema/response/mediaAnticipatedResponseSchema.ts @@ -2,6 +2,7 @@ import { z } from '../../../_internal/z.ts'; import { movieAnticipatedResponseSchema } from '../../../movies/index.ts'; import { showAnticipatedResponseSchema } from '../../../shows/index.ts'; +/** Zod schema for the media anticipated response. */ export const mediaAnticipatedResponseSchema = z.union([ movieAnticipatedResponseSchema, showAnticipatedResponseSchema, diff --git a/projects/api/src/contracts/media/schema/response/mediaPopularResponseSchema.ts b/projects/api/src/contracts/media/schema/response/mediaPopularResponseSchema.ts index f08d7d2e..a526b033 100644 --- a/projects/api/src/contracts/media/schema/response/mediaPopularResponseSchema.ts +++ b/projects/api/src/contracts/media/schema/response/mediaPopularResponseSchema.ts @@ -2,6 +2,7 @@ import { z } from '../../../_internal/z.ts'; import { movieResponseSchema } from '../../../movies/index.ts'; import { showResponseSchema } from '../../../shows/index.ts'; +/** Zod schema for the media popular response. */ export const mediaPopularResponseSchema = z.union([ movieResponseSchema, showResponseSchema, diff --git a/projects/api/src/contracts/media/schema/response/mediaTrendingResponseSchema.ts b/projects/api/src/contracts/media/schema/response/mediaTrendingResponseSchema.ts index dae6311c..9035167d 100644 --- a/projects/api/src/contracts/media/schema/response/mediaTrendingResponseSchema.ts +++ b/projects/api/src/contracts/media/schema/response/mediaTrendingResponseSchema.ts @@ -2,6 +2,7 @@ import { z } from '../../../_internal/z.ts'; import { movieTrendingResponseSchema } from '../../../movies/index.ts'; import { showTrendingResponseSchema } from '../../../shows/index.ts'; +/** Zod schema for the media trending response. */ export const mediaTrendingResponseSchema = z.union([ movieTrendingResponseSchema, showTrendingResponseSchema, diff --git a/projects/api/src/contracts/models/index.ts b/projects/api/src/contracts/models/index.ts index 10e46667..74c544e2 100644 --- a/projects/api/src/contracts/models/index.ts +++ b/projects/api/src/contracts/models/index.ts @@ -29,91 +29,116 @@ import { watchNowResponseSchema } from '../_internal/response/watchNowResponseSc import type { z } from '../_internal/z.ts'; export { commentResponseSchema }; +/** The comment response payload. */ export type CommentResponse = z.infer; export { episodeResponseSchema }; +/** The episode response payload. */ export type EpisodeResponse = z.infer; export { episodeStatsResponseSchema }; +/** The episode stats response payload. */ export type EpisodeStatsResponse = z.infer; export { episodeTranslationResponseSchema }; +/** The episode translation response payload. */ export type EpisodeTranslationResponse = z.infer< typeof episodeTranslationResponseSchema >; +/** The likes response payload. */ export type LikesResponse = z.infer; export { listAddResponseSchema }; +/** The list add response payload. */ export type ListAddResponse = z.infer; export { listedMovieResponseSchema }; +/** The listed movie response payload. */ export type ListedMovieResponse = z.infer< typeof listedMovieResponseSchema >; export { listedShowResponseSchema }; +/** The listed show response payload. */ export type ListedShowResponse = z.infer< typeof listedShowResponseSchema >; export { listedMediaResponseSchema }; +/** The listed media response payload. */ export type ListedMediaResponse = z.infer< typeof listedMediaResponseSchema >; export { listedAllResponseSchema }; +/** The listed all response payload. */ export type ListedAllResponse = z.infer< typeof listedAllResponseSchema >; export { listRemoveResponseSchema }; +/** The list remove response payload. */ export type ListRemoveResponse = z.infer< typeof listRemoveResponseSchema >; export { listResponseSchema }; +/** The list response payload. */ export type ListResponse = z.infer; export { peopleResponseSchema }; +/** The people response payload. */ export type PeopleResponse = z.infer; export { crewResponseSchema }; +/** The crew response payload. */ export type CrewResponse = z.infer; export { castResponseSchema }; +/** The cast response payload. */ export type CastResponse = z.infer; export { ratingsResponseSchema }; +/** The ratings response payload. */ export type RatingsResponse = z.infer; export { sentimentsResponseSchema }; +/** The sentiments response payload. */ export type SentimentsResponse = z.infer; export { statusResponseSchema }; +/** The status response payload. */ export type StatusResponse = z.infer; export { studioResponseSchema }; +/** The studio response payload. */ export type StudioResponse = z.infer; export { translationResponseSchema }; +/** The translation response payload. */ export type TranslationResponse = z.infer< typeof translationResponseSchema >; export { profileResponseSchema }; +/** The profile response payload. */ export type ProfileResponse = z.infer; export { watchNowResponseSchema }; +/** The watch now response payload. */ export type WatchNowResponse = z.infer; export { justWatchLinkResponseSchema }; +/** The just watch link response payload. */ export type JustWatchLinkResponse = z.infer; export { videoResponseSchema }; +/** The video response payload. */ export type VideoResponse = z.infer; export { socialIdsResponseSchema }; +/** The social ids response payload. */ export type SocialIdsResponse = z.infer< typeof socialIdsResponseSchema >; diff --git a/projects/api/src/contracts/movies/index.ts b/projects/api/src/contracts/movies/index.ts index c53028a8..fbb47004 100644 --- a/projects/api/src/contracts/movies/index.ts +++ b/projects/api/src/contracts/movies/index.ts @@ -509,6 +509,7 @@ Returns movies recently available on streaming services for the requested \`peri }, }); +/** ts-rest contract for the `movies` endpoints. */ export const movies = builder.router({ ...ENTITY_LEVEL, ...GLOBAL_LEVEL, @@ -516,47 +517,59 @@ export const movies = builder.router({ pathPrefix: '/movies', }); +/** The movie id parameters. */ export type MovieIdParams = z.infer; export { movieResponseSchema }; +/** The movie response payload. */ export type MovieResponse = z.infer; +/** The genre type. */ export type Genre = z.infer; +/** The watch now service response payload. */ export type WatchNowServiceResponse = z.infer< typeof watchNowServiceResponseSchema >; +/** The watch now rank response payload. */ export type watchNowRankResponse = z.infer< typeof watchNowRankResponseSchema >; +/** The movie stats response payload. */ export type MovieStatsResponse = z.infer; export { movieTrendingResponseSchema }; +/** The movie trending response payload. */ export type MovieTrendingResponse = z.infer< typeof movieTrendingResponseSchema >; export { movieWatchedResponseSchema }; +/** The movie watched response payload. */ export type MovieWatchedResponse = z.infer< typeof movieWatchedResponseSchema >; export { movieAnticipatedResponseSchema }; +/** The movie anticipated response payload. */ export type MovieAnticipatedResponse = z.infer< typeof movieAnticipatedResponseSchema >; export { movieHotResponseSchema }; +/** The movie hot response payload. */ export type MovieHotResponse = z.infer< typeof movieHotResponseSchema >; +/** The movie certification response payload. */ export type MovieCertificationResponse = z.infer< typeof movieCertificationResponseSchema >; export { movieStreamingResponseSchema }; +/** The movie streaming response payload. */ export type MovieStreamingResponse = z.infer< typeof movieStreamingResponseSchema >; diff --git a/projects/api/src/contracts/movies/schema/response/movieAnticipatedResponseSchema.ts b/projects/api/src/contracts/movies/schema/response/movieAnticipatedResponseSchema.ts index 98f27859..bcc968da 100644 --- a/projects/api/src/contracts/movies/schema/response/movieAnticipatedResponseSchema.ts +++ b/projects/api/src/contracts/movies/schema/response/movieAnticipatedResponseSchema.ts @@ -1,6 +1,7 @@ import { movieResponseSchema } from '../../../_internal/response/movieResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the movie anticipated response. */ export const movieAnticipatedResponseSchema = z.object({ list_count: z.number().int(), movie: movieResponseSchema, diff --git a/projects/api/src/contracts/movies/schema/response/movieHotResponseSchema.ts b/projects/api/src/contracts/movies/schema/response/movieHotResponseSchema.ts index d06059bb..0c2dc985 100644 --- a/projects/api/src/contracts/movies/schema/response/movieHotResponseSchema.ts +++ b/projects/api/src/contracts/movies/schema/response/movieHotResponseSchema.ts @@ -1,3 +1,4 @@ import { movieAnticipatedResponseSchema } from './movieAnticipatedResponseSchema.ts'; +/** Zod schema for the movie hot response. */ export const movieHotResponseSchema = movieAnticipatedResponseSchema; diff --git a/projects/api/src/contracts/movies/schema/response/movieStreamingResponseSchema.ts b/projects/api/src/contracts/movies/schema/response/movieStreamingResponseSchema.ts index 17f7e8fd..d1904dcb 100644 --- a/projects/api/src/contracts/movies/schema/response/movieStreamingResponseSchema.ts +++ b/projects/api/src/contracts/movies/schema/response/movieStreamingResponseSchema.ts @@ -1,6 +1,7 @@ import { movieResponseSchema } from '../../../_internal/response/movieResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the movie streaming response. */ export const movieStreamingResponseSchema = z.object({ rank: z.number().int(), delta: z.number().int().nullish(), diff --git a/projects/api/src/contracts/movies/schema/response/movieTrendingResponseSchema.ts b/projects/api/src/contracts/movies/schema/response/movieTrendingResponseSchema.ts index 56cedabb..20f45bc6 100644 --- a/projects/api/src/contracts/movies/schema/response/movieTrendingResponseSchema.ts +++ b/projects/api/src/contracts/movies/schema/response/movieTrendingResponseSchema.ts @@ -1,6 +1,7 @@ import { movieResponseSchema } from '../../../_internal/response/movieResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the movie trending response. */ export const movieTrendingResponseSchema = z.object({ watchers: z.number().int(), movie: movieResponseSchema, diff --git a/projects/api/src/contracts/movies/schema/response/movieWatchedResponseSchema.ts b/projects/api/src/contracts/movies/schema/response/movieWatchedResponseSchema.ts index 628bb660..15c1571f 100644 --- a/projects/api/src/contracts/movies/schema/response/movieWatchedResponseSchema.ts +++ b/projects/api/src/contracts/movies/schema/response/movieWatchedResponseSchema.ts @@ -1,6 +1,7 @@ import { movieResponseSchema } from '../../../_internal/response/movieResponseSchema.ts'; import { watchedStatsResponseSchema } from '../../../_internal/response/watchedStatsResponseSchema.ts'; +/** Zod schema for the movie watched response. */ export const movieWatchedResponseSchema = watchedStatsResponseSchema.extend({ movie: movieResponseSchema, }); diff --git a/projects/api/src/contracts/networks/index.ts b/projects/api/src/contracts/networks/index.ts index f84ceedc..e5a401cf 100644 --- a/projects/api/src/contracts/networks/index.ts +++ b/projects/api/src/contracts/networks/index.ts @@ -1,11 +1,13 @@ import { builder } from '../_internal/builder.ts'; import { z } from '../_internal/z.ts'; +/** Zod schema for the network response. */ export const networkResponseSchema = z.object({ name: z.string(), country: z.string().nullable().optional(), }); +/** ts-rest contract for the `networks` endpoints. */ export const networks = builder.router({ list: { summary: 'Get networks', @@ -20,4 +22,5 @@ export const networks = builder.router({ pathPrefix: '/networks', }); +/** The network response payload. */ export type NetworkResponse = z.infer; diff --git a/projects/api/src/contracts/notes/index.ts b/projects/api/src/contracts/notes/index.ts index b4a626e0..3025596a 100644 --- a/projects/api/src/contracts/notes/index.ts +++ b/projects/api/src/contracts/notes/index.ts @@ -13,6 +13,7 @@ const noteRequestSchema = z.object({ spoiler: z.boolean().optional(), }).passthrough(); +/** Zod schema for the note response. */ export const noteResponseSchema = z.object({ id: z.number().int(), notes: z.string().nullable().optional(), @@ -70,6 +71,7 @@ const ENTITY_LEVEL = builder.router({ pathPrefix: '/:id', }); +/** ts-rest contract for the `notes` endpoints. */ export const notes = builder.router({ create: { summary: 'Add notes', @@ -88,5 +90,7 @@ Add a new note to a movie, show, season, episode, person, or list.`, metadata: authMetadata('required'), }); +/** The note request payload. */ export type NoteRequest = z.infer; +/** The note response payload. */ export type NoteResponse = z.infer; diff --git a/projects/api/src/contracts/oauth/index.ts b/projects/api/src/contracts/oauth/index.ts index 8209ee50..f83c3891 100644 --- a/projects/api/src/contracts/oauth/index.ts +++ b/projects/api/src/contracts/oauth/index.ts @@ -82,23 +82,30 @@ This method will send various HTTP status codes that you should handle according }); export { codeRequestSchema }; +/** The o auth device code request payload. */ export type OAuthDeviceCodeRequest = z.infer; export { codeResponseSchema }; +/** The o auth device code response payload. */ export type OAuthDeviceCodeResponse = z.infer; export { deviceTokenRequestSchema }; +/** The o auth device token request payload. */ export type OAuthDeviceTokenRequest = z.infer; export { tokenRequestSchema }; +/** The o auth token request payload. */ export type OAuthTokenRequest = z.infer; export { tokenRefreshSchema }; +/** The o auth token refresh type. */ export type OAuthTokenRefresh = z.infer; export { tokenResponseSchema }; +/** The o auth token response payload. */ export type OAuthTokenResponse = z.infer; +/** ts-rest contract for the `oauth` endpoints. */ export const oauth = builder .router({ authorize: { diff --git a/projects/api/src/contracts/oauth/schema/request/codeRequestSchema.ts b/projects/api/src/contracts/oauth/schema/request/codeRequestSchema.ts index cf7c2f45..f507ad48 100644 --- a/projects/api/src/contracts/oauth/schema/request/codeRequestSchema.ts +++ b/projects/api/src/contracts/oauth/schema/request/codeRequestSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the code request. */ export const codeRequestSchema = z.object({ client_id: z.string().openapi({ description: `The client ID of the application. diff --git a/projects/api/src/contracts/oauth/schema/request/deviceTokenRequestSchema.ts b/projects/api/src/contracts/oauth/schema/request/deviceTokenRequestSchema.ts index cde6e299..4bf8f27a 100644 --- a/projects/api/src/contracts/oauth/schema/request/deviceTokenRequestSchema.ts +++ b/projects/api/src/contracts/oauth/schema/request/deviceTokenRequestSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the device token request. */ export const deviceTokenRequestSchema = z.object({ code: z.string({ description: diff --git a/projects/api/src/contracts/oauth/schema/request/tokenBaseSchema.ts b/projects/api/src/contracts/oauth/schema/request/tokenBaseSchema.ts index d3618b7b..b92c03bd 100644 --- a/projects/api/src/contracts/oauth/schema/request/tokenBaseSchema.ts +++ b/projects/api/src/contracts/oauth/schema/request/tokenBaseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for token base. */ export const tokenBaseSchema = z.object({ client_id: z.string({ description: `The client ID of the application. diff --git a/projects/api/src/contracts/oauth/schema/request/tokenRefreshSchema.ts b/projects/api/src/contracts/oauth/schema/request/tokenRefreshSchema.ts index 9b297c63..1f5d6e3e 100644 --- a/projects/api/src/contracts/oauth/schema/request/tokenRefreshSchema.ts +++ b/projects/api/src/contracts/oauth/schema/request/tokenRefreshSchema.ts @@ -1,6 +1,7 @@ import { z } from '../../../_internal/z.ts'; import { tokenBaseSchema } from './tokenBaseSchema.ts'; +/** Zod schema for token refresh. */ export const tokenRefreshSchema = tokenBaseSchema.extend({ refresh_token: z.string({ description: diff --git a/projects/api/src/contracts/oauth/schema/request/tokenRequestSchema.ts b/projects/api/src/contracts/oauth/schema/request/tokenRequestSchema.ts index 7fd35428..defff208 100644 --- a/projects/api/src/contracts/oauth/schema/request/tokenRequestSchema.ts +++ b/projects/api/src/contracts/oauth/schema/request/tokenRequestSchema.ts @@ -1,6 +1,7 @@ import { z } from '../../../_internal/z.ts'; import { tokenBaseSchema } from './tokenBaseSchema.ts'; +/** Zod schema for the token request. */ export const tokenRequestSchema = tokenBaseSchema.extend({ code: z.string({ description: diff --git a/projects/api/src/contracts/oauth/schema/response/codeResponseSchema.ts b/projects/api/src/contracts/oauth/schema/response/codeResponseSchema.ts index 0b0abeb8..a28eb5d7 100644 --- a/projects/api/src/contracts/oauth/schema/response/codeResponseSchema.ts +++ b/projects/api/src/contracts/oauth/schema/response/codeResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the code response. */ export const codeResponseSchema = z.object({ device_code: z.string(), user_code: z.string(), diff --git a/projects/api/src/contracts/oauth/schema/response/tokenResponseSchema.ts b/projects/api/src/contracts/oauth/schema/response/tokenResponseSchema.ts index 7e6d82ea..de0c87a4 100644 --- a/projects/api/src/contracts/oauth/schema/response/tokenResponseSchema.ts +++ b/projects/api/src/contracts/oauth/schema/response/tokenResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the token response. */ export const tokenResponseSchema = z.object({ access_token: z.string(), token_type: z.string(), diff --git a/projects/api/src/contracts/people/index.ts b/projects/api/src/contracts/people/index.ts index 169cbfd0..70302e1a 100644 --- a/projects/api/src/contracts/people/index.ts +++ b/projects/api/src/contracts/people/index.ts @@ -157,6 +157,7 @@ const GLOBAL_LEVEL = builder.router({ }, }); +/** ts-rest contract for the `people` endpoints. */ export const people = builder.router({ ...GLOBAL_LEVEL, ...ENTITY_LEVEL, @@ -165,6 +166,7 @@ export const people = builder.router({ }); export { personResponseSchema }; +/** The person response payload. */ export type PersonResponse = z.infer< typeof personResponseSchema >; @@ -174,10 +176,13 @@ export { peopleMovieCreditsResponseSchema }; export { peopleShowCreditsResponseSchema }; export { peopleReportRequestSchema }; +/** The people report request payload. */ export type PeopleReportRequest = z.infer; +/** The people movie credits response payload. */ export type PeopleMovieCreditsResponse = z.infer< typeof peopleMovieCreditsResponseSchema >; +/** The people show credits response payload. */ export type PeopleShowCreditsResponse = z.infer< typeof peopleShowCreditsResponseSchema >; diff --git a/projects/api/src/contracts/people/schema/request/peopleReportRequestSchema.ts b/projects/api/src/contracts/people/schema/request/peopleReportRequestSchema.ts index 59e11c8c..267f72ce 100644 --- a/projects/api/src/contracts/people/schema/request/peopleReportRequestSchema.ts +++ b/projects/api/src/contracts/people/schema/request/peopleReportRequestSchema.ts @@ -1,5 +1,6 @@ import { reportRequestSchemaFactory } from '../../../_internal/request/reportRequestSchemaFactory.ts'; +/** Zod schema for the people report request. */ export const peopleReportRequestSchema = reportRequestSchemaFactory( [ 'duplicate', diff --git a/projects/api/src/contracts/people/schema/response/peopleMovieCreditsResponseSchema.ts b/projects/api/src/contracts/people/schema/response/peopleMovieCreditsResponseSchema.ts index 6ac00a8a..be556277 100644 --- a/projects/api/src/contracts/people/schema/response/peopleMovieCreditsResponseSchema.ts +++ b/projects/api/src/contracts/people/schema/response/peopleMovieCreditsResponseSchema.ts @@ -4,6 +4,7 @@ import { jobsResponseSchema } from '../../../_internal/response/jobsResponseSche import { movieResponseSchema } from '../../../_internal/response/movieResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the people movie credits response. */ export const peopleMovieCreditsResponseSchema = z.object({ cast: z.array( z.object({ diff --git a/projects/api/src/contracts/people/schema/response/peopleShowCreditsResponseSchema.ts b/projects/api/src/contracts/people/schema/response/peopleShowCreditsResponseSchema.ts index f07d3249..b6d59901 100644 --- a/projects/api/src/contracts/people/schema/response/peopleShowCreditsResponseSchema.ts +++ b/projects/api/src/contracts/people/schema/response/peopleShowCreditsResponseSchema.ts @@ -4,6 +4,7 @@ import { jobsResponseSchema } from '../../../_internal/response/jobsResponseSche import { showResponseSchema } from '../../../_internal/response/showResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the people show credits response. */ export const peopleShowCreditsResponseSchema = z.object({ cast: z.array( z.object({ diff --git a/projects/api/src/contracts/people/schema/response/personResponseSchema.ts b/projects/api/src/contracts/people/schema/response/personResponseSchema.ts index 1d788685..40380760 100644 --- a/projects/api/src/contracts/people/schema/response/personResponseSchema.ts +++ b/projects/api/src/contracts/people/schema/response/personResponseSchema.ts @@ -2,6 +2,7 @@ import { crewPositionResponseSchema } from '../../../_internal/response/crewPosi import { socialIdsResponseSchema } from '../../../_internal/response/socialIdsResponseSchema.ts'; import { asString, z } from '../../../_internal/z.ts'; +/** Zod schema for the person response. */ export const personResponseSchema = z.object({ name: z.string(), ids: z.object({ diff --git a/projects/api/src/contracts/recommendations/index.ts b/projects/api/src/contracts/recommendations/index.ts index 3646add6..d1d8f873 100644 --- a/projects/api/src/contracts/recommendations/index.ts +++ b/projects/api/src/contracts/recommendations/index.ts @@ -65,6 +65,7 @@ Hide a show from getting recommended anymore.`, }, }, { pathPrefix: '/shows' }); +/** ts-rest contract for the `recommendations` endpoints. */ export const recommendations = builder.router({ movies, shows, @@ -74,12 +75,15 @@ export const recommendations = builder.router({ }); export { hideParamsSchema }; +/** The hide recommendation parameters. */ export type HideRecommendationParams = z.infer; export { recommendedMovieResponse }; +/** The recommended movie response payload. */ export type RecommendedMovieResponse = z.infer; export { recommendedShowResponse }; +/** The recommended show response payload. */ export type RecommendedShowResponse = z.infer; export { recommendationsQuerySchema }; diff --git a/projects/api/src/contracts/recommendations/schema/request/hideParamsSchema.ts b/projects/api/src/contracts/recommendations/schema/request/hideParamsSchema.ts index 6f209317..61a34dba 100644 --- a/projects/api/src/contracts/recommendations/schema/request/hideParamsSchema.ts +++ b/projects/api/src/contracts/recommendations/schema/request/hideParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the hide parameters. */ export const hideParamsSchema = z.object({ id: z.number().int().or(z.string()).describe( 'Trakt ID, Trakt slug, or IMDB ID Example: 922.', diff --git a/projects/api/src/contracts/recommendations/schema/request/recommendationsQuerySchema.ts b/projects/api/src/contracts/recommendations/schema/request/recommendationsQuerySchema.ts index be61f8a4..970dcebf 100644 --- a/projects/api/src/contracts/recommendations/schema/request/recommendationsQuerySchema.ts +++ b/projects/api/src/contracts/recommendations/schema/request/recommendationsQuerySchema.ts @@ -1,6 +1,7 @@ import { ignoreQuerySchema } from '../../../_internal/request/ignoreQuerySchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the recommendations query parameters. */ export const recommendationsQuerySchema = z.object({ limit: z.number().int().openapi({ description: 'Limit the number of results.', diff --git a/projects/api/src/contracts/recommendations/schema/response/recommendedMovieResponse.ts b/projects/api/src/contracts/recommendations/schema/response/recommendedMovieResponse.ts index c9732394..18894973 100644 --- a/projects/api/src/contracts/recommendations/schema/response/recommendedMovieResponse.ts +++ b/projects/api/src/contracts/recommendations/schema/response/recommendedMovieResponse.ts @@ -2,6 +2,7 @@ import { movieResponseSchema } from '../../../_internal/response/movieResponseSc import { z } from '../../../_internal/z.ts'; import { userProfileWithNotesSchema } from './userProfileWithNotesSchema.ts'; +/** Recommended movie response. */ export const recommendedMovieResponse = z.array( movieResponseSchema .extend({ diff --git a/projects/api/src/contracts/recommendations/schema/response/recommendedShowResponse.ts b/projects/api/src/contracts/recommendations/schema/response/recommendedShowResponse.ts index 861f7677..ff9526e1 100644 --- a/projects/api/src/contracts/recommendations/schema/response/recommendedShowResponse.ts +++ b/projects/api/src/contracts/recommendations/schema/response/recommendedShowResponse.ts @@ -2,6 +2,7 @@ import { showResponseSchema } from '../../../_internal/response/showResponseSche import { z } from '../../../_internal/z.ts'; import { userProfileWithNotesSchema } from './userProfileWithNotesSchema.ts'; +/** Recommended show response. */ export const recommendedShowResponse = z.array( showResponseSchema .extend({ diff --git a/projects/api/src/contracts/recommendations/schema/response/userProfileWithNotesSchema.ts b/projects/api/src/contracts/recommendations/schema/response/userProfileWithNotesSchema.ts index 571c58b7..cc829607 100644 --- a/projects/api/src/contracts/recommendations/schema/response/userProfileWithNotesSchema.ts +++ b/projects/api/src/contracts/recommendations/schema/response/userProfileWithNotesSchema.ts @@ -1,6 +1,7 @@ import { profileResponseSchema } from '../../../_internal/response/profileResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for user profile with notes. */ export const userProfileWithNotesSchema = profileResponseSchema .extend({ notes: z.string(), diff --git a/projects/api/src/contracts/scrobble/index.ts b/projects/api/src/contracts/scrobble/index.ts index 74bf0041..ef197f4c 100644 --- a/projects/api/src/contracts/scrobble/index.ts +++ b/projects/api/src/contracts/scrobble/index.ts @@ -5,6 +5,7 @@ import { movieScrobbleRequestSchema } from './schema/request/movieScrobbleReques import { episodeScrobbleResponseSchema } from './schema/response/episodeScrobbleResponseSchema.ts'; import { movieScrobbleResponseSchema } from './schema/response/movieScrobbleResponseSchema.ts'; +/** ts-rest contract for the `scrobble` endpoints. */ export const scrobble = builder.router({ start: { summary: 'Start watching in a media center', @@ -83,11 +84,15 @@ export { movieScrobbleResponseSchema, }; +/** The movie scrobble request payload. */ export type MovieScrobbleRequest = z.infer; +/** The movie scrobble response payload. */ export type MovieScrobbleResponse = z.infer; +/** The episode scrobble request payload. */ export type EpisodeScrobbleRequest = z.infer< typeof episodeScrobbleRequestSchema >; +/** The episode scrobble response payload. */ export type EpisodeScrobbleResponse = z.infer< typeof episodeScrobbleResponseSchema >; diff --git a/projects/api/src/contracts/scrobble/schema/request/episodeScrobbleRequestSchema.ts b/projects/api/src/contracts/scrobble/schema/request/episodeScrobbleRequestSchema.ts index ac9b6f15..3af736f6 100644 --- a/projects/api/src/contracts/scrobble/schema/request/episodeScrobbleRequestSchema.ts +++ b/projects/api/src/contracts/scrobble/schema/request/episodeScrobbleRequestSchema.ts @@ -1,8 +1,9 @@ import { episodeIdsRequestSchema, } from '../../../_internal/request/idsRequestSchema.ts'; -import {float, z} from '../../../_internal/z.ts'; +import { float, z } from '../../../_internal/z.ts'; +/** Zod schema for the episode scrobble request. */ export const episodeScrobbleRequestSchema = z.object({ progress: float(z.number()), episode: z.object({ diff --git a/projects/api/src/contracts/scrobble/schema/request/movieScrobbleRequestSchema.ts b/projects/api/src/contracts/scrobble/schema/request/movieScrobbleRequestSchema.ts index 3305bd22..456d14f3 100644 --- a/projects/api/src/contracts/scrobble/schema/request/movieScrobbleRequestSchema.ts +++ b/projects/api/src/contracts/scrobble/schema/request/movieScrobbleRequestSchema.ts @@ -1,13 +1,14 @@ import { movieIdsRequestSchema, } from '../../../_internal/request/idsRequestSchema.ts'; -import {float, z} from '../../../_internal/z.ts'; +import { float, z } from '../../../_internal/z.ts'; /* FIXME: verify data structure of the standard media schemas and reuse where applicable. */ +/** Zod schema for the movie scrobble request. */ export const movieScrobbleRequestSchema = z.object({ progress: float(z.number()), movie: z.object({ diff --git a/projects/api/src/contracts/scrobble/schema/response/episodeScrobbleResponseSchema.ts b/projects/api/src/contracts/scrobble/schema/response/episodeScrobbleResponseSchema.ts index e268aac0..10ee59cf 100644 --- a/projects/api/src/contracts/scrobble/schema/response/episodeScrobbleResponseSchema.ts +++ b/projects/api/src/contracts/scrobble/schema/response/episodeScrobbleResponseSchema.ts @@ -2,6 +2,7 @@ import { episodeResponseSchema } from '../../../_internal/response/episodeRespon import { showResponseSchema } from '../../../_internal/response/showResponseSchema.ts'; import { asString, float, int64, z } from '../../../_internal/z.ts'; +/** Zod schema for the episode scrobble response. */ export const episodeScrobbleResponseSchema = z.object({ id: int64(z.number().int()), progress: float(z.number()), diff --git a/projects/api/src/contracts/scrobble/schema/response/movieScrobbleResponseSchema.ts b/projects/api/src/contracts/scrobble/schema/response/movieScrobbleResponseSchema.ts index a069381a..71ef97a8 100644 --- a/projects/api/src/contracts/scrobble/schema/response/movieScrobbleResponseSchema.ts +++ b/projects/api/src/contracts/scrobble/schema/response/movieScrobbleResponseSchema.ts @@ -1,6 +1,7 @@ import { movieResponseSchema } from '../../../_internal/response/movieResponseSchema.ts'; import { asString, float, int64, z } from '../../../_internal/z.ts'; +/** Zod schema for the movie scrobble response. */ export const movieScrobbleResponseSchema = z.object({ id: int64(z.number().int()), progress: float(z.number()), diff --git a/projects/api/src/contracts/search/index.ts b/projects/api/src/contracts/search/index.ts index 659d09b4..2278f20a 100644 --- a/projects/api/src/contracts/search/index.ts +++ b/projects/api/src/contracts/search/index.ts @@ -53,6 +53,7 @@ const idLookupQuerySchema = z.object({ type: z.string().optional().describe('Optional media type filter.'), }); +/** ts-rest contract for the `search` endpoints. */ export const search = builder.router({ query: { summary: 'Get text query results', @@ -168,37 +169,46 @@ Returns globally trending recent searches by \`type\`. Use \`query\` to narrow t }); export { searchEngineSchema, searchQuerySchema }; +/** The search query parameters. */ export type SearchQueryParams = z.infer; export { searchResultResponseSchema }; +/** The search result response payload. */ export type SearchResultResponse = z.infer; export { searchTypeParamFactory }; export { searchMovieResponseSchema } from './schema/response/searchMovieResponseSchema.ts'; +/** The search movie result response payload. */ export type SearchMovieResultResponse = z.infer< typeof searchMovieResponseSchema >; export { searchShowResponseSchema } from './schema/response/searchShowResponseSchema.ts'; +/** The search show result response payload. */ export type SearchShowResultResponse = z.infer; export { searchPersonResponseSchema } from './schema/response/searchPersonResponseSchema.ts'; +/** The search person result response payload. */ export type SearchPersonResultResponse = z.infer< typeof searchPersonResponseSchema >; export { trendingSearchMovieResponseSchema } from './schema/response/trendingSearchMovieResponseSchema.ts'; +/** The trending search movie result response payload. */ export type TrendingSearchMovieResultResponse = z.infer< typeof trendingSearchMovieResponseSchema >; export { trendingSearchShowResponseSchema } from './schema/response/trendingSearchShowResponseSchema.ts'; +/** The trending search show result response payload. */ export type TrendingSearchShowResultResponse = z.infer< typeof trendingSearchShowResponseSchema >; export { trendingSearchPersonResponseSchema } from './schema/response/trendingSearchPersonResponseSchema.ts'; +/** The trending search person result response payload. */ export type TrendingSearchPersonResultResponse = z.infer< typeof trendingSearchPersonResponseSchema >; export { recentSearchRequestSchema }; +/** The recent search request payload. */ export type RecentSearchRequest = z.infer; diff --git a/projects/api/src/contracts/search/schema/request/recentSearchRequestSchema.ts b/projects/api/src/contracts/search/schema/request/recentSearchRequestSchema.ts index 7c008847..d40a1935 100644 --- a/projects/api/src/contracts/search/schema/request/recentSearchRequestSchema.ts +++ b/projects/api/src/contracts/search/schema/request/recentSearchRequestSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the recent search request. */ export const recentSearchRequestSchema = z.object({ query: z.string(), id: z.number().int(), diff --git a/projects/api/src/contracts/search/schema/request/searchEngineSchema.ts b/projects/api/src/contracts/search/schema/request/searchEngineSchema.ts index f0b02261..2082a045 100644 --- a/projects/api/src/contracts/search/schema/request/searchEngineSchema.ts +++ b/projects/api/src/contracts/search/schema/request/searchEngineSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for search engine. */ export const searchEngineSchema = z.object({ engine: z.string().nullish().openapi({ description: 'The search engine type to use.', diff --git a/projects/api/src/contracts/search/schema/request/searchQuerySchema.ts b/projects/api/src/contracts/search/schema/request/searchQuerySchema.ts index 6204ca05..e549b7a7 100644 --- a/projects/api/src/contracts/search/schema/request/searchQuerySchema.ts +++ b/projects/api/src/contracts/search/schema/request/searchQuerySchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the search query parameters. */ export const searchQuerySchema = z.object({ query: z.string().nullish().openapi({ description: 'The search query to search all text based fields.', diff --git a/projects/api/src/contracts/search/schema/request/searchTypeParamFactory.ts b/projects/api/src/contracts/search/schema/request/searchTypeParamFactory.ts index 07b9d2b9..dbd9b2ae 100644 --- a/projects/api/src/contracts/search/schema/request/searchTypeParamFactory.ts +++ b/projects/api/src/contracts/search/schema/request/searchTypeParamFactory.ts @@ -1,6 +1,7 @@ import type { CombinationsFrom } from '../../../../types/CombinationsFrom.ts'; import { z } from '../../../_internal/z.ts'; +/** Search type param factory. */ export const searchTypeParamFactory = (): z.ZodObject<{ type: z.ZodOptional>>>; }> => diff --git a/projects/api/src/contracts/search/schema/request/trendingSearchTypeParamFactory.ts b/projects/api/src/contracts/search/schema/request/trendingSearchTypeParamFactory.ts index 1916cb97..48d1f573 100644 --- a/projects/api/src/contracts/search/schema/request/trendingSearchTypeParamFactory.ts +++ b/projects/api/src/contracts/search/schema/request/trendingSearchTypeParamFactory.ts @@ -1,6 +1,7 @@ import type { CombinationsFrom } from '../../../../types/CombinationsFrom.ts'; import { z } from '../../../_internal/z.ts'; +/** Trending search type param factory. */ export const trendingSearchTypeParamFactory = < T extends string[], >(): z.ZodObject<{ diff --git a/projects/api/src/contracts/search/schema/response/searchListResponseSchema.ts b/projects/api/src/contracts/search/schema/response/searchListResponseSchema.ts index f641a395..1851a8ab 100644 --- a/projects/api/src/contracts/search/schema/response/searchListResponseSchema.ts +++ b/projects/api/src/contracts/search/schema/response/searchListResponseSchema.ts @@ -1,6 +1,7 @@ import { int64, z } from '../../../_internal/z.ts'; import { listResponseSchema } from '../../../models/index.ts'; +/** Zod schema for the search list response. */ export const searchListResponseSchema = z.object({ score: int64(z.number().int()), type: z.literal('list'), diff --git a/projects/api/src/contracts/search/schema/response/searchMovieResponseSchema.ts b/projects/api/src/contracts/search/schema/response/searchMovieResponseSchema.ts index 4e1618ac..b0655edd 100644 --- a/projects/api/src/contracts/search/schema/response/searchMovieResponseSchema.ts +++ b/projects/api/src/contracts/search/schema/response/searchMovieResponseSchema.ts @@ -1,6 +1,7 @@ import { movieResponseSchema } from '../../../_internal/response/movieResponseSchema.ts'; import { int64, z } from '../../../_internal/z.ts'; +/** Zod schema for the search movie response. */ export const searchMovieResponseSchema = z.object({ score: int64(z.number().int()), type: z.literal('movie'), diff --git a/projects/api/src/contracts/search/schema/response/searchPersonResponseSchema.ts b/projects/api/src/contracts/search/schema/response/searchPersonResponseSchema.ts index 629464cf..bcc8d5fc 100644 --- a/projects/api/src/contracts/search/schema/response/searchPersonResponseSchema.ts +++ b/projects/api/src/contracts/search/schema/response/searchPersonResponseSchema.ts @@ -1,6 +1,7 @@ import { int64, z } from '../../../_internal/z.ts'; import { personResponseSchema } from '../../../people/schema/response/personResponseSchema.ts'; +/** Zod schema for the search person response. */ export const searchPersonResponseSchema = z.object({ score: int64(z.number().int()), type: z.literal('person'), diff --git a/projects/api/src/contracts/search/schema/response/searchResultResponseSchema.ts b/projects/api/src/contracts/search/schema/response/searchResultResponseSchema.ts index d1e7d033..3b1c18bb 100644 --- a/projects/api/src/contracts/search/schema/response/searchResultResponseSchema.ts +++ b/projects/api/src/contracts/search/schema/response/searchResultResponseSchema.ts @@ -4,6 +4,7 @@ import { searchMovieResponseSchema } from './searchMovieResponseSchema.ts'; import { searchPersonResponseSchema } from './searchPersonResponseSchema.ts'; import { searchShowResponseSchema } from './searchShowResponseSchema.ts'; +/** Zod schema for the search result response. */ export const searchResultResponseSchema = z.union([ searchMovieResponseSchema, searchShowResponseSchema, diff --git a/projects/api/src/contracts/search/schema/response/searchShowResponseSchema.ts b/projects/api/src/contracts/search/schema/response/searchShowResponseSchema.ts index 7ac637a0..8365c2dd 100644 --- a/projects/api/src/contracts/search/schema/response/searchShowResponseSchema.ts +++ b/projects/api/src/contracts/search/schema/response/searchShowResponseSchema.ts @@ -1,6 +1,7 @@ import { showResponseSchema } from '../../../_internal/response/showResponseSchema.ts'; import { int64, z } from '../../../_internal/z.ts'; +/** Zod schema for the search show response. */ export const searchShowResponseSchema = z.object({ score: int64(z.number().int()), type: z.literal('show'), diff --git a/projects/api/src/contracts/search/schema/response/trendingSearchMovieResponseSchema.ts b/projects/api/src/contracts/search/schema/response/trendingSearchMovieResponseSchema.ts index 636dd703..9fbf59f6 100644 --- a/projects/api/src/contracts/search/schema/response/trendingSearchMovieResponseSchema.ts +++ b/projects/api/src/contracts/search/schema/response/trendingSearchMovieResponseSchema.ts @@ -1,6 +1,7 @@ import { movieResponseSchema } from '../../../_internal/response/movieResponseSchema.ts'; import { int64, z } from '../../../_internal/z.ts'; +/** Zod schema for the trending search movie response. */ export const trendingSearchMovieResponseSchema = z.object({ id: int64(z.number().int()), count: z.number().int(), diff --git a/projects/api/src/contracts/search/schema/response/trendingSearchPersonResponseSchema.ts b/projects/api/src/contracts/search/schema/response/trendingSearchPersonResponseSchema.ts index d2638dec..11518bf4 100644 --- a/projects/api/src/contracts/search/schema/response/trendingSearchPersonResponseSchema.ts +++ b/projects/api/src/contracts/search/schema/response/trendingSearchPersonResponseSchema.ts @@ -1,6 +1,7 @@ import { int64, z } from '../../../_internal/z.ts'; import { personResponseSchema } from '../../../people/schema/response/personResponseSchema.ts'; +/** Zod schema for the trending search person response. */ export const trendingSearchPersonResponseSchema = z.object({ id: int64(z.number().int()), count: z.number().int(), diff --git a/projects/api/src/contracts/search/schema/response/trendingSearchResponseSchema.ts b/projects/api/src/contracts/search/schema/response/trendingSearchResponseSchema.ts index aba73575..32589a51 100644 --- a/projects/api/src/contracts/search/schema/response/trendingSearchResponseSchema.ts +++ b/projects/api/src/contracts/search/schema/response/trendingSearchResponseSchema.ts @@ -3,6 +3,7 @@ import { trendingSearchMovieResponseSchema } from './trendingSearchMovieResponse import { trendingSearchPersonResponseSchema } from './trendingSearchPersonResponseSchema.ts'; import { trendingSearchShowResponseSchema } from './trendingSearchShowResponseSchema.ts'; +/** Zod schema for the trending search response. */ export const trendingSearchResponseSchema = z.union([ trendingSearchMovieResponseSchema, trendingSearchShowResponseSchema, diff --git a/projects/api/src/contracts/search/schema/response/trendingSearchShowResponseSchema.ts b/projects/api/src/contracts/search/schema/response/trendingSearchShowResponseSchema.ts index aeabe8ed..a2a167ea 100644 --- a/projects/api/src/contracts/search/schema/response/trendingSearchShowResponseSchema.ts +++ b/projects/api/src/contracts/search/schema/response/trendingSearchShowResponseSchema.ts @@ -1,6 +1,7 @@ import { showResponseSchema } from '../../../_internal/response/showResponseSchema.ts'; import { int64, z } from '../../../_internal/z.ts'; +/** Zod schema for the trending search show response. */ export const trendingSearchShowResponseSchema = z.object({ id: int64(z.number().int()), count: z.number().int(), diff --git a/projects/api/src/contracts/seasons/index.ts b/projects/api/src/contracts/seasons/index.ts index b48beb28..8be661d6 100644 --- a/projects/api/src/contracts/seasons/index.ts +++ b/projects/api/src/contracts/seasons/index.ts @@ -3,6 +3,7 @@ import { idParamsSchema } from '../_internal/request/idParamsSchema.ts'; import { mediaReportRequestSchema } from '../_internal/request/mediaReportRequestSchema.ts'; import { z } from '../_internal/z.ts'; +/** ts-rest contract for the `seasons` endpoints. */ export const seasons = builder.router({ report: { summary: 'Report a season', diff --git a/projects/api/src/contracts/shows/index.ts b/projects/api/src/contracts/shows/index.ts index 6b62d079..72169e01 100644 --- a/projects/api/src/contracts/shows/index.ts +++ b/projects/api/src/contracts/shows/index.ts @@ -993,6 +993,7 @@ Returns shows recently available on streaming services for the requested \`perio }, }); +/** ts-rest contract for the `shows` endpoints. */ export const shows = builder.router({ ...ENTITY_LEVEL, ...GLOBAL_LEVEL, @@ -1000,43 +1001,55 @@ export const shows = builder.router({ pathPrefix: '/shows', }); +/** The show id parameters. */ export type ShowIdParams = z.infer; export { showResponseSchema }; +/** The show response payload. */ export type ShowResponse = z.infer; export { showProgressResponseSchema }; +/** The show progress response payload. */ export type ShowProgressResponse = z.infer; export { showQueryParamsSchema }; +/** The show query parameters. */ export type ShowQueryParams = z.infer; export { showTrendingResponseSchema }; +/** The show trending response payload. */ export type ShowTrendingResponse = z.infer; export { showWatchedResponseSchema }; +/** The show watched response payload. */ export type ShowWatchedResponse = z.infer; +/** The show stats response payload. */ export type ShowStatsResponse = z.infer; export { showAnticipatedResponseSchema }; +/** The show anticipated response payload. */ export type ShowAnticipatedResponse = z.infer< typeof showAnticipatedResponseSchema >; export { showHotResponseSchema }; +/** The show hot response payload. */ export type ShowHotResponse = z.infer< typeof showHotResponseSchema >; +/** The show certification response payload. */ export type ShowCertificationResponse = z.infer< typeof showCertificationResponseSchema >; export { seasonResponseSchema }; +/** The seasons response payload. */ export type SeasonsResponse = z.infer[]; export { showStreamingResponseSchema }; +/** The show streaming response payload. */ export type ShowStreamingResponse = z.infer; export { episodeParamsSchema }; @@ -1044,4 +1057,5 @@ export { episodeParamsSchema }; export { seasonParamsSchema }; export { mediaReportRequestSchema }; +/** The media report request payload. */ export type MediaReportRequest = z.infer; diff --git a/projects/api/src/contracts/shows/schema/request/episodeParamsSchema.ts b/projects/api/src/contracts/shows/schema/request/episodeParamsSchema.ts index 830a9ccf..10ea9f1d 100644 --- a/projects/api/src/contracts/shows/schema/request/episodeParamsSchema.ts +++ b/projects/api/src/contracts/shows/schema/request/episodeParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the episode parameters. */ export const episodeParamsSchema = z.object({ episode: z.number().int().nonnegative().openapi({ description: 'Episode number', diff --git a/projects/api/src/contracts/shows/schema/request/seasonParamsSchema.ts b/projects/api/src/contracts/shows/schema/request/seasonParamsSchema.ts index 1bf200a5..e5195959 100644 --- a/projects/api/src/contracts/shows/schema/request/seasonParamsSchema.ts +++ b/projects/api/src/contracts/shows/schema/request/seasonParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the season parameters. */ export const seasonParamsSchema = z.object({ season: z.number().int().nonnegative().openapi({ description: 'Season number', diff --git a/projects/api/src/contracts/shows/schema/request/showQueryParamsSchema.ts b/projects/api/src/contracts/shows/schema/request/showQueryParamsSchema.ts index 4a5ff3d1..baf8968d 100644 --- a/projects/api/src/contracts/shows/schema/request/showQueryParamsSchema.ts +++ b/projects/api/src/contracts/shows/schema/request/showQueryParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the show query parameters. */ export const showQueryParamsSchema = z.object({ hidden: z.boolean().nullish().openapi({ description: 'Whether to include any hidden seasons', diff --git a/projects/api/src/contracts/shows/schema/response/seasonResponseSchema.ts b/projects/api/src/contracts/shows/schema/response/seasonResponseSchema.ts index 00c167e5..040872c0 100644 --- a/projects/api/src/contracts/shows/schema/response/seasonResponseSchema.ts +++ b/projects/api/src/contracts/shows/schema/response/seasonResponseSchema.ts @@ -1,6 +1,7 @@ import { seasonIdsResponseSchema } from '../../../_internal/response/seasonIdsResponseSchema.ts'; import { float, z } from '../../../_internal/z.ts'; +/** Zod schema for the season response. */ export const seasonResponseSchema = z.object({ number: z.number().int(), ids: seasonIdsResponseSchema, diff --git a/projects/api/src/contracts/shows/schema/response/showAnticipatedResponseSchema.ts b/projects/api/src/contracts/shows/schema/response/showAnticipatedResponseSchema.ts index 3d928e7d..5b2987a7 100644 --- a/projects/api/src/contracts/shows/schema/response/showAnticipatedResponseSchema.ts +++ b/projects/api/src/contracts/shows/schema/response/showAnticipatedResponseSchema.ts @@ -1,6 +1,7 @@ import { showResponseSchema } from '../../../_internal/response/showResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the show anticipated response. */ export const showAnticipatedResponseSchema = z.object({ list_count: z.number().int(), show: showResponseSchema, diff --git a/projects/api/src/contracts/shows/schema/response/showHotResponseSchema.ts b/projects/api/src/contracts/shows/schema/response/showHotResponseSchema.ts index 2ed992c9..2dee50cb 100644 --- a/projects/api/src/contracts/shows/schema/response/showHotResponseSchema.ts +++ b/projects/api/src/contracts/shows/schema/response/showHotResponseSchema.ts @@ -1,3 +1,4 @@ import { showAnticipatedResponseSchema } from './showAnticipatedResponseSchema.ts'; +/** Zod schema for the show hot response. */ export const showHotResponseSchema = showAnticipatedResponseSchema; diff --git a/projects/api/src/contracts/shows/schema/response/showProgressResponseSchema.ts b/projects/api/src/contracts/shows/schema/response/showProgressResponseSchema.ts index eb33b7cf..a5906fc8 100644 --- a/projects/api/src/contracts/shows/schema/response/showProgressResponseSchema.ts +++ b/projects/api/src/contracts/shows/schema/response/showProgressResponseSchema.ts @@ -3,6 +3,7 @@ import { seasonIdsResponseSchema } from '../../../_internal/response/seasonIdsRe import { statsResponseSchema } from '../../../_internal/response/statsResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the show progress response. */ export const showProgressResponseSchema = progressResponseSchema.extend({ seasons: z.array( z.object({ diff --git a/projects/api/src/contracts/shows/schema/response/showStreamingResponseSchema.ts b/projects/api/src/contracts/shows/schema/response/showStreamingResponseSchema.ts index 6874d95d..f28f300f 100644 --- a/projects/api/src/contracts/shows/schema/response/showStreamingResponseSchema.ts +++ b/projects/api/src/contracts/shows/schema/response/showStreamingResponseSchema.ts @@ -1,6 +1,7 @@ import { showResponseSchema } from '../../../_internal/response/showResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the show streaming response. */ export const showStreamingResponseSchema = z.object({ rank: z.number().int(), delta: z.number().int().nullish(), diff --git a/projects/api/src/contracts/shows/schema/response/showTrendingResponseSchema.ts b/projects/api/src/contracts/shows/schema/response/showTrendingResponseSchema.ts index 9bb0a17d..6a4cb13d 100644 --- a/projects/api/src/contracts/shows/schema/response/showTrendingResponseSchema.ts +++ b/projects/api/src/contracts/shows/schema/response/showTrendingResponseSchema.ts @@ -1,6 +1,7 @@ import { showResponseSchema } from '../../../_internal/response/showResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the show trending response. */ export const showTrendingResponseSchema = z.object({ watchers: z.number().int(), show: showResponseSchema, diff --git a/projects/api/src/contracts/shows/schema/response/showWatchedResponseSchema.ts b/projects/api/src/contracts/shows/schema/response/showWatchedResponseSchema.ts index 58d468d9..763f4184 100644 --- a/projects/api/src/contracts/shows/schema/response/showWatchedResponseSchema.ts +++ b/projects/api/src/contracts/shows/schema/response/showWatchedResponseSchema.ts @@ -2,6 +2,7 @@ import { showResponseSchema } from '../../../_internal/response/showResponseSche import { watchedStatsResponseSchema } from '../../../_internal/response/watchedStatsResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the show watched response. */ export const showWatchedResponseSchema = watchedStatsResponseSchema.extend({ collector_count: z.number().int(), show: showResponseSchema, diff --git a/projects/api/src/contracts/smart_lists/index.ts b/projects/api/src/contracts/smart_lists/index.ts index 24d275f2..05ddea2e 100644 --- a/projects/api/src/contracts/smart_lists/index.ts +++ b/projects/api/src/contracts/smart_lists/index.ts @@ -15,6 +15,7 @@ const listItemsPathParamsSchema = listParamsSchema.extend({ sort_how: z.string().describe('Sort direction.'), }); +/** ts-rest contract for the `smartLists` endpoints. */ export const smartLists = builder.router({ summary: { summary: 'Get smart list', @@ -52,4 +53,5 @@ Returns the dynamic items a smart list resolves to. Use \`type\`, \`sort_by\`, a pathPrefix: '/smart-lists', }); +/** The smart list item response payload. */ export type SmartListItemResponse = z.infer; diff --git a/projects/api/src/contracts/social_recommendations/index.ts b/projects/api/src/contracts/social_recommendations/index.ts index 7519c0ba..4aaa6417 100644 --- a/projects/api/src/contracts/social_recommendations/index.ts +++ b/projects/api/src/contracts/social_recommendations/index.ts @@ -36,6 +36,7 @@ Returns show recommendations based on the authenticated user social graph. Use \ }, }, { pathPrefix: '/shows' }); +/** ts-rest contract for the `social_recommendations` endpoints. */ export const social_recommendations = builder.router({ movies, shows, diff --git a/projects/api/src/contracts/sync/index.ts b/projects/api/src/contracts/sync/index.ts index 40cb8504..7c1d8a72 100644 --- a/projects/api/src/contracts/sync/index.ts +++ b/projects/api/src/contracts/sync/index.ts @@ -655,6 +655,7 @@ Returns the authenticated user episode collection in a minimal format optimized pathPrefix: '/collection', }); +/** ts-rest contract for the `sync` endpoints. */ export const sync = builder.router({ lastActivities: { summary: 'Get last activity', @@ -709,39 +710,61 @@ export { upNextResponseSchema, }; +/** The up next response payload. */ export type UpNextResponse = z.infer; +/** The movie progress response payload. */ export type MovieProgressResponse = z.infer; +/** The up next intent request payload. */ export type UpNextIntentRequest = z.infer; +/** The history add request payload. */ export type HistoryAddRequest = z.infer; +/** The history remove request payload. */ export type HistoryRemoveRequest = z.infer; +/** The history response payload. */ export type HistoryResponse = z.infer; +/** The history remove response payload. */ export type HistoryRemoveResponse = z.infer; +/** The last activities response payload. */ export type LastActivitiesResponse = z.infer< typeof lastActivitiesResponseSchema >; +/** The watchlist request payload. */ export type WatchlistRequest = z.infer; +/** The ratings sync request payload. */ export type RatingsSyncRequest = z.infer; +/** The ratings sync response payload. */ export type RatingsSyncResponse = z.infer; +/** The favorites request payload. */ export type FavoritesRequest = z.infer; +/** The favorites response payload. */ export type FavoritesResponse = z.infer; +/** The favorites remove response payload. */ export type FavoritesRemoveResponse = z.infer< typeof favoritesRemoveResponseSchema >; +/** The collection request payload. */ export type CollectionRequest = z.infer; +/** The collection response payload. */ export type CollectionResponse = z.infer; +/** The collection movie response payload. */ export type CollectionMovieResponse = z.infer; +/** The collection show response payload. */ export type CollectionShowResponse = z.infer; +/** The collection episode response payload. */ export type CollectionEpisodeResponse = z.infer; +/** The collection minimal response payload. */ export type CollectionMinimalResponse = z.infer< typeof collectionMinimalResponseSchema >; +/** The collection minimal show response payload. */ export type CollectionMinimalShowResponse = z.infer< typeof collectionMinimalShowResponseSchema >; +/** The remove ratings parameters. */ export type RemoveRatingsParams = z.infer; diff --git a/projects/api/src/contracts/sync/schema/request/availableOnEnumSchema.ts b/projects/api/src/contracts/sync/schema/request/availableOnEnumSchema.ts index c984e9ef..e8d2d92a 100644 --- a/projects/api/src/contracts/sync/schema/request/availableOnEnumSchema.ts +++ b/projects/api/src/contracts/sync/schema/request/availableOnEnumSchema.ts @@ -1,5 +1,6 @@ import { asString, z } from '../../../_internal/z.ts'; +/** Zod schema for available on enum. */ export const availableOnEnumSchema = asString(z.enum([ 'plex', ])); diff --git a/projects/api/src/contracts/sync/schema/request/collectionParamSchema.ts b/projects/api/src/contracts/sync/schema/request/collectionParamSchema.ts index 0e041315..002c0082 100644 --- a/projects/api/src/contracts/sync/schema/request/collectionParamSchema.ts +++ b/projects/api/src/contracts/sync/schema/request/collectionParamSchema.ts @@ -1,6 +1,7 @@ import { z } from '../../../_internal/z.ts'; import { availableOnEnumSchema } from './availableOnEnumSchema.ts'; +/** Zod schema for collection param. */ export const collectionParamSchema = z.object({ available_on: availableOnEnumSchema.nullish(), }); diff --git a/projects/api/src/contracts/sync/schema/request/favoritesParamSchema.ts b/projects/api/src/contracts/sync/schema/request/favoritesParamSchema.ts index cb755ebe..a0fb767e 100644 --- a/projects/api/src/contracts/sync/schema/request/favoritesParamSchema.ts +++ b/projects/api/src/contracts/sync/schema/request/favoritesParamSchema.ts @@ -4,6 +4,7 @@ import { } from '../../../_internal/request/idsRequestSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for favorite param. */ export const favoriteParamSchema = z.object({ movies: z.array( z.object({ ids: movieIdsRequestSchema }), diff --git a/projects/api/src/contracts/sync/schema/request/historyIdsRequestSchema.ts b/projects/api/src/contracts/sync/schema/request/historyIdsRequestSchema.ts index 8688c6b2..22cf4510 100644 --- a/projects/api/src/contracts/sync/schema/request/historyIdsRequestSchema.ts +++ b/projects/api/src/contracts/sync/schema/request/historyIdsRequestSchema.ts @@ -1,5 +1,6 @@ import { int64, z } from '../../../_internal/z.ts'; +/** Zod schema for the history ids request. */ export const historyIdsRequestSchema = z.object({ ids: z.array(int64(z.number().int())).nullish(), }); diff --git a/projects/api/src/contracts/sync/schema/request/historyRemoveRequestSchema.ts b/projects/api/src/contracts/sync/schema/request/historyRemoveRequestSchema.ts index 898d8b6e..71b99ee4 100644 --- a/projects/api/src/contracts/sync/schema/request/historyRemoveRequestSchema.ts +++ b/projects/api/src/contracts/sync/schema/request/historyRemoveRequestSchema.ts @@ -1,5 +1,6 @@ import { bulkMediaRequestSchema } from '../../../_internal/request/bulkMediaRequestSchema.ts'; import { historyIdsRequestSchema } from './historyIdsRequestSchema.ts'; +/** Zod schema for the history remove request. */ export const historyRemoveRequestSchema = bulkMediaRequestSchema .merge(historyIdsRequestSchema); diff --git a/projects/api/src/contracts/sync/schema/request/minimalParamSchema.ts b/projects/api/src/contracts/sync/schema/request/minimalParamSchema.ts index a0450764..005253e0 100644 --- a/projects/api/src/contracts/sync/schema/request/minimalParamSchema.ts +++ b/projects/api/src/contracts/sync/schema/request/minimalParamSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for minimal param. */ export const minimalParamSchema = z.object({ extended: z.literal('min'), }); diff --git a/projects/api/src/contracts/sync/schema/request/playbackIdParamsSchema.ts b/projects/api/src/contracts/sync/schema/request/playbackIdParamsSchema.ts index 445ee0d4..89091183 100644 --- a/projects/api/src/contracts/sync/schema/request/playbackIdParamsSchema.ts +++ b/projects/api/src/contracts/sync/schema/request/playbackIdParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the playback id parameters. */ export const playbackIdParamsSchema = z.object({ id: z.number().int().describe('ID of the playback entry'), }); diff --git a/projects/api/src/contracts/sync/schema/request/progressParamsSchema.ts b/projects/api/src/contracts/sync/schema/request/progressParamsSchema.ts index 71645bc7..0ca888df 100644 --- a/projects/api/src/contracts/sync/schema/request/progressParamsSchema.ts +++ b/projects/api/src/contracts/sync/schema/request/progressParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the progress parameters. */ export const progressParamsSchema = z.object({ start_at: z.string().optional().openapi({ description: 'Start date for the range. Must be formatted as "YYYY-MM-DD".', diff --git a/projects/api/src/contracts/sync/schema/request/ratingsParamSchema.ts b/projects/api/src/contracts/sync/schema/request/ratingsParamSchema.ts index e4bdb3d3..a75594fd 100644 --- a/projects/api/src/contracts/sync/schema/request/ratingsParamSchema.ts +++ b/projects/api/src/contracts/sync/schema/request/ratingsParamSchema.ts @@ -6,10 +6,12 @@ import { } from '../../../_internal/request/idsRequestSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for media rating. */ export const mediaRatingSchema = z.object({ rating: z.number().int().min(1).max(10), }); +/** Zod schema for ratings param. */ export const ratingsParamSchema = z.object({ movies: z.array( mediaRatingSchema diff --git a/projects/api/src/contracts/sync/schema/request/removeRatingsParamSchema.ts b/projects/api/src/contracts/sync/schema/request/removeRatingsParamSchema.ts index 3517066c..0d7207e5 100644 --- a/projects/api/src/contracts/sync/schema/request/removeRatingsParamSchema.ts +++ b/projects/api/src/contracts/sync/schema/request/removeRatingsParamSchema.ts @@ -6,6 +6,7 @@ import { } from '../../../_internal/request/idsRequestSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for remove ratings param. */ export const removeRatingsParamSchema = z.object({ movies: z.array(z.object({ ids: movieIdsRequestSchema })).nullish(), shows: z.array(z.object({ ids: showIdsRequestSchema })).nullish(), diff --git a/projects/api/src/contracts/sync/schema/request/upNextIntentQuerySchema.ts b/projects/api/src/contracts/sync/schema/request/upNextIntentQuerySchema.ts index aaadc62e..b2ab7709 100644 --- a/projects/api/src/contracts/sync/schema/request/upNextIntentQuerySchema.ts +++ b/projects/api/src/contracts/sync/schema/request/upNextIntentQuerySchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the up next intent query parameters. */ export const upNextIntentQuerySchema = z.object({ intent: z.enum(['all', 'continue', 'start', 'completed']).optional().openapi({ description: diff --git a/projects/api/src/contracts/sync/schema/response/collectionMinimalResponseSchema.ts b/projects/api/src/contracts/sync/schema/response/collectionMinimalResponseSchema.ts index 529048f9..0355f3c0 100644 --- a/projects/api/src/contracts/sync/schema/response/collectionMinimalResponseSchema.ts +++ b/projects/api/src/contracts/sync/schema/response/collectionMinimalResponseSchema.ts @@ -1,10 +1,12 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the collection minimal response. */ export const collectionMinimalResponseSchema = z.record( z.string(), z.string().datetime(), ); +/** Zod schema for the collection minimal show response. */ export const collectionMinimalShowResponseSchema = z.record( z.string(), z.record( diff --git a/projects/api/src/contracts/sync/schema/response/collectionResponseSchema.ts b/projects/api/src/contracts/sync/schema/response/collectionResponseSchema.ts index fa3f48df..e9f35709 100644 --- a/projects/api/src/contracts/sync/schema/response/collectionResponseSchema.ts +++ b/projects/api/src/contracts/sync/schema/response/collectionResponseSchema.ts @@ -20,12 +20,14 @@ const collectedItemSchema = z.object({ updated_at: z.string().datetime(), }).merge(availableOnSchema); +/** Zod schema for collected movie. */ export const collectedMovieSchema = z.object({ type: z.literal('movie'), movie: movieResponseSchema.nullish(), }) .merge(collectedItemSchema); +/** Zod schema for collected episode. */ export const collectedEpisodeSchema = z.object({ type: z.literal('episode'), episode: episodeResponseSchema.nullish(), @@ -43,6 +45,7 @@ const collectedSeasonResponseSchema = z.object({ episodes: collectedSeasonEpisodeSchema.array(), }); +/** Zod schema for collected show. */ export const collectedShowSchema = z.object({ last_collected_at: z.string().datetime().nullish(), last_updated_at: z.string().datetime().nullish(), @@ -53,6 +56,7 @@ export const collectedShowSchema = z.object({ show: showResponseSchema.nullish(), })); +/** Zod schema for the collection response. */ export const collectionResponseSchema = z.union([ collectedMovieSchema, collectedShowSchema, diff --git a/projects/api/src/contracts/sync/schema/response/favoritesRemoveResponseSchema.ts b/projects/api/src/contracts/sync/schema/response/favoritesRemoveResponseSchema.ts index 28b28224..86cd969e 100644 --- a/projects/api/src/contracts/sync/schema/response/favoritesRemoveResponseSchema.ts +++ b/projects/api/src/contracts/sync/schema/response/favoritesRemoveResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../../../_internal/z.ts'; import { favoriteParamSchema } from '../request/favoritesParamSchema.ts'; +/** Zod schema for the favorites remove response. */ export const favoritesRemoveResponseSchema = z.object({ deleted: z.object({ movies: z.number().int(), diff --git a/projects/api/src/contracts/sync/schema/response/favoritesResponseSchema.ts b/projects/api/src/contracts/sync/schema/response/favoritesResponseSchema.ts index 23ea723e..de1c74f9 100644 --- a/projects/api/src/contracts/sync/schema/response/favoritesResponseSchema.ts +++ b/projects/api/src/contracts/sync/schema/response/favoritesResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../../../_internal/z.ts'; import { favoriteParamSchema } from '../request/favoritesParamSchema.ts'; +/** Zod schema for the favorites response. */ export const favoritesResponseSchema = z.object({ added: z.object({ movies: z.number().int(), diff --git a/projects/api/src/contracts/sync/schema/response/historyRemoveResponseSchema.ts b/projects/api/src/contracts/sync/schema/response/historyRemoveResponseSchema.ts index 841f9150..6cdaedd3 100644 --- a/projects/api/src/contracts/sync/schema/response/historyRemoveResponseSchema.ts +++ b/projects/api/src/contracts/sync/schema/response/historyRemoveResponseSchema.ts @@ -1,6 +1,7 @@ import { bulkMediaRequestSchema } from '../../../_internal/request/bulkMediaRequestSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the history remove response. */ export const historyRemoveResponseSchema = z.object({ deleted: z.object({ movies: z.number().int(), episodes: z.number().int() }), not_found: bulkMediaRequestSchema, diff --git a/projects/api/src/contracts/sync/schema/response/historyResponseSchema.ts b/projects/api/src/contracts/sync/schema/response/historyResponseSchema.ts index 597bef13..d27d103d 100644 --- a/projects/api/src/contracts/sync/schema/response/historyResponseSchema.ts +++ b/projects/api/src/contracts/sync/schema/response/historyResponseSchema.ts @@ -1,6 +1,7 @@ import { bulkMediaRequestSchema } from '../../../_internal/request/bulkMediaRequestSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the history response. */ export const historyResponseSchema = z.object({ added: z.object({ movies: z.number().int(), episodes: z.number().int() }), updated: z.object({ movies: z.number().int(), episodes: z.number().int() }), diff --git a/projects/api/src/contracts/sync/schema/response/lastActivitiesResponseSchema.ts b/projects/api/src/contracts/sync/schema/response/lastActivitiesResponseSchema.ts index 40db8216..c7c78f82 100644 --- a/projects/api/src/contracts/sync/schema/response/lastActivitiesResponseSchema.ts +++ b/projects/api/src/contracts/sync/schema/response/lastActivitiesResponseSchema.ts @@ -63,6 +63,7 @@ const accountActivitiesSchema = z.object({ requested_at: timestampSchema, }); +/** Zod schema for the last activities response. */ export const lastActivitiesResponseSchema = z.object({ all: timestampSchema, movies: movieActivitiesSchema, diff --git a/projects/api/src/contracts/sync/schema/response/movieProgressResponseSchema.ts b/projects/api/src/contracts/sync/schema/response/movieProgressResponseSchema.ts index 49e02b30..63ba82d6 100644 --- a/projects/api/src/contracts/sync/schema/response/movieProgressResponseSchema.ts +++ b/projects/api/src/contracts/sync/schema/response/movieProgressResponseSchema.ts @@ -2,6 +2,7 @@ import { z } from 'zod'; import { float, int64 } from '../../../_internal/z.ts'; import { movieResponseSchema } from '../../../movies/index.ts'; +/** Zod schema for the movie progress response. */ export const movieProgressResponseSchema = z.object({ progress: float(z.number().min(0).max(100)), paused_at: z.string().datetime(), diff --git a/projects/api/src/contracts/sync/schema/response/ratingsResponseSchema.ts b/projects/api/src/contracts/sync/schema/response/ratingsResponseSchema.ts index c30f62e2..4c2d8682 100644 --- a/projects/api/src/contracts/sync/schema/response/ratingsResponseSchema.ts +++ b/projects/api/src/contracts/sync/schema/response/ratingsResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../../../_internal/z.ts'; import { ratingsParamSchema } from '../request/ratingsParamSchema.ts'; +/** Zod schema for the ratings sync response. */ export const ratingsSyncResponseSchema = z.object({ added: z.object({ movies: z.number().int(), diff --git a/projects/api/src/contracts/sync/schema/response/removeRatingsResponseSchema.ts b/projects/api/src/contracts/sync/schema/response/removeRatingsResponseSchema.ts index fd192f44..fdd14164 100644 --- a/projects/api/src/contracts/sync/schema/response/removeRatingsResponseSchema.ts +++ b/projects/api/src/contracts/sync/schema/response/removeRatingsResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../../../_internal/z.ts'; import { ratingsParamSchema } from '../request/ratingsParamSchema.ts'; +/** Zod schema for the remove ratings response. */ export const removeRatingsResponseSchema = z.object({ deleted: z.object({ movies: z.number().int(), diff --git a/projects/api/src/contracts/sync/schema/response/upNextResponseSchema.ts b/projects/api/src/contracts/sync/schema/response/upNextResponseSchema.ts index 8f9939e4..3ccafabd 100644 --- a/projects/api/src/contracts/sync/schema/response/upNextResponseSchema.ts +++ b/projects/api/src/contracts/sync/schema/response/upNextResponseSchema.ts @@ -2,6 +2,7 @@ import { z } from 'zod'; import { progressResponseSchema } from '../../../_internal/response/progressResponseSchema.ts'; import { showResponseSchema } from '../../../_internal/response/showResponseSchema.ts'; +/** Zod schema for the up next response. */ export const upNextResponseSchema = z.object({ show: showResponseSchema, progress: progressResponseSchema, diff --git a/projects/api/src/contracts/team/index.ts b/projects/api/src/contracts/team/index.ts index 12162e95..ce179bc2 100644 --- a/projects/api/src/contracts/team/index.ts +++ b/projects/api/src/contracts/team/index.ts @@ -3,6 +3,7 @@ import { extendedQuerySchemaFactory } from '../_internal/request/extendedQuerySc import type { z } from '../_internal/z.ts'; import { teamMemberResponseSchema } from './schema/response/teamMemberResponseSchema.ts'; +/** ts-rest contract for the `team` endpoints. */ export const team = builder.router({ members: { summary: 'Get team members', @@ -20,4 +21,5 @@ Returns Trakt team members. Use \`extended\` to include additional person detail }); export { teamMemberResponseSchema }; +/** The team member response payload. */ export type TeamMemberResponse = z.infer; diff --git a/projects/api/src/contracts/team/schema/response/teamMemberResponseSchema.ts b/projects/api/src/contracts/team/schema/response/teamMemberResponseSchema.ts index 48b537a4..28827c03 100644 --- a/projects/api/src/contracts/team/schema/response/teamMemberResponseSchema.ts +++ b/projects/api/src/contracts/team/schema/response/teamMemberResponseSchema.ts @@ -1,6 +1,7 @@ import { profileResponseSchema } from '../../../_internal/response/profileResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the team member response. */ export const teamMemberResponseSchema = z.object({ user: profileResponseSchema, }); diff --git a/projects/api/src/contracts/traktContract.ts b/projects/api/src/contracts/traktContract.ts index 4411b77d..272370ad 100644 --- a/projects/api/src/contracts/traktContract.ts +++ b/projects/api/src/contracts/traktContract.ts @@ -60,6 +60,7 @@ type TraktContract = { younify: typeof younify; }; +/** ts-rest contract for the `traktContract` endpoints. */ export const traktContract: TraktContract = builder .router({ oauth, diff --git a/projects/api/src/contracts/users/index.ts b/projects/api/src/contracts/users/index.ts index 795b7edd..a2db075b 100644 --- a/projects/api/src/contracts/users/index.ts +++ b/projects/api/src/contracts/users/index.ts @@ -660,6 +660,7 @@ type UsersRouter = ReturnType< typeof builder.router >; +/** ts-rest contract for the `users` endpoints. */ export const users = builder.router({ ...GLOBAL_LEVEL, syncs, @@ -733,69 +734,112 @@ export { watchingResponseSchema, }; +/** The profile parameters. */ export type ProfileParams = z.infer; +/** The user report request payload. */ export type UserReportRequest = z.infer; +/** The settings response payload. */ export type SettingsResponse = z.infer; +/** The sort direction type. */ export type SortDirection = z.infer; +/** The sort type type. */ export type SortType = z.infer; +/** The watch action type. */ export type WatchAction = z.infer; +/** The liked comment item response payload. */ export type LikedCommentItemResponse = z.infer< typeof likedCommentResponseSchema >; +/** The liked list item response payload. */ export type LikedListItemResponse = z.infer; +/** The social activity response payload. */ export type SocialActivityResponse = z.infer< typeof socialActivityResponseSchema >; +/** The follower response payload. */ export type FollowerResponse = z.infer< typeof followerResponseSchema >; +/** The follow response payload. */ export type FollowResponse = z.infer; +/** The blocked user response payload. */ export type BlockedUserResponse = z.infer; +/** The friend response payload. */ export type FriendResponse = z.infer; +/** The user stats response payload. */ export type UserStatsResponse = z.infer; +/** The comment type parameters. */ export type CommentTypeParams = z.infer; +/** The comment on type parameters. */ export type CommentOnTypeParams = z.infer; +/** The comment request payload. */ export type CommentRequest = z.infer; +/** The user comment response payload. */ export type UserCommentResponse = z.infer; +/** The watching response payload. */ export type WatchingResponse = z.infer; +/** The avatar request payload. */ export type AvatarRequest = z.infer; +/** The cover request payload. */ export type CoverRequest = z.infer; +/** The settings request payload. */ export type SettingsRequest = z.infer; +/** The month in review parameters. */ export type MonthInReviewParams = z.infer; +/** The month in review response payload. */ export type MonthInReviewResponse = z.infer; +/** The year in review parameters. */ export type YearInReviewParams = z.infer; +/** The year in review response payload. */ export type YearInReviewResponse = z.infer; +/** The reacted comment response payload. */ export type ReactedCommentResponse = z.infer< typeof reactedCommentResponseSchema >; +/** The sync response payload. */ export type SyncResponse = z.infer; +/** The sync item response payload. */ export type SyncItemResponse = z.infer; +/** The sync type parameters. */ export type SyncTypeParams = z.infer; +/** The sync id parameters. */ export type SyncIdParams = z.infer; +/** The plex settings response payload. */ export type PlexSettingsResponse = z.infer; +/** The plex settings update request payload. */ export type PlexSettingsUpdateRequest = z.infer< typeof plexSettingsUpdateSchema >; +/** The plex connect request payload. */ export type PlexConnectRequest = z.infer; +/** The plex connect response payload. */ export type PlexConnectResponse = z.infer; +/** The plex servers response payload. */ export type PlexServersResponse = z.infer; +/** The plex server type. */ export type PlexServer = z.infer; +/** The plex server accounts response payload. */ export type PlexServerAccountsResponse = z.infer< typeof plexServerAccountsResponseSchema >; +/** The plex account type. */ export type PlexAccount = z.infer; +/** The plex library type. */ export type PlexLibrary = z.infer; +/** The plex server parameters. */ export type PlexServerParams = z.infer; +/** The plex sync request payload. */ export type PlexSyncRequest = z.infer; +/** The plex error type. */ export type PlexError = z.infer; diff --git a/projects/api/src/contracts/users/schema/request/addFilterRequestSchema.ts b/projects/api/src/contracts/users/schema/request/addFilterRequestSchema.ts index 94b4d692..499f3eec 100644 --- a/projects/api/src/contracts/users/schema/request/addFilterRequestSchema.ts +++ b/projects/api/src/contracts/users/schema/request/addFilterRequestSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the add filter request. */ export const addFilterRequestSchema = z.object({ name: z.string(), url: z.string(), diff --git a/projects/api/src/contracts/users/schema/request/avatarRequestSchema.ts b/projects/api/src/contracts/users/schema/request/avatarRequestSchema.ts index 5fd4dd59..053874ed 100644 --- a/projects/api/src/contracts/users/schema/request/avatarRequestSchema.ts +++ b/projects/api/src/contracts/users/schema/request/avatarRequestSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the avatar request. */ export const avatarRequestSchema = z.object({ user: z.object({ avatar: z.string(), diff --git a/projects/api/src/contracts/users/schema/request/commentOnTypeParamsSchema.ts b/projects/api/src/contracts/users/schema/request/commentOnTypeParamsSchema.ts index 58d4671f..a0640286 100644 --- a/projects/api/src/contracts/users/schema/request/commentOnTypeParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/commentOnTypeParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the comment on type parameters. */ export const commentOnTypeParamsSchema = z.object({ type: z.enum([ 'all', diff --git a/projects/api/src/contracts/users/schema/request/commentTypeParamsSchema.ts b/projects/api/src/contracts/users/schema/request/commentTypeParamsSchema.ts index a470e6aa..8ff1bca1 100644 --- a/projects/api/src/contracts/users/schema/request/commentTypeParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/commentTypeParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the comment type parameters. */ export const commentTypeParamsSchema = z.object({ comment_type: z.enum(['all', 'reviews', 'shouts']), }); diff --git a/projects/api/src/contracts/users/schema/request/commentsRequestSchema.ts b/projects/api/src/contracts/users/schema/request/commentsRequestSchema.ts index 5aa6521f..34656e18 100644 --- a/projects/api/src/contracts/users/schema/request/commentsRequestSchema.ts +++ b/projects/api/src/contracts/users/schema/request/commentsRequestSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the comments request. */ export const commentsRequestSchema = z.object({ include_replies: z.enum(['true', 'false', 'only']).nullish(), }); diff --git a/projects/api/src/contracts/users/schema/request/coverRequestSchema.ts b/projects/api/src/contracts/users/schema/request/coverRequestSchema.ts index 353ed833..b8f612df 100644 --- a/projects/api/src/contracts/users/schema/request/coverRequestSchema.ts +++ b/projects/api/src/contracts/users/schema/request/coverRequestSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the cover request. */ export const coverRequestSchema = z.object({ cover_type: z.enum(['movie', 'show', 'episode']), cover_id: z.number().int(), diff --git a/projects/api/src/contracts/users/schema/request/createListRequestSchema.ts b/projects/api/src/contracts/users/schema/request/createListRequestSchema.ts index e2983423..8475988a 100644 --- a/projects/api/src/contracts/users/schema/request/createListRequestSchema.ts +++ b/projects/api/src/contracts/users/schema/request/createListRequestSchema.ts @@ -3,6 +3,7 @@ import { sortDirectionSchema } from '../../../_internal/response/sortDirectionSc import { z } from '../../../_internal/z.ts'; import { sortEnumSchema } from './sortParamsSchema.ts'; +/** Zod schema for the create list request. */ export const createListRequestSchema = z.object({ name: z.string(), description: z.string().optional(), diff --git a/projects/api/src/contracts/users/schema/request/dateRangeParamsSchema.ts b/projects/api/src/contracts/users/schema/request/dateRangeParamsSchema.ts index 1ca3e1b7..dcfd2c66 100644 --- a/projects/api/src/contracts/users/schema/request/dateRangeParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/dateRangeParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the date range parameters. */ export const dateRangeParamsSchema = z.object({ start_at: z.string().datetime().nullish() .openapi({ diff --git a/projects/api/src/contracts/users/schema/request/filterIdParamsSchema.ts b/projects/api/src/contracts/users/schema/request/filterIdParamsSchema.ts index 48f6ef18..c0ea2167 100644 --- a/projects/api/src/contracts/users/schema/request/filterIdParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/filterIdParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the filter id parameters. */ export const filterIdParamsSchema = z.object({ id: z.number().int().describe('ID of the saved filter'), }); diff --git a/projects/api/src/contracts/users/schema/request/hiddenParamsSchema.ts b/projects/api/src/contracts/users/schema/request/hiddenParamsSchema.ts index 0518b1c6..4f366a2e 100644 --- a/projects/api/src/contracts/users/schema/request/hiddenParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/hiddenParamsSchema.ts @@ -1,6 +1,7 @@ import { z } from '../../../_internal/z.ts'; import { hiddenSectionSchema } from './hiddenSectionSchema.ts'; +/** Zod schema for the hidden parameters. */ export const hiddenParamsSchema = z.object({ section: hiddenSectionSchema, }); diff --git a/projects/api/src/contracts/users/schema/request/hiddenSectionSchema.ts b/projects/api/src/contracts/users/schema/request/hiddenSectionSchema.ts index 52c09eaf..5d37e271 100644 --- a/projects/api/src/contracts/users/schema/request/hiddenSectionSchema.ts +++ b/projects/api/src/contracts/users/schema/request/hiddenSectionSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for hidden section. */ export const hiddenSectionSchema = z.enum([ 'calendar', 'progress_watched', diff --git a/projects/api/src/contracts/users/schema/request/hiddenShowRequestSchema.ts b/projects/api/src/contracts/users/schema/request/hiddenShowRequestSchema.ts index 87aa04cb..adf55189 100644 --- a/projects/api/src/contracts/users/schema/request/hiddenShowRequestSchema.ts +++ b/projects/api/src/contracts/users/schema/request/hiddenShowRequestSchema.ts @@ -1,3 +1,4 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the hidden show request. */ export const hiddenShowRequestSchema = z.object({ type: z.literal('show') }); diff --git a/projects/api/src/contracts/users/schema/request/historyItemIdParamsSchema.ts b/projects/api/src/contracts/users/schema/request/historyItemIdParamsSchema.ts index b460346a..f9d614b8 100644 --- a/projects/api/src/contracts/users/schema/request/historyItemIdParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/historyItemIdParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the history item id parameters. */ export const historyItemIdParamsSchema = z.object({ item_id: z.string(), }); diff --git a/projects/api/src/contracts/users/schema/request/listCommentsSortParamsSchema.ts b/projects/api/src/contracts/users/schema/request/listCommentsSortParamsSchema.ts index 0f1282f5..62f6b9d4 100644 --- a/projects/api/src/contracts/users/schema/request/listCommentsSortParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/listCommentsSortParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the list comments sort parameters. */ export const listCommentsSortParamsSchema = z.object({ sort: z.enum([ 'newest', diff --git a/projects/api/src/contracts/users/schema/request/listParamsSchema.ts b/projects/api/src/contracts/users/schema/request/listParamsSchema.ts index fd1a20e9..4a16be61 100644 --- a/projects/api/src/contracts/users/schema/request/listParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/listParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the list parameters. */ export const listParamsSchema = z.object({ list_id: z.string(), }); diff --git a/projects/api/src/contracts/users/schema/request/listUpdateRequestSchema.ts b/projects/api/src/contracts/users/schema/request/listUpdateRequestSchema.ts index 889f6780..60d71fa3 100644 --- a/projects/api/src/contracts/users/schema/request/listUpdateRequestSchema.ts +++ b/projects/api/src/contracts/users/schema/request/listUpdateRequestSchema.ts @@ -1,6 +1,7 @@ import { listPrivacyEnumSchema } from '../../../_internal/response/listPrivacyEnumSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the list update request. */ export const listUpdateRequestSchema = z.object({ name: z.string().nullish(), description: z.string().nullish(), diff --git a/projects/api/src/contracts/users/schema/request/monthInReviewParamsSchema.ts b/projects/api/src/contracts/users/schema/request/monthInReviewParamsSchema.ts index 41eac9d4..ac0c2983 100644 --- a/projects/api/src/contracts/users/schema/request/monthInReviewParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/monthInReviewParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the month in review parameters. */ export const monthInReviewParamsSchema = z.object({ year: z.number().int(), month: z.number().int(), diff --git a/projects/api/src/contracts/users/schema/request/plexConnectRequestSchema.ts b/projects/api/src/contracts/users/schema/request/plexConnectRequestSchema.ts index 885522e0..4011cd05 100644 --- a/projects/api/src/contracts/users/schema/request/plexConnectRequestSchema.ts +++ b/projects/api/src/contracts/users/schema/request/plexConnectRequestSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the plex connect request. */ export const plexConnectRequestSchema = z.object({ return_url: z.string().openapi({ description: diff --git a/projects/api/src/contracts/users/schema/request/plexServerParamsSchema.ts b/projects/api/src/contracts/users/schema/request/plexServerParamsSchema.ts index 8c3580ed..303164ff 100644 --- a/projects/api/src/contracts/users/schema/request/plexServerParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/plexServerParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the plex server parameters. */ export const plexServerParamsSchema = z.object({ server_id: z.string().openapi({ description: 'The Plex server machine identifier.', diff --git a/projects/api/src/contracts/users/schema/request/plexSettingsUpdateSchema.ts b/projects/api/src/contracts/users/schema/request/plexSettingsUpdateSchema.ts index 55657177..d4b73db3 100644 --- a/projects/api/src/contracts/users/schema/request/plexSettingsUpdateSchema.ts +++ b/projects/api/src/contracts/users/schema/request/plexSettingsUpdateSchema.ts @@ -14,6 +14,7 @@ import { // Mirrors the GET shape so it round-trips. Every key is optional and omitted // toggle keys are left unchanged server-side (no clobbering), so each toggle // group is a partial of its response counterpart. +/** Zod schema for plex settings update. */ export const plexSettingsUpdateSchema = z.object({ sync: z.object({ selection: z.object({ diff --git a/projects/api/src/contracts/users/schema/request/plexSyncRequestSchema.ts b/projects/api/src/contracts/users/schema/request/plexSyncRequestSchema.ts index 4b4ca8a3..e7705676 100644 --- a/projects/api/src/contracts/users/schema/request/plexSyncRequestSchema.ts +++ b/projects/api/src/contracts/users/schema/request/plexSyncRequestSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the plex sync request. */ export const plexSyncRequestSchema = z.object({ server_id: z.string().optional().openapi({ description: diff --git a/projects/api/src/contracts/users/schema/request/profileParamsSchema.ts b/projects/api/src/contracts/users/schema/request/profileParamsSchema.ts index 354e4da9..08b40989 100644 --- a/projects/api/src/contracts/users/schema/request/profileParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/profileParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the profile parameters. */ export const profileParamsSchema = z.object({ id: z.string().openapi({ description: diff --git a/projects/api/src/contracts/users/schema/request/reorderRequestSchema.ts b/projects/api/src/contracts/users/schema/request/reorderRequestSchema.ts index fa39ccb3..2c34282a 100644 --- a/projects/api/src/contracts/users/schema/request/reorderRequestSchema.ts +++ b/projects/api/src/contracts/users/schema/request/reorderRequestSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the reorder request. */ export const reorderRequestSchema = z.object({ rank: z.array(z.number().int()), }); diff --git a/projects/api/src/contracts/users/schema/request/sectionParamsSchema.ts b/projects/api/src/contracts/users/schema/request/sectionParamsSchema.ts index 527d992f..938fdd7c 100644 --- a/projects/api/src/contracts/users/schema/request/sectionParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/sectionParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the section parameters. */ export const sectionParamsSchema = z.object({ section: z.enum([ 'movies', diff --git a/projects/api/src/contracts/users/schema/request/settingsRequestSchema.ts b/projects/api/src/contracts/users/schema/request/settingsRequestSchema.ts index 0119c2f8..9946767c 100644 --- a/projects/api/src/contracts/users/schema/request/settingsRequestSchema.ts +++ b/projects/api/src/contracts/users/schema/request/settingsRequestSchema.ts @@ -32,6 +32,7 @@ const browsingSettingsSchema = z.object({ locale: z.string().nullish(), }); +/** Zod schema for the settings request. */ export const settingsRequestSchema = z.object({ user: userSettingsSettingsSchema.nullish(), browsing: browsingSettingsSchema.nullish(), diff --git a/projects/api/src/contracts/users/schema/request/socialActivityParamsSchema.ts b/projects/api/src/contracts/users/schema/request/socialActivityParamsSchema.ts index be53ee27..7cf42368 100644 --- a/projects/api/src/contracts/users/schema/request/socialActivityParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/socialActivityParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the social activity parameters. */ export const socialActivityParamsSchema = z.object({ type: z.enum(['friends', 'followers', 'following']), }); diff --git a/projects/api/src/contracts/users/schema/request/sortParamsSchema.ts b/projects/api/src/contracts/users/schema/request/sortParamsSchema.ts index 2a296500..ca8f59cf 100644 --- a/projects/api/src/contracts/users/schema/request/sortParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/sortParamsSchema.ts @@ -1,6 +1,7 @@ import { asString, z } from '../../../_internal/z.ts'; // FIXME: add vip-only sort options +/** Zod schema for sort enum. */ export const sortEnumSchema = asString(z.enum([ 'rank', 'added', @@ -13,6 +14,7 @@ export const sortEnumSchema = asString(z.enum([ ])); // FIXME split up param & response schemas +/** Zod schema for the sort parameters. */ export const sortParamsSchema = z.object({ sort: sortEnumSchema, }).openapi({ diff --git a/projects/api/src/contracts/users/schema/request/syncIdParamsSchema.ts b/projects/api/src/contracts/users/schema/request/syncIdParamsSchema.ts index 89e061aa..83128622 100644 --- a/projects/api/src/contracts/users/schema/request/syncIdParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/syncIdParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the sync id parameters. */ export const syncIdParamsSchema = z.object({ id: z.number().int().openapi({ description: diff --git a/projects/api/src/contracts/users/schema/request/syncTypeParamsSchema.ts b/projects/api/src/contracts/users/schema/request/syncTypeParamsSchema.ts index 002e8653..d804c001 100644 --- a/projects/api/src/contracts/users/schema/request/syncTypeParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/syncTypeParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the sync type parameters. */ export const syncTypeParamsSchema = z.object({ type: z.enum(['younify', 'plex', 'import']).openapi({ description: diff --git a/projects/api/src/contracts/users/schema/request/userReportRequestSchema.ts b/projects/api/src/contracts/users/schema/request/userReportRequestSchema.ts index a79cc640..df229f16 100644 --- a/projects/api/src/contracts/users/schema/request/userReportRequestSchema.ts +++ b/projects/api/src/contracts/users/schema/request/userReportRequestSchema.ts @@ -1,5 +1,6 @@ import { reportRequestSchemaFactory } from '../../../_internal/request/reportRequestSchemaFactory.ts'; +/** Zod schema for the user report request. */ export const userReportRequestSchema = reportRequestSchemaFactory( [ 'spam', diff --git a/projects/api/src/contracts/users/schema/request/yearInReviewParamsSchema.ts b/projects/api/src/contracts/users/schema/request/yearInReviewParamsSchema.ts index 4b0a32a8..3b5110aa 100644 --- a/projects/api/src/contracts/users/schema/request/yearInReviewParamsSchema.ts +++ b/projects/api/src/contracts/users/schema/request/yearInReviewParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the year in review parameters. */ export const yearInReviewParamsSchema = z.object({ year: z.number().int(), }); diff --git a/projects/api/src/contracts/users/schema/response/activityHistoryResponseSchema.ts b/projects/api/src/contracts/users/schema/response/activityHistoryResponseSchema.ts index c1c6a769..792590dc 100644 --- a/projects/api/src/contracts/users/schema/response/activityHistoryResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/activityHistoryResponseSchema.ts @@ -21,6 +21,7 @@ const historyMovieSchema = z.object({ movie: movieResponseSchema.nullish(), }); +/** Zod schema for the activity history response. */ export const activityHistoryResponseSchema = z.union([ historyBaseSchema.merge(historyEpisodeSchema), historyBaseSchema.merge(historyMovieSchema), diff --git a/projects/api/src/contracts/users/schema/response/addFilterResponseSchema.ts b/projects/api/src/contracts/users/schema/response/addFilterResponseSchema.ts index e471c07c..06f66030 100644 --- a/projects/api/src/contracts/users/schema/response/addFilterResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/addFilterResponseSchema.ts @@ -2,6 +2,7 @@ import { z } from '../../../_internal/z.ts'; import { addFilterRequestSchema } from '../request/addFilterRequestSchema.ts'; import { filterResponseSchema } from './filterResponseSchema.ts'; +/** Zod schema for the add filter response. */ export const addFilterResponseSchema = z.object({ added: filterResponseSchema.array(), skipped: addFilterRequestSchema.array(), diff --git a/projects/api/src/contracts/users/schema/response/blockedUserResponseSchema.ts b/projects/api/src/contracts/users/schema/response/blockedUserResponseSchema.ts index fe590101..85f51b3e 100644 --- a/projects/api/src/contracts/users/schema/response/blockedUserResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/blockedUserResponseSchema.ts @@ -1,6 +1,7 @@ import { profileResponseSchema } from '../../../_internal/response/profileResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the blocked user response. */ export const blockedUserResponseSchema = z.object({ blocked_at: z.string().datetime(), user: profileResponseSchema, diff --git a/projects/api/src/contracts/users/schema/response/episodeActivityHistoryResponseSchema.ts b/projects/api/src/contracts/users/schema/response/episodeActivityHistoryResponseSchema.ts index 37a5a30b..5f346f31 100644 --- a/projects/api/src/contracts/users/schema/response/episodeActivityHistoryResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/episodeActivityHistoryResponseSchema.ts @@ -2,6 +2,7 @@ import { typedEpisodeResponseSchema } from '../../../_internal/response/episodeR import { int64, z } from '../../../_internal/z.ts'; import { historyActionSchema } from './historyActionSchema.ts'; +/** Zod schema for the episode activity history response. */ export const episodeActivityHistoryResponseSchema = z.object({ id: int64(z.number().int()), watched_at: z.string().datetime(), diff --git a/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts b/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts index 07815300..d7d343dc 100644 --- a/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts @@ -1,6 +1,7 @@ import { typedMovieResponseSchema } from '../../../_internal/response/movieResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the favorited movies response. */ export const favoritedMoviesResponseSchema = z.object({ id: z.number().int(), listed_at: z.string().datetime(), diff --git a/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts b/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts index be59e12d..e9728ef4 100644 --- a/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts @@ -1,6 +1,7 @@ import { typedShowResponseSchema } from '../../../_internal/response/showResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the favorited shows response. */ export const favoritedShowsResponseSchema = z.object({ id: z.number().int(), listed_at: z.string().datetime(), diff --git a/projects/api/src/contracts/users/schema/response/filterResponseSchema.ts b/projects/api/src/contracts/users/schema/response/filterResponseSchema.ts index 4dabb234..bd503c28 100644 --- a/projects/api/src/contracts/users/schema/response/filterResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/filterResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../../../_internal/z.ts'; import { sectionParamsSchema } from '../request/sectionParamsSchema.ts'; +/** Zod schema for the filter response. */ export const filterResponseSchema = z.object({ rank: z.number().int(), id: z.number().int(), diff --git a/projects/api/src/contracts/users/schema/response/followResponseSchema.ts b/projects/api/src/contracts/users/schema/response/followResponseSchema.ts index 66b7eb49..288051a4 100644 --- a/projects/api/src/contracts/users/schema/response/followResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/followResponseSchema.ts @@ -1,6 +1,7 @@ import { profileResponseSchema } from '../../../_internal/response/profileResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the follow response. */ export const followResponseSchema = z.object({ approved_at: z.string().datetime().nullish(), user: profileResponseSchema, diff --git a/projects/api/src/contracts/users/schema/response/followerResponseSchema.ts b/projects/api/src/contracts/users/schema/response/followerResponseSchema.ts index ab3324bb..bcd7ced8 100644 --- a/projects/api/src/contracts/users/schema/response/followerResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/followerResponseSchema.ts @@ -1,6 +1,7 @@ import { profileResponseSchema } from '../../../_internal/response/profileResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the follower response. */ export const followerResponseSchema = z.object({ followed_at: z.string().datetime(), user: profileResponseSchema, diff --git a/projects/api/src/contracts/users/schema/response/friendResponseSchema.ts b/projects/api/src/contracts/users/schema/response/friendResponseSchema.ts index a2f48149..6fa7137b 100644 --- a/projects/api/src/contracts/users/schema/response/friendResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/friendResponseSchema.ts @@ -1,6 +1,7 @@ import { profileResponseSchema } from '../../../_internal/response/profileResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the friend response. */ export const friendResponseSchema = z.object({ friends_at: z.string().datetime(), user: profileResponseSchema, diff --git a/projects/api/src/contracts/users/schema/response/hiddenAddResponseSchema.ts b/projects/api/src/contracts/users/schema/response/hiddenAddResponseSchema.ts index 7422b99f..b89e78d7 100644 --- a/projects/api/src/contracts/users/schema/response/hiddenAddResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/hiddenAddResponseSchema.ts @@ -1,6 +1,7 @@ import { bulkMediaRequestSchema } from '../../../_internal/request/bulkMediaRequestSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the hidden add response. */ export const hiddenAddResponseSchema = z.object({ added: z.object({ movies: z.number().int(), diff --git a/projects/api/src/contracts/users/schema/response/hiddenRemoveResponseSchema.ts b/projects/api/src/contracts/users/schema/response/hiddenRemoveResponseSchema.ts index d905a040..26dfd96b 100644 --- a/projects/api/src/contracts/users/schema/response/hiddenRemoveResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/hiddenRemoveResponseSchema.ts @@ -1,6 +1,7 @@ import { bulkMediaRequestSchema } from '../../../_internal/request/bulkMediaRequestSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the hidden remove response. */ export const hiddenRemoveResponseSchema = z.object({ deleted: z.object({ movies: z.number().int(), episodes: z.number().int() }), not_found: bulkMediaRequestSchema, diff --git a/projects/api/src/contracts/users/schema/response/hiddenShowResponseSchema.ts b/projects/api/src/contracts/users/schema/response/hiddenShowResponseSchema.ts index c0e78816..d1fb214e 100644 --- a/projects/api/src/contracts/users/schema/response/hiddenShowResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/hiddenShowResponseSchema.ts @@ -1,6 +1,7 @@ import { typedShowResponseSchema } from '../../../_internal/response/showResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the hidden show response. */ export const hiddenShowResponseSchema = z.object({ hidden_at: z.string().datetime().nullish(), }).merge(typedShowResponseSchema); diff --git a/projects/api/src/contracts/users/schema/response/historyActionSchema.ts b/projects/api/src/contracts/users/schema/response/historyActionSchema.ts index 241ef634..80d4cfd1 100644 --- a/projects/api/src/contracts/users/schema/response/historyActionSchema.ts +++ b/projects/api/src/contracts/users/schema/response/historyActionSchema.ts @@ -1,3 +1,4 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for history action. */ export const historyActionSchema = z.enum(['scrobble', 'checkin', 'watch']); diff --git a/projects/api/src/contracts/users/schema/response/likedItemResponseSchema.ts b/projects/api/src/contracts/users/schema/response/likedItemResponseSchema.ts index 53c2f387..c01844e7 100644 --- a/projects/api/src/contracts/users/schema/response/likedItemResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/likedItemResponseSchema.ts @@ -63,6 +63,7 @@ const likedExtendedCommentResponseSchema = z.union( ], ); +/** Zod schema for the liked comment response. */ export const likedCommentResponseSchema = z.object({ liked_at: z.string().datetime(), type: z.literal('comment'), @@ -70,9 +71,10 @@ export const likedCommentResponseSchema = z.object({ * When using extended 'min', only the id is returned */ comment: commentResponseSchema.partial() - .extend({ id: z.number().int() }).nullish() + .extend({ id: z.number().int() }).nullish(), }).and(likedExtendedCommentResponseSchema); +/** Zod schema for the liked list response. */ export const likedListResponseSchema = z.object({ liked_at: z.string().datetime(), type: z.literal('list'), diff --git a/projects/api/src/contracts/users/schema/response/monthInReviewResponseSchema.ts b/projects/api/src/contracts/users/schema/response/monthInReviewResponseSchema.ts index 54f593bf..26000776 100644 --- a/projects/api/src/contracts/users/schema/response/monthInReviewResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/monthInReviewResponseSchema.ts @@ -94,6 +94,7 @@ const streamingServicesSchema = z.object({ // Shared by both the month- and year-in-review endpoints. Year in Review does // not include `streaming_services` (the catalog scan is bounded to a month). +/** Zod schema for review base. */ export const reviewBaseSchema = z.object({ stats: z.object({ all: statsCategoriesSchema.merge(z.object({ @@ -113,6 +114,7 @@ export const reviewBaseSchema = z.object({ thanks: thanksSchema, }); +/** Zod schema for the month in review response. */ export const monthInReviewResponseSchema = reviewBaseSchema.merge(z.object({ streaming_services: streamingServicesSchema, })); diff --git a/projects/api/src/contracts/users/schema/response/movieActivityHistoryResponseSchema.ts b/projects/api/src/contracts/users/schema/response/movieActivityHistoryResponseSchema.ts index d5018f01..efeec7a3 100644 --- a/projects/api/src/contracts/users/schema/response/movieActivityHistoryResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/movieActivityHistoryResponseSchema.ts @@ -2,6 +2,7 @@ import { typedMovieResponseSchema } from '../../../_internal/response/movieRespo import { int64, z } from '../../../_internal/z.ts'; import { historyActionSchema } from './historyActionSchema.ts'; +/** Zod schema for the movie activity history response. */ export const movieActivityHistoryResponseSchema = z.object({ id: int64(z.number().int()), watched_at: z.string().datetime(), diff --git a/projects/api/src/contracts/users/schema/response/plexConnectResponseSchema.ts b/projects/api/src/contracts/users/schema/response/plexConnectResponseSchema.ts index b4338762..31a87e98 100644 --- a/projects/api/src/contracts/users/schema/response/plexConnectResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/plexConnectResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the plex connect response. */ export const plexConnectResponseSchema = z.object({ url: z.string().openapi({ description: 'The Plex web-auth URL for the client to open.', diff --git a/projects/api/src/contracts/users/schema/response/plexErrorResponseSchema.ts b/projects/api/src/contracts/users/schema/response/plexErrorResponseSchema.ts index 0dd8b5a1..82994562 100644 --- a/projects/api/src/contracts/users/schema/response/plexErrorResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/plexErrorResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the plex error response. */ export const plexErrorResponseSchema = z.object({ error_code: z.string().openapi({ description: diff --git a/projects/api/src/contracts/users/schema/response/plexServerAccountsResponseSchema.ts b/projects/api/src/contracts/users/schema/response/plexServerAccountsResponseSchema.ts index f0c56d96..b7f0c07d 100644 --- a/projects/api/src/contracts/users/schema/response/plexServerAccountsResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/plexServerAccountsResponseSchema.ts @@ -1,10 +1,12 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for plex account. */ export const plexAccountSchema = z.object({ id: z.number().int(), name: z.string(), }); +/** Zod schema for plex library. */ export const plexLibrarySchema = z.object({ id: z.number().int(), uuid: z.string(), @@ -19,6 +21,7 @@ export const plexLibrarySchema = z.object({ url: z.string(), }); +/** Zod schema for the plex server accounts response. */ export const plexServerAccountsResponseSchema = z.object({ accounts: plexAccountSchema.array().openapi({ description: diff --git a/projects/api/src/contracts/users/schema/response/plexServersResponseSchema.ts b/projects/api/src/contracts/users/schema/response/plexServersResponseSchema.ts index d889ac7c..0ecfe152 100644 --- a/projects/api/src/contracts/users/schema/response/plexServersResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/plexServersResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for plex server. */ export const plexServerSchema = z.object({ id: z.string(), name: z.string(), @@ -16,6 +17,7 @@ export const plexServerSchema = z.object({ }), }); +/** Zod schema for the plex servers response. */ export const plexServersResponseSchema = z.object({ servers: plexServerSchema.array(), }); diff --git a/projects/api/src/contracts/users/schema/response/plexSettingsResponseSchema.ts b/projects/api/src/contracts/users/schema/response/plexSettingsResponseSchema.ts index 339a94ae..9fb1bdb4 100644 --- a/projects/api/src/contracts/users/schema/response/plexSettingsResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/plexSettingsResponseSchema.ts @@ -1,10 +1,12 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for plex library selection. */ export const plexLibrarySelectionSchema = z.object({ server_id: z.string(), uuid: z.string(), }); +/** Zod schema for sync movie toggles. */ export const syncMovieTogglesSchema = z.object({ watching: z.boolean(), watched: z.boolean(), @@ -13,15 +15,18 @@ export const syncMovieTogglesSchema = z.object({ watchlist: z.boolean(), }); +/** Zod schema for sync show toggles. */ export const syncShowTogglesSchema = z.object({ rated: z.boolean(), watchlist: z.boolean(), }); +/** Zod schema for sync season toggles. */ export const syncSeasonTogglesSchema = z.object({ rated: z.boolean(), }); +/** Zod schema for sync episode toggles. */ export const syncEpisodeTogglesSchema = z.object({ watching: z.boolean(), watched: z.boolean(), @@ -29,6 +34,7 @@ export const syncEpisodeTogglesSchema = z.object({ collected: z.boolean(), }); +/** Zod schema for scrobbler movie toggles. */ export const scrobblerMovieTogglesSchema = z.object({ watching: z.boolean(), watched: z.boolean(), @@ -36,14 +42,17 @@ export const scrobblerMovieTogglesSchema = z.object({ collected: z.boolean(), }); +/** Zod schema for scrobbler show toggles. */ export const scrobblerShowTogglesSchema = z.object({ rated: z.boolean(), }); +/** Zod schema for scrobbler season toggles. */ export const scrobblerSeasonTogglesSchema = z.object({ rated: z.boolean(), }); +/** Zod schema for scrobbler episode toggles. */ export const scrobblerEpisodeTogglesSchema = z.object({ watching: z.boolean(), watched: z.boolean(), @@ -51,6 +60,7 @@ export const scrobblerEpisodeTogglesSchema = z.object({ collected: z.boolean(), }); +/** Zod schema for plex sync toggles. */ export const plexSyncTogglesSchema = z.object({ movie: syncMovieTogglesSchema, show: syncShowTogglesSchema, @@ -58,6 +68,7 @@ export const plexSyncTogglesSchema = z.object({ episode: syncEpisodeTogglesSchema, }); +/** Zod schema for plex scrobbler toggles. */ export const plexScrobblerTogglesSchema = z.object({ movie: scrobblerMovieTogglesSchema, show: scrobblerShowTogglesSchema, @@ -65,6 +76,7 @@ export const plexScrobblerTogglesSchema = z.object({ episode: scrobblerEpisodeTogglesSchema, }); +/** Zod schema for the plex settings response. */ export const plexSettingsResponseSchema = z.object({ connection: z.object({ connected: z.boolean().openapi({ diff --git a/projects/api/src/contracts/users/schema/response/ratedItemResponseSchema.ts b/projects/api/src/contracts/users/schema/response/ratedItemResponseSchema.ts index 968e52cd..3b1c3c2a 100644 --- a/projects/api/src/contracts/users/schema/response/ratedItemResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/ratedItemResponseSchema.ts @@ -37,6 +37,7 @@ const ratedShowsResponseSchema = ratedResponseSchema show: showResponseSchema.nullish(), })); +/** Zod schema for the rated item response. */ export const RatedItemResponseSchema = z.union([ ratedEpisodesResponseSchema, ratedMoviesResponseSchema, diff --git a/projects/api/src/contracts/users/schema/response/reactedCommentResponseSchema.ts b/projects/api/src/contracts/users/schema/response/reactedCommentResponseSchema.ts index 8ceba268..a7adcb0c 100644 --- a/projects/api/src/contracts/users/schema/response/reactedCommentResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/reactedCommentResponseSchema.ts @@ -2,6 +2,7 @@ import { commentResponseSchema } from '../../../_internal/response/commentRespon import { reactionEnumSchema } from '../../../_internal/response/reactionsResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the reacted comment response. */ export const reactedCommentResponseSchema = z.object({ reacted_at: z.string().datetime(), reaction: z.object({ diff --git a/projects/api/src/contracts/users/schema/response/reorderListResponseSchema.ts b/projects/api/src/contracts/users/schema/response/reorderListResponseSchema.ts index 616de982..fe96c02e 100644 --- a/projects/api/src/contracts/users/schema/response/reorderListResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/reorderListResponseSchema.ts @@ -1,6 +1,7 @@ import { z } from '../../../_internal/z.ts'; import { reorderListsResponseSchema } from './reorderListsResponseSchema.ts'; +/** Zod schema for the reorder list response. */ export const reorderListResponseSchema = reorderListsResponseSchema.extend({ list: z.object({ updated_at: z.string().datetime(), diff --git a/projects/api/src/contracts/users/schema/response/reorderListsResponseSchema.ts b/projects/api/src/contracts/users/schema/response/reorderListsResponseSchema.ts index 0e818cbf..b0c15168 100644 --- a/projects/api/src/contracts/users/schema/response/reorderListsResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/reorderListsResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the reorder lists response. */ export const reorderListsResponseSchema = z.object({ updated: z.number().int(), skipped_ids: z.array(z.number().int()), diff --git a/projects/api/src/contracts/users/schema/response/requestsResponseSchema.ts b/projects/api/src/contracts/users/schema/response/requestsResponseSchema.ts index 5d40c084..4cef86b5 100644 --- a/projects/api/src/contracts/users/schema/response/requestsResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/requestsResponseSchema.ts @@ -1,6 +1,7 @@ import { profileResponseSchema } from '../../../_internal/response/profileResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the requests response. */ export const requestsResponseSchema = z.object({ id: z.number().int(), requested_at: z.string().datetime(), diff --git a/projects/api/src/contracts/users/schema/response/settingsResponseSchema.ts b/projects/api/src/contracts/users/schema/response/settingsResponseSchema.ts index a276ffa0..5e5e52d2 100644 --- a/projects/api/src/contracts/users/schema/response/settingsResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/settingsResponseSchema.ts @@ -4,6 +4,7 @@ import { sortDirectionSchema } from '../../../_internal/response/sortDirectionSc import { upNextSortBySchema } from '../../../_internal/response/upNextSortBySchema.ts'; import { watchActionSchema } from './watchActionSchema.ts'; +/** Zod schema for the settings response. */ export const settingsResponseSchema = z.object({ user: z.object({ username: z.string(), diff --git a/projects/api/src/contracts/users/schema/response/showActivityHistoryResponseSchema.ts b/projects/api/src/contracts/users/schema/response/showActivityHistoryResponseSchema.ts index 62e98308..fddec006 100644 --- a/projects/api/src/contracts/users/schema/response/showActivityHistoryResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/showActivityHistoryResponseSchema.ts @@ -2,6 +2,7 @@ import { typedEpisodeResponseSchema } from '../../../_internal/response/episodeR import { int64, z } from '../../../_internal/z.ts'; import { historyActionSchema } from './historyActionSchema.ts'; +/** Zod schema for the show activity history response. */ export const showActivityHistoryResponseSchema = z.object({ id: int64(z.number().int()), watched_at: z.string().datetime(), diff --git a/projects/api/src/contracts/users/schema/response/socialActivityResponseSchema.ts b/projects/api/src/contracts/users/schema/response/socialActivityResponseSchema.ts index d4d86042..d4228877 100644 --- a/projects/api/src/contracts/users/schema/response/socialActivityResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/socialActivityResponseSchema.ts @@ -23,6 +23,7 @@ const socialMovieResponseSchema = z.object({ movie: movieResponseSchema.nullish(), }); +/** Zod schema for the social activity response. */ export const socialActivityResponseSchema = z.union([ activitySchema.merge(socialEpisodeResponseSchema), activitySchema.merge(socialMovieResponseSchema), diff --git a/projects/api/src/contracts/users/schema/response/syncItemResponseSchema.ts b/projects/api/src/contracts/users/schema/response/syncItemResponseSchema.ts index 1e6638c0..369924c4 100644 --- a/projects/api/src/contracts/users/schema/response/syncItemResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/syncItemResponseSchema.ts @@ -34,12 +34,14 @@ const episodeVariantSchema = z.object({ show: showVariantSchema.nullable(), }); +/** Zod schema for trakt item. */ export const traktItemSchema = z.discriminatedUnion('type', [ movieVariantSchema, showVariantSchema, episodeVariantSchema, ]); +/** Zod schema for sync item. */ export const syncItemSchema = z.object({ kind: z.enum(['history', 'rating']).openapi({ description: diff --git a/projects/api/src/contracts/users/schema/response/syncResponseSchema.ts b/projects/api/src/contracts/users/schema/response/syncResponseSchema.ts index 5aba5e71..644b3596 100644 --- a/projects/api/src/contracts/users/schema/response/syncResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/syncResponseSchema.ts @@ -7,6 +7,7 @@ const countBlock = z.object({ seasons: z.number().int().optional(), }); +/** Zod schema for sync. */ export const syncSchema = z.object({ id: z.number().int(), created_at: z.string().datetime().openapi({ diff --git a/projects/api/src/contracts/users/schema/response/userCommentResponseSchema.ts b/projects/api/src/contracts/users/schema/response/userCommentResponseSchema.ts index c5eddbca..faed6dcd 100644 --- a/projects/api/src/contracts/users/schema/response/userCommentResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/userCommentResponseSchema.ts @@ -5,6 +5,7 @@ import { showResponseSchema } from '../../../_internal/response/showResponseSche import { z } from '../../../_internal/z.ts'; import { seasonResponseSchema } from '../../../shows/schema/response/seasonResponseSchema.ts'; +/** Zod schema for the user comment response. */ export const userCommentResponseSchema = z.object({ type: z.enum(['movie', 'show', 'season', 'episode']), comment: commentResponseSchema, diff --git a/projects/api/src/contracts/users/schema/response/userStatsResponseSchema.ts b/projects/api/src/contracts/users/schema/response/userStatsResponseSchema.ts index fe430b71..607544b1 100644 --- a/projects/api/src/contracts/users/schema/response/userStatsResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/userStatsResponseSchema.ts @@ -16,6 +16,7 @@ const fullStatsResponseSchema = extendedStatsResponseSchema.extend({ minutes: z.number().int(), }); +/** Zod schema for the user stats response. */ export const userStatsResponseSchema = z.object({ seasons: simpleStatsResponseSchema, shows: extendedStatsResponseSchema, diff --git a/projects/api/src/contracts/users/schema/response/watchActionSchema.ts b/projects/api/src/contracts/users/schema/response/watchActionSchema.ts index b6e14719..fded12ff 100644 --- a/projects/api/src/contracts/users/schema/response/watchActionSchema.ts +++ b/projects/api/src/contracts/users/schema/response/watchActionSchema.ts @@ -1,3 +1,4 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for watch action. */ export const watchActionSchema = z.enum(['now', 'ask', 'released', 'unknown']); diff --git a/projects/api/src/contracts/users/schema/response/watchedMoviesMinimalResponseSchema.ts b/projects/api/src/contracts/users/schema/response/watchedMoviesMinimalResponseSchema.ts index 117843d5..22a567e6 100644 --- a/projects/api/src/contracts/users/schema/response/watchedMoviesMinimalResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/watchedMoviesMinimalResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the watched movies minimal response. */ export const watchedMoviesMinimalResponseSchema = z.record( z.string(), z.string().datetime().array(), diff --git a/projects/api/src/contracts/users/schema/response/watchedMoviesResponseSchema.ts b/projects/api/src/contracts/users/schema/response/watchedMoviesResponseSchema.ts index 4b4b6535..d45a968e 100644 --- a/projects/api/src/contracts/users/schema/response/watchedMoviesResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/watchedMoviesResponseSchema.ts @@ -1,6 +1,7 @@ import { movieIdsResponseSchema } from '../../../_internal/response/movieIdsResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the watched movies response. */ export const watchedMoviesResponseSchema = z.array( z.object({ plays: z.number().int(), diff --git a/projects/api/src/contracts/users/schema/response/watchedShowsMinimalResponseSchema.ts b/projects/api/src/contracts/users/schema/response/watchedShowsMinimalResponseSchema.ts index fb741367..b70950b0 100644 --- a/projects/api/src/contracts/users/schema/response/watchedShowsMinimalResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/watchedShowsMinimalResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the watched shows minimal response. */ export const watchedShowsMinimalResponseSchema = z.record( z.string(), z.record( diff --git a/projects/api/src/contracts/users/schema/response/watchedShowsResponseSchema.ts b/projects/api/src/contracts/users/schema/response/watchedShowsResponseSchema.ts index 69f18545..570d7686 100644 --- a/projects/api/src/contracts/users/schema/response/watchedShowsResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/watchedShowsResponseSchema.ts @@ -1,6 +1,7 @@ import { showIdsResponseSchema } from '../../../_internal/response/showIdsResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; +/** Zod schema for the watched shows response. */ export const watchedShowsResponseSchema = z.array(z.object({ plays: z.number().int(), last_watched_at: z.string().datetime(), diff --git a/projects/api/src/contracts/users/schema/response/watchingResponseSchema.ts b/projects/api/src/contracts/users/schema/response/watchingResponseSchema.ts index c6cec7fb..3d988fc7 100644 --- a/projects/api/src/contracts/users/schema/response/watchingResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/watchingResponseSchema.ts @@ -22,6 +22,7 @@ const episodeWatchingResponseSchema = commonWatchingResponseSchema show: showResponseSchema.nullish(), })); +/** Zod schema for the watching response. */ export const watchingResponseSchema = z.union([ movieWatchingResponseSchema, episodeWatchingResponseSchema, diff --git a/projects/api/src/contracts/users/schema/response/yearInReviewResponseSchema.ts b/projects/api/src/contracts/users/schema/response/yearInReviewResponseSchema.ts index 3f745d00..7279c2db 100644 --- a/projects/api/src/contracts/users/schema/response/yearInReviewResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/yearInReviewResponseSchema.ts @@ -2,4 +2,5 @@ import { reviewBaseSchema } from './monthInReviewResponseSchema.ts'; // Year in Review returns the same shape as Month in Review minus // `streaming_services` (that catalog scan is bounded to a single month). +/** Zod schema for the year in review response. */ export const yearInReviewResponseSchema = reviewBaseSchema; diff --git a/projects/api/src/contracts/users/subroutes/favorites.ts b/projects/api/src/contracts/users/subroutes/favorites.ts index de132e82..dc8a1c53 100644 --- a/projects/api/src/contracts/users/subroutes/favorites.ts +++ b/projects/api/src/contracts/users/subroutes/favorites.ts @@ -16,6 +16,7 @@ const typedSortedFavoritesParamsSchema = profileParamsSchema.extend({ sort_how: z.string().describe('Sort direction.'), }); +/** ts-rest contract for the `favorites` endpoints. */ export const favorites = builder.router({ media: { summary: 'Get favorite media', @@ -101,7 +102,9 @@ Returns all top level comments for the favorites. By default, the comments are s pathPrefix: '/:id/favorites', }); +/** The favorite show response payload. */ export type FavoriteShowResponse = z.infer; +/** The favorite movie response payload. */ export type FavoriteMovieResponse = z.infer< typeof favoritedMoviesResponseSchema >; diff --git a/projects/api/src/contracts/users/subroutes/filters.ts b/projects/api/src/contracts/users/subroutes/filters.ts index 7a668ff4..11a740f4 100644 --- a/projects/api/src/contracts/users/subroutes/filters.ts +++ b/projects/api/src/contracts/users/subroutes/filters.ts @@ -7,6 +7,7 @@ import { sectionParamsSchema } from '../schema/request/sectionParamsSchema.ts'; import { addFilterResponseSchema } from '../schema/response/addFilterResponseSchema.ts'; import { filterResponseSchema } from '../schema/response/filterResponseSchema.ts'; +/** ts-rest contract for the `filters` endpoints. */ export const filters = builder.router({ saved: { summary: 'Get saved filters', @@ -47,5 +48,7 @@ Delete a saved filter by \`id\`. A successful delete returns \`204\`; an unknown pathPrefix: '/saved_filters', }); +/** The filter section type. */ export type FilterSection = z.infer; +/** The filter response payload. */ export type FilterResponse = z.infer; diff --git a/projects/api/src/contracts/users/subroutes/hidden.ts b/projects/api/src/contracts/users/subroutes/hidden.ts index 6f324d4c..c93e1c21 100644 --- a/projects/api/src/contracts/users/subroutes/hidden.ts +++ b/projects/api/src/contracts/users/subroutes/hidden.ts @@ -13,6 +13,7 @@ const hiddenTypeQuerySchema = z.object({ type: z.string().optional().describe('Hidden item type filter.'), }); +/** ts-rest contract for the `hidden` endpoints. */ export const hidden = builder.router({ add: { summary: 'Add hidden items', @@ -121,7 +122,9 @@ Remove hidden items for a specific section. Send hideable media objects in the r pathPrefix: '/hidden', }); +/** The hidden show item response payload. */ export type HiddenShowItemResponse = z.infer< typeof hiddenShowResponseSchema >; +/** The hidden media request payload. */ export type HiddenMediaRequest = z.infer; diff --git a/projects/api/src/contracts/users/subroutes/history.ts b/projects/api/src/contracts/users/subroutes/history.ts index c7065ecc..4f1237c5 100644 --- a/projects/api/src/contracts/users/subroutes/history.ts +++ b/projects/api/src/contracts/users/subroutes/history.ts @@ -17,6 +17,7 @@ const historyTypedItemParamsSchema = profileParamsSchema type: z.string().describe('History media type filter.'), }); +/** ts-rest contract for the `history` endpoints. */ export const history = builder.router({ all: { summary: 'Get watched history', @@ -140,15 +141,19 @@ Returns watched history entries for one item. Use \`type\`, \`item_id\`, \`start pathPrefix: '/:id/history', }); +/** The movie activity history response payload. */ export type MovieActivityHistoryResponse = z.infer< typeof movieActivityHistoryResponseSchema >; +/** The show activity history response payload. */ export type ShowActivityHistoryResponse = z.infer< typeof showActivityHistoryResponseSchema >; +/** The activity history response payload. */ export type ActivityHistoryResponse = z.infer< typeof activityHistoryResponseSchema >; +/** The episode activity history response payload. */ export type EpisodeActivityHistoryResponse = z.infer< typeof episodeActivityHistoryResponseSchema >; diff --git a/projects/api/src/contracts/users/subroutes/ratings.ts b/projects/api/src/contracts/users/subroutes/ratings.ts index 385eda93..861b2f53 100644 --- a/projects/api/src/contracts/users/subroutes/ratings.ts +++ b/projects/api/src/contracts/users/subroutes/ratings.ts @@ -10,6 +10,7 @@ const typedRatingParamsSchema = profileParamsSchema.extend({ rating: z.string().describe('Rating filter from 1 to 10.'), }); +/** ts-rest contract for the `ratings` endpoints. */ export const ratings = builder.router({ movies: { summary: 'Get movie ratings', @@ -80,4 +81,5 @@ Returns all ratings by a user including each rating value and when it was rated. pathPrefix: '/:id/ratings', }); +/** The rated item response payload. */ export type RatedItemResponse = z.infer; diff --git a/projects/api/src/contracts/users/subroutes/requests.ts b/projects/api/src/contracts/users/subroutes/requests.ts index 445dcd4f..d649b18a 100644 --- a/projects/api/src/contracts/users/subroutes/requests.ts +++ b/projects/api/src/contracts/users/subroutes/requests.ts @@ -5,6 +5,7 @@ import { z } from '../../_internal/z.ts'; import { followerResponseSchema } from '../schema/response/followerResponseSchema.ts'; import { requestsResponseSchema } from '../schema/response/requestsResponseSchema.ts'; +/** ts-rest contract for the `requests` endpoints. */ export const requests = builder.router({ follow: { summary: 'Get follow requests', @@ -58,4 +59,5 @@ Deny a follower using the \`id\` of the request. If the \`id\` is not found, was pathPrefix: '/requests', }); +/** The requests response payload. */ export type RequestsResponse = z.infer; diff --git a/projects/api/src/contracts/users/subroutes/smartLists.ts b/projects/api/src/contracts/users/subroutes/smartLists.ts index 0ff7436e..c74ac5af 100644 --- a/projects/api/src/contracts/users/subroutes/smartLists.ts +++ b/projects/api/src/contracts/users/subroutes/smartLists.ts @@ -48,6 +48,7 @@ Remove a smart list.`, pathPrefix: '/:list_id', }); +/** ts-rest contract for the `smartLists` endpoints. */ export const smartLists = builder.router({ personal: { summary: "Get a user's smart lists", @@ -85,10 +86,13 @@ Create a new smart list. A smart list is a dynamic list driven by a \`source\` a pathPrefix: '/:id/smart-lists', }); +/** The smart list write request payload. */ export type SmartListWriteRequest = z.infer; +/** The smart list definition response payload. */ export type SmartListDefinitionResponse = z.infer< typeof smartListDefinitionResponseSchema >; +/** The smart list create response payload. */ export type SmartListCreateResponse = z.infer< typeof smartListCreateResponseSchema >; diff --git a/projects/api/src/contracts/users/subroutes/userLists.ts b/projects/api/src/contracts/users/subroutes/userLists.ts index d9f04945..f20ebda3 100644 --- a/projects/api/src/contracts/users/subroutes/userLists.ts +++ b/projects/api/src/contracts/users/subroutes/userLists.ts @@ -362,6 +362,7 @@ Report a list for moderator review. Send a \`reason\` and optional \`message\` w pathPrefix: '/:list_id', }); +/** ts-rest contract for the `userLists` endpoints. */ export const userLists = builder.router({ personal: { summary: "Get a user's personal lists", @@ -441,16 +442,23 @@ Lists will be \`private\` by default. Here is what each value means. pathPrefix: '/:id/lists', }); +/** The reorder request payload. */ export type ReorderRequest = z.infer; +/** The reorder lists response payload. */ export type ReorderListsResponse = z.infer; +/** The reorder list response schema type. */ export type ReorderListResponseSchema = z.infer< typeof reorderListResponseSchema >; +/** The list comments sort parameters. */ export type ListCommentsSortParams = z.infer< typeof listCommentsSortParamsSchema >; +/** The list request payload. */ export type ListRequest = z.infer; +/** The list update request payload. */ export type ListUpdateRequest = z.infer; +/** The create list request payload. */ export type CreateListRequest = z.infer; diff --git a/projects/api/src/contracts/users/subroutes/watched.ts b/projects/api/src/contracts/users/subroutes/watched.ts index 03381686..139705fd 100644 --- a/projects/api/src/contracts/users/subroutes/watched.ts +++ b/projects/api/src/contracts/users/subroutes/watched.ts @@ -14,6 +14,7 @@ const watchedTypeParamsSchema = profileParamsSchema.extend({ type: z.string().describe('Watched media type filter.'), }); +/** ts-rest contract for the `watched` endpoints. */ export const watched = builder.router({ movies: { path: '/movies', @@ -86,13 +87,17 @@ Returns shows watched by a user in a minimal paginated format. Use \`specials\` pathPrefix: '/:id/watched', }); +/** The watched movies response payload. */ export type WatchedMoviesResponse = z.infer; +/** The watched shows response payload. */ export type WatchedShowsResponse = z.infer; +/** The watched movies minimal response payload. */ export type WatchedMoviesMinimalResponse = z.infer< typeof watchedMoviesMinimalResponseSchema >; +/** The watched shows minimal response payload. */ export type WatchedShowsMinimalResponse = z.infer< typeof watchedShowsMinimalResponseSchema >; diff --git a/projects/api/src/contracts/users/subroutes/watchlist.ts b/projects/api/src/contracts/users/subroutes/watchlist.ts index cdee8cca..12d19fae 100644 --- a/projects/api/src/contracts/users/subroutes/watchlist.ts +++ b/projects/api/src/contracts/users/subroutes/watchlist.ts @@ -19,6 +19,7 @@ const typedSortedWatchlistParamsSchema = profileParamsSchema.extend({ sort_how: z.string().describe('Sort direction.'), }); +/** ts-rest contract for the `watchlist` endpoints. */ export const watchlist = builder.router({ movies: { summary: 'Get movie watchlist', diff --git a/projects/api/src/contracts/watchnow/index.ts b/projects/api/src/contracts/watchnow/index.ts index e0604f3b..65c3804b 100644 --- a/projects/api/src/contracts/watchnow/index.ts +++ b/projects/api/src/contracts/watchnow/index.ts @@ -5,6 +5,7 @@ import { watchNowSourcesResponseSchema, } from './schema/response/watchNowSourcesResponseSchema.ts'; +/** ts-rest contract for the `watchnow` endpoints. */ export const watchnow = builder.router({ sources: { all: { @@ -37,9 +38,11 @@ export const watchnow = builder.router({ export { watchNowSourceResponseSchema, watchNowSourcesResponseSchema }; +/** The watch now sources response payload. */ export type WatchNowSourcesResponse = z.infer< typeof watchNowSourcesResponseSchema >; +/** The watch now source response payload. */ export type WatchNowSourceResponse = z.infer< typeof watchNowSourceResponseSchema >; diff --git a/projects/api/src/contracts/watchnow/schema/response/watchNowSourcesResponseSchema.ts b/projects/api/src/contracts/watchnow/schema/response/watchNowSourcesResponseSchema.ts index f70ec805..b4c9ab74 100644 --- a/projects/api/src/contracts/watchnow/schema/response/watchNowSourcesResponseSchema.ts +++ b/projects/api/src/contracts/watchnow/schema/response/watchNowSourcesResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the watch now source response. */ export const watchNowSourceResponseSchema = z.object({ source: z.string(), name: z.string(), @@ -14,6 +15,7 @@ export const watchNowSourceResponseSchema = z.object({ }), }); +/** Zod schema for the watch now sources response. */ export const watchNowSourcesResponseSchema = z.record( z.string(), z.array(watchNowSourceResponseSchema), diff --git a/projects/api/src/contracts/younify/index.ts b/projects/api/src/contracts/younify/index.ts index 95712ba3..a4559722 100644 --- a/projects/api/src/contracts/younify/index.ts +++ b/projects/api/src/contracts/younify/index.ts @@ -6,6 +6,7 @@ import { serviceIdParamsSchema } from './schema/request/serviceIdParamsSchema.ts import { connectionSchema } from './schema/response/connectionResponseSchema.ts'; import { connectResponseSchema } from './schema/response/connectResponseSchema.ts'; +/** ts-rest contract for the `younify` endpoints. */ export const younify = builder.router({ connections: { summary: 'Get streaming connections', @@ -85,6 +86,9 @@ export { serviceIdParamsSchema, }; +/** The younify connection type. */ export type YounifyConnection = z.infer; +/** The younify connect request payload. */ export type YounifyConnectRequest = z.infer; +/** The younify connect response payload. */ export type YounifyConnectResponse = z.infer; diff --git a/projects/api/src/contracts/younify/schema/request/connectRequestSchema.ts b/projects/api/src/contracts/younify/schema/request/connectRequestSchema.ts index eb40c9b4..b8de0800 100644 --- a/projects/api/src/contracts/younify/schema/request/connectRequestSchema.ts +++ b/projects/api/src/contracts/younify/schema/request/connectRequestSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the connect request. */ export const connectRequestSchema = z.object({ service_id: z.string().openapi({ description: 'The streaming service to connect (e.g. `netflix`).', diff --git a/projects/api/src/contracts/younify/schema/request/refreshParamsSchema.ts b/projects/api/src/contracts/younify/schema/request/refreshParamsSchema.ts index a4577b8a..ec50dc03 100644 --- a/projects/api/src/contracts/younify/schema/request/refreshParamsSchema.ts +++ b/projects/api/src/contracts/younify/schema/request/refreshParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the refresh parameters. */ export const refreshParamsSchema = z.object({ service_id: z.string().openapi({ description: 'The streaming service id to re-sync (e.g. `netflix`).', diff --git a/projects/api/src/contracts/younify/schema/request/serviceIdParamsSchema.ts b/projects/api/src/contracts/younify/schema/request/serviceIdParamsSchema.ts index 99988140..4c2011b0 100644 --- a/projects/api/src/contracts/younify/schema/request/serviceIdParamsSchema.ts +++ b/projects/api/src/contracts/younify/schema/request/serviceIdParamsSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the service id parameters. */ export const serviceIdParamsSchema = z.object({ service_id: z.string().openapi({ description: 'The streaming service id (e.g. `netflix`).', diff --git a/projects/api/src/contracts/younify/schema/response/connectResponseSchema.ts b/projects/api/src/contracts/younify/schema/response/connectResponseSchema.ts index 56e29818..5bad06c9 100644 --- a/projects/api/src/contracts/younify/schema/response/connectResponseSchema.ts +++ b/projects/api/src/contracts/younify/schema/response/connectResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for the connect response. */ export const connectResponseSchema = z.object({ url: z.string().openapi({ description: 'The signed younify web-auth URL for the client to open.', diff --git a/projects/api/src/contracts/younify/schema/response/connectionResponseSchema.ts b/projects/api/src/contracts/younify/schema/response/connectionResponseSchema.ts index 866c2b44..3737084a 100644 --- a/projects/api/src/contracts/younify/schema/response/connectionResponseSchema.ts +++ b/projects/api/src/contracts/younify/schema/response/connectionResponseSchema.ts @@ -1,5 +1,6 @@ import { z } from '../../../_internal/z.ts'; +/** Zod schema for connection. */ export const connectionSchema = z.object({ id: z.string().openapi({ description: 'The streaming service id (e.g. `netflix`).', diff --git a/projects/api/src/index.ts b/projects/api/src/index.ts index 22fd90e9..8dfbd0cc 100644 --- a/projects/api/src/index.ts +++ b/projects/api/src/index.ts @@ -30,6 +30,7 @@ export * from './contracts/younify/index.ts'; export { Environment, traktContract }; +/** Options for constructing a Trakt API client via {@link traktApi}. */ export type TraktApiOptions = { /** * Trakt API environment target (production, staging, development) @@ -58,10 +59,12 @@ export type TraktApiOptions = { cancellationId?: string; }; +/** A fully typed Trakt API client, as returned by {@link traktApi}. */ export type TraktApi = ReturnType; const controllers = new Map(); +/** Error thrown when an in-flight request is aborted by a newer one with the same cancellation id. */ export class AbortError extends Error { constructor(message: string) { super(message); @@ -103,6 +106,7 @@ function createCancellationHandler(cancellable: boolean, id: string) { }; } +/** Aborts every in-flight request whose cancellation id matches `matcher`, with the given `reason`. */ export function abortRequest(matcher: (id: string) => boolean, reason: Error) { for (const [id, controller] of controllers) { if (!matcher(id)) { @@ -113,6 +117,10 @@ export function abortRequest(matcher: (id: string) => boolean, reason: Error) { } } +/** + * Builds a Trakt API client bound to the given environment and credentials. + * Prefer {@link traktApi}, which defaults `environment` to production. + */ export function traktApiFactory({ environment, apiKey, @@ -178,6 +186,20 @@ export function traktApiFactory({ }); } +/** + * Creates a fully typed Trakt API client. + * + * @example + * ```ts + * import { traktApi } from '@trakt/api'; + * + * const client = traktApi({ apiKey: '' }); + * const res = await client.movies.summary({ params: { id: 'tron-legacy-2010' } }); + * if (res.status === 200) { + * console.log(res.body.title); + * } + * ``` + */ export function traktApi({ environment = Environment.production, apiKey, diff --git a/projects/api/src/types/CombinationsFrom.ts b/projects/api/src/types/CombinationsFrom.ts index 4f32ab3e..7f32f82a 100644 --- a/projects/api/src/types/CombinationsFrom.ts +++ b/projects/api/src/types/CombinationsFrom.ts @@ -3,4 +3,5 @@ type Combinations = T extends ? F | `${F},${Combinations}` | Combinations : never; +/** The combinations from type. */ export type CombinationsFrom = Combinations; From 114e2bb974b9ddc78148e0cfb725ff61cec00232 Mon Sep 17 00:00:00 2001 From: Vlad Jerca Date: Thu, 16 Jul 2026 22:06:53 +0200 Subject: [PATCH 2/3] chore(api): bump @trakt/api to 0.5.1 0.5.0 was already published (static types only); 0.5.1 is the first version to ship the docs and JSR publish workflow. Published versions are immutable, so a new version is required to update the JSR score. --- projects/api/deno.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/api/deno.json b/projects/api/deno.json index 4831b540..54095b6d 100644 --- a/projects/api/deno.json +++ b/projects/api/deno.json @@ -1,7 +1,7 @@ { "name": "@trakt/api", "exports": "./mod.ts", - "version": "0.5.0", + "version": "0.5.1", "imports": { "@anatine/zod-openapi": "npm:@anatine/zod-openapi@^2.2.6", "@std/testing": "jsr:@std/testing@^1.0.5", From 2058e73dcf9100fd0031737967eaaf9a4a7aa513 Mon Sep 17 00:00:00 2001 From: Vlad Jerca Date: Thu, 16 Jul 2026 22:44:55 +0200 Subject: [PATCH 3/3] docs: add CLAUDE.md/AGENTS rules to hold the JSR 100 score Adds trakt-web-style agent rules: root CLAUDE.md routes to .agents/rules/, AGENTS.md loads the core project rule, and domain rules cover keeping the @trakt/api JSR score at 100 (jsr.md) and authoring contract schemas (schemas.md, migrated from the previous AGENTS.md). --- .agents/rules/jsr.md | 87 ++++++++++++++++++++++++++++++++++++++++ .agents/rules/project.md | 66 ++++++++++++++++++++++++++++++ .agents/rules/schemas.md | 56 ++++++++++++++++++++++++++ AGENTS.md | 50 ++++++----------------- CLAUDE.md | 10 +++++ projects/api/CLAUDE.md | 6 +++ 6 files changed, 237 insertions(+), 38 deletions(-) create mode 100644 .agents/rules/jsr.md create mode 100644 .agents/rules/project.md create mode 100644 .agents/rules/schemas.md create mode 100644 CLAUDE.md create mode 100644 projects/api/CLAUDE.md diff --git a/.agents/rules/jsr.md b/.agents/rules/jsr.md new file mode 100644 index 00000000..f181fd06 --- /dev/null +++ b/.agents/rules/jsr.md @@ -0,0 +1,87 @@ +--- +trigger: glob +globs: 'projects/api/**' +description: 'How @trakt/api keeps a 100 JSR score - static types, symbol docs, and provenance publishing. Read when touching projects/api.' +applyTo: 'projects/api/**' +--- + +# Keeping @trakt/api at a 100 JSR score + +The JSR score is scored per published version. Every rule below must hold in the +version you publish, or the score drops. Verify with +`cd projects/api && deno task publish:check` (expect `Success`, no +`--allow-slow-types`) before shipping. + +## 1. No slow types (static declarations) + +The contracts are Zod + ts-rest, whose fully-inferred types are JSR "slow +types". We do NOT publish with `--allow-slow-types`. Instead: + +- `mod.ts` is the published entry. Runtime comes from `./src/index.ts`; the + public types come from precomputed `./types/*.d.ts` via a + `// @ts-types="./types/index.d.ts"` directive. +- `deno task build:types` (scripts/build-types.ts) generates `./types` with + dnt + tsc, then rewrites relative import extensions to `.d.ts`. `types/` is + gitignored and force-included via `publish.include`; it is regenerated by the + `publish` / `publish:check` tasks. + +**A few aggregate types exceed TypeScript's own declaration-serialization limit +(TS7056) as a single literal.** They are kept precise by composing from `typeof` +references (or ts-rest's own `router` return type). Do not "simplify" these +annotations - they are load-bearing: + +- `traktContract` has an explicit `TraktContract` type of `typeof ` + references. **When you add a new domain router, add it to this alias**, or + `build:types` fails with TS7056. +- `users` uses `UsersInput` + + `UsersRouter = ReturnType>` with an + `as unknown as UsersRouter` cast. Keep the internal route groups + (`GLOBAL_LEVEL`, `ENTITY_LEVEL`, `syncs`, `plex`) non-exported. +- The query factories (`extendedQuerySchemaFactory`, `searchTypeParamFactory`, + `trendingSearchTypeParamFactory`) have explicit `z.ZodObject<{...}>` returns + (avoids TS5088 cyclic). +- `builder` is typed `ReturnType` (avoids TS4023). + +If a new symbol trips TS7056/TS5088/TS4023 during `build:types`, give it an +explicit type composed of named references - never fall back to +`--allow-slow-types`. + +## 2. Docs for every exported symbol (>= 80%, keep it 100%) + +JSR reads JSDoc from the symbol's type source. Because we ship generated +declarations, **source JSDoc is carried into `./types` and counted** - so every +exported symbol needs a `/** ... */` above it. + +- **Every new `export const` / `export type` / `export function` / + `export class` / `export enum` gets a JSDoc comment.** One tight line stating + what it is is enough (`/** Zod schema for the movie response. */`). +- Follow the existing naming-derived phrasing: `...ResponseSchema` -> "Zod + schema for the X response.", `XResponse` (type) -> "The X response payload.", + routers -> "ts-rest contract for the `/x` endpoints.", etc. +- The `mod.ts` module doc (with `@module` and an `@example` code block) and the + package `README.md` are required - do not remove them. Keep the example + compiling. +- Measure: `cd projects/api && deno doc src/index.ts` then confirm every + "Defined in" block has a doc line (target 100%). + +## 3. Provenance (publish only via CI) + +Provenance requires publishing through the GitHub Actions workflow with OIDC +(`.github/workflows/publish.yml`), which records a public transparency-log +entry. + +- **Never publish with a manual local `deno publish`** - that produces no + provenance and drops the score. +- Publish by cutting a GitHub release (or `workflow_dispatch` on the publish + workflow). The workflow runs `deno task build:types` then `deno publish`. +- **Bump `version` in `projects/api/deno.json` first** - JSR versions are + immutable; you cannot re-publish an existing version to fix its score. + +## Pre-publish checklist + +1. New/changed exports all have JSDoc. +2. New domain routers added to the `TraktContract` alias. +3. `deno task publish:check` -> `Success` (no `--allow-slow-types`). +4. `deno doc src/index.ts` symbol coverage is 100%. +5. `version` bumped in `projects/api/deno.json`. +6. Publish via the GitHub workflow, not locally. diff --git a/.agents/rules/project.md b/.agents/rules/project.md new file mode 100644 index 00000000..c95097b0 --- /dev/null +++ b/.agents/rules/project.md @@ -0,0 +1,66 @@ +--- +trigger: glob +globs: '**' +description: 'Core project overview, structure, tooling, and commit standards for the trakt-api monorepo. Apply to all files.' +applyTo: '**' +--- + +# Project Guidelines + +## Tech Stack + +Deno workspace (monorepo). TypeScript. The publishable artifact is `@trakt/api` +in `projects/api/` - a fully typed [ts-rest](https://ts-rest.com) contract + +client for the Trakt API, backed by Zod schemas, published to +[JSR](https://jsr.io/@trakt/api). + +## Project Structure + +``` +projects/ + api/ # @trakt/api - the published package + mod.ts # published entry (facade: runtime from src, types from ./types) + src/ # implementation: contracts, schemas, client + index.ts # barrel + client (traktApi, traktApiFactory) + contracts/ # one dir per domain (movies, shows, users, ...) + _internal/ # shared schemas, builder, request/response building blocks + traktContract.ts # aggregate contract of all domains + types/ # GENERATED static .d.ts (gitignored, built before publish) + scripts/ # build tooling (build-types.ts) + openapi/ # generates OpenAPI from the contract (runtime consumer) + playground/ # local scratch client +``` + +## Tooling + +- `deno task install` - frozen install (matches lockfile; run before CI work). +- `deno fmt` / `deno lint` - formatting and lint (config in root + api + deno.json). +- `deno task openapi:validate` - validates the generated OpenAPI. +- `cd projects/api && deno task test` - package tests. +- Never hand-edit `deno.lock` for build-only deps; `build:types` runs with + `--no-lock` so it never dirties it. + +## Commit Standards + +- **Conventional Commits** (enforced by commitlint on PRs): `feat:`, `fix:`, + `chore:`, `docs:`, `refactor:`, `test:`, `perf:`. Scope with `(api)` when the + change is in the package, e.g. `feat(api): add smart lists endpoints`. +- **Version bumps are their own `chore(api): bump ...` commit.** JSR versions + are immutable - every publish needs a new version. +- **No `Co-Authored-By` trailers**, no "generated with" footers. +- **No em-dashes or en-dashes** in commit messages, PR bodies, or review + replies - plain hyphens only. + +## Branching and PRs + +- Never commit to `master`. Branch first, open a PR, let CI gate it. +- Keep the PR description in sync with the branch as scope changes. +- Address review feedback by amending the origin commit (fixup + autosquash), + not by stacking "address review" commits. + +## Tone + +Direct, concise, technical. State assumptions before non-trivial changes. +Surgical diffs - every changed line traces to the request; do not "improve" +adjacent code. Match existing style even if you would do it differently. diff --git a/.agents/rules/schemas.md b/.agents/rules/schemas.md new file mode 100644 index 00000000..aa0741d7 --- /dev/null +++ b/.agents/rules/schemas.md @@ -0,0 +1,56 @@ +--- +trigger: glob +globs: 'projects/api/src/contracts/**' +description: 'Conventions for authoring ts-rest + Zod contract schemas. The OpenAPI spec and consumer models/clients are generated from these, so schema shape is a public artifact. Read when editing contracts.' +applyTo: 'projects/api/src/contracts/**' +--- + +# Schema authoring + +Conventions for authoring the ts-rest + Zod API contract. The OpenAPI spec and +consumer models/clients are generated from these schemas, so schema shape is a +public artifact, not just internal typing. + +## Response schemas + +### Polymorphic / multi-shape responses: one flat object, all fields nullish + +When an endpoint returns entries of more than one entity shape - a merged feed +(e.g. calendar `media` / `releases/hot` returning movies AND episodes), or any +route whose response varies by a `type=movie|show|episode|...` param - model the +response as a SINGLE object with **every shape-specific field nullish**. Do NOT +use `z.union([...])`. + +```ts +// ❌ BAD: union -> OpenAPI `oneOf` -> codegen emits a model with ALL fields +// required, so consumers get a wrong schema. +export const feedResponseSchema = z.union([movieEntrySchema, showEntrySchema]); + +// ✅ GOOD: one flat object, shape-specific fields nullish -> codegen emits a +// correct all-optional model. Discriminate by shape at runtime. +export const feedResponseSchema = z.object({ + released: z.string().nullish(), + movie: movieResponseSchema.nullish(), + first_aired: z.string().nullish(), + episode: episodeResponseSchema.nullish(), + show: showResponseSchema.nullish(), +}); +``` + +**Why:** OpenAPI codegen turns a union `oneOf` into a single model with every +member's fields marked required, so a downstream consumer sees `movie`, `show`, +`episode`, `season`, etc. all as non-null and its generated model is wrong. +Nullish fields on one object generate a correct optional-field model; the caller +null-checks (`if (entry.movie) ...`) to discriminate. + +Single-shape responses stay fully required - only widen to nullish the fields +that are genuinely absent for some variant. + +Reference: +`projects/api/src/contracts/calendars/schema/response/hotReleaseResponseSchema.ts`. + +## JSR score + +Every exported schema and type is a public symbol on JSR and must carry a JSDoc +`/** ... */`, and new domain routers must be added to the `traktContract` type +alias. See `jsr.md` for the full rules that keep the score at 100. diff --git a/AGENTS.md b/AGENTS.md index c5f18a88..c760a3d7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,43 +1,17 @@ -# trakt-api agent rules +# Always-loaded core (small, project-wide) -Conventions for authoring the ts-rest + zod API contract. The OpenAPI spec and -consumer models/clients are generated from these schemas, so schema shape is a -public artifact, not just internal typing. +@.agents/rules/project.md -## Response schemas +# Domain rules - load on demand -### Polymorphic / multi-shape responses: one flat object, all fields nullish +Domain-specific rules are NOT auto-imported, to keep the baseline small. Read +them when the work touches the matching area (CLAUDE.md routes the mapping; the +rule files live at `.agents/rules/`): -When an endpoint returns entries of more than one entity shape - a merged feed -(e.g. calendar `media` / `releases/hot` returning movies AND episodes), or any -route whose response varies by a `type=movie|show|episode|...` param - model the -response as a SINGLE object with **every shape-specific field nullish**. Do NOT -use `z.union([...])`. +- `jsr.md` - anything under `projects/api/`: static types, symbol docs, and + provenance publishing that keep the `@trakt/api` JSR score at 100. +- `schemas.md` - authoring ts-rest + Zod contract schemas under + `projects/api/src/contracts/` (schema shape is a generated public artifact). -```ts -// ❌ BAD: union -> OpenAPI `oneOf` -> codegen emits a model with ALL fields -// required, so consumers get a wrong schema. -export const feedResponseSchema = z.union([movieEntrySchema, showEntrySchema]); - -// ✅ GOOD: one flat object, shape-specific fields nullish -> codegen emits a -// correct all-optional model. Discriminate by shape at runtime. -export const feedResponseSchema = z.object({ - released: z.string().nullish(), - movie: movieResponseSchema.nullish(), - first_aired: z.string().nullish(), - episode: episodeResponseSchema.nullish(), - show: showResponseSchema.nullish(), -}); -``` - -**Why:** OpenAPI codegen turns a union `oneOf` into a single model with every -member's fields marked required, so a downstream consumer sees `movie`, `show`, -`episode`, `season`, etc. all as non-null and its generated model is wrong. -Nullish fields on one object generate a correct optional-field model; the caller -null-checks (`if (entry.movie) ...`) to discriminate. - -Single-shape responses stay fully required - only widen to nullish the fields -that are genuinely absent for some variant. - -Reference: -`projects/api/src/contracts/calendars/schema/response/hotReleaseResponseSchema.ts`. +Read with the Read tool when the task enters the domain. Re-read after long gaps +if context was compacted. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..83c72b60 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,10 @@ +Before implementing anything, identify which area you are working in and read +the corresponding rule file from `.agents/rules/` (only the core rules auto-load +via AGENTS.md; domain rules load on demand): + +- Published package (`projects/api/**`): read `jsr.md` - keeps the `@trakt/api` + JSR score at 100 (static types, symbol docs, provenance publishing). +- Contract schemas (`projects/api/src/contracts/**`): also read `schemas.md`. +- Everything else: `project.md` (always-on baseline, already loaded as core). + +@AGENTS.md diff --git a/projects/api/CLAUDE.md b/projects/api/CLAUDE.md new file mode 100644 index 00000000..4aa6525a --- /dev/null +++ b/projects/api/CLAUDE.md @@ -0,0 +1,6 @@ +This is the published `@trakt/api` package. Keeping its JSR score at 100 has +hard rules - read them before changing exports, schemas, or the publish flow: + +@../../.agents/rules/jsr.md + +@../../.agents/rules/schemas.md