export type DeleteApiApiV1SourcesSourceUuidArgs = {source_uuid: string, space_uuid?: string | undefined, space_id?: string | undefined}; export type DeleteApiApiV1SourcesSourceUuidOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Source * * DELETE /api/v1/sources/{source_uuid} */ export const deleteApiApiV1SourcesSourceUuid = async (args: DeleteApiApiV1SourcesSourceUuidArgs, options: DeleteApiApiV1SourcesSourceUuidOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.space_uuid != null) query.append("space_uuid", String(args.space_uuid)) if (args.space_id != null) query.append("space_id", String(args.space_id)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/sources/${encodeURIComponent(String(args.source_uuid))}${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 };