import API from "api/Api";
import type { AxiosPromise } from "axios";
import type { AppTheme } from "entities/AppTheming";
import type { ApiResponse } from "./ApiResponses";
class AppThemingApi extends API {
static baseUrl = "/v1";
/**
* fires api to get all themes
*
* @returns
*/
static fetchThemes(
applicationId: string,
): AxiosPromise<ApiResponse<AppTheme[]>> {
return API.get(
`${AppThemingApi.baseUrl}/themes/applications/${applicationId}`,
);
}
* fires api to fetch selected theme
* @param applicationId
static fetchSelected(
mode = "EDIT",
`${AppThemingApi.baseUrl}/themes/applications/${applicationId}/current?mode=${mode}`,
* fires api to updating current theme
* @param theme
static updateTheme(
theme: AppTheme,
return API.put(
theme,
static changeTheme(
return API.patch(
`${AppThemingApi.baseUrl}/applications/${applicationId}/themes/${theme.id}`,
* fires api for saving current theme
static saveTheme(
payload: { name: string },
payload,
* fires api for deleting theme
static deleteTheme(themeId: string): AxiosPromise<ApiResponse<AppTheme[]>> {
return API.delete(`${AppThemingApi.baseUrl}/themes/${themeId}`);
export default AppThemingApi;