48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import type { ApiSettings } from "../types";
|
|
import type { PlatformModuleInfo } from "../types";
|
|
import { apiFetch } from "./client";
|
|
|
|
export type PlatformModulesResponse = { modules: PlatformModuleInfo[] };
|
|
|
|
export type PlatformStatusResponse = {
|
|
maintenance_mode: {
|
|
enabled: boolean;
|
|
message?: string | null;
|
|
};
|
|
i18n?: {
|
|
available_languages: Array<{
|
|
code: string;
|
|
label: string;
|
|
native_label?: string | null;
|
|
}>;
|
|
enabled_languages: string[];
|
|
default_language: string;
|
|
};
|
|
};
|
|
|
|
export type PlatformPermission = {
|
|
scope: string;
|
|
module_id: string;
|
|
resource: string;
|
|
action: string;
|
|
label: string;
|
|
description: string;
|
|
category: string;
|
|
level: "system" | "tenant";
|
|
deprecated: boolean;
|
|
};
|
|
|
|
export type PlatformPermissionsResponse = { permissions: PlatformPermission[] };
|
|
|
|
export async function fetchPlatformModules(settings: ApiSettings): Promise<PlatformModulesResponse> {
|
|
return apiFetch<PlatformModulesResponse>(settings, "/api/v1/platform/modules");
|
|
}
|
|
|
|
export async function fetchPlatformStatus(settings: ApiSettings): Promise<PlatformStatusResponse> {
|
|
return apiFetch<PlatformStatusResponse>(settings, "/api/v1/platform/status");
|
|
}
|
|
|
|
export async function fetchPlatformPermissions(settings: ApiSettings): Promise<PlatformPermissionsResponse> {
|
|
return apiFetch<PlatformPermissionsResponse>(settings, "/api/v1/platform/permissions");
|
|
}
|