@lorenzopant/tmdb 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ pnpm run lint
2
+ pnpm test
@@ -5,11 +5,11 @@
5
5
  * @property status_code - The numeric code representing the type of error encountered.
6
6
  * @property status_message - A descriptive message providing details about the error.
7
7
  */
8
- export type TMDBAPIErrorResponse = {
8
+ export interface TMDBAPIErrorResponse {
9
9
  success: boolean;
10
10
  status_code: number;
11
11
  status_message: string;
12
- };
12
+ }
13
13
  /**
14
14
  * Represents a generic error or an error specific to the TMDB (The Movie Database) API.
15
15
  * This error class extends the built-in `Error` class and includes additional
package/dist/tmdb.d.ts CHANGED
@@ -3,7 +3,7 @@ import { MoviesAPI } from "./endpoints/movies";
3
3
  import { SearchAPI } from "./endpoints/search";
4
4
  import { CountryISO3166_1 } from "./types/countries";
5
5
  import { LanguageISO6391 } from "./types/lang";
6
- export type TMDBOptions = {
6
+ export interface TMDBOptions {
7
7
  /**
8
8
  * The language to use for requests (ISO 639-1 code)
9
9
  * This provides localization and translated data.
@@ -16,7 +16,7 @@ export type TMDBOptions = {
16
16
  * If not set, TMDB may fall back to a default or global data.
17
17
  */
18
18
  region?: CountryISO3166_1;
19
- };
19
+ }
20
20
  export declare class TMDB {
21
21
  private client;
22
22
  private options;
@@ -1,47 +1,47 @@
1
1
  /**
2
2
  * Represents a genre of a movie or TV show.
3
3
  */
4
- export type Genre = {
4
+ export interface Genre {
5
5
  id: number;
6
6
  name: string;
7
- };
7
+ }
8
8
  /**
9
9
  * Represents a production company involved in creating a movie or TV show.
10
10
  */
11
- export type ProductionCompany = {
11
+ export interface ProductionCompany {
12
12
  id: number;
13
13
  logo_path: string | null;
14
14
  name: string;
15
15
  origin_country: string;
16
- };
16
+ }
17
17
  /**
18
18
  * Represents a country where a movie or TV show was produced.
19
19
  */
20
- export type ProductionCountry = {
20
+ export interface ProductionCountry {
21
21
  iso_3166_1: string;
22
22
  name: string;
23
- };
23
+ }
24
24
  /**
25
25
  * Represents a spoken language in a movie or TV show.
26
26
  */
27
- export type SpokenLanguage = {
27
+ export interface SpokenLanguage {
28
28
  english_name: string;
29
29
  iso_639_1: string;
30
30
  name: string;
31
- };
31
+ }
32
32
  /**
33
33
  * Represents a collection of movies.
34
34
  */
35
- export type Collection = {
35
+ export interface Collection {
36
36
  id: number;
37
37
  name: string;
38
38
  poster_path: string | null;
39
39
  backdrop_path: string | null;
40
- };
40
+ }
41
41
  /**
42
42
  * Represents a cast member in a movie or TV show.
43
43
  */
44
- export type Cast = {
44
+ export interface Cast {
45
45
  adult: boolean;
46
46
  gender: number | null;
47
47
  id: number;
@@ -54,11 +54,11 @@ export type Cast = {
54
54
  character: string;
55
55
  credit_id: string;
56
56
  order: number;
57
- };
57
+ }
58
58
  /**
59
59
  * Represents a crew member in a movie or TV show.
60
60
  */
61
- export type Crew = {
61
+ export interface Crew {
62
62
  adult: boolean;
63
63
  gender: number | null;
64
64
  id: number;
@@ -70,27 +70,27 @@ export type Crew = {
70
70
  credit_id: string;
71
71
  department: string;
72
72
  job: string;
73
- };
74
- export type Keyword = {
73
+ }
74
+ export interface Keyword {
75
75
  id: number;
76
76
  name: string;
77
- };
78
- export type Changes = {
77
+ }
78
+ export interface Changes {
79
79
  changes: Change[];
80
- };
81
- export type Change = {
80
+ }
81
+ export interface Change {
82
82
  key: string;
83
83
  items: ChangeItem[];
84
- };
85
- export type ChangeItem = {
84
+ }
85
+ export interface ChangeItem {
86
86
  id: number;
87
87
  action: string;
88
88
  time: string;
89
89
  iso_639_1: string;
90
90
  iso_3166_1: string;
91
91
  value: any;
92
- };
93
- export type ImageItem = {
92
+ }
93
+ export interface ImageItem {
94
94
  aspect_ratio: number;
95
95
  height: number;
96
96
  iso_639_1: string | null;
@@ -98,8 +98,8 @@ export type ImageItem = {
98
98
  vote_average: number;
99
99
  vote_count: number;
100
100
  width: number;
101
- };
102
- export type VideoItem = {
101
+ }
102
+ export interface VideoItem {
103
103
  iso_649_1: string;
104
104
  iso_3166_1: string;
105
105
  name: string;
@@ -110,4 +110,4 @@ export type VideoItem = {
110
110
  official: boolean;
111
111
  published_at: string;
112
112
  id: string;
113
- };
113
+ }
@@ -2,7 +2,7 @@ import { Cast, Changes, Collection, Crew, Genre, ImageItem, Keyword, ProductionC
2
2
  import { ReleaseType } from "./enums";
3
3
  import { PaginatedResponse } from "./params";
4
4
  import { ISO3166Country } from "./utility";
5
- export type MovieDetails = {
5
+ export interface MovieDetails {
6
6
  adult: boolean;
7
7
  backdrop_path: string | null;
8
8
  belongs_to_collection: Collection | null;
@@ -29,8 +29,8 @@ export type MovieDetails = {
29
29
  video: boolean;
30
30
  vote_average: number;
31
31
  vote_count: number;
32
- };
33
- export type MovieResultItem = {
32
+ }
33
+ export interface MovieResultItem {
34
34
  backdrop_path: string;
35
35
  id: number;
36
36
  title: string;
@@ -46,59 +46,59 @@ export type MovieResultItem = {
46
46
  video: boolean;
47
47
  vote_average: number;
48
48
  vote_count: number;
49
- };
50
- export type MovieAlternativeTitles = {
49
+ }
50
+ export interface MovieAlternativeTitles {
51
51
  id: number;
52
52
  titles: MovieAlternativeTitle[];
53
- };
54
- export type MovieAlternativeTitle = {
53
+ }
54
+ export interface MovieAlternativeTitle {
55
55
  title: string;
56
56
  iso_3166_1: string;
57
57
  type: string;
58
- };
58
+ }
59
59
  export type MovieChanges = Changes;
60
- export type MovieCredits = {
60
+ export interface MovieCredits {
61
61
  id: number;
62
62
  cast: Cast[];
63
63
  crew: Crew[];
64
- };
65
- export type MovieExternalIDs = {
64
+ }
65
+ export interface MovieExternalIDs {
66
66
  id: number;
67
67
  imdb_id: string | null;
68
68
  facebook_id: string | null;
69
69
  twitter_id: string | null;
70
70
  instagram_id: string | null;
71
- };
72
- export type MovieKeywords = {
71
+ }
72
+ export interface MovieKeywords {
73
73
  id: number;
74
74
  keywords: Keyword[];
75
- };
76
- export type MovieImages = {
75
+ }
76
+ export interface MovieImages {
77
77
  id: number;
78
78
  backdrops: ImageItem[];
79
79
  logos: ImageItem[];
80
80
  posters: ImageItem[];
81
- };
81
+ }
82
82
  export type MovieRecommendations = PaginatedResponse<MovieResultItem>;
83
83
  export type MovieSimilar = PaginatedResponse<MovieResultItem>;
84
- export type MovieReleaseDates = {
84
+ export interface MovieReleaseDates {
85
85
  id: number;
86
86
  results: MovieReleaseDateResult[];
87
- };
88
- export type MovieReleaseDateResult = {
87
+ }
88
+ export interface MovieReleaseDateResult {
89
89
  iso_3166_1: string;
90
90
  release_dates: MovieReleaseDate[];
91
- };
92
- export type MovieReleaseDate = {
91
+ }
92
+ export interface MovieReleaseDate {
93
93
  certification: string;
94
94
  iso_639_1: string;
95
95
  release_date: string;
96
96
  type: ReleaseType | number;
97
97
  note: string;
98
98
  descriptors: any[];
99
- };
99
+ }
100
100
  export type MovieReviews = PaginatedResponse<MovieReview>;
101
- export type MovieReview = {
101
+ export interface MovieReview {
102
102
  author: string;
103
103
  author_details: MovieReviewAuthorDetails;
104
104
  content: string;
@@ -106,18 +106,18 @@ export type MovieReview = {
106
106
  id: string;
107
107
  updated_at: string;
108
108
  url: string;
109
- };
110
- export type MovieReviewAuthorDetails = {
109
+ }
110
+ export interface MovieReviewAuthorDetails {
111
111
  name: string;
112
112
  username: string;
113
113
  avatar_path?: string;
114
114
  rating?: number;
115
- };
116
- export type MovieTranslations = {
115
+ }
116
+ export interface MovieTranslations {
117
117
  id: number;
118
118
  translations: MovieTranslationResults[];
119
- };
120
- export type MovieTranslationResults = {
119
+ }
120
+ export interface MovieTranslationResults {
121
121
  iso_3166_1: string;
122
122
  iso_639_1: string;
123
123
  name: string;
@@ -129,30 +129,30 @@ export type MovieTranslationResults = {
129
129
  tagline: string;
130
130
  title: string;
131
131
  };
132
- };
133
- export type MovieVideos = {
132
+ }
133
+ export interface MovieVideos {
134
134
  id: number;
135
135
  results: VideoItem[];
136
- };
137
- export type MovieWatchProvider = {
136
+ }
137
+ export interface MovieWatchProvider {
138
138
  id: number;
139
139
  results: Record<ISO3166Country, WatchProvider[]>;
140
- };
141
- export type WatchProvider = {
140
+ }
141
+ export interface WatchProvider {
142
142
  link: string;
143
143
  flatrate: WatchProviderItem[];
144
144
  rent: WatchProviderItem[];
145
145
  buy: WatchProviderItem[];
146
- };
147
- export type WatchProviderItem = {
146
+ }
147
+ export interface WatchProviderItem {
148
148
  logo_path: string;
149
149
  provider_id: number;
150
150
  provider_name: string;
151
151
  display_priority: number;
152
- };
152
+ }
153
153
  /** Append To Response */
154
154
  export type MovieAppendToResponseNamespace = "alternative_titles" | "changes" | "credits" | "external_ids" | "images" | "keywords" | "recommendations" | "release_dates" | "reviews" | "similar" | "translations" | "videos";
155
- export type MovieAppendableMap = {
155
+ export interface MovieAppendableMap {
156
156
  alternative_titles: MovieAlternativeTitles;
157
157
  changes: MovieChanges;
158
158
  credits: MovieCredits;
@@ -165,7 +165,7 @@ export type MovieAppendableMap = {
165
165
  similar: MovieSimilar;
166
166
  translations: MovieTranslations;
167
167
  videos: MovieVideos;
168
- };
168
+ }
169
169
  export type MovieDetailsWithAppends<T extends readonly MovieAppendToResponseNamespace[]> = MovieDetails & {
170
170
  [K in T[number]]: MovieAppendableMap[K];
171
171
  };
@@ -1,13 +1,13 @@
1
1
  import { CountryISO3166_1 } from "./countries";
2
2
  import { LanguageISO6391 } from "./lang";
3
3
  import { MovieAppendToResponseNamespace } from "./movies";
4
- export type PaginatedResponse<T> = {
4
+ export interface PaginatedResponse<T> {
5
5
  page: number;
6
6
  total_pages: number;
7
7
  total_results: number;
8
8
  results: T[];
9
- };
10
- export type SearchMoviesParams = {
9
+ }
10
+ export interface SearchMoviesParams {
11
11
  query: string;
12
12
  include_adult?: boolean;
13
13
  language?: LanguageISO6391;
@@ -15,48 +15,48 @@ export type SearchMoviesParams = {
15
15
  primary_release_year?: string;
16
16
  region?: CountryISO3166_1;
17
17
  year?: string;
18
- };
19
- export type MovieListParams = {
18
+ }
19
+ export interface MovieListParams {
20
20
  language?: LanguageISO6391;
21
21
  page?: number;
22
22
  region?: CountryISO3166_1;
23
- };
24
- export type MovieDetailsParams = {
23
+ }
24
+ export interface MovieDetailsParams {
25
25
  movie_id: number;
26
26
  append_to_response?: MovieAppendToResponseNamespace[];
27
27
  language?: LanguageISO6391;
28
- };
29
- export type MovieAlternativeTitlesParams = {
28
+ }
29
+ export interface MovieAlternativeTitlesParams {
30
30
  movie_id: number;
31
31
  country?: CountryISO3166_1;
32
- };
33
- export type MovieCreditsParams = {
32
+ }
33
+ export interface MovieCreditsParams {
34
34
  movie_id: number;
35
35
  language?: LanguageISO6391;
36
- };
37
- export type MovieKeywordsParams = {
36
+ }
37
+ export interface MovieKeywordsParams {
38
38
  movie_id: number;
39
- };
39
+ }
40
40
  export type MovieExternalIDsParams = MovieKeywordsParams;
41
41
  export type MovieReleaseDatesParams = MovieKeywordsParams;
42
42
  export type MovieTranslationsParams = MovieKeywordsParams;
43
43
  export type MovieWathProvidersParams = MovieKeywordsParams;
44
- export type MovieChangesParams = {
44
+ export interface MovieChangesParams {
45
45
  movie_id: number;
46
46
  page?: number;
47
47
  start_date?: string;
48
48
  end_date?: string;
49
- };
50
- export type MovieImagesParams = {
49
+ }
50
+ export interface MovieImagesParams {
51
51
  movie_id: number;
52
52
  language?: LanguageISO6391;
53
53
  include_image_language?: LanguageISO6391;
54
- };
55
- export type MovieRecommendationsParams = {
54
+ }
55
+ export interface MovieRecommendationsParams {
56
56
  movie_id: number;
57
57
  page?: number;
58
58
  language?: LanguageISO6391;
59
- };
59
+ }
60
60
  export type MovieSimilarParams = MovieRecommendationsParams;
61
61
  export type MovieVideosParams = MovieCreditsParams;
62
62
  export type MovieReviewsParams = MovieRecommendationsParams;
@@ -0,0 +1,6 @@
1
+ // @ts-check
2
+
3
+ import eslint from "@eslint/js";
4
+ import tseslint from "typescript-eslint";
5
+
6
+ export default tseslint.config(eslint.configs.recommended, tseslint.configs.strict, { ignores: ["dist/**", "node_modules"] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lorenzopant/tmdb",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "A completely type-safe The Movie Database (TMDB) API wrapper for typescript applications.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,23 +17,40 @@
17
17
  "movies"
18
18
  ],
19
19
  "devDependencies": {
20
+ "@eslint/compat": "^1.3.1",
21
+ "@eslint/eslintrc": "^3.3.1",
22
+ "@eslint/js": "^9.30.0",
20
23
  "@types/node": "^22.15.2",
24
+ "@types/react": "^19.1.8",
25
+ "@typescript-eslint/eslint-plugin": "^8.35.0",
26
+ "@typescript-eslint/parser": "^8.35.0",
21
27
  "@vitest/coverage-v8": "^3.1.2",
22
28
  "@vitest/ui": "^3.1.2",
23
29
  "dotenv": "^16.5.0",
30
+ "eslint": "^9.30.0",
31
+ "eslint-config-prettier": "^10.1.5",
32
+ "eslint-plugin-import": "^2.32.0",
33
+ "husky": "^9.1.7",
34
+ "pino": "^9.7.0",
35
+ "react": "^19.1.0",
36
+ "react-dom": "^19.1.0",
24
37
  "release-it": "^19.0.3",
25
38
  "release-it-pnpm": "^4.6.6",
26
39
  "typescript": "^5.8.3",
40
+ "typescript-eslint": "^8.35.0",
41
+ "vite": "^7.0.0",
27
42
  "vitest": "^3.2.4"
28
43
  },
29
- "dependencies": {
30
- "vite": "^7.0.0"
44
+ "peerDependencies": {
45
+ "react": "^18.0.0",
46
+ "react-dom": "^18.0.0"
31
47
  },
32
48
  "scripts": {
33
49
  "build": "tsc",
34
50
  "build:watch": "tsc --watch",
35
51
  "test": "vitest",
36
52
  "test:ui": "vitest --ui",
37
- "test:coverage": "vitest --coverage"
53
+ "test:coverage": "vitest --coverage",
54
+ "lint": "eslint ."
38
55
  }
39
56
  }
package/tsconfig.json CHANGED
@@ -13,7 +13,7 @@
13
13
  /* Language and Environment */
14
14
  "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
15
  // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
- // "jsx": "preserve", /* Specify what JSX code is generated. */
16
+ "jsx": "react-jsx", /* Specify what JSX code is generated. */
17
17
  // "libReplacement": true, /* Enable lib replacement. */
18
18
  // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
19
19
  // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
@@ -52,15 +52,15 @@
52
52
  // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
53
53
 
54
54
  /* Emit */
55
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
56
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
55
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
56
+ "declarationMap": true, /* Create sourcemaps for d.ts files. */
57
57
  // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
58
58
  // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
59
59
  // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
60
60
  // "noEmit": true, /* Disable emitting files from a compilation. */
61
61
  // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
62
- "outDir": "dist", /* Specify an output folder for all emitted files. */
63
- "removeComments": false, /* Disable emitting comments. */
62
+ "outDir": "dist", /* Specify an output folder for all emitted files. */
63
+ "removeComments": false, /* Disable emitting comments. */
64
64
  // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
65
65
  // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
66
66
  // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
@@ -79,7 +79,7 @@
79
79
  // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
80
80
  // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
81
81
  // "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */
82
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
82
+ "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
83
83
  "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
84
84
  // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
85
85
  "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
package/vitest.config.mts CHANGED
@@ -1,4 +1,3 @@
1
- import { loadEnvFile } from "process";
2
1
  import { defineConfig } from "vitest/config";
3
2
  import { loadEnv } from "vite";
4
3