add changes, credits, search
This commit is contained in:
4
.eslintignore
Normal file
4
.eslintignore
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
lib
|
||||||
|
coverage
|
||||||
43
.eslintrc.js
Normal file
43
.eslintrc.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
browser: false,
|
||||||
|
es2021: true,
|
||||||
|
},
|
||||||
|
extends: [
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
],
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 12,
|
||||||
|
sourceType: 'module',
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
'@typescript-eslint',
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-var-requires': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
'@typescript-eslint/interface-name-prefix': 'off',
|
||||||
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
|
'@typescript-eslint/no-use-before-define': 'off',
|
||||||
|
'@typescript-eslint/no-empty-interface': 'off',
|
||||||
|
'@typescript-eslint/explicit-function-return-type': ['warn', { allowExpressions: true }],
|
||||||
|
indent: 'off',
|
||||||
|
'@typescript-eslint/indent': ['error', 2],
|
||||||
|
'no-trailing-spaces': 'error',
|
||||||
|
quotes: ['error', 'single', { allowTemplateLiterals: true }],
|
||||||
|
semi: ['error', 'always'],
|
||||||
|
'spaced-comment': ['error', 'always'],
|
||||||
|
'no-irregular-whitespace': ['error', { 'skipComments': true }],
|
||||||
|
'space-infix-ops': 'error',
|
||||||
|
'array-bracket-spacing': 'error',
|
||||||
|
'object-curly-spacing': ['error', 'always'],
|
||||||
|
'space-before-function-paren': ['error', {
|
||||||
|
named: 'never',
|
||||||
|
anonymous: 'never',
|
||||||
|
asyncArrow: 'always',
|
||||||
|
}],
|
||||||
|
'comma-dangle': ['warn', 'always-multiline'],
|
||||||
|
'no-multiple-empty-lines': 'error',
|
||||||
|
},
|
||||||
|
};
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,6 @@
|
|||||||
/node_modules/
|
/node_modules/
|
||||||
/.env
|
/.env
|
||||||
|
|
||||||
|
dist
|
||||||
|
/.npmignore
|
||||||
.idea
|
.idea
|
||||||
|
|||||||
4502
package-lock.json
generated
4502
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
50
package.json
50
package.json
@@ -1,27 +1,55 @@
|
|||||||
{
|
{
|
||||||
"name": "tmdb-ts",
|
"name": "tmdb-ts",
|
||||||
"version": "1.0.0",
|
"version": "0.0.3",
|
||||||
"description": "",
|
"description": "TMDB v3 library wrapper",
|
||||||
"main": "index.js",
|
"main": "dist/index.ts",
|
||||||
|
"types": "dist/types/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"compile": "rm -rf dist && tsc -d && npm run copy-types",
|
||||||
"start": "ts-node"
|
"lint": "eslint --ext .ts src/",
|
||||||
|
"lint:fix": "eslint --ext .ts src/ --fix",
|
||||||
|
"prepublish": "tsc",
|
||||||
|
"copy-types": "mkdir dist/types && cp src/types/*.d.ts dist/types"
|
||||||
|
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"bugs": {
|
||||||
"author": "",
|
"url": "https://github.com/blakejoy/tmdb-ts/issues",
|
||||||
"license": "ISC",
|
"email": "blake@bjoynes.com"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/blakejoy/tmdb-ts.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"tmdb",
|
||||||
|
"movies",
|
||||||
|
"database",
|
||||||
|
"api",
|
||||||
|
"typescript"
|
||||||
|
],
|
||||||
|
"author": "Blake Joynes",
|
||||||
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^15.3.0",
|
"@types/node": "^15.3.0",
|
||||||
"@types/node-fetch": "^2.5.10",
|
"@types/node-fetch": "^2.5.10",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^4.23.0",
|
||||||
|
"@typescript-eslint/parser": "^4.23.0",
|
||||||
|
"dotenv": "^9.0.2",
|
||||||
|
"eslint": "^7.26.0",
|
||||||
|
"eslint-config-airbnb-base": "^14.2.1",
|
||||||
|
"eslint-plugin-import": "^2.23.1",
|
||||||
"ts-node": "^9.1.1",
|
"ts-node": "^9.1.1",
|
||||||
"typescript": "^4.2.4"
|
"typescript": "^4.2.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dotenv": "^9.0.2",
|
|
||||||
"node-fetch": "^2.6.1"
|
"node-fetch": "^2.6.1"
|
||||||
},
|
},
|
||||||
"volta": {
|
"volta": {
|
||||||
"node": "15.13.0",
|
"node": "15.13.0",
|
||||||
"yarn": "1.19.2"
|
"yarn": "1.19.2",
|
||||||
}
|
"npm": "7.12.1"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
32
src/api.ts
32
src/api.ts
@@ -1,22 +1,20 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
|
|
||||||
|
const BASE_URL_V3 = 'https://api.themoviedb.org/3';
|
||||||
|
|
||||||
const BASE_URL_V3 = 'https://api.themoviedb.org/3'
|
export default class Api {
|
||||||
|
constructor(private accessToken: string) {
|
||||||
|
this.accessToken = accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
export class Api{
|
async get<T>(path: string): Promise<T> {
|
||||||
|
const response = await fetch(`${BASE_URL_V3}${path}`, {
|
||||||
constructor(private accessToken: string){
|
method: 'GET',
|
||||||
this.accessToken = accessToken
|
headers: {
|
||||||
}
|
Authorization: `Bearer ${this.accessToken}`,
|
||||||
|
'Content-Type': 'application/json;charset=utf-8',
|
||||||
async get<T>(path: string): Promise<T> {
|
},
|
||||||
const response = await fetch(`${BASE_URL_V3}${path}`, {
|
});
|
||||||
method: 'GET',
|
return await response.json() as T;
|
||||||
headers: {
|
}
|
||||||
Authorization: `Bearer ${this.accessToken}`,
|
|
||||||
'Content-Type': 'application/json;charset=utf-8'
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return await response.json() as T;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
require('dotenv').config()
|
|
||||||
|
|
||||||
|
|
||||||
export class config {
|
|
||||||
static accessToken = process.env.ACCESS_TOKEN;
|
|
||||||
}
|
|
||||||
@@ -1,17 +1,11 @@
|
|||||||
import { Api } from "../api";
|
import { BaseEndpoint } from './base';
|
||||||
import {Base} from "./base";
|
|
||||||
|
|
||||||
|
export class AccountEndpoint extends BaseEndpoint {
|
||||||
|
constructor(accessToken: string) {
|
||||||
|
super(accessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
async details(): Promise<any> {
|
||||||
export class Account extends Base{
|
return await this.api.get('/account');
|
||||||
|
}
|
||||||
constructor(accessToken: string){
|
|
||||||
super(accessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async details(): Promise<any> {
|
|
||||||
return await this.api.get('/account');
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
import {Api} from "../api";
|
import Api from '../api';
|
||||||
|
|
||||||
|
export class BaseEndpoint {
|
||||||
|
protected api: Api;
|
||||||
|
|
||||||
export class Base {
|
constructor(protected readonly accessToken: string) {
|
||||||
protected api: Api;
|
this.api = new Api(accessToken);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(protected readonly accessToken: string){
|
|
||||||
this.api = new Api(accessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
import {Base} from "./base";
|
import { BaseEndpoint } from './base';
|
||||||
import {Certifications} from "../types/certification";
|
import { Certifications } from '../types/certification';
|
||||||
|
|
||||||
|
export class CertificationEndpoint extends BaseEndpoint {
|
||||||
|
constructor(protected readonly accessToken: string) {
|
||||||
|
super(accessToken);
|
||||||
|
}
|
||||||
|
|
||||||
export class Certification extends Base{
|
async movies(): Promise<Certifications> {
|
||||||
|
return await this.api.get<Certifications>('/certification/movie/list');
|
||||||
|
}
|
||||||
|
|
||||||
constructor(protected readonly accessToken: string){
|
async tvShows(): Promise<Certifications> {
|
||||||
super(accessToken);
|
return await this.api.get<Certifications>('/certification/tv/list');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async movies(): Promise<Certifications> {
|
|
||||||
return await this.api.get<Certifications>('/certification/movie/list');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async tvShows(): Promise<Certifications> {
|
|
||||||
return await this.api.get<Certifications>('/certification/tv/list');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +1,31 @@
|
|||||||
import querystring, {ParsedUrlQueryInput} from 'querystring';
|
import querystring, { ParsedUrlQueryInput } from 'querystring';
|
||||||
import {Base} from "./base";
|
import { BaseEndpoint } from './base';
|
||||||
import {Changes} from "../types/changes";
|
import { Changes } from '../types/changes';
|
||||||
|
|
||||||
|
|
||||||
export interface ChangeOptions extends ParsedUrlQueryInput {
|
export interface ChangeOptions extends ParsedUrlQueryInput {
|
||||||
end_date?: string;
|
end_date?: string;
|
||||||
start_date?: string;
|
start_date?: string;
|
||||||
page?: number;
|
page?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Change extends Base{
|
export class ChangeEndpoint extends BaseEndpoint {
|
||||||
|
constructor(protected readonly accessToken: string) {
|
||||||
|
super(accessToken);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(protected readonly accessToken: string){
|
async movies(options?: ChangeOptions): Promise<Changes> {
|
||||||
super(accessToken);
|
const params = querystring.encode(options);
|
||||||
}
|
return await this.api.get<Changes>(`/movie/changes?${params}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async tvShows(options?: ChangeOptions): Promise<Changes> {
|
||||||
|
const params = querystring.stringify(options);
|
||||||
|
return await this.api.get<Changes>(`/tv/changes?${params}`);
|
||||||
|
}
|
||||||
|
|
||||||
async movies(options?: ChangeOptions): Promise<Changes> {
|
async person(options?: ChangeOptions): Promise<Changes> {
|
||||||
const params = querystring.encode(options);
|
const params = querystring.stringify(options);
|
||||||
return await this.api.get<Changes>(`/movie/changes?${params}`);
|
|
||||||
|
|
||||||
}
|
return await this.api.get<Changes>(`/person/changes${params}`);
|
||||||
|
}
|
||||||
async tvShows(options?: ChangeOptions): Promise<Changes> {
|
|
||||||
const params = querystring.stringify(options);
|
|
||||||
return await this.api.get<Changes>(`/tv/changes?${params}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
async person(options?: ChangeOptions): Promise<Changes> {
|
|
||||||
const params = querystring.stringify(options);
|
|
||||||
|
|
||||||
return await this.api.get<Changes>(`/person/changes${params}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
14
src/endpoints/credits.ts
Normal file
14
src/endpoints/credits.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { BaseEndpoint } from './base';
|
||||||
|
import { CreditResponse } from '../types/credits';
|
||||||
|
|
||||||
|
|
||||||
|
export class CreditsEndpoint extends BaseEndpoint {
|
||||||
|
constructor(protected readonly accessToken: string) {
|
||||||
|
super(accessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getById(id: string): Promise<CreditResponse> {
|
||||||
|
return await this.api.get<CreditResponse>(`/credit/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
7
src/endpoints/index.ts
Normal file
7
src/endpoints/index.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
export * from './account';
|
||||||
|
export * from './certification';
|
||||||
|
export * from './changes';
|
||||||
|
export * from './credits';
|
||||||
|
export * from './search';
|
||||||
65
src/endpoints/search.ts
Normal file
65
src/endpoints/search.ts
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
import { BaseEndpoint } from './base';
|
||||||
|
import querystring, { ParsedUrlQueryInput } from 'querystring';
|
||||||
|
import { Search } from '../types/search';
|
||||||
|
import { Collection, Company, Movie, Person, TV } from '../types';
|
||||||
|
|
||||||
|
const BASE_SEARCH = '/search';
|
||||||
|
|
||||||
|
export interface SearchOptions extends ParsedUrlQueryInput {
|
||||||
|
query: string;
|
||||||
|
page?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MovieSearchOptions extends SearchOptions {
|
||||||
|
include_adult?: boolean;
|
||||||
|
year?: number;
|
||||||
|
primary_release_year?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TvSearchOptions extends SearchOptions{
|
||||||
|
include_adult?: boolean;
|
||||||
|
first_air_date_year?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PeopleSearchOptions extends SearchOptions{
|
||||||
|
include_adult?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SearchEndpoint extends BaseEndpoint {
|
||||||
|
constructor(protected readonly accessToken: string) {
|
||||||
|
super(accessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
async companies(options: SearchOptions): Promise<Search<Company>>{
|
||||||
|
const params = querystring.encode(options);
|
||||||
|
return await this.api.get<Search<Company>>(`${BASE_SEARCH}/company?${params}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async collections(options: SearchOptions): Promise<Search<Collection>>{
|
||||||
|
const params = querystring.encode(options);
|
||||||
|
return await this.api.get<Search<Collection>>(`${BASE_SEARCH}/collection?${params}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async keywords(options: SearchOptions): Promise<Search<{ id: string, name: string }>>{
|
||||||
|
const params = querystring.encode(options);
|
||||||
|
return await this.api.get<Search<{ id: string, name: string }>>(`${BASE_SEARCH}/keyword?${params}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async movies(options: MovieSearchOptions): Promise<Search<Movie>>{
|
||||||
|
const params = querystring.encode(options);
|
||||||
|
return await this.api.get<Search<Movie>>(`${BASE_SEARCH}/movie?${params}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async people(options: PeopleSearchOptions): Promise<Search<Person>>{
|
||||||
|
const params = querystring.encode(options);
|
||||||
|
return await this.api.get<Search<Person>>(`${BASE_SEARCH}/person?${params}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Multi search
|
||||||
|
|
||||||
|
async tvShows(options: TvSearchOptions): Promise<Search<TV>>{
|
||||||
|
const params = querystring.encode(options);
|
||||||
|
return await this.api.get<Search<TV>>(`${BASE_SEARCH}/tv?${params}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import TMDB from './tmdb';
|
||||||
|
|
||||||
|
export default TMDB;
|
||||||
|
|||||||
47
src/tmdb.ts
47
src/tmdb.ts
@@ -1,28 +1,35 @@
|
|||||||
import { Account } from "./endpoints/account";
|
import {
|
||||||
|
AccountEndpoint,
|
||||||
|
CertificationEndpoint,
|
||||||
|
ChangeEndpoint,
|
||||||
|
CreditsEndpoint,
|
||||||
|
SearchEndpoint,
|
||||||
|
} from './endpoints';
|
||||||
|
|
||||||
import {Certification} from "./endpoints/certification";
|
export default class TMDB {
|
||||||
import {Change} from "./endpoints/changes";
|
private readonly accessToken: string;
|
||||||
|
|
||||||
export class TMDB {
|
constructor(accessToken: string) {
|
||||||
private accessToken: string;
|
this.accessToken = accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
constructor(accessToken: string){
|
get account(): AccountEndpoint {
|
||||||
this.accessToken = accessToken;
|
return new AccountEndpoint(this.accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
get account(){
|
get certifications(): CertificationEndpoint {
|
||||||
return new Account(this.accessToken);
|
return new CertificationEndpoint(this.accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
get certifications(){
|
get changes(): ChangeEndpoint {
|
||||||
return new Certification(this.accessToken);
|
return new ChangeEndpoint(this.accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
get changes(){
|
get credits(): CreditsEndpoint {
|
||||||
return new Change(this.accessToken);
|
return new CreditsEndpoint(this.accessToken);
|
||||||
}
|
}
|
||||||
|
get search(): SearchEndpoint{
|
||||||
|
return new SearchEndpoint(this.accessToken);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
33
src/types/certification.d.ts
vendored
33
src/types/certification.d.ts
vendored
@@ -1,20 +1,19 @@
|
|||||||
|
export interface Certification {
|
||||||
|
certification: string;
|
||||||
|
meaning: string;
|
||||||
|
order: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Certifications {
|
export interface Certifications {
|
||||||
certifications: {
|
certifications: {
|
||||||
US: Certification[],
|
US: Certification[],
|
||||||
CA: Certification[],
|
CA: Certification[],
|
||||||
DE: Certification[],
|
DE: Certification[],
|
||||||
GB: Certification[],
|
GB: Certification[],
|
||||||
AU: Certification[],
|
AU: Certification[],
|
||||||
BR: Certification[],
|
BR: Certification[],
|
||||||
FR: Certification[],
|
FR: Certification[],
|
||||||
NZ: Certification[],
|
NZ: Certification[],
|
||||||
IN: Certification[],
|
IN: Certification[],
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
export interface Certification {
|
|
||||||
certification: string;
|
|
||||||
meaning: string;
|
|
||||||
order: number;
|
|
||||||
}
|
}
|
||||||
|
|||||||
16
src/types/changes.d.ts
vendored
16
src/types/changes.d.ts
vendored
@@ -1,11 +1,11 @@
|
|||||||
export interface Changes{
|
export interface Change {
|
||||||
results: Change[];
|
id: number;
|
||||||
page: number;
|
adult: boolean | undefined;
|
||||||
total_pages: nubmer;
|
|
||||||
total_results: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Change {
|
export interface Changes{
|
||||||
id: number;
|
results: Change[];
|
||||||
adult: boolean | undefined;
|
page: number;
|
||||||
|
total_pages: number;
|
||||||
|
total_results: number;
|
||||||
}
|
}
|
||||||
|
|||||||
37
src/types/credits.d.ts
vendored
Normal file
37
src/types/credits.d.ts
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
export interface CreditSeason {
|
||||||
|
air_date?: string;
|
||||||
|
poster_path?: string;
|
||||||
|
season_number?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export interface Media{
|
||||||
|
i?: number;
|
||||||
|
name?:string;
|
||||||
|
first_air_date?: string;
|
||||||
|
vote_count?: number;
|
||||||
|
overview?: string;
|
||||||
|
vote_average?: number;
|
||||||
|
backdrop_path?: string;
|
||||||
|
genre_ids?: number[];
|
||||||
|
original_name?: string;
|
||||||
|
origin_country?: string[];
|
||||||
|
poster_path?: string;
|
||||||
|
original_language?: string;
|
||||||
|
popularity?: number;
|
||||||
|
character?: string;
|
||||||
|
episodes?: string[];
|
||||||
|
seasons?: CreditSeason[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreditResponse {
|
||||||
|
credit_type?: string;
|
||||||
|
department?: string;
|
||||||
|
job?: string;
|
||||||
|
media?: Media;
|
||||||
|
media_type?: string;
|
||||||
|
id?: string;
|
||||||
|
person?: Person;
|
||||||
|
}
|
||||||
|
|
||||||
88
src/types/index.d.ts
vendored
88
src/types/index.d.ts
vendored
@@ -0,0 +1,88 @@
|
|||||||
|
import * as certs from './certification';
|
||||||
|
import * as credits from './credits';
|
||||||
|
import * as changes from './changes';
|
||||||
|
|
||||||
|
export interface KnownFor {
|
||||||
|
id: number;
|
||||||
|
overview: string;
|
||||||
|
release_date: string;
|
||||||
|
video: boolean;
|
||||||
|
adult: boolean;
|
||||||
|
backdrop_path: string;
|
||||||
|
media_type: string;
|
||||||
|
genre_ids: number[];
|
||||||
|
title: string;
|
||||||
|
original_language: string;
|
||||||
|
original_title: string;
|
||||||
|
poster_path: string;
|
||||||
|
vote_count: number;
|
||||||
|
vote_average: number;
|
||||||
|
popularity: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Person {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
known_for: KnownFor[];
|
||||||
|
profile_path: string;
|
||||||
|
adult: boolean;
|
||||||
|
known_for_department: string;
|
||||||
|
gender: number;
|
||||||
|
popularity: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Collection {
|
||||||
|
id:number;
|
||||||
|
backdrop_path: string;
|
||||||
|
name: string;
|
||||||
|
poster_path: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Movie {
|
||||||
|
id: number;
|
||||||
|
logo_path: string;
|
||||||
|
name: string;
|
||||||
|
poster_path: string;
|
||||||
|
adult: boolean;
|
||||||
|
overview: string;
|
||||||
|
release_date: string;
|
||||||
|
genre_ids: number[];
|
||||||
|
original_title: string;
|
||||||
|
original_language: string;
|
||||||
|
title: string;
|
||||||
|
backdrop_path: string;
|
||||||
|
popularity: number;
|
||||||
|
vote_count: number;
|
||||||
|
video: boolean;
|
||||||
|
vote_average: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Company {
|
||||||
|
id: number;
|
||||||
|
logo_path: string;
|
||||||
|
name: string;
|
||||||
|
origin_country: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TV {
|
||||||
|
id: number;
|
||||||
|
name:string;
|
||||||
|
first_air_date: string;
|
||||||
|
backdrop_path: string;
|
||||||
|
genre_ids: number[];
|
||||||
|
origin_country: string[];
|
||||||
|
original_language: string;
|
||||||
|
original_name: string;
|
||||||
|
overview: string;
|
||||||
|
poster_path: string;
|
||||||
|
popularity: number;
|
||||||
|
vote_count: number;
|
||||||
|
vote_average: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export {
|
||||||
|
certs,
|
||||||
|
credits,
|
||||||
|
changes,
|
||||||
|
};
|
||||||
|
|||||||
8
src/types/search.ts
Normal file
8
src/types/search.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
export interface Search<T> {
|
||||||
|
page: number;
|
||||||
|
results: T[];
|
||||||
|
total_pages: number;
|
||||||
|
total_results: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,69 +1,25 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
||||||
|
|
||||||
/* Basic Options */
|
|
||||||
// "incremental": true, /* Enable incremental compilation */
|
|
||||||
"target": "es2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
|
"target": "es2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
|
||||||
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
||||||
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
||||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
||||||
// "checkJs": true, /* Report errors in .js files. */
|
|
||||||
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
||||||
"sourceMap": true /* Generates corresponding '.map' file. */,
|
"sourceMap": true /* Generates corresponding '.map' file. */,
|
||||||
// "outFile": "./", /* Concatenate and emit output to single file. */
|
"outDir": "dist" /* Redirect output structure to the directory. */,
|
||||||
"outDir": "lib" /* Redirect output structure to the directory. */,
|
|
||||||
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
||||||
// "composite": true, /* Enable project compilation */
|
|
||||||
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
||||||
// "removeComments": true, /* Do not emit comments to output. */
|
|
||||||
// "noEmit": true, /* Do not emit outputs. */
|
|
||||||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
||||||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
||||||
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
||||||
|
|
||||||
/* Strict Type-Checking Options */
|
|
||||||
"strict": true /* Enable all strict type-checking options. */,
|
"strict": true /* Enable all strict type-checking options. */,
|
||||||
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||||
// "strictNullChecks": true, /* Enable strict null checks. */
|
"types": ["node"],
|
||||||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
||||||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
||||||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
||||||
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
||||||
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
||||||
|
|
||||||
/* Additional Checks */
|
|
||||||
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
||||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
||||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
||||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
||||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
||||||
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
|
|
||||||
|
|
||||||
/* Module Resolution Options */
|
|
||||||
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
||||||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
||||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
||||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
||||||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
||||||
// "types": [], /* Type declaration files to be included in compilation. */
|
|
||||||
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
||||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
||||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
||||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
||||||
|
|
||||||
/* Source Map Options */
|
|
||||||
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
||||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
||||||
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
||||||
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
||||||
|
|
||||||
/* Experimental Options */
|
|
||||||
"experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
|
"experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
|
||||||
"emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */,
|
"emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */,
|
||||||
|
|
||||||
/* Advanced Options */
|
|
||||||
"skipLibCheck": true /* Skip type checking of declaration files. */,
|
"skipLibCheck": true /* Skip type checking of declaration files. */,
|
||||||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
||||||
}
|
},
|
||||||
|
"types": ["node"],
|
||||||
|
"include": [
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"dist",
|
||||||
|
"./src/types/*.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user