/* generated using openapi-typescript-codegen -- do not edit */ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { AvailableNotificationType } from '../models/AvailableNotificationType'; import type { CampaignEnablement } from '../models/CampaignEnablement'; import type { CampaignExclusion } from '../models/CampaignExclusion'; import type { ContextResponse } from '../models/ContextResponse'; import type { MarkAllReadRequest } from '../models/MarkAllReadRequest'; import type { MarkAllReadResponse } from '../models/MarkAllReadResponse'; import type { Notification } from '../models/Notification'; import type { NotificationCount } from '../models/NotificationCount'; import type { NotificationPreview } from '../models/NotificationPreview'; import type { NotificationSource } from '../models/NotificationSource'; import type { NotificationsUpdate } from '../models/NotificationsUpdate'; import type { NotificationTemplateDetail } from '../models/NotificationTemplateDetail'; import type { NotificationTemplateList } from '../models/NotificationTemplateList'; import type { NotificationTemplateTest } from '../models/NotificationTemplateTest'; import type { NotificationTemplateTestResponse } from '../models/NotificationTemplateTestResponse'; import type { NotificationToggle } from '../models/NotificationToggle'; import type { NotificationTypePreference } from '../models/NotificationTypePreference'; import type { PatchedNotification } from '../models/PatchedNotification'; import type { PatchedNotificationTemplateDetail } from '../models/PatchedNotificationTemplateDetail'; import type { PatchedNotificationToggle } from '../models/PatchedNotificationToggle'; import type { PatchedNotificationTypePreference } from '../models/PatchedNotificationTypePreference'; import type { PatchedUserNotificationPreferences } from '../models/PatchedUserNotificationPreferences'; import type { PreviewResponse } from '../models/PreviewResponse'; import type { Recipient } from '../models/Recipient'; import type { SendNotification } from '../models/SendNotification'; import type { SendResponse } from '../models/SendResponse'; import type { TestSMTPCredentials } from '../models/TestSMTPCredentials'; import type { TestSMTPResponse } from '../models/TestSMTPResponse'; import type { UserNotificationPreferences } from '../models/UserNotificationPreferences'; import type { ValidateSourceResponse } from '../models/ValidateSourceResponse'; import type { CancelablePromise } from '../core/CancelablePromise'; import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class NotificationsService { /** * Unsubscribe from a campaign using a hash * @returns any * @throws ApiError */ public static notificationV1CampaignsUnsubscribeRetrieve({ unsubscribeHash, }: { unsubscribeHash: string, }): CancelablePromise<{ success?: boolean; message?: string; }> { return __request(OpenAPI, { method: 'GET', url: '/api/notification/v1/campaigns/unsubscribe/{unsubscribe_hash}/', path: { 'unsubscribe_hash': unsubscribeHash, }, }); } /** * Get notifications for a user. Requires: Ibl.Notifications/Notification/list * @returns Notification * @throws ApiError */ public static notificationV1OrgsNotificationsRetrieve({ org, channel, endDate, excludeChannel, startDate, status, tags, }: { org: string, /** * Filter by delivery channel */ channel?: string, /** * Filter notifications until this date */ endDate?: string, /** * Exclude notifications from this channel */ excludeChannel?: string, /** * Filter notifications from this date */ startDate?: string, /** * Filter by notification status */ status?: string, /** * Comma-separated tags to filter by (e.g. 'learning,activity'). Returns notifications whose template matches ANY of the given tags. */ tags?: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/notification/v1/orgs/{org}/notifications/', path: { 'org': org, }, query: { 'channel': channel, 'end_date': endDate, 'exclude_channel': excludeChannel, 'start_date': startDate, 'status': status, 'tags': tags, }, }); } /** * Update notification status for a user. Requires: Ibl.Notifications/Notification/write * @returns Notification * @throws ApiError */ public static notificationV1OrgsNotificationsUpdate({ org, requestBody, }: { org: string, requestBody: NotificationsUpdate, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/notification/v1/orgs/{org}/notifications/', path: { 'org': org, }, body: requestBody, mediaType: 'application/json', }); } /** * Bulk update notification status for a user. Requires: Ibl.Notifications/Notification/write * @returns Notification * @throws ApiError */ public static notificationV1OrgsNotificationsBulkUpdatePartialUpdate({ org, requestBody, }: { org: string, requestBody?: PatchedNotification, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/notification/v1/orgs/{org}/notifications/bulk-update/', path: { 'org': org, }, body: requestBody, mediaType: 'application/json', }); } /** * Get notifications for a user. Requires: Ibl.Notifications/Notification/list * @returns Notification * @throws ApiError */ public static notificationV1OrgsUsersNotificationsRetrieve({ org, userId, channel, endDate, excludeChannel, startDate, status, tags, }: { org: string, userId: string, /** * Filter by delivery channel */ channel?: string, /** * Filter notifications until this date */ endDate?: string, /** * Exclude notifications from this channel */ excludeChannel?: string, /** * Filter notifications from this date */ startDate?: string, /** * Filter by notification status */ status?: string, /** * Comma-separated tags to filter by (e.g. 'learning,activity'). Returns notifications whose template matches ANY of the given tags. */ tags?: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/notification/v1/orgs/{org}/users/{user_id}/notifications/', path: { 'org': org, 'user_id': userId, }, query: { 'channel': channel, 'end_date': endDate, 'exclude_channel': excludeChannel, 'start_date': startDate, 'status': status, 'tags': tags, }, }); } /** * Update notification status for a user. Requires: Ibl.Notifications/Notification/write * @returns Notification * @throws ApiError */ public static notificationV1OrgsUsersNotificationsUpdate({ org, userId, requestBody, }: { org: string, userId: string, requestBody: NotificationsUpdate, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/notification/v1/orgs/{org}/users/{user_id}/notifications/', path: { 'org': org, 'user_id': userId, }, body: requestBody, mediaType: 'application/json', }); } /** * Get notifications count for a user. Requires: Ibl.Notifications/Notification/list * @returns NotificationCount * @throws ApiError */ public static notificationV1OrgsUsersNotificationsCountRetrieve({ org, userId, channel, status, }: { org: string, userId: string, /** * Filter count by delivery channel */ channel?: string, /** * Filter count by notification status * * * `READ` - Read * * `UNREAD` - Unread * * `CANCELLED` - Cancelled */ status?: 'READ' | 'UNREAD' | 'CANCELLED', }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/notification/v1/orgs/{org}/users/{user_id}/notifications-count/', path: { 'org': org, 'user_id': userId, }, query: { 'channel': channel, 'status': status, }, }); } /** * Delete a notification for a user. Requires: Ibl.Notifications/Notification/delete * @returns void * @throws ApiError */ public static notificationV1OrgsUsersNotificationsDestroy({ notificationId, org, userId, }: { notificationId: string, org: string, userId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/notification/v1/orgs/{org}/users/{user_id}/notifications/{notification_id}/', path: { 'notification_id': notificationId, 'org': org, 'user_id': userId, }, }); } /** * Bulk update notification status for a user. Requires: Ibl.Notifications/Notification/write * @returns Notification * @throws ApiError */ public static notificationV1OrgsUsersNotificationsBulkUpdatePartialUpdate({ org, userId, requestBody, }: { org: string, userId: string, requestBody?: PatchedNotification, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/notification/v1/orgs/{org}/users/{user_id}/notifications/bulk-update/', path: { 'org': org, 'user_id': userId, }, body: requestBody, mediaType: 'application/json', }); } /** * Re-enable campaigns for a user. Requires: Ibl.Notifications/Campaigns/action * @returns any * @throws ApiError */ public static notificationV1OrgsCampaignsEnableCreate({ platformKey, requestBody, }: { platformKey: string, requestBody?: CampaignEnablement, }): CancelablePromise<{ success?: boolean; message?: string; }> { return __request(OpenAPI, { method: 'POST', url: '/api/notification/v1/orgs/{platform_key}/campaigns/enable/', path: { 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * Exclude a user from specified campaigns. Requires: Ibl.Notifications/Campaigns/action * @returns any * @throws ApiError */ public static notificationV1OrgsCampaignsExcludeCreate({ platformKey, requestBody, }: { platformKey: string, requestBody?: CampaignExclusion, }): CancelablePromise<{ success?: boolean; message?: string; }> { return __request(OpenAPI, { method: 'POST', url: '/api/notification/v1/orgs/{platform_key}/campaigns/exclude/', path: { 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * Mark all notifications as read for a user. Optionally provide specific notification IDs. Requires: Ibl.Notifications/Notification/write * @returns MarkAllReadResponse * @throws ApiError */ public static notificationV1OrgsMarkAllAsReadCreate({ platformKey, requestBody, }: { platformKey: string, requestBody?: MarkAllReadRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/notification/v1/orgs/{platform_key}/mark-all-as-read', path: { 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * Get build recipients * Get paginated list of recipients for a notification build * @returns Recipient * @throws ApiError */ public static notificationV1OrgsNotificationBuilderRecipientsList({ id, platformKey, page, pageSize, search, }: { id: string, platformKey: string, /** * Page number */ page?: number, /** * Number of items per page */ pageSize?: number, /** * Search recipients by username or email */ search?: string, }): CancelablePromise> { return __request(OpenAPI, { method: 'GET', url: '/api/notification/v1/orgs/{platform_key}/notification-builder/{id}/recipients/', path: { 'id': id, 'platform_key': platformKey, }, query: { 'page': page, 'page_size': pageSize, 'search': search, }, }); } /** * Get notification context data * Get all context data needed for notification building including templates, channels, and platforms * @returns ContextResponse * @throws ApiError */ public static notificationV1OrgsNotificationBuilderContextRetrieve({ platformKey, }: { platformKey: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/notification/v1/orgs/{platform_key}/notification-builder/context/', path: { 'platform_key': platformKey, }, }); } /** * Preview notification * Preview notification recipients and get build ID for sending * @returns PreviewResponse * @throws ApiError */ public static notificationV1OrgsNotificationBuilderPreviewCreate({ platformKey, requestBody, }: { platformKey: string, requestBody: NotificationPreview, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/notification/v1/orgs/{platform_key}/notification-builder/preview/', path: { 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * Send notification * Send notifications to all recipients in a build * @returns SendResponse * @throws ApiError */ public static notificationV1OrgsNotificationBuilderSendCreate({ platformKey, requestBody, }: { platformKey: string, requestBody: SendNotification, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/notification/v1/orgs/{platform_key}/notification-builder/send/', path: { 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * Validate notification source * Validate a single notification source (email, username, platform, csv) * @returns ValidateSourceResponse * @throws ApiError */ public static notificationV1OrgsNotificationBuilderValidateSourceCreate({ platformKey, requestBody, }: { platformKey: string, requestBody: NotificationSource, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/notification/v1/orgs/{platform_key}/notification-builder/validate_source/', path: { 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * Test SMTP credentials for a platform * Test SMTP credentials by sending a test email to the specified address. Requires: Ibl.Notifications/SMTP/action * @returns TestSMTPResponse * @throws ApiError */ public static notificationV1PlatformsConfigTestSmtpCreate({ platformKey, requestBody, }: { platformKey: string, requestBody: TestSMTPCredentials, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/notification/v1/platforms/{platform_key}/config/test-smtp/', path: { 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * Get user notification preferences * Retrieve notification preferences for the authenticated user (or another user via ?username= for admins). Auto-creates preferences with defaults on first access. RBAC: Ibl.Notifications/Notification/read * @returns UserNotificationPreferences * @throws ApiError */ public static notificationV1PlatformsNotificationPreferencesRetrieve({ platformKey, tags, username, }: { platformKey: string, /** * Comma-separated tags to filter by (e.g. 'learning,activity'). Returns types matching ANY tag. */ tags?: string, /** * Username to manage preferences for (admin only). Defaults to authenticated user. */ username?: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/notification/v1/platforms/{platform_key}/notification-preferences/', path: { 'platform_key': platformKey, }, query: { 'tags': tags, 'username': username, }, }); } /** * Update user notification preferences * Partially update global notification preferences. Per-type overrides use the /types/{notification_type}/ endpoint. RBAC: Ibl.Notifications/Notification/write * @returns UserNotificationPreferences * @throws ApiError */ public static notificationV1PlatformsNotificationPreferencesPartialUpdate({ platformKey, tags, username, requestBody, }: { platformKey: string, /** * Comma-separated tags to filter by (e.g. 'learning,activity'). Returns types matching ANY tag. */ tags?: string, /** * Username to manage preferences for (admin only). Defaults to authenticated user. */ username?: string, requestBody?: PatchedUserNotificationPreferences, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/notification/v1/platforms/{platform_key}/notification-preferences/', path: { 'platform_key': platformKey, }, query: { 'tags': tags, 'username': username, }, body: requestBody, mediaType: 'application/json', }); } /** * List available notification types * Returns notification types enabled for this platform, annotated with the user's per-type preferences. RBAC: Ibl.Notifications/Notification/read * @returns AvailableNotificationType * @throws ApiError */ public static notificationV1PlatformsNotificationPreferencesAvailableTypesList({ platformKey, tags, username, }: { platformKey: string, /** * Comma-separated tags to filter by (e.g. 'learning,activity'). Returns types matching ANY tag. */ tags?: string, /** * Username to manage preferences for (admin only). Defaults to authenticated user. */ username?: string, }): CancelablePromise> { return __request(OpenAPI, { method: 'GET', url: '/api/notification/v1/platforms/{platform_key}/notification-preferences/available-types/', path: { 'platform_key': platformKey, }, query: { 'tags': tags, 'username': username, }, }); } /** * Update per-type notification preference * Set enabled/frequency for a single notification type. RBAC: Ibl.Notifications/Notification/write * @returns NotificationTypePreference * @throws ApiError */ public static notificationV1PlatformsNotificationPreferencesTypesPartialUpdate({ notificationType, platformKey, tags, username, requestBody, }: { notificationType: string, platformKey: string, /** * Comma-separated tags to filter by (e.g. 'learning,activity'). Returns types matching ANY tag. */ tags?: string, /** * Username to manage preferences for (admin only). Defaults to authenticated user. */ username?: string, requestBody?: PatchedNotificationTypePreference, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/notification/v1/platforms/{platform_key}/notification-preferences/types/{notification_type}/', path: { 'notification_type': notificationType, 'platform_key': platformKey, }, query: { 'tags': tags, 'username': username, }, body: requestBody, mediaType: 'application/json', }); } /** * List notification templates * Get all notification templates for the platform. Includes both platform-specific and inherited templates from main. Filter by tags with ?tags=learning,activity (comma-separated, OR logic). Requires permission: Ibl.Notifications/NotificationTemplate/list * @returns NotificationTemplateList * @throws ApiError */ public static notificationV1PlatformsTemplatesList({ platformKey, page, pageSize = 25, tags, }: { platformKey: string, /** * Page number. When provided, response is paginated ({count, next, previous, results}). When omitted, returns a flat list. */ page?: number, /** * Number of templates per page (default 25, max 100). */ pageSize?: number, /** * Comma-separated tags to filter by (e.g. 'learning,activity'). Returns templates matching ANY of the given tags. */ tags?: string, }): CancelablePromise> { return __request(OpenAPI, { method: 'GET', url: '/api/notification/v1/platforms/{platform_key}/templates/', path: { 'platform_key': platformKey, }, query: { 'page': page, 'page_size': pageSize, 'tags': tags, }, }); } /** * Get notification template details * Get detailed view of a notification template by type. Returns platform-specific template if exists, otherwise main template. Requires permission: Ibl.Notifications/NotificationTemplate/read * @returns NotificationTemplateDetail * @throws ApiError */ public static notificationV1PlatformsTemplatesRetrieve({ notificationType, platformKey, }: { notificationType: string, platformKey: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/notification/v1/platforms/{platform_key}/templates/{notification_type}/', path: { 'notification_type': notificationType, 'platform_key': platformKey, }, }); } /** * Update notification template * Update notification template. Creates platform-specific copy on first edit. Requires permission: Ibl.Notifications/NotificationTemplate/write * @returns NotificationTemplateDetail * @throws ApiError */ public static notificationV1PlatformsTemplatesPartialUpdate({ notificationType, platformKey, requestBody, }: { notificationType: string, platformKey: string, requestBody?: PatchedNotificationTemplateDetail, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/notification/v1/platforms/{platform_key}/templates/{notification_type}/', path: { 'notification_type': notificationType, 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * Reset template to default * Delete platform-specific template override and revert to main template. Notification preference (on/off) is preserved. Requires permission: Ibl.Notifications/NotificationTemplate/write * @returns any * @throws ApiError */ public static notificationV1PlatformsTemplatesResetCreate({ notificationType, platformKey, }: { notificationType: string, platformKey: string, }): CancelablePromise<{ message?: string; deleted?: boolean; }> { return __request(OpenAPI, { method: 'POST', url: '/api/notification/v1/platforms/{platform_key}/templates/{notification_type}/reset/', path: { 'notification_type': notificationType, 'platform_key': platformKey, }, }); } /** * Send test notification * Send a test notification to verify template rendering and delivery. Sends to the requesting admin's email or a specified test email. Requires permission: Ibl.Notifications/NotificationTemplate/action * @returns NotificationTemplateTestResponse * @throws ApiError */ public static notificationV1PlatformsTemplatesTestCreate({ notificationType, platformKey, requestBody, }: { notificationType: string, platformKey: string, requestBody?: NotificationTemplateTest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/notification/v1/platforms/{platform_key}/templates/{notification_type}/test/', path: { 'notification_type': notificationType, 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * Toggle notification preference * Enable or disable a notification type for the platform. This sets the NotificationPreference, not the template. Requires permission: Ibl.Notifications/NotificationTemplate/write * @returns NotificationToggle * @throws ApiError */ public static notificationV1PlatformsTemplatesTogglePartialUpdate({ notificationType, platformKey, requestBody, }: { notificationType: string, platformKey: string, requestBody?: PatchedNotificationToggle, }): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/notification/v1/platforms/{platform_key}/templates/{notification_type}/toggle/', path: { 'notification_type': notificationType, 'platform_key': platformKey, }, body: requestBody, mediaType: 'application/json', }); } /** * List distinct template tags * Get all unique tags used across notification templates for this platform. Useful for autocomplete / filter UIs. Requires permission: Ibl.Notifications/NotificationTemplate/list * @returns string * @throws ApiError */ public static notificationV1PlatformsTemplatesTagsRetrieve({ platformKey, }: { platformKey: string, }): CancelablePromise> { return __request(OpenAPI, { method: 'GET', url: '/api/notification/v1/platforms/{platform_key}/templates/tags/', path: { 'platform_key': platformKey, }, }); } }