bazarr/frontend/src/apis/raw/movies.ts

94 lines
2.2 KiB
TypeScript
Raw Normal View History

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
}
async movies(radarrid?: number[]) {
const response = await this.get<DataWrapperWithTotal<Item.Movie>>("", {
2021-08-17 14:52:50 +00:00
radarrid,
2021-03-25 14:22:43 +00:00
});
return response.data;
2021-03-25 14:22:43 +00:00
}
async moviesBy(params: Parameter.Range) {
const response = await this.get<DataWrapperWithTotal<Item.Movie>>(
"",
params
);
2021-08-17 14:52:50 +00:00
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
}
async wanted(params: Parameter.Range) {
const response = await this.get<DataWrapperWithTotal<Wanted.Movie>>(
2021-08-17 14:52:50 +00:00
"/wanted",
params
);
return response;
2021-03-25 14:22:43 +00:00
}
async wantedBy(radarrid: number[]) {
const response = await this.get<DataWrapperWithTotal<Wanted.Movie>>(
"/wanted",
{
radarrid,
}
);
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<DataWrapperWithTotal<History.Movie>>(
2021-08-17 14:27:33 +00:00
"/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<DataWrapperWithTotal<History.Movie>>(
2021-08-17 14:27:33 +00:00
"/history",
{ radarrid }
);
return response.data;
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();