Files
tmdb-ts/src/endpoints/changes.ts
Tobias Karlsson f8b5564d22 Replace querystring with URLSearchParams
URLSearchParams has greater compatibility with browser code

Created new PageOptions and LocaleOptions for easier use
with URLSearchParams
2023-03-08 14:15:48 +01:00

31 lines
952 B
TypeScript

import { BaseEndpoint } from './base';
import { ChangeOptions, Changes } from '../types/changes';
export class ChangeEndpoint extends BaseEndpoint {
constructor(protected readonly accessToken: string) {
super(accessToken);
}
async movies(options?: ChangeOptions): Promise<Changes> {
const params = options
? new URLSearchParams(Object.entries(options)).toString()
: '';
return await this.api.get<Changes>(`/movie/changes?${params}`);
}
async tvShows(options?: ChangeOptions): Promise<Changes> {
const params = options
? new URLSearchParams(Object.entries(options)).toString()
: '';
return await this.api.get<Changes>(`/tv/changes?${params}`);
}
async person(options?: ChangeOptions): Promise<Changes> {
const params = options
? new URLSearchParams(Object.entries(options)).toString()
: '';
return await this.api.get<Changes>(`/person/changes${params}`);
}
}