@dvcol/tvdb-http-client
TypeScript icon, indicating that this package has built-in type declarations

1.1.7 • Public • Published

@dvcol/tvdb-http-client

donate

Simple fetch based http client for TVDB API with full typescript support (request and response).

Prerequisites

  • pnpm >=9.0.0
  • node >=20.0.0

Install

pnpm install

Usage

pnpm add @dvcol/tvdb-http-client

Modular endpoint bundling

Tvdb-http-client is designed to be modular and flexible. Although it uses static classes, endpoints are instantiated at runtime and can be easily omitted, extended or overridden. If your bundler does not support tree-shaking, you can omit unused endpoints by only importing the ones you need.

By default we provide a full api object with all supported endpoints, as well as a minimal api object with only the essential authentication endpoints. You can also import any endpoint by common scope.

import { TvdbClient } from '@dvcol/tvdb-http-client';

import { minimalTvdbApi } from '@dvcol/tvdb-http-client/api/minimal';

import { movies } from '@dvcol/tvdb-http-client/api/movies';
import { series } from '@dvcol/tvdb-http-client/api/series';
import { Config } from '@dvcol/tvdb-http-client/config';

import type { TvdbClientSettings } from '@dvcol/tvdb-http-client/models';

export const api = {
  ...minimalTvdbApi,
  movies,
  series
};

export const settings: TvdbClientSettings = {
  apiKey:'<Your api ID>',
  tokenTTL: Config.tokenTTL,
  endpoint: Config.endpoint,
  version: 'v4',

  useragent: '<Your user Agent>',
  corsProxy: '<Optional cors Proxy>',
  corsPrefix: '<Optional cors Proxy prefix>'
};

const authenticaiton = {}

const client = new TvdbClient(settings, authenticaiton, api);

Features

Documentation

See Tvdb API documentation for more information.

Author

📝 License

This project is MIT licensed.

/@dvcol/tvdb-http-client/

    Package Sidebar

    Install

    npm i @dvcol/tvdb-http-client

    Weekly Downloads

    0

    Version

    1.1.7

    License

    MIT

    Unpacked Size

    271 kB

    Total Files

    284

    Last publish

    Collaborators

    • dvcol