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 CreateApiGroupApiVVersionMerchantsMerchantIdNotificationsInappArgs = {MerchantId: string, group: string, version: string, body: VagaroPublicControllerV2ModelInAppNotification}; export type CreateApiGroupApiVVersionMerchantsMerchantIdNotificationsInappOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /{group}/api/v{version}/merchants/{merchantId}/Notifications/inapp */ export const createApiGroupApiVVersionMerchantsMerchantIdNotificationsInapp = async (args: CreateApiGroupApiVVersionMerchantsMerchantIdNotificationsInappArgs, options: CreateApiGroupApiVVersionMerchantsMerchantIdNotificationsInappOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/${encodeURIComponent(String(args.group))}/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 };