export type StoreId = string; export type PersonalIdentifiers = {taxIdentificationNumber?: (string | null) | undefined, serviceProviderId?: (string | null) | undefined} | null; export type Courier = {name?: (string | null) | undefined, phone?: (string | null) | undefined, phoneCode?: (string | null) | undefined, email?: (string | null) | undefined, personalIdentifiers?: PersonalIdentifiers | undefined} | null; export type Location = {latitude: number, longitude: number} | null; export type Address = {fullAddress?: (string | null) | undefined, postalCode?: string | undefined, city?: string | undefined, state?: string | undefined, countryCode?: string | undefined, addressLines?: (Array | null) | undefined, linesOfAddress?: (Array | null) | undefined, location?: Location | undefined} | null; export type SignatureRequirement = {enabled?: boolean | undefined, collectSignerName?: boolean | undefined, collectSignerRelationship?: boolean | undefined} | null; export type PictureRequirement = {enabled?: boolean | undefined} | null; export type VerificationRequirements = {signatureRequirement?: SignatureRequirement | undefined, pictureRequirement?: PictureRequirement | undefined} | null; export type DropoffInstructions = {dropoffType?: ('MEET_AT_DOOR' | 'LEAVE_AT_DOOR' | 'MEET_IN_LOBBY') | undefined, verificationRequirements?: VerificationRequirements | undefined} | null; export type RequiredDeliveryInfo = {courier?: Courier | undefined, destination?: Address | undefined, licensePlate?: (string | null) | undefined, makeModel?: (string | null) | undefined, lastKnownLocation?: Location | undefined, dropoffInstructions?: DropoffInstructions | undefined, note?: (string | null) | undefined}; export type OrderDeliveryInfoUpdateRequest = {deliveryInfo: RequiredDeliveryInfo}; export type UpdateApiV1OrdersOrderIdDeliveryArgs = {'X-Store-Id': StoreId, orderId: string, body: OrderDeliveryInfoUpdateRequest}; export type UpdateApiV1OrdersOrderIdDeliveryOptions = {baseUrl?: string | undefined, OAuth20?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update order delivery information * * PUT /v1/orders/{orderId}/delivery */ export const updateApiV1OrdersOrderIdDelivery = async (args: UpdateApiV1OrdersOrderIdDeliveryArgs, options?: UpdateApiV1OrdersOrderIdDeliveryOptions) => { const {baseUrl = "https://partners.tryotter.com", fetch: fetchFn = fetch, OAuth20} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['X-Store-Id'] != null) headers.set("X-Store-Id", String(args['X-Store-Id'])) if (OAuth20 !== undefined) headers.set('authorization', `Bearer ${OAuth20}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/orders/${encodeURIComponent(String(args.orderId))}/delivery${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };