export type OrderStatus = 0 | 1 | 2 | 3 | 4 | 5; export type OrderNotificationAttachmentFormat = 0 | 1; export type OrderNotificationStatusSettingDto = {status?: OrderStatus | undefined, attachment?: OrderNotificationAttachmentFormat | undefined}; export type OrderNotificationSettingsRequest = {orderNotificationsEnabled?: boolean | undefined, orderNotificationReceivers?: (Array | null) | undefined, orderNotificationStatuses?: (Array | null) | undefined}; export type UpdateApiV1LocationsLocationIdOrderNotificationsArgs = {locationId: number, Account: unknown, body: OrderNotificationSettingsRequest}; export type UpdateApiV1LocationsLocationIdOrderNotificationsOptions = {baseUrl: string, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update order notification settings for location (buyer side) * * PUT /v1/Locations/{locationId}/order-notifications */ export const updateApiV1LocationsLocationIdOrderNotifications = async (args: UpdateApiV1LocationsLocationIdOrderNotificationsArgs, options: UpdateApiV1LocationsLocationIdOrderNotificationsOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json-patch+json; x-api-version=1.0") if (args.Account != null) query.append("Account", String(args.Account)) if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/Locations/${encodeURIComponent(String(args.locationId))}/order-notifications${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 };