Giter Site home page Giter Site logo

shr1k4nt / tmdb_api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ratakondalaarun/tmdb_api

0.0 0.0 0.0 347 KB

Dart client library for themoviedb.org(TMDB) API

Home Page: https://pub.dev/packages/tmdb_api

License: GNU General Public License v3.0

Dart 100.00%

tmdb_api's Introduction

tmdb_api

Dart Code Analysis CI pub package style: lint

A TheMovieDatabase client library for dart. To know more about TMDB visit offical site

Getting started

  1. Adding as dependencies

    Pub.dev's installation guide

    Add this to your package's pubspec.yaml file:

    dependencies:
      tmdb_api: latest //visit tmdb for latest version number
  2. Import it

    Now in your Dart code, you can use:

    import 'package:tmdb_api/tmdb_api.dart';
  3. Create Instance

    Now you need to create instance for TMDB and ApiKeys with your api keys.

    final tmdbWithCustomLogs = TMDB( //TMDB instance
        ApiKeys('Your API KEY', 'apiReadAccessTokenv4'),//ApiKeys instance with your keys,
      );
  4. Configuring console logs

    There are 3 logconfigs presets avaliable.

    • ConfigLogger.showAll(): development use.
    • ConfigLogger.showRecommended(): development use.
    • ConfigLogger.showNone(): production use.

    You can add any off this presets to logConfig named parameter of TMDB instance Custom Logs

    final tmdbWithCustomLogs = TMDB(
        ApiKeys('Your API KEY', 'apiReadAccessTokenv4'),
        logConfig: ConfigLogger(
          showLogs: true,//must be true than only all other logs will be shown
          showErrorLogs: true,
        ),
      );

Example

For getting Trending movies

Map result = await tmdb.v3.trending.getTrending(mediaType = MediaType.all,timeWindow = TimeWindow.day);

Custom Dio instance

    final tmdbWithCustomLogs = TMDB(
        ApiKeys('Your API KEY', 'apiReadAccessTokenv4'),
        dio:Dio()// your own dio instance
      );

Setting Default api data language

    final tmdbWithCustomLogs = TMDB(
        ApiKeys('Your API KEY', 'apiReadAccessTokenv4'),
        defaultLanguage:'en-US'// sets default language for all supported endpoints
      );

Adding Interceptors

final tmdbWithCustomLogs = TMDB(
    ApiKeys('Your API KEY', 'apiReadAccessTokenv4'),
    interceptors:Interceptors()..add(/*your interceptor*/)
    );

or

final customDio = Dio();
customDio.interceptors.add(/*your interceptor*/)

final tmdbWithCustomLogs = TMDB(
    ApiKeys('Your API KEY', 'apiReadAccessTokenv4'),
    dio:dio
    );

note:Use interceptors only when you are not using a custom Dio instance.

For more API documentation

visit offical API documentation

tmdb_api's People

Contributors

ratakondalaarun avatar msviswanth avatar gutala avatar arley011 avatar gopal-dahale avatar shr1k4nt avatar srihariash999 avatar is8r 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.