1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
import BaseApi from "./base";
class MovieApi extends BaseApi {
constructor() {
super("/movies");
}
async blacklist() {
const response = await this.get<DataWrapper<Blacklist.Movie[]>>(
"/blacklist"
);
return response.data;
}
async addBlacklist(radarrid: number, form: FormType.AddBlacklist) {
await this.post("/blacklist", form, { radarrid });
}
async deleteBlacklist(all?: boolean, form?: FormType.DeleteBlacklist) {
await this.delete("/blacklist", form, { all });
}
async movies(radarrid?: number[]) {
const response = await this.get<DataWrapperWithTotal<Item.Movie>>("", {
radarrid,
});
return response.data;
}
async moviesBy(params: Parameter.Range) {
const response = await this.get<DataWrapperWithTotal<Item.Movie>>(
"",
params
);
return response;
}
async modify(form: FormType.ModifyItem) {
await this.post("", { radarrid: form.id, profileid: form.profileid });
}
async wanted(params: Parameter.Range) {
const response = await this.get<DataWrapperWithTotal<Wanted.Movie>>(
"/wanted",
params
);
return response;
}
async wantedBy(radarrid: number[]) {
const response = await this.get<DataWrapperWithTotal<Wanted.Movie>>(
"/wanted",
{
radarrid,
}
);
return response;
}
async history(params: Parameter.Range) {
const response = await this.get<DataWrapperWithTotal<History.Movie>>(
"/history",
params
);
return response;
}
async historyBy(radarrid: number) {
const response = await this.get<DataWrapperWithTotal<History.Movie>>(
"/history",
{ radarrid }
);
return response.data;
}
async action(action: FormType.MoviesAction) {
await this.patch("", action);
}
async downloadSubtitles(radarrid: number, form: FormType.Subtitle) {
await this.patch("/subtitles", form, { radarrid });
}
async uploadSubtitles(radarrid: number, form: FormType.UploadSubtitle) {
await this.post("/subtitles", form, { radarrid });
}
async deleteSubtitles(radarrid: number, form: FormType.DeleteSubtitle) {
await this.delete("/subtitles", form, { radarrid });
}
}
export default new MovieApi();
|