2021-03-25 14:22:43 +00:00
|
|
|
import BaseApi from "./base";
|
|
|
|
|
|
|
|
class MovieApi extends BaseApi {
|
|
|
|
constructor() {
|
|
|
|
super("/movies");
|
|
|
|
}
|
|
|
|
|
2021-08-17 14:52:50 +00:00
|
|
|
async blacklist() {
|
|
|
|
const response = await this.get<DataWrapper<Blacklist.Movie[]>>(
|
|
|
|
"/blacklist"
|
|
|
|
);
|
|
|
|
return response.data;
|
2021-03-25 14:22:43 +00:00
|
|
|
}
|
|
|
|
|
2021-08-17 14:52:50 +00:00
|
|
|
async addBlacklist(radarrid: number, form: FormType.AddBlacklist) {
|
|
|
|
await this.post("/blacklist", form, { radarrid });
|
2021-03-25 14:22:43 +00:00
|
|
|
}
|
|
|
|
|
2021-08-17 14:52:50 +00:00
|
|
|
async deleteBlacklist(all?: boolean, form?: FormType.DeleteBlacklist) {
|
|
|
|
await this.delete("/blacklist", form, { all });
|
2021-03-25 14:22:43 +00:00
|
|
|
}
|
|
|
|
|
2021-05-08 14:25:29 +00:00
|
|
|
async movies(radarrid?: number[]) {
|
2021-08-17 14:52:50 +00:00
|
|
|
const response = await this.get<AsyncDataWrapper<Item.Movie>>("", {
|
|
|
|
radarrid,
|
2021-03-25 14:22:43 +00:00
|
|
|
});
|
2021-08-17 14:52:50 +00:00
|
|
|
return response;
|
2021-03-25 14:22:43 +00:00
|
|
|
}
|
|
|
|
|
2021-08-14 12:59:08 +00:00
|
|
|
async moviesBy(params: Parameter.Range) {
|
2021-08-17 14:52:50 +00:00
|
|
|
const response = await this.get<AsyncDataWrapper<Item.Movie>>("", params);
|
|
|
|
return response;
|
2021-03-25 14:22:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async modify(form: FormType.ModifyItem) {
|
2021-08-17 14:52:50 +00:00
|
|
|
await this.post("", { radarrid: form.id, profileid: form.profileid });
|
2021-03-25 14:22:43 +00:00
|
|
|
}
|
|
|
|
|
2021-08-14 12:59:08 +00:00
|
|
|
async wanted(params: Parameter.Range) {
|
2021-08-17 14:52:50 +00:00
|
|
|
const response = await this.get<AsyncDataWrapper<Wanted.Movie>>(
|
|
|
|
"/wanted",
|
|
|
|
params
|
|
|
|
);
|
|
|
|
return response;
|
2021-03-25 14:22:43 +00:00
|
|
|
}
|
|
|
|
|
2021-05-08 14:25:29 +00:00
|
|
|
async wantedBy(radarrid: number[]) {
|
2021-08-17 14:52:50 +00:00
|
|
|
const response = await this.get<AsyncDataWrapper<Wanted.Movie>>("/wanted", {
|
|
|
|
radarrid,
|
2021-03-25 14:22:43 +00:00
|
|
|
});
|
2021-08-17 14:52:50 +00:00
|
|
|
return response;
|
2021-03-25 14:22:43 +00:00
|
|
|
}
|
|
|
|
|
2021-08-17 14:27:33 +00:00
|
|
|
async history(params: Parameter.Range) {
|
|
|
|
const response = await this.get<AsyncDataWrapper<History.Movie>>(
|
|
|
|
"/history",
|
|
|
|
params
|
|
|
|
);
|
2021-08-17 14:52:50 +00:00
|
|
|
return response;
|
2021-08-17 14:27:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async historyBy(radarrid: number) {
|
|
|
|
const response = await this.get<AsyncDataWrapper<History.Movie>>(
|
|
|
|
"/history",
|
|
|
|
{ radarrid }
|
|
|
|
);
|
2021-08-17 14:52:50 +00:00
|
|
|
return response;
|
2021-03-25 14:22:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async action(action: FormType.MoviesAction) {
|
2021-08-17 14:52:50 +00:00
|
|
|
await this.patch("", action);
|
2021-03-25 14:22:43 +00:00
|
|
|
}
|
|
|
|
|
2021-08-17 14:52:50 +00:00
|
|
|
async downloadSubtitles(radarrid: number, form: FormType.Subtitle) {
|
|
|
|
await this.patch("/subtitles", form, { radarrid });
|
2021-03-25 14:22:43 +00:00
|
|
|
}
|
|
|
|
|
2021-08-17 14:52:50 +00:00
|
|
|
async uploadSubtitles(radarrid: number, form: FormType.UploadSubtitle) {
|
|
|
|
await this.post("/subtitles", form, { radarrid });
|
2021-03-25 14:22:43 +00:00
|
|
|
}
|
|
|
|
|
2021-08-17 14:52:50 +00:00
|
|
|
async deleteSubtitles(radarrid: number, form: FormType.DeleteSubtitle) {
|
|
|
|
await this.delete("/subtitles", form, { radarrid });
|
2021-03-25 14:22:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default new MovieApi();
|