* Updated Typescript types. * Typefixes after merge with release. * chore: GenericApiResponse Removed alltogether. * chore: resolved ApiResponse unknown errors removed PageListPayload. * Added shouldBeDefined. * fix: Resolved type errors. * fix: Typescript upgrade to 4.5 and type fixes. * feat: upgrade to cra 5 * feat: uncomment service worker registeration * force secure websocket protocol * jest test fixes * fix: react function lint rule removed * fix: klona test case. * fix: typescirpt issues resolved * fix: timeout for colorpicker test and change env. * feat: update client-build.yml file * fix: remove brotliplugin use compression plugin * fix: build config fixed * fix: upgrade webpack plugin * fix: add branchbutton test to todo. * fix: remove branch button test. * fix: Add tailwind theme values, fix cypress tests * fix: Typescript type fixes. * feat: run jest tests in silent mode * fix: cypress rgb values add branchbutton jest test * fix: review comments, fixes for error.message * fix: increase cache size for the workbox * fix: remove OrgApi.ts file * fix: cypress.json file remove credentials * fix: downgrade react and react-dom packages Co-authored-by: rahulramesha <rahul@appsmith.com>
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
import { AxiosPromise } from "axios";
|
|
import Api from "api/Api";
|
|
import { ApiResponse } from "./ApiResponses";
|
|
import { WidgetType } from "constants/WidgetConstants";
|
|
import { ApplicationResponsePayload } from "./ApplicationApi";
|
|
|
|
export interface Template {
|
|
id: string;
|
|
userPermissions: string[];
|
|
title: string;
|
|
description: string;
|
|
appUrl: string;
|
|
gifUrl: string;
|
|
screenshotUrls: string[];
|
|
widgets: WidgetType[];
|
|
functions: string[];
|
|
useCases: string[];
|
|
datasources: string[];
|
|
}
|
|
|
|
export type FetchTemplatesResponse = ApiResponse<Template[]>;
|
|
export type FilterKeys = "widgets" | "datasources";
|
|
|
|
export type FetchTemplateResponse = ApiResponse<Template>;
|
|
|
|
export type ImportTemplateResponse = ApiResponse<ApplicationResponsePayload>;
|
|
|
|
class TemplatesAPI extends Api {
|
|
static baseUrl = "v1";
|
|
|
|
static getAllTemplates(): AxiosPromise<FetchTemplatesResponse> {
|
|
return Api.get(TemplatesAPI.baseUrl + `/app-templates`);
|
|
}
|
|
static getTemplateInformation(
|
|
templateId: string,
|
|
): AxiosPromise<FetchTemplatesResponse> {
|
|
return Api.get(TemplatesAPI.baseUrl + `/app-templates/${templateId}`);
|
|
}
|
|
static getSimilarTemplates(
|
|
templateId: string,
|
|
): AxiosPromise<FetchTemplatesResponse> {
|
|
return Api.get(
|
|
TemplatesAPI.baseUrl + `/app-templates/${templateId}/similar`,
|
|
);
|
|
}
|
|
static importTemplate(
|
|
templateId: string,
|
|
workspaceId: string,
|
|
): AxiosPromise<ImportTemplateResponse> {
|
|
return Api.post(
|
|
TemplatesAPI.baseUrl +
|
|
`/app-templates/${templateId}/import/${workspaceId}`,
|
|
);
|
|
}
|
|
}
|
|
|
|
export default TemplatesAPI;
|