import { GridSortDirection } from "@mui/x-data-grid"; import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios"; import { AccountSelf } from "../types/account"; import { SecLevel } from "../types/seclevel"; export declare const HEADERS: { Accept: string; "Content-Type": string; }; export type LoginArgs = { username: string; password: string; }; export type LoginResponse = { userId: number; }; export type LogoutResponse = { success: true; }; export type ErrorResponse = { detail: string; }; /** * Makes a POST request to the /login endpoint. If successful, the server returns a cookie * containing the JWT access token used to access protected endpoints. * * @returns Promise */ export declare const login: ({ username, password, }: LoginArgs) => Promise; /** * Makes a GET request to the /logout endpoint. If successful, the server deletes the JWT Cookie. */ export declare const logout: () => Promise; /** * Generic Endpoint class, for account and webmap endpoints. * First generic contains attributes visible for admins, the second one * only those accessible to regular users (are equal by default). */ declare class Endpoint { protected endpointPath: string; constructor(endpointPath: string); get(id: number, config?: AxiosRequestConfig): Promise; getMe(config?: AxiosRequestConfig): Promise; getAll(orderBy?: string, orderType?: GridSortDirection, limit?: number, offset?: number, config?: AxiosRequestConfig): Promise>; update(id: number, changes: Partial, config?: AxiosRequestConfig): Promise; createNew(object: Partial, config?: AxiosRequestConfig): Promise; } export declare class SecLevelEndpoint { protected endpointPath: string; protected axiosInstance: AxiosInstance; constructor(endpointPath: string, axiosInstance: AxiosInstance); getAll(orderBy?: string, orderType?: GridSortDirection, limit?: number, offset?: number, config?: AxiosRequestConfig): Promise>; update(id: number, changes: Partial, config?: AxiosRequestConfig): Promise; } export interface Webmap { id: number; ars_lnd: string; bezeichner: string; kunden_id: string; projekt_id: string; intern: boolean; titel: string; map_setup: string; kbs: string; is_3d: boolean; aktiv: boolean; factura: boolean; dauer: number; fs_start: string; fs_ende: string; changed_by: string; is_tagged: boolean; is_revised: boolean; is_locked: boolean; is_checked: boolean; is_removed: boolean; } interface WebmapWithAccounts extends Webmap { accounts: Account[]; } export interface Account { id: number; admin: boolean; kontakt_id: string; kunden_id: string; intern: boolean; cookies_1: boolean; cookies_2: boolean; dse: boolean; vnb: boolean; faktura: boolean; vorname: string; nachname: string; username: string; aktiv: boolean; is_removed: boolean; position: string; institut: string; stn: string; hnr: number; hnrz: string; plz: string; ort: string; ortz: string; email: string; mobil: string; telefon: string; changed_by: string; created_by: string; webmaps: { id: number; }[]; } export type WebmapSelf = { id: number; ars_lnd: string; bezeichner: string; backend_url_prod: string; backend_port_dev: string; frontend_url_prod: string; frontend_port_dev: string; }; interface WebmapWithAccounts extends Webmap { accounts: Account[]; } interface AccountWithWebmaps extends Webmap { webmaps: Webmap[]; } /** * The Accounts endpoint. Extends generic Endpoint class by adding the webmaps * endpoints as well as a patch method for changing information about onself. */ declare class AccountsEndpoint extends Endpoint { patchMe(changes: Partial, config?: AxiosRequestConfig): Promise; getWebmaps(accountId: number, config?: AxiosRequestConfig): Promise; addWebmap(accountId: number, webMapId: number, config?: AxiosRequestConfig): Promise; putWebmaps(accountId: number, webMapIds: number[], config?: AxiosRequestConfig): Promise; removeWebmap(accountId: number, webMapId: number, config?: AxiosRequestConfig): Promise; } /** * The Webmaps endpoint. Extends generic Endpoint class by adding the accounts * endpoints. */ declare class WebmapsEndpoint extends Endpoint { getAccounts(webmapId: number, config?: AxiosRequestConfig): Promise; addAccount(webmapId: number, accountId: number, config?: AxiosRequestConfig): Promise; removeAccount(webMapId: number, accountId: number, config?: AxiosRequestConfig): Promise; } export declare const Accounts: AccountsEndpoint; export declare const Webmaps: WebmapsEndpoint; export declare const SecLevelsPortal: SecLevelEndpoint; export {};