import { Any, TraktSharing } from './trakt-entity.model.js'; import { TraktEpisode } from './trakt-episode.model.js'; import { TraktMovie } from './trakt-movie.model.js'; import { TraktShow } from './trakt-show.model.js'; import '@dvcol/common-utils/common/models'; import './trakt-client.model.js'; import '@dvcol/base-http-client'; import '@dvcol/common-utils/http/fetch'; import '../api/trakt-api.filters.js'; import './trakt-id.model.js'; import './trakt-image.model.js'; import './trakt-people.model.js'; type BaseTraktCheckin = { movie: TraktMovie; episode: TraktEpisode; show: TraktShow; }; type TypedTraktCheckin = T extends 'movie' ? Pick : T extends 'show' ? Pick : T extends 'episode' ? Pick : Partial; type TraktCheckin = { id: number; /** Timestamp in ISO 8601 GMT format (YYYY-MM-DD'T'hh:mm:ss.sssZ) */ watched_at: string; sharing: TraktSharing; } & TypedTraktCheckin; /** * Error when there is already a checkin in progress. (code 409) */ type TraktCheckinError = { /** Timestamp in ISO 8601 GMT format (YYYY-MM-DD'T'hh:mm:ss.sssZ) */ expires_at: '2014-10-15T22:21:29.000Z'; }; type TraktCheckinRequestMovie = { /** Movie to be checked-in */ movie: Partial & { ids: Pick & Partial>; }; }; type TraktCheckinRequestShow = { /** Show to be checked-in */ show: TraktShow; /** Episode to be checked-in. If no traktv ids is provided, either episode's season & number or number_abs is required */ episode: Partial & (Pick | { number_abs: number; }); }; type TraktCheckinRequestEpisode = { /** Episode to be checked-in. If no show is provided, traktv ids are required */ episode: Partial & { ids: Pick & Partial>; }; }; type TraktCheckinRequestItem = T extends 'movie' ? TraktCheckinRequestMovie : T extends 'show' ? TraktCheckinRequestShow : T extends 'episode' ? TraktCheckinRequestEpisode : TraktCheckinRequestMovie | TraktCheckinRequestEpisode | TraktCheckinRequestShow; type TraktCheckinRequest = { /** * Control sharing to any connected social networks. * * The sharing object is optional and will apply the user's settings if not sent. * If sharing is sent, each key will override the user's setting for that social network. * Send true to post or false to not post on the indicated social network. * You can see which social networks a user has connected with the [/users/settings]{@link https://trakt.docs.apiary.io/reference/users/settings} method. * * Note: If a checkin is already in progress, a 409 HTTP status code will returned. The response will contain an expires_at timestamp which is when the user can check in again. */ sharing?: TraktSharing; /** Message used for sharing. If not sent, it will use the watching string in the user settings. */ message?: string; } & TraktCheckinRequestItem; export type { TraktCheckin, TraktCheckinError, TraktCheckinRequest, TypedTraktCheckin };