Merge branch 'blakejoy:master' into master
This commit is contained in:
27
src/endpoints/collections.ts
Normal file
27
src/endpoints/collections.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { DetailedCollection, ImageCollection, LanguageOption, Translations } from '../types';
|
||||
import { BaseEndpoint } from './base';
|
||||
import querystring from 'querystring';
|
||||
|
||||
const BASE_COLLECTION = '/collection';
|
||||
|
||||
export class CollectionsEndpoint extends BaseEndpoint {
|
||||
constructor(protected readonly accessToken: string) {
|
||||
super(accessToken);
|
||||
}
|
||||
|
||||
async details(id: number, options? : LanguageOption): Promise<DetailedCollection> {
|
||||
const params = querystring.encode(options);
|
||||
return await this.api.get<DetailedCollection>(`${BASE_COLLECTION}/${id}?${params}`);
|
||||
}
|
||||
|
||||
async images(id: number, options? : LanguageOption): Promise<ImageCollection> {
|
||||
const params = querystring.encode(options);
|
||||
return await this.api.get<ImageCollection>(`${BASE_COLLECTION}/${id}/images?${params}`);
|
||||
}
|
||||
|
||||
async translations(id: number, options? : LanguageOption): Promise<Translations> {
|
||||
const params = querystring.encode(options);
|
||||
return await this.api.get<Translations>(`${BASE_COLLECTION}/${id}/translations?${params}`);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,4 +14,6 @@ export * from './people';
|
||||
export * from './review';
|
||||
export * from './trending';
|
||||
export * from './find';
|
||||
export * from './keywords';
|
||||
export * from './collections';
|
||||
|
||||
|
||||
20
src/endpoints/keywords.ts
Normal file
20
src/endpoints/keywords.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { BaseEndpoint } from './base';
|
||||
import querystring from 'querystring';
|
||||
import { BelongingMovies, Keyword, KeywordsOptions } from '../types';
|
||||
|
||||
const BASE_Keyword = '/keyword';
|
||||
|
||||
export class KeywordsEndpoint extends BaseEndpoint {
|
||||
constructor(accessToken: string) {
|
||||
super(accessToken);
|
||||
}
|
||||
|
||||
async details(keywordId : number): Promise<Keyword> {
|
||||
return await this.api.get<Keyword>(`${BASE_Keyword}/${keywordId}`);
|
||||
}
|
||||
|
||||
async belongingMovies(keywordId : number, options?: KeywordsOptions): Promise<BelongingMovies> {
|
||||
const params = querystring.encode(options);
|
||||
return await this.api.get<BelongingMovies>(`${BASE_Keyword}/${keywordId}/movies?${params}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user