2019-11-29 05:22:49 +00:00
|
|
|
import Api from "./Api";
|
|
|
|
|
import { AxiosPromise } from "axios";
|
|
|
|
|
import { GenericApiResponse } from "api/ApiResponses";
|
|
|
|
|
|
|
|
|
|
export interface Plugin {
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
type: "API" | "DB";
|
2020-04-14 12:34:14 +00:00
|
|
|
packageName: string;
|
2020-07-21 10:36:53 +00:00
|
|
|
iconLocation?: string;
|
2020-04-14 12:34:14 +00:00
|
|
|
uiComponent: "ApiEditorForm" | "RapidApiEditorForm" | "DbEditorForm";
|
2020-05-05 09:03:03 +00:00
|
|
|
allowUserDatasources?: boolean;
|
2020-07-21 10:36:53 +00:00
|
|
|
templates: Record<string, string>;
|
|
|
|
|
responseType?: "TABLE" | "JSON";
|
|
|
|
|
documentationLink?: string;
|
2019-11-29 05:22:49 +00:00
|
|
|
}
|
|
|
|
|
|
2020-04-29 09:23:23 +00:00
|
|
|
export interface DatasourceForm {
|
|
|
|
|
form: [];
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-29 05:22:49 +00:00
|
|
|
class PluginsApi extends Api {
|
|
|
|
|
static url = "v1/plugins";
|
2020-06-17 10:19:56 +00:00
|
|
|
static fetchPlugins(
|
|
|
|
|
orgId: string,
|
|
|
|
|
): AxiosPromise<GenericApiResponse<Plugin[]>> {
|
|
|
|
|
return Api.get(PluginsApi.url, { organizationId: orgId });
|
2019-11-29 05:22:49 +00:00
|
|
|
}
|
2020-04-29 09:23:23 +00:00
|
|
|
|
|
|
|
|
static fetchFormConfig(
|
|
|
|
|
id: string,
|
|
|
|
|
): AxiosPromise<GenericApiResponse<DatasourceForm>> {
|
|
|
|
|
return Api.get(PluginsApi.url + `/${id}/form`);
|
|
|
|
|
}
|
2019-11-29 05:22:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default PluginsApi;
|