Comparing version 4.2.0 to 4.3.0
@@ -0,1 +1,5 @@ | ||
# Version 4.3.0 | ||
* Added support for `Game` type from omdb (Fixes #81) | ||
# Version 4.2.0 | ||
@@ -2,0 +6,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { OmdbEpisode, OmdbMovie, OmdbSearch, OmdbSearchResult, OmdbTvshow } from "./interfaces"; | ||
import { OmdbEpisode, OmdbGetResponse, OmdbSearch, OmdbSearchResult, OmdbTvshow } from "./interfaces"; | ||
export interface MovieOpts { | ||
@@ -51,3 +51,3 @@ apiKey?: string; | ||
protected _yearData: string; | ||
constructor(obj: OmdbMovie); | ||
constructor(obj: OmdbGetResponse); | ||
} | ||
@@ -69,2 +69,4 @@ export declare class Episode extends Movie { | ||
} | ||
export declare class Game extends Movie { | ||
} | ||
export declare class SearchResult { | ||
@@ -71,0 +73,0 @@ title: string; |
@@ -27,3 +27,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Client = exports.search = exports.get = exports.ImdbError = exports.SearchResults = exports.SearchResult = exports.TVShow = exports.Episode = exports.Movie = exports.Rating = void 0; | ||
exports.Client = exports.search = exports.get = exports.ImdbError = exports.SearchResults = exports.SearchResult = exports.Game = exports.TVShow = exports.Episode = exports.Movie = exports.Rating = void 0; | ||
var ky = require("ky-universal"); | ||
@@ -199,2 +199,10 @@ var url_1 = require("url"); | ||
exports.TVShow = TVShow; | ||
var Game = (function (_super) { | ||
__extends(Game, _super); | ||
function Game() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return Game; | ||
}(Movie)); | ||
exports.Game = Game; | ||
var SearchResult = (function () { | ||
@@ -311,2 +319,5 @@ function SearchResult(obj) { | ||
} | ||
else if (interfaces_1.isGame(data)) { | ||
ret = new Game(data); | ||
} | ||
else if (interfaces_1.isTvshow(data)) { | ||
@@ -313,0 +324,0 @@ ret = new TVShow(data, opts); |
@@ -5,3 +5,3 @@ export interface OmdbRating { | ||
} | ||
export interface OmdbMovie { | ||
export interface OmdbGetResponse { | ||
Title: string; | ||
@@ -33,50 +33,8 @@ Year: string; | ||
} | ||
export interface OmdbTvshow { | ||
Title: string; | ||
Year: string; | ||
Rated: string; | ||
Released: string; | ||
Runtime: string; | ||
Genre: string; | ||
Director: string; | ||
Writer: string; | ||
Actors: string; | ||
Plot: string; | ||
Language: string; | ||
Country: string; | ||
Awards: string; | ||
Poster: string; | ||
Metascore: string; | ||
imdbRating: string; | ||
imdbVotes: string; | ||
imdbID: string; | ||
Ratings?: OmdbRating[]; | ||
Type: string; | ||
Response: string; | ||
export interface OmdbTvshow extends OmdbGetResponse { | ||
totalSeasons: string; | ||
} | ||
export interface OmdbEpisode { | ||
Title: string; | ||
Released: string; | ||
export interface OmdbEpisode extends OmdbGetResponse { | ||
Season: string; | ||
Episode: string; | ||
Type: string; | ||
imdbRating: string; | ||
imdbID: string; | ||
imdbVotes: string; | ||
Year: string; | ||
Rated: string; | ||
Runtime: string; | ||
Genre: string; | ||
Director: string; | ||
Writer: string; | ||
Actors: string; | ||
Plot: string; | ||
Language: string; | ||
Country: string; | ||
Awards: string; | ||
Poster: string; | ||
Ratings?: OmdbRating[]; | ||
Metascore: string; | ||
Response: string; | ||
} | ||
@@ -106,5 +64,6 @@ export interface OmdbSeason { | ||
} | ||
export declare function isError(response: OmdbSearch | OmdbSeason | OmdbTvshow | OmdbMovie | OmdbError): response is OmdbError; | ||
export declare function isTvshow(response: OmdbMovie | OmdbTvshow | OmdbEpisode): response is OmdbTvshow; | ||
export declare function isMovie(response: OmdbMovie | OmdbTvshow | OmdbEpisode): response is OmdbTvshow; | ||
export declare function isEpisode(response: OmdbMovie | OmdbTvshow | OmdbEpisode): response is OmdbEpisode; | ||
export declare function isError(response: OmdbSearch | OmdbSeason | OmdbTvshow | OmdbGetResponse | OmdbError): response is OmdbError; | ||
export declare function isTvshow(response: OmdbGetResponse): response is OmdbTvshow; | ||
export declare function isMovie(response: OmdbGetResponse): boolean; | ||
export declare function isEpisode(response: OmdbGetResponse): response is OmdbEpisode; | ||
export declare function isGame(response: OmdbGetResponse): boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isEpisode = exports.isMovie = exports.isTvshow = exports.isError = void 0; | ||
exports.isGame = exports.isEpisode = exports.isMovie = exports.isTvshow = exports.isError = void 0; | ||
function isError(response) { | ||
@@ -20,2 +20,6 @@ return response.Response === "False"; | ||
exports.isEpisode = isEpisode; | ||
function isGame(response) { | ||
return response.Type === "game"; | ||
} | ||
exports.isGame = isGame; | ||
//# sourceMappingURL=interfaces.js.map |
@@ -5,3 +5,3 @@ { | ||
"description": "Queries unofficial imdb APIs to get movie and television information from imdb", | ||
"version": "4.2.0", | ||
"version": "4.3.0", | ||
"main": "./lib/imdb.js", | ||
@@ -69,3 +69,3 @@ "types": "./lib/imdb.d.ts", | ||
"ky": "^0.23.0", | ||
"ky-universal": "^0.8.1" | ||
"ky-universal": "^0.8.2" | ||
}, | ||
@@ -72,0 +72,0 @@ "mocha": { |
@@ -6,2 +6,3 @@ import * as ky from "ky-universal"; | ||
isError, | ||
isGame, | ||
isMovie, | ||
@@ -11,3 +12,3 @@ isTvshow, | ||
OmdbError, | ||
OmdbMovie, | ||
OmdbGetResponse, | ||
OmdbSearch, | ||
@@ -254,3 +255,3 @@ OmdbSearchResult, | ||
*/ | ||
constructor(obj: OmdbMovie) { | ||
constructor(obj: OmdbGetResponse) { | ||
this.ratings = []; | ||
@@ -450,2 +451,4 @@ | ||
export class Game extends Movie {} | ||
/** | ||
@@ -682,3 +685,3 @@ * A single search result from either {@link search} or {@link Client.search}. | ||
.json() | ||
.then((data: OmdbMovie | OmdbError) => { | ||
.then((data: OmdbGetResponse | OmdbError) => { | ||
let ret: Movie | Episode; | ||
@@ -691,2 +694,4 @@ if (isError(data)) { | ||
ret = new Movie(data); | ||
} else if (isGame(data)) { | ||
ret = new Game(data); | ||
} else if (isTvshow(data)) { | ||
@@ -693,0 +698,0 @@ ret = new TVShow(data, opts); |
@@ -6,3 +6,3 @@ export interface OmdbRating { | ||
export interface OmdbMovie { | ||
export interface OmdbGetResponse { | ||
Title: string; | ||
@@ -35,52 +35,9 @@ Year: string; | ||
export interface OmdbTvshow { | ||
Title: string; | ||
Year: string; | ||
Rated: string; | ||
Released: string; | ||
Runtime: string; | ||
Genre: string; | ||
Director: string; | ||
Writer: string; | ||
Actors: string; | ||
Plot: string; | ||
Language: string; | ||
Country: string; | ||
Awards: string; | ||
Poster: string; | ||
Metascore: string; | ||
imdbRating: string; | ||
imdbVotes: string; | ||
imdbID: string; | ||
Ratings?: OmdbRating[]; | ||
Type: string; | ||
Response: string; | ||
export interface OmdbTvshow extends OmdbGetResponse { | ||
totalSeasons: string; | ||
} | ||
export interface OmdbEpisode { | ||
Title: string; | ||
Released: string; | ||
export interface OmdbEpisode extends OmdbGetResponse { | ||
Season: string; | ||
Episode: string; | ||
Type: string; | ||
imdbRating: string; | ||
imdbID: string; | ||
imdbVotes: string; | ||
Year: string; | ||
Rated: string; | ||
Runtime: string; | ||
Genre: string; | ||
Director: string; | ||
Writer: string; | ||
Actors: string; | ||
Plot: string; | ||
Language: string; | ||
Country: string; | ||
Awards: string; | ||
Poster: string; | ||
Ratings?: OmdbRating[]; | ||
Metascore: string; | ||
Response: string; | ||
} | ||
@@ -116,3 +73,3 @@ | ||
export function isError( | ||
response: OmdbSearch | OmdbSeason | OmdbTvshow | OmdbMovie | OmdbError | ||
response: OmdbSearch | OmdbSeason | OmdbTvshow | OmdbGetResponse | OmdbError | ||
): response is OmdbError { | ||
@@ -122,18 +79,16 @@ return response.Response === "False"; | ||
export function isTvshow( | ||
response: OmdbMovie | OmdbTvshow | OmdbEpisode | ||
): response is OmdbTvshow { | ||
export function isTvshow(response: OmdbGetResponse): response is OmdbTvshow { | ||
return response.Type === "series"; | ||
} | ||
export function isMovie( | ||
response: OmdbMovie | OmdbTvshow | OmdbEpisode | ||
): response is OmdbTvshow { | ||
export function isMovie(response: OmdbGetResponse): boolean { | ||
return response.Type === "movie"; | ||
} | ||
export function isEpisode( | ||
response: OmdbMovie | OmdbTvshow | OmdbEpisode | ||
): response is OmdbEpisode { | ||
export function isEpisode(response: OmdbGetResponse): response is OmdbEpisode { | ||
return response.Type === "episode"; | ||
} | ||
export function isGame(response: OmdbGetResponse): boolean { | ||
return response.Type === "game"; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58486
1296
Updatedky-universal@^0.8.2