initial commit
This commit is contained in:
17
src/endpoints/account.ts
Normal file
17
src/endpoints/account.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Api } from "../api";
|
||||
import {Base} from "./base";
|
||||
|
||||
|
||||
|
||||
export class Account extends Base{
|
||||
|
||||
constructor(accessToken: string){
|
||||
super(accessToken);
|
||||
}
|
||||
|
||||
|
||||
async details(): Promise<any> {
|
||||
return await this.api.get('/account');
|
||||
|
||||
}
|
||||
}
|
||||
12
src/endpoints/base.ts
Normal file
12
src/endpoints/base.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import {Api} from "../api";
|
||||
|
||||
|
||||
export class Base {
|
||||
protected api: Api;
|
||||
|
||||
|
||||
constructor(protected readonly accessToken: string){
|
||||
this.api = new Api(accessToken);
|
||||
}
|
||||
|
||||
}
|
||||
20
src/endpoints/certification.ts
Normal file
20
src/endpoints/certification.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import {Base} from "./base";
|
||||
import {Certifications} from "../types/certification";
|
||||
|
||||
|
||||
export class Certification extends Base{
|
||||
|
||||
constructor(protected readonly accessToken: string){
|
||||
super(accessToken);
|
||||
}
|
||||
|
||||
|
||||
async movies(): Promise<Certifications> {
|
||||
return await this.api.get<Certifications>('/certification/movie/list');
|
||||
|
||||
}
|
||||
|
||||
async tvShows(): Promise<Certifications> {
|
||||
return await this.api.get<Certifications>('/certification/tv/list');
|
||||
}
|
||||
}
|
||||
35
src/endpoints/changes.ts
Normal file
35
src/endpoints/changes.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import querystring, {ParsedUrlQueryInput} from 'querystring';
|
||||
import {Base} from "./base";
|
||||
import {Changes} from "../types/changes";
|
||||
|
||||
|
||||
export interface ChangeOptions extends ParsedUrlQueryInput {
|
||||
end_date?: string;
|
||||
start_date?: string;
|
||||
page?: number;
|
||||
}
|
||||
|
||||
export class Change extends Base{
|
||||
|
||||
constructor(protected readonly accessToken: string){
|
||||
super(accessToken);
|
||||
}
|
||||
|
||||
|
||||
async movies(options?: ChangeOptions): Promise<Changes> {
|
||||
const params = querystring.encode(options);
|
||||
return await this.api.get<Changes>(`/movie/changes?${params}`);
|
||||
|
||||
}
|
||||
|
||||
async tvShows(options?: ChangeOptions): Promise<Changes> {
|
||||
const params = querystring.stringify(options);
|
||||
return await this.api.get<Changes>(`/tv/changes?${params}`);
|
||||
}
|
||||
|
||||
async person(options?: ChangeOptions): Promise<Changes> {
|
||||
const params = querystring.stringify(options);
|
||||
|
||||
return await this.api.get<Changes>(`/person/changes${params}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user