diff --git a/src/endpoints/companies.ts b/src/endpoints/companies.ts new file mode 100644 index 0000000..d8410ce --- /dev/null +++ b/src/endpoints/companies.ts @@ -0,0 +1,21 @@ +import { Images } from './../types'; +import { CompanyDetails, AlternativeNames } from './../types/companies'; +import { BaseEndpoint } from './base'; + +export class CompaniesEndpoint extends BaseEndpoint { + constructor(protected readonly accessToken: string) { + super(accessToken); + } + + async details(id: number): Promise { + return await this.api.get(`/company/${id}`); + } + + async alternativeNames(id: number): Promise { + return await this.api.get(`/company/${id}/alternative_names`); + } + + async images(id: number): Promise { + return await this.api.get(`/company/${id}/images`); + } +} diff --git a/src/types/companies.ts b/src/types/companies.ts new file mode 100644 index 0000000..3ec621a --- /dev/null +++ b/src/types/companies.ts @@ -0,0 +1,33 @@ +import { Image } from '.'; + +export interface CompanyDetails { + description: string; + headquarters: string; + homepage: string; + id: number; + logo_path: string; + name: string; + origin_country: string; + parent_company: ParentCompany; +} + +export interface ParentCompany { + name: string; + id: number; + logo_path: string; +} + +export interface AlternativeNames { + id: number; + results: Name[]; +} + +export interface Name { + name: string; + type: string; +} + +export interface CompanyImages { + id: number; + logos: Image[]; +} diff --git a/src/types/index.ts b/src/types/index.ts index 9da1316..fd1bcf5 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,6 +1,7 @@ export * from './options'; export * from './certification'; export * from './credits'; +export * from './companies'; export * from './configuration'; export * from './changes'; export * from './movies';