Add company endpoints
This commit is contained in:
21
src/endpoints/companies.ts
Normal file
21
src/endpoints/companies.ts
Normal file
@@ -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<CompanyDetails> {
|
||||
return await this.api.get<CompanyDetails>(`/company/${id}`);
|
||||
}
|
||||
|
||||
async alternativeNames(id: number): Promise<AlternativeNames> {
|
||||
return await this.api.get<AlternativeNames>(`/company/${id}/alternative_names`);
|
||||
}
|
||||
|
||||
async images(id: number): Promise<Images> {
|
||||
return await this.api.get<Images>(`/company/${id}/images`);
|
||||
}
|
||||
}
|
||||
33
src/types/companies.ts
Normal file
33
src/types/companies.ts
Normal file
@@ -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[];
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user