adding tv networks
This commit is contained in:
23
src/endpoints/networks.ts
Normal file
23
src/endpoints/networks.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { NetworkDetails, NetworkImages } from '..';
|
||||
import { AlternativeNames } from './../types/companies';
|
||||
import { BaseEndpoint } from './base';
|
||||
|
||||
export class NetworksEndpoint extends BaseEndpoint {
|
||||
constructor(protected readonly accessToken: string) {
|
||||
super(accessToken);
|
||||
}
|
||||
|
||||
async details(id: number): Promise<NetworkDetails> {
|
||||
return await this.api.get<NetworkDetails>(`/network/${id}`);
|
||||
}
|
||||
|
||||
async alternativeNames(id: number): Promise<AlternativeNames> {
|
||||
return await this.api.get<AlternativeNames>(
|
||||
`/network/${id}/alternative_names`
|
||||
);
|
||||
}
|
||||
|
||||
async images(id: number): Promise<NetworkImages> {
|
||||
return await this.api.get<NetworkImages>(`/network/${id}/images`);
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
TvEpisodesEndpoint,
|
||||
} from './endpoints';
|
||||
import { CompaniesEndpoint } from './endpoints/companies';
|
||||
import { NetworksEndpoint } from './endpoints/networks';
|
||||
|
||||
export class TMDB {
|
||||
private readonly accessToken: string;
|
||||
@@ -51,6 +52,10 @@ export class TMDB {
|
||||
return new CompaniesEndpoint(this.accessToken);
|
||||
}
|
||||
|
||||
get networks(): NetworksEndpoint {
|
||||
return new NetworksEndpoint(this.accessToken);
|
||||
}
|
||||
|
||||
get search(): SearchEndpoint {
|
||||
return new SearchEndpoint(this.accessToken);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ export * from './options';
|
||||
export * from './certification';
|
||||
export * from './credits';
|
||||
export * from './companies';
|
||||
export * from './networks';
|
||||
export * from './configuration';
|
||||
export * from './changes';
|
||||
export * from './movies';
|
||||
|
||||
15
src/types/networks.ts
Normal file
15
src/types/networks.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Image } from '.';
|
||||
|
||||
export interface NetworkDetails {
|
||||
headquarters: string;
|
||||
homepage: string;
|
||||
id: number;
|
||||
logo_path: string;
|
||||
name: string;
|
||||
origin_country: string;
|
||||
}
|
||||
|
||||
export interface NetworkImages {
|
||||
id: number;
|
||||
logos: Image[];
|
||||
}
|
||||
Reference in New Issue
Block a user