export type VagaroPublicControllerV2ModelNotificationActions = {launchUrl?: string | undefined, buttonLabel?: unknown | undefined, module?: unknown | undefined}; export type VagaroPublicControllerV2ModelInAppNotification = {id?: string | undefined, merchantId?: string | undefined, serviceProviderId: string, notificationType?: string | undefined, subject: unknown, message: unknown, imageUrl?: string | undefined, isDeleted?: boolean | undefined, priority?: number | undefined, numberOfDays: number, startDate: string, expireAt?: string | undefined, action1?: VagaroPublicControllerV2ModelNotificationActions | undefined, action2?: VagaroPublicControllerV2ModelNotificationActions | undefined}; export type CreateApiApiVVersionMerchantsMerchantIdNotificationsInappArgs = {MerchantId: string, version: string, body: VagaroPublicControllerV2ModelInAppNotification}; export type CreateApiApiVVersionMerchantsMerchantIdNotificationsInappOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /api/v{version}/merchants/{merchantId}/Notifications/inapp */ export const createApiApiVVersionMerchantsMerchantIdNotificationsInapp = async (args: CreateApiApiVVersionMerchantsMerchantIdNotificationsInappArgs, options: CreateApiApiVVersionMerchantsMerchantIdNotificationsInappOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/v${encodeURIComponent(String(args.version))}/merchants/${encodeURIComponent(String(args.merchantId))}/Notifications/inapp${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 };