export type GetApiApiOrgIdDbMonitoringQueryPlansArgs = {org_id: string}; export type GetApiApiOrgIdDbMonitoringQueryPlansOptions = {baseUrl: string, Authorization?: string | undefined, fetch?: typeof fetch | undefined}; /** * Database Monitoring: captured query plans for a query * * GET /api/{org_id}/db_monitoring/query/plans */ export const getApiApiOrgIdDbMonitoringQueryPlans = async (args: GetApiApiOrgIdDbMonitoringQueryPlansArgs, options: GetApiApiOrgIdDbMonitoringQueryPlansOptions) => { const {baseUrl, fetch: fetchFn = fetch, Authorization} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (Authorization !== undefined) headers.set("Authorization", Authorization) const url = `${baseUrl.replace(/\/+$/, '')}/api/${encodeURIComponent(String(args.org_id))}/db_monitoring/query/plans${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 };