export type InterceptorScope = {vCluster?: string | undefined, group?: string | undefined, username?: string | undefined}; export type DeleteApiGatewayV2InterceptorNameArgs = {name: string, body: InterceptorScope}; export type DeleteApiGatewayV2InterceptorNameOptions = {baseUrl: string, httpAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * DELETE /gateway/v2/interceptor/{name} */ export const deleteApiGatewayV2InterceptorName = async (args: DeleteApiGatewayV2InterceptorNameArgs, options: DeleteApiGatewayV2InterceptorNameOptions) => { const {baseUrl, fetch: fetchFn = fetch, httpAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (httpAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${httpAuth.username}:${httpAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/gateway/v2/interceptor/${encodeURIComponent(String(args.name))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };