export type TopicViewId = {name: string, vCluster?: string | undefined}; export type DeleteApiGatewayV2TopicViewArgs = {body: TopicViewId}; export type DeleteApiGatewayV2TopicViewOptions = {baseUrl: string, httpAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * DELETE /gateway/v2/topic-view */ export const deleteApiGatewayV2TopicView = async (args: DeleteApiGatewayV2TopicViewArgs, options: DeleteApiGatewayV2TopicViewOptions) => { 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/topic-view${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 };