Giter Club home page Giter Club logo

trakt-http-client's Introduction

@dvcol/trakt-http-client

donate

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

Prerequisites

  • pnpm >=9.0.0
  • node >=20.0.0

Install

pnpm install

Usage

pnpm add @dvcol/trakt-http-client

Modular endpoint bundling

Trakt-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 { TraktClient } from '@dvcol/trakt-http-client';
import { calendars } from '@dvcol/trakt-http-client/api/calendar';
import { episodes } from '@dvcol/trakt-http-client/api/episodes';
import { minimalTraktApi } from '@dvcol/trakt-http-client/api/minimal';
 
import { Config } from '@dvcol/trakt-http-client/config';

import type { TraktClientSettings } from '@dvcol/trakt-http-client/models';


const traktUsedApi = {
  ...minimalTraktApi,
  calendars,
  episodes,
};

const traktClientSettings: TraktClientSettings = {
  client_id: '<Your trakt ID>',
  client_secret: '<Your trakt secret>',
  redirect_uri: '<Your trakt redirect uri>',
  endpoint: Config.endpoint.Production,

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

const initAuthentication = {}


const traktClient = new TraktClient(traktClientSettings, initAuthentication, traktUsedApi);

Features

Documentation

See Trakt API documentation for more information.

Author

๐Ÿ“ License

This project is MIT licensed.

trakt-http-client's People

Contributors

dvcol avatar

Stargazers

MD. ABU SAYED avatar Yvonnelim99 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.