diff --git a/package.json b/package.json index e526222..4f3a84c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tmdb-ts", - "version": "0.1.8", + "version": "0.1.9", "description": "TMDB v3 library wrapper", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/endpoints/account.ts b/src/endpoints/account.ts index 170584c..3f1c3e0 100644 --- a/src/endpoints/account.ts +++ b/src/endpoints/account.ts @@ -1,11 +1,12 @@ import { BaseEndpoint } from './base'; +import { AccountDetails } from '../types/account'; export class AccountEndpoint extends BaseEndpoint { constructor(accessToken: string) { super(accessToken); } - async details(): Promise { + async details(): Promise { return await this.api.get('/account'); } } diff --git a/src/types/account.ts b/src/types/account.ts new file mode 100644 index 0000000..f1ee6d0 --- /dev/null +++ b/src/types/account.ts @@ -0,0 +1,17 @@ +export interface Gravatar { + hash: string; +} + +export interface Avatar { + gravatar: Gravatar; +} + +export interface AccountDetails { + avatar: Avatar; + id: number; + include_adult: boolean; + iso_3166_1: string; + iso_639_1: string; + name: string; + username: string; +} diff --git a/src/types/index.ts b/src/types/index.ts index 25dac3b..8432a50 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -134,14 +134,14 @@ export interface ContentRatingsResult { export interface Recommendation { adult: boolean; - backdrop_path?: any; + backdrop_path?: string; genre_ids: number[]; id: number; original_language: string; original_title: string; overview: string; release_date: string; - poster_path?: any; + poster_path?: string; popularity: number; title: string; video: boolean; diff --git a/src/types/movies.ts b/src/types/movies.ts index d1371a4..e08c0a5 100644 --- a/src/types/movies.ts +++ b/src/types/movies.ts @@ -6,10 +6,17 @@ import { SpokenLanguage, } from './'; +export interface BelongsToCollection { + id: number; + name: string; + poster_path: string; + backdrop_path: string; +} + export interface MovieDetails { adult: boolean; backdrop_path: string; - belongs_to_collection?: any; + belongs_to_collection?: BelongsToCollection; budget: number; genres: Genre[]; homepage: string; @@ -19,7 +26,7 @@ export interface MovieDetails { original_title: string; overview: string; popularity: number; - poster_path?: any; + poster_path?: string; production_companies: ProductionCompany[]; production_countries: ProductionCountry[]; release_date: string; @@ -107,8 +114,8 @@ export interface MovieChanges { export interface LatestMovie { adult: boolean; - backdrop_path?: any; - belongs_to_collection?: any; + backdrop_path?: string; + belongs_to_collection?: BelongsToCollection; budget: number; genres: Genre[]; homepage: string; @@ -119,12 +126,12 @@ export interface LatestMovie { overview: string; popularity: number; poster_path: string; - production_companies: any[]; - production_countries: any[]; + production_companies: ProductionCompany[]; + production_countries: ProductionCountry[]; release_date: string; revenue: number; runtime: number; - spoken_languages: any[]; + spoken_languages: SpokenLanguage[]; status: string; tagline: string; title: string; diff --git a/src/types/tv-shows.ts b/src/types/tv-shows.ts index c1ea5f0..375dc50 100644 --- a/src/types/tv-shows.ts +++ b/src/types/tv-shows.ts @@ -14,6 +14,21 @@ export interface CreatedBy { profile_path: string; } +export interface NextEpisodeToAir { + id: number; + name: string; + overview: string; + vote_average: number; + vote_count: number; + air_date: string; + episode_number: number; + production_code: string; + runtime: number; + season_number: number; + show_id: number; + still_path: string; +} + export interface LastEpisodeToAir { air_date: string; episode_number: number; @@ -57,7 +72,7 @@ export interface TvShowDetails { last_air_date: string; last_episode_to_air: LastEpisodeToAir; name: string; - next_episode_to_air?: any; + next_episode_to_air?: NextEpisodeToAir; networks: Network[]; number_of_episodes: number; number_of_seasons: number; @@ -123,9 +138,9 @@ export interface TvShowItem { id: string; action: string; time: string; - value: any; + value: Array; iso_639_1: string; - original_value: any; + original_value: Array; } export interface TvShowChange { @@ -194,8 +209,8 @@ export interface SimilarTvShows { } export interface LatestTvShows { - backdrop_path?: any; - created_by: any[]; + backdrop_path?: string; + created_by: CreatedBy[]; episode_run_time: number[]; first_air_date: string; genres: Genre[]; @@ -211,10 +226,10 @@ export interface LatestTvShows { origin_country: string[]; original_language: string; original_name: string; - overview?: any; + overview?: string; popularity: number; - poster_path?: any; - production_companies: any[]; + poster_path?: string; + production_companies: ProductionCompany[]; seasons: Season[]; status: string; type: string; diff --git a/src/utils/parseOptions.ts b/src/utils/parseOptions.ts index 0821c93..9ef0d54 100644 --- a/src/utils/parseOptions.ts +++ b/src/utils/parseOptions.ts @@ -1,3 +1,4 @@ export function parseOptions(options?: Record): string { +/* eslint-disable @typescript-eslint/no-explicit-any */ return options ? new URLSearchParams(Object.entries(options)).toString() : ''; }