TheIntroDB Package Docs

Documentation for the theintrodb NPM package

View on GitHub

Types

Exported Constants

MEDIA_TYPES

Readonly array of supported media kinds:

SEGMENT_TYPES

Readonly array of supported segment kinds:

SUBMISSION_STATUSES

Readonly array of submission states:

EPISODE_ORDERS

Readonly array of canonical TVDB episode orders accepted as a mapping:

EPISODE_ORDER_ALIASES

Record mapping every accepted mapping spelling to its canonical EpisodeOrder. It mirrors the API’s alias set, so the same spellings the server accepts are accepted (and canonicalised) by the package before a request is sent. Besides the six canonical names it carries:

MEDIA_RESPONSE_KINDS

Readonly array of GET /media response discriminants:

Core Client Types

TIDBClient

Returned by createIntroDbClient().

Methods:

TIDBClientOptions

Shared options for a reusable client instance.

Fields:

TIDBRequestOptions

Per-request overrides for client methods.

Fields:

TIDBTransportOptions

Transport options used by standalone functions.

Fields:

TIDBLogger

Optional logging interface.

Methods:

Media Types

MediaType

Union of:

SegmentType

Union of:

SubmissionStatus

Union of:

EpisodeOrder

Union of the six canonical TVDB orders. See EPISODE_ORDERS.

EpisodeOrderInput

EpisodeOrder | string: a canonical order name or any accepted alias. Aliases are canonicalised by the package before a request is sent.

EpisodeSelection

number | string. The string form may be a single number ('1'), a comma-separated list ('1,2'), an ascending range ('1-3'), or a mix ('1,3-4,6').

Request Types

GetMediaParams

Fields:

Notes:

SubmitMediaBase

Shared base fields for submission inputs.

Fields:

SubmitMediaSecondsInput

Seconds-based submission.

Fields:

SubmitMediaMillisecondsInput

Milliseconds-based submission.

Fields:

SubmitMediaTimestampInput

Union of:

SubmissionRequestPayload

Serialized raw payload sent to /submit.

Fields:

MapSubmissionInput

Parameters accepted by mapSubmission().

Fields:

Response Types

API Time Naming

TheIntroDB uses two different naming styles depending on context:

The API also uses two different time units depending on request direction:

SegmentTimestampRaw

Raw timestamp object from the API.

Fields:

Notes:

NormalizedSegmentTimestamp

Normalized runtime timestamp shape.

Fields:

Notes:

MediaResponseRaw

Raw grouped-timestamps /media response.

MediaVersionRaw / MediaVersion

A release version (a duration cluster) in raw and normalized form.

MediaVersionsRaw / MediaVersions

The list_versions=true response in raw and normalized form.

MediaEpisodeSummaryRaw / MediaEpisodeSummary

Per-episode submission counts in raw and normalized form.

MediaEpisodeListRaw / MediaEpisodeList

The episode-list fallback response in raw and normalized form.

MediaRecord

Normalized grouped-timestamps media result (kind: 'media').

Fields:

Notes:

MediaVersions

Normalized release-version list (kind: 'versions').

Fields:

MediaEpisodeList

Normalized episode-list fallback (kind: 'episodes').

Fields:

MediaResponse

MediaRecord | MediaVersions | MediaEpisodeList. Narrow it with kind.

SubmissionDataRaw

Raw submission object from the API.

Notes:

SubmissionData

Normalized submission object returned by the package.

Fields:

Notes:

SubmissionResponseRaw / SubmissionResponse

Raw and normalized success response from /submit.

Fields:

MapResponseRaw / MapResult

Raw and normalized success response from /map.

Fields:

Utility Types

RateLimitDetails

Parsed rate-limit and usage-limit metadata, including the specific-media usage cap:

ErrorResponse

API error body shape.

HeadersLike

Minimal header reader contract used by the transport layer.

FetchResponseLike

Minimal fetch response shape expected by the package.

FetchLike

Minimal fetch function shape accepted by the package.