Merge pull request #2 from SalmanAlSaigal/master
Move to corss-fetch & add season endpoint
This commit is contained in:
18
package-lock.json
generated
18
package-lock.json
generated
@@ -9,7 +9,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dotenv": "^9.0.2",
|
"dotenv": "^9.0.2",
|
||||||
"node-fetch": "^2.6.1"
|
"cross-fetch": "^3.1.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^15.3.0",
|
"@types/node": "^15.3.0",
|
||||||
@@ -653,6 +653,14 @@
|
|||||||
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
|
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/cross-fetch": {
|
||||||
|
"version": "3.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz",
|
||||||
|
"integrity": "sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"node-fetch": "2.6.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/cross-spawn": {
|
"node_modules/cross-spawn": {
|
||||||
"version": "7.0.3",
|
"version": "7.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||||
@@ -3252,6 +3260,14 @@
|
|||||||
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
|
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"cross-fetch": {
|
||||||
|
"version": "3.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz",
|
||||||
|
"integrity": "sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==",
|
||||||
|
"requires": {
|
||||||
|
"node-fetch": "2.6.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"cross-spawn": {
|
"cross-spawn": {
|
||||||
"version": "7.0.3",
|
"version": "7.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
"typescript": "^4.2.4"
|
"typescript": "^4.2.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"node-fetch": "^2.6.1"
|
"cross-fetch": "^3.1.4"
|
||||||
},
|
},
|
||||||
"volta": {
|
"volta": {
|
||||||
"node": "15.13.0",
|
"node": "15.13.0",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'cross-fetch';
|
||||||
|
|
||||||
const BASE_URL_V3 = 'https://api.themoviedb.org/3';
|
const BASE_URL_V3 = 'https://api.themoviedb.org/3';
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
Recommendations,
|
Recommendations,
|
||||||
Reviews,
|
Reviews,
|
||||||
ScreenedTheatrically,
|
ScreenedTheatrically,
|
||||||
|
SeasonDetails,
|
||||||
SimilarTvShows,
|
SimilarTvShows,
|
||||||
TopRatedTvShows,
|
TopRatedTvShows,
|
||||||
Translations,
|
Translations,
|
||||||
@@ -53,6 +54,9 @@ export class TvShowsEndpoint extends BaseEndpoint{
|
|||||||
return await this.api.get<Credits>(`${BASE_TV}/${id}/credits`);
|
return await this.api.get<Credits>(`${BASE_TV}/${id}/credits`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async season(tvId: number, seasonNumber: number): Promise<SeasonDetails>{
|
||||||
|
return await this.api.get<SeasonDetails>(`${BASE_TV}/${tvId}/season/${seasonNumber}`);
|
||||||
|
}
|
||||||
|
|
||||||
async episodeGroups(id: number): Promise<EpisodeGroups>{
|
async episodeGroups(id: number): Promise<EpisodeGroups>{
|
||||||
return await this.api.get<EpisodeGroups>(`${BASE_TV}/${id}/episode_groups`);
|
return await this.api.get<EpisodeGroups>(`${BASE_TV}/${id}/episode_groups`);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Genre, ProductionCompany, ProductionCountry, SpokenLanguage } from './';
|
import { Genre, ProductionCompany, ProductionCountry, SpokenLanguage, Crew } from './';
|
||||||
|
|
||||||
export interface CreatedBy {
|
export interface CreatedBy {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -72,6 +72,46 @@ export interface TvShowDetails {
|
|||||||
vote_count: number;
|
vote_count: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GuestStar {
|
||||||
|
credit_id: string
|
||||||
|
order: number
|
||||||
|
character: string
|
||||||
|
adult: boolean
|
||||||
|
gender: number | null
|
||||||
|
id: number
|
||||||
|
known_for_department: string
|
||||||
|
name: string
|
||||||
|
original_name: string
|
||||||
|
popularity: number
|
||||||
|
profile_path: string | null
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Episode {
|
||||||
|
air_date: string
|
||||||
|
episode_number: number
|
||||||
|
crew: Crew[]
|
||||||
|
guest_stars: GuestStar[]
|
||||||
|
id: number
|
||||||
|
name: string
|
||||||
|
overview: string
|
||||||
|
production_code: string
|
||||||
|
season_number: number
|
||||||
|
still_path: string
|
||||||
|
vote_average: number
|
||||||
|
vote_count: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SeasonDetails {
|
||||||
|
air_date: string
|
||||||
|
episodes: Episode[]
|
||||||
|
name: string
|
||||||
|
overview: string
|
||||||
|
id: number
|
||||||
|
poster_path: string | null
|
||||||
|
season_number: number
|
||||||
|
}
|
||||||
|
|
||||||
export interface TvShowItem {
|
export interface TvShowItem {
|
||||||
id: string;
|
id: string;
|
||||||
action: string;
|
action: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user