export type DeleteApiEnrollmentsEnrollmentIdArgs = {enrollmentId: string}; export type DeleteApiEnrollmentsEnrollmentIdOptions = {baseUrl?: string | undefined, httpApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes an enrollment request. Only enrollments in DRAFT status can be deleted. This operation is idempotent. * * DELETE /enrollments/{enrollmentId} */ export const deleteApiEnrollmentsEnrollmentId = async (args: DeleteApiEnrollmentsEnrollmentIdArgs, options?: DeleteApiEnrollmentsEnrollmentIdOptions) => { const {baseUrl = "https://enrollments.us.stedi.com/2024-09-01", fetch: fetchFn = fetch, httpApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (httpApiKeyAuth !== undefined) headers.set("Authorization", httpApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/enrollments/${encodeURIComponent(String(args.enrollmentId))}${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 };