export type AppNotificationAppNtfChannelValues = {app_ntf_id?: number | undefined, app_ntf_channel_id?: number | undefined, due_timestamp?: number | undefined, status?: number | undefined, retry_cnt?: number | undefined, claimed_timestamp?: number | undefined, claim_owner?: string | undefined}; export type CreateApiAppNotificationMappingBulkOtherEntitiesArgs = {op?: ('add' | 'update' | 'add_or_update' | 'delete') | undefined, otherEntities: string, body: Array<{ids?: {app_ntf_id: number, app_ntf_channel_id: number} | undefined, mapped?: AppNotificationAppNtfChannelValues | undefined}>}; export type CreateApiAppNotificationMappingBulkOtherEntitiesOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add/remove/update mappings between 'AppNotification' entities and other entities * * POST /app-notification/mapping/bulk/{otherEntities} */ export const createApiAppNotificationMappingBulkOtherEntities = async (args: CreateApiAppNotificationMappingBulkOtherEntitiesArgs, options?: CreateApiAppNotificationMappingBulkOtherEntitiesOptions) => { const {baseUrl = "https://app.testiny.io/api/v1", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.op != null) query.append("op", String(args.op)) if (ApiKeyAuth !== undefined) headers.set("X-Api-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/app-notification/mapping/bulk/${encodeURIComponent(String(args.otherEntities))}${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 };