export type CarrierIssueExternalRefRequest = {carrierIssueId: string, externalId: string}; export type CreateApiV2CarrierIssuesExternalRefArgs = {body: CarrierIssueExternalRefRequest}; export type CreateApiV2CarrierIssuesExternalRefOptions = {baseUrl?: string | undefined, httpBasic?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Report the external incident id for a carrier issue * * POST /v2/carrier-issues/external-ref */ export const createApiV2CarrierIssuesExternalRef = async (args: CreateApiV2CarrierIssuesExternalRefArgs, options?: CreateApiV2CarrierIssuesExternalRefOptions) => { const {baseUrl = "https://api.prod.goaugment.com", fetch: fetchFn = fetch, httpBasic} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (httpBasic !== undefined) headers.set('authorization', `Basic ${btoa(`${httpBasic.username}:${httpBasic.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/carrier-issues/external-ref${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };