-
Notifications
You must be signed in to change notification settings - Fork 303
Expand file tree
/
Copy pathjsLibraryApi.ts
More file actions
29 lines (24 loc) · 854 Bytes
/
jsLibraryApi.ts
File metadata and controls
29 lines (24 loc) · 854 Bytes
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
import Api from "./api";
import { AxiosPromise } from "axios";
import { GenericApiResponse } from "api/apiResponses";
import { FetchJSLibraryMetasPayload } from "redux/reduxActions/jsLibraryActions";
export interface JSLibraryMeta {
name: string;
latestVersion: string;
homepage?: string;
description?: string;
}
export interface RecommendedJSLibraryMeta extends JSLibraryMeta {
downloadUrl: string;
}
export class JSLibraryApi extends Api {
static url = "/misc/js-library";
static fetchMetas(
request: FetchJSLibraryMetasPayload
): AxiosPromise<GenericApiResponse<JSLibraryMeta[]>> {
return Api.get(JSLibraryApi.url + `/metas`, { name: request.names.join(",") });
}
static fetchRecommends(): AxiosPromise<GenericApiResponse<RecommendedJSLibraryMeta[]>> {
return Api.get(JSLibraryApi.url + `/recommendations`);
}
}