export type GetApiPlansPlanSanitizedJsonOutputArgs = {plan: string, format?: ('text' | 'gzip') | undefined}; export type GetApiPlansPlanSanitizedJsonOutputOptions = {baseUrl?: string | undefined, APIKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Sanitized JSON Output * * GET /plans/{plan}/sanitized-json-output */ export const getApiPlansPlanSanitizedJsonOutput = async (args: GetApiPlansPlanSanitizedJsonOutputArgs, options?: GetApiPlansPlanSanitizedJsonOutputOptions) => { const {baseUrl = "https://example.scalr.io/api/iacp/v3", fetch: fetchFn = fetch, APIKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.format != null) query.append("format", String(args.format)) if (APIKey !== undefined) headers.set('authorization', `Bearer ${APIKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/plans/${encodeURIComponent(String(args.plan))}/sanitized-json-output${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 };