summaryrefslogtreecommitdiffhomepage
path: root/frontend/src/apis/raw/providers.ts
blob: cfbb2dbc599367cc9238d6ffcda81cadb003e97d (plain)
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
import BaseApi from "./base";

class ProviderApi extends BaseApi {
  constructor() {
    super("/providers");
  }

  async providers(history: boolean = false) {
    const response = await this.get<DataWrapper<System.Provider[]>>("", {
      history,
    });
    return response.data;
  }

  async reset() {
    await this.post("", { action: "reset" });
  }

  async movies(id: number) {
    const response = await this.get<DataWrapper<SearchResultType[]>>(
      "/movies",
      { radarrid: id }
    );
    return response.data;
  }

  async downloadMovieSubtitle(radarrid: number, form: FormType.ManualDownload) {
    await this.post("/movies", form, { radarrid });
  }

  async episodes(episodeid: number) {
    const response = await this.get<DataWrapper<SearchResultType[]>>(
      "/episodes",
      {
        episodeid,
      }
    );
    return response.data;
  }

  async downloadEpisodeSubtitle(
    seriesid: number,
    episodeid: number,
    form: FormType.ManualDownload
  ) {
    await this.post("/episodes", form, { seriesid, episodeid });
  }
}

export default new ProviderApi();