export type DeleteApiV2PortalsPortalIdClassicArgs = {force?: ('true' | 'false') | undefined}; export type DeleteApiV2PortalsPortalIdClassicOptions = {baseUrl?: string | undefined, personalAccessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Portal * * DELETE /v2/portals/{portalId}#classic * * Also accepts auth: systemAccountAccessToken, konnectAccessToken, serviceAccessToken */ export const deleteApiV2PortalsPortalIdClassic = async (args: DeleteApiV2PortalsPortalIdClassicArgs, options?: DeleteApiV2PortalsPortalIdClassicOptions) => { const {baseUrl = "https://global.api.konghq.com", fetch: fetchFn = fetch, personalAccessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.force != null) query.append("force", String(args.force)) if (personalAccessToken !== undefined) headers.set('authorization', `Bearer ${personalAccessToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/portals/${encodeURIComponent(String(args.portalId))}#classic${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };