added trending endpoint and types

This commit is contained in:
DerPenz
2023-02-23 18:03:38 +01:00
parent 3c31ab3374
commit c45e74db13
4 changed files with 35 additions and 0 deletions

View File

@@ -12,4 +12,5 @@ export * from './tv-shows';
export * from './discover';
export * from './people';
export * from './review';
export * from './trending';

14
src/endpoints/trending.ts Normal file
View File

@@ -0,0 +1,14 @@
import { MediaType, TimeWindow, TrendingResults, } from '../types';
import { BaseEndpoint } from './base';
export class TrendingEndpoint extends BaseEndpoint {
constructor(accessToken: string) {
super(accessToken);
}
async trending<T extends MediaType>(mediaType : T, timeWindow: TimeWindow): Promise<TrendingResults<T>> {
return await this.api.get<TrendingResults<T>>(`/trending/${mediaType}/${timeWindow}`);
}
}