export type ExternalCode = {external_code_type_id: string, value: string}; export type CreateApiProductReservationsActionsSetProductReservationExternalCodesArgs = {'Accept-Language'?: string | undefined, body: {product_reservation_id: string, external_reservation_codes: Array}}; export type CreateApiProductReservationsActionsSetProductReservationExternalCodesOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Set one or multiple external reservation codes of different types to the product reservation * * POST /product-reservations/actions/set-product-reservation-external-codes * * Also accepts auth: basicAuth */ export const createApiProductReservationsActionsSetProductReservationExternalCodes = async (args: CreateApiProductReservationsActionsSetProductReservationExternalCodesArgs, options?: CreateApiProductReservationsActionsSetProductReservationExternalCodesOptions) => { const {baseUrl = "https://sandbox.crmcarecloud.com/webservice/rest-api/enterprise-interface/v1.0", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Accept-Language'] != null) headers.set("Accept-Language", String(args['Accept-Language'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/product-reservations/actions/set-product-reservation-external-codes${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 };