export type GetApiMfV1DashboardArgs = {clusterName?: string | undefined}; export type GetApiMfV1DashboardOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get service's dashborad * * GET /mf/v1/dashboard */ export const getApiMfV1Dashboard = async (args: GetApiMfV1DashboardArgs, options?: GetApiMfV1DashboardOptions) => { const {baseUrl = "http://gateway.mlss.mf", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.clusterName != null) query.append("clusterName", String(args.clusterName)) const url = `${baseUrl.replace(/\/+$/, '')}/mf/v1/dashboard${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };