added Collection endpoint and types, buildable option interfaces
This commit is contained in:
17
src/endpoints/collections.ts
Normal file
17
src/endpoints/collections.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { DetailedCollection, LanguageOption, PageOption } 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}`);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,4 +15,5 @@ export * from './review';
|
||||
export * from './trending';
|
||||
export * from './find';
|
||||
export * from './keywords';
|
||||
export * from './collections';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user