Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix: channel message notification read status fixes (#2482)

gbirmanef788b0dea4d
diff --git a/js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx b/js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx
index 5ccd7e50f3..d2ba046941 100644
--- a/js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx
+++ b/js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx
@@ -1,5 +1,6 @@
import { useGlobalNotificationSource } from '@app/component/GlobalAppState';
import type { UnifiedNotification } from '@notifications/types';
+import { openNotification } from '@notifications';
import {
For,
Show,
@@ -16,11 +17,11 @@ import {
useSenderName,
} from '@app/component/app-sidebar/utils';
import { Button } from '@app/component/next-soup/soup-view/filters-bar/button';
-import { useSplitLayout } from '@app/component/split-layout/layout';
import { globalSplitManager } from '@app/signal/splitLayout';
import { compareDateDesc } from '@core/util/date';
import { ContextMenuContent, MenuItem } from '@core/component/Menu';
import { ContextMenu } from '@kobalte/core/context-menu';
+import { getChannelNotificationParams } from '@notifications/notification-navigation';
function getChannelInfo(notification: UnifiedNotification): {
channelName: string | null;
@@ -93,8 +94,6 @@ function groupByChannel(
}
function ChannelGroupItem(props: { group: ChannelGroup; animate?: boolean }) {
- const layout = useSplitLayout();
-
const [isVisible, setIsVisible] = createSignal(!props.animate);
onMount(() => {
@@ -117,35 +116,36 @@ function ChannelGroupItem(props: { group: ChannelGroup; animate?: boolean }) {
: 'Unknown Channel';
};
- const content = () =>
- ({
- type: 'channel',
- id: props.group.entityId,
- }) as const;
+ const latestNotification = () => props.group.notifications[0];
const canOpenInNewSplit = () =>
globalSplitManager()?.canAppendSplit() ?? false;
- const openInCurrentSplit = () =>
- layout.openWithSplit(content(), {
- referredFrom: 'sidebar',
- });
+ const navigateToLatestNotification = (newSplit = false) => {
+ const manager = globalSplitManager();
+ if (!manager) return;
+ const notification = latestNotification();
+ openNotification(notification, manager, newSplit);
+ };
+
+ const openInCurrentSplit = () => {
+ navigateToLatestNotification(false);
+ };
const openInNewSplit = () => {
if (!canOpenInNewSplit()) return;
- const manager = globalSplitManager()!;
-
- manager.createNewSplit({
- content: content(),
- activate: true,
- allowDuplicate: true,
- referredFrom: 'sidebar',
- });
+ navigateToLatestNotification(true);
};
- const openFullscreen = () => {
- const split = openInCurrentSplit();
- split?.toggleSpotlight(true);
+ const _openFullscreen = () => {
+ const { params } = getChannelNotificationParams(latestNotification());
+ globalSplitManager()?.createPopoverSplit({
+ content: {
+ type: 'channel',
+ id: props.group.entityId,
+ params,
+ },
+ });
};
return (
@@ -163,14 +163,10 @@ function ChannelGroupItem(props: { group: ChannelGroup; animate?: boolean }) {
'opacity-100 translate-y-0': isVisible(),
}}
onClick={(e) => {
- // Middle mouse handling
if (e.button === 1) return;
e.preventDefault();
- layout.openWithSplit(content(), {
- preferNewSplit: e.shiftKey,
- referredFrom: 'sidebar',
- });
+ navigateToLatestNotification(e.shiftKey);
}}
>
<div class="flex-shrink-0">
@@ -210,7 +206,8 @@ function ChannelGroupItem(props: { group: ChannelGroup; animate?: boolean }) {
onClick={openInNewSplit}
disabled={!canOpenInNewSplit()}
/>
- <MenuItem text="Open fullscreen" onClick={openFullscreen} />
+ {/* FIXME: this doesn't work yet */}
+ {/* <MenuItem text="Open fullscreen" onClick={openFullscreen} /> */}
<MenuItem text="Open in current split" onClick={openInCurrentSplit} />
</ContextMenuContent>
</ContextMenu.Portal>
@@ -226,27 +223,11 @@ export const ChannelsUnreadWidget = () => {
const notificationSource = useGlobalNotificationSource();
const allNotifications = () => [...notificationSource.notifications()];
- const openChannelIds = createMemo(() => {
- const manager = globalSplitManager();
- if (!manager) return new Set<string>();
- return new Set(
- manager
- .splits()
- .filter((s) => s.content.type === 'channel')
- .map((s) => s.content.id)
- );
- });
-
const filteredNotifications = () => filterUnreadNotDone(allNotifications());
- const channelGroupsMap = createMemo(() => {
- const open = openChannelIds();
- const groups = groupByChannel(filteredNotifications());
- for (const id of open) {
- groups.delete(id);
- }
- return groups;
- });
+ const channelGroupsMap = createMemo(() =>
+ groupByChannel(filteredNotifications())
+ );
const [orderedIds, setOrderedIds] = createSignal<string[]>([]);
diff --git a/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx b/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx
index 9c1cdaca7e..f3b5858d2d 100644
--- a/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx
+++ b/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx
@@ -26,8 +26,6 @@ import {
} from '@channel/Channel/channel-tabs';
import { ChannelAttachmentsTab } from '@channel/Attachments/ChannelAttachmentsTab';
import { ChannelParticipantsTab } from '@channel/Participants/ChannelParticipantsTab';
-import { ChannelDebouncedNotificationReadMarker } from '@notifications/components/DebouncedNotificationReadMarker';
-import { useGlobalNotificationSource } from '@app/component/GlobalAppState';
import {
CallProvider,
ChannelCallButton,
@@ -103,7 +101,6 @@ export function NewChannelBlockAdapter(props: BlockChannelProps) {
useBlockEntityCommands();
const isPreview = !!useMaybePreviewPanel();
- const notificationSource = useGlobalNotificationSource();
const channelId = useBlockId();
const blockHandle = blockHandleSignal.get;
const [activeTab, setActiveTab] =
@@ -143,11 +140,6 @@ export function NewChannelBlockAdapter(props: BlockChannelProps) {
return (
<EntityPermissionsGate entityType="channel" entityId={channelId}>
- <ChannelDebouncedNotificationReadMarker
- notificationSource={notificationSource}
- channelId={channelId}
- debounceTime={500}
- />
<CallProvider>
<ChannelTabProvider activeTab={activeTab} setActiveTab={setActiveTab}>
<div class="h-full flex flex-col">
diff --git a/js/app/packages/channel/Channel/Channel.tsx b/js/app/packages/channel/Channel/Channel.tsx
index 10bf093aed..7ce4e22916 100644
--- a/js/app/packages/channel/Channel/Channel.tsx
+++ b/js/app/packages/channel/Channel/Channel.tsx
@@ -8,6 +8,7 @@ import {
createMemo,
createSignal,
on,
+ onCleanup,
onMount,
Show,
type Accessor,
@@ -149,18 +150,23 @@ export function Channel(props: ChannelProps) {
},
});
- onMount(() => {
+ const markAsViewed = () => {
updateActivityMutation.mutate({
channelId: props.channelId,
activityType: 'view',
});
+ };
+
+ onMount(() => {
+ markAsViewed();
+ });
+
+ onCleanup(() => {
+ markAsViewed();
});
useBeforeLeave(() => {
- updateActivityMutation.mutate({
- channelId: props.channelId,
- activityType: 'view',
- });
+ markAsViewed();
});
const threadManager = createThreadManager();
diff --git a/js/app/packages/channel/Thread/ChannelThread.tsx b/js/app/packages/channel/Thread/ChannelThread.tsx
index 1a5e353acd..bcfe45b75f 100644
--- a/js/app/packages/channel/Thread/ChannelThread.tsx
+++ b/js/app/packages/channel/Thread/ChannelThread.tsx
@@ -1,7 +1,7 @@
import { useThreadRepliesQuery } from '@queries/channel/thread-replies';
import { createEffect, createSignal, on, Show } from 'solid-js';
import { ChannelMessage } from '../Message';
-import { MarkMessaageNotifications } from '@notifications/components/MarkMessageNotifications';
+import { MarkMessageNotifications } from '@notifications/components/MarkMessageNotifications';
import { useUserId } from '@core/context/user';
import { deferredGate } from '@core/util/debounce';
import { tryMacroId, useDisplayName } from '@core/user';
@@ -176,7 +176,7 @@ export function ChannelThread(props: ThreadProps) {
onDismissNewMessages={props.threadActions?.onDismissNewMessages}
>
<div class="flex flex-col w-full">
- <MarkMessaageNotifications
+ <MarkMessageNotifications
messageId={props.data().id}
channelId={props.channelId()}
>
@@ -197,7 +197,7 @@ export function ChannelThread(props: ThreadProps) {
}
/>
</DebugSuspense>
- </MarkMessaageNotifications>
+ </MarkMessageNotifications>
<Show when={hasReplies() || props.isReplying()}>
<div class="relative w-full">
<DebugSuspense name="ChannelThread.reply-rail">
diff --git a/js/app/packages/channel/Thread/ThreadReplyList.tsx b/js/app/packages/channel/Thread/ThreadReplyList.tsx
index cdc49c5a8d..f53c7fdca7 100644
--- a/js/app/packages/channel/Thread/ThreadReplyList.tsx
+++ b/js/app/packages/channel/Thread/ThreadReplyList.tsx
@@ -5,7 +5,7 @@ import {
type MessageData,
} from '../Message';
import type { ApiThreadReply } from '@service-comms/client';
-import { MarkMessaageNotifications } from '@notifications/components/MarkMessageNotifications';
+import { MarkMessageNotifications } from '@notifications/components/MarkMessageNotifications';
import { buildThreadReplyListMeta } from './reply-list-meta';
import { ThreadRail } from './ThreadRail';
import type { MessageEditor } from '../Channel/create-message-editor';
@@ -74,7 +74,7 @@ export function ThreadReplyList(props: {
<ThreadRail
newMessage={listMetaByReplyId()[reply.id].isNewMessage}
/>
- <MarkMessaageNotifications
+ <MarkMessageNotifications
messageId={reply.id}
channelId={props.channelId}
>
@@ -91,7 +91,7 @@ export function ThreadReplyList(props: {
isReplySelected() ? { isSelected: true } : undefined
}
/>
- </MarkMessaageNotifications>
+ </MarkMessageNotifications>
</div>
);
}}
diff --git a/js/app/packages/notifications/components/MarkMessageNotifications.tsx b/js/app/packages/notifications/components/MarkMessageNotifications.tsx
index 5e5cd8f007..3f64089744 100644
--- a/js/app/packages/notifications/components/MarkMessageNotifications.tsx
+++ b/js/app/packages/notifications/components/MarkMessageNotifications.tsx
@@ -1,30 +1,47 @@
-import { onMount } from 'solid-js';
+import { onCleanup, onMount } from 'solid-js';
import type { JSXElement } from 'solid-js';
import { useGlobalNotificationSource } from '@app/component/GlobalAppState';
+import type { UnifiedNotification } from '@notifications/types';
+import { useNotificationsForEntity } from '@notifications/notification-helpers';
-export function MarkMessaageNotifications(props: {
+export function MarkMessageNotifications(props: {
messageId: string;
channelId: string;
children: JSXElement;
}) {
const notificationSource = useGlobalNotificationSource();
+ const notifications = useNotificationsForEntity(notificationSource, {
+ type: 'channel',
+ id: props.channelId,
+ });
+ const isMessageNotification = (n: UnifiedNotification) => {
+ return (
+ (n.notification_metadata.tag === 'channel_mention' ||
+ n.notification_metadata.tag === 'channel_message_send' ||
+ n.notification_metadata.tag === 'channel_message_reply') &&
+ n.notification_metadata.content.messageId === props.messageId
+ );
+ };
+
+ let unsubscribe: () => void = () => {};
+ onCleanup(() => {
+ unsubscribe();
+ });
onMount(() => {
- const toMark = notificationSource.notifications().filter((n) => {
- if (n.viewed_at || n.done) return false;
- if (n.entity_id !== props.channelId) return false;
- const meta = n.notification_metadata;
- if (
- meta.tag === 'channel_mention' ||
- meta.tag === 'channel_message_send' ||
- meta.tag === 'channel_message_reply'
- ) {
- return meta.content.messageId === props.messageId;
- }
- return false;
- });
- if (toMark.length > 0) {
- notificationSource.bulkMarkAsRead(toMark);
+ const existing = notifications().find(isMessageNotification);
+
+ if (!existing) {
+ unsubscribe = notificationSource.subscribe((n) => {
+ if (!isMessageNotification(n)) return;
+ notificationSource.markAsRead(n);
+ unsubscribe();
+ });
+ return;
+ }
+
+ if (!existing.viewed_at) {
+ notificationSource.markAsRead(existing);
}
});
diff --git a/js/app/packages/notifications/notification-navigation.ts b/js/app/packages/notifications/notification-navigation.ts
index 877ac632fa..f0d5146605 100644
--- a/js/app/packages/notifications/notification-navigation.ts
+++ b/js/app/packages/notifications/notification-navigation.ts
@@ -39,15 +39,9 @@ function openSplitIfNotOpen(
);
}
-/**
- * Opens a channel notification.
- */
-async function openChannelNotification(
- notification: UnifiedNotification,
- layoutManager: SplitManager,
- newSplit: boolean = false
-) {
- const channelId = notification.entity_id;
+export function getChannelNotificationParams(
+ notification: UnifiedNotification
+): { messageId?: string; threadId?: string; params?: Record<string, string> } {
let messageId: string | undefined;
let threadId: string | undefined;
@@ -63,6 +57,20 @@ async function openChannelNotification(
}
const params = messageId ? getChannelParams(messageId, threadId) : undefined;
+ return { messageId, threadId, params };
+}
+
+/**
+ * Opens a channel notification.
+ */
+async function openChannelNotification(
+ notification: UnifiedNotification,
+ layoutManager: SplitManager,
+ newSplit: boolean = false
+) {
+ const channelId = notification.entity_id;
+ const { messageId, threadId, params } =
+ getChannelNotificationParams(notification);
openSplitIfNotOpen(layoutManager, 'channel', channelId, {
newSplit,
diff --git a/js/app/packages/notifications/notification-source.ts b/js/app/packages/notifications/notification-source.ts
index 8faa2d6b8c..7ad8233177 100644
--- a/js/app/packages/notifications/notification-source.ts
+++ b/js/app/packages/notifications/notification-source.ts
@@ -7,7 +7,11 @@ import {
} from '@queries/notification/user-notifications';
import type { ConnectionGatewayWebsocket } from '@service-connection/websocket';
import { notificationServiceClient } from '@service-notification/client';
-import type { UserUnsubscribe } from '@service-notification/generated/schemas';
+import type {
+ ConnGatewayInnerNotifValue,
+ NotifEvent,
+ UserUnsubscribe,
+} from '@service-notification/generated/schemas';
import type {
UseInfiniteQueryResult,
UseQueryResult,
@@ -26,7 +30,9 @@ import {
compositeEntity,
notificationEntity,
type UnifiedNotification,
+ unifiedNotificationSchema,
} from './types';
+import { fromZodError } from 'zod-validation-error';
type NotificationsByEntity = Record<CompositeEntity, UnifiedNotification[]>;
@@ -120,13 +126,35 @@ export function createNotificationSource(
setMutedEntities(reconcile(mutedEntities));
});
+ const mapWebsocketNotification = (
+ raw: ConnGatewayInnerNotifValue
+ ): UnifiedNotification => {
+ return {
+ ...raw,
+ id: raw.notification_id,
+ notification_metadata: raw.notification_metadata as NotifEvent,
+ };
+ };
+
createSocketEffect(ws, (wsData) => {
if (wsData.type !== NOTIFICATION_EVENT_TYPE) {
return;
}
let parsedNotification: UnifiedNotification;
try {
- parsedNotification = JSON.parse(wsData.data);
+ const raw = JSON.parse(wsData.data) as ConnGatewayInnerNotifValue;
+ const unsafeMapped = mapWebsocketNotification(raw);
+ const parseResult = unifiedNotificationSchema.safeParse(unsafeMapped);
+ if (!parseResult.success) {
+ console.warn(
+ 'Failed to parse notification',
+ wsData.data,
+ fromZodError(parseResult.error)
+ );
+ parsedNotification = unsafeMapped;
+ } else {
+ parsedNotification = parseResult.data;
+ }
} catch (e) {
console.error('Failed to parse notification', wsData.data, e);
return;
diff --git a/js/app/packages/notifications/types.ts b/js/app/packages/notifications/types.ts
index 25d04ec72b..e77de0a0ca 100644
--- a/js/app/packages/notifications/types.ts
+++ b/js/app/packages/notifications/types.ts
@@ -1,8 +1,16 @@
import type { Entity, EntityType } from '@core/types';
import type { ApiUserNotification } from '@service-notification/generated/schemas';
+import { listTypedNotificationsResponse } from '@service-notification/generated/zod';
export type UnifiedNotification = Omit<ApiUserNotification, 'owner_id'>;
+const _baseSchema = listTypedNotificationsResponse.shape.items.element;
+const _entitySchema = _baseSchema._def.left;
+const _allOfSchema = _baseSchema._def.right;
+export const unifiedNotificationSchema = _entitySchema.and(
+ _allOfSchema.omit({ owner_id: true })
+);
+
export type CompositeEntity = `${EntityType}@${string}`;
export function compositeEntity(entity: Entity): CompositeEntity {
diff --git a/js/app/packages/service-clients/orval.config.ts b/js/app/packages/service-clients/orval.config.ts
index 9bca18a376..ea18ed00f3 100644
--- a/js/app/packages/service-clients/orval.config.ts
+++ b/js/app/packages/service-clients/orval.config.ts
@@ -82,8 +82,9 @@ export default defineConfig({
notificationService: {
output: {
- client: 'fetch',
- target: './service-notification/generated/client.ts',
+ client: 'zod',
+ mode: 'split',
+ target: './service-notification/generated/zod.ts',
schemas: './service-notification/generated/schemas',
override: {
useDates: false,
diff --git a/js/app/packages/service-clients/service-notification/generated/client.ts b/js/app/packages/service-clients/service-notification/generated/client.ts
deleted file mode 100644
index a14680d8b0..0000000000
--- a/js/app/packages/service-clients/service-notification/generated/client.ts
+++ /dev/null
@@ -1,1224 +0,0 @@
-/**
- * Generated by orval v7.13.0 🍺
- * Do not edit manually.
- * notification_service
- * OpenAPI spec version: 0.1.0
- */
-import type {
- ApiUserNotification,
- BulkGetByEventItemIdsRequest,
- BulkGetTypedNotificationsByEventItemIdsParams,
- EmptyResponse,
- ErrorResponse,
- GetAllUserNotificationsResponse,
- GetNotificationTypePreferencesResponse,
- GetTypedNotificationsByEventItemIdParams,
- ListTypedNotificationsParams,
- NotificationBulkRequest,
- UserUnsubscribe,
-} from './schemas';
-
-/**
- * @summary Health check
- */
-export type healthHandlerResponse200 = {
- data: EmptyResponse;
- status: 200;
-};
-
-export type healthHandlerResponseSuccess = healthHandlerResponse200 & {
- headers: Headers;
-};
-
-export type healthHandlerResponse = healthHandlerResponseSuccess;
-
-export const getHealthHandlerUrl = () => {
- return `/health`;
-};
-
-export const healthHandler = async (
- options?: RequestInit
-): Promise<healthHandlerResponse> => {
- const res = await fetch(getHealthHandlerUrl(), {
- ...options,
- method: 'GET',
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: healthHandlerResponse['data'] = body ? JSON.parse(body) : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as healthHandlerResponse;
-};
-
-/**
- * @summary Gets the users unsubscribe items.
- */
-export type getUnsubscribesResponse200 = {
- data: UserUnsubscribe[];
- status: 200;
-};
-
-export type getUnsubscribesResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type getUnsubscribesResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type getUnsubscribesResponseSuccess = getUnsubscribesResponse200 & {
- headers: Headers;
-};
-export type getUnsubscribesResponseError = (
- | getUnsubscribesResponse401
- | getUnsubscribesResponse500
-) & {
- headers: Headers;
-};
-
-export type getUnsubscribesResponse =
- | getUnsubscribesResponseSuccess
- | getUnsubscribesResponseError;
-
-export const getGetUnsubscribesUrl = () => {
- return `/unsubscribe`;
-};
-
-export const getUnsubscribes = async (
- options?: RequestInit
-): Promise<getUnsubscribesResponse> => {
- const res = await fetch(getGetUnsubscribesUrl(), {
- ...options,
- method: 'GET',
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: getUnsubscribesResponse['data'] = body ? JSON.parse(body) : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as getUnsubscribesResponse;
-};
-
-/**
- * @summary Unsubscribes a user from receiving emails
- */
-export type unsubscribeEmailResponse200 = {
- data: EmptyResponse;
- status: 200;
-};
-
-export type unsubscribeEmailResponse404 = {
- data: ErrorResponse;
- status: 404;
-};
-
-export type unsubscribeEmailResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type unsubscribeEmailResponseSuccess = unsubscribeEmailResponse200 & {
- headers: Headers;
-};
-export type unsubscribeEmailResponseError = (
- | unsubscribeEmailResponse404
- | unsubscribeEmailResponse500
-) & {
- headers: Headers;
-};
-
-export type unsubscribeEmailResponse =
- | unsubscribeEmailResponseSuccess
- | unsubscribeEmailResponseError;
-
-export const getUnsubscribeEmailUrl = () => {
- return `/unsubscribe/email`;
-};
-
-export const unsubscribeEmail = async (
- options?: RequestInit
-): Promise<unsubscribeEmailResponse> => {
- const res = await fetch(getUnsubscribeEmailUrl(), {
- ...options,
- method: 'POST',
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: unsubscribeEmailResponse['data'] = body ? JSON.parse(body) : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as unsubscribeEmailResponse;
-};
-
-/**
- * @summary Unsubscribes a user from a given item for notifications.
- */
-export type unsubscribeItemResponse200 = {
- data: EmptyResponse;
- status: 200;
-};
-
-export type unsubscribeItemResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type unsubscribeItemResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type unsubscribeItemResponseSuccess = unsubscribeItemResponse200 & {
- headers: Headers;
-};
-export type unsubscribeItemResponseError = (
- | unsubscribeItemResponse401
- | unsubscribeItemResponse500
-) & {
- headers: Headers;
-};
-
-export type unsubscribeItemResponse =
- | unsubscribeItemResponseSuccess
- | unsubscribeItemResponseError;
-
-export const getUnsubscribeItemUrl = (itemType: string, itemId: string) => {
- return `/unsubscribe/item/${itemType}/${itemId}`;
-};
-
-export const unsubscribeItem = async (
- itemType: string,
- itemId: string,
- options?: RequestInit
-): Promise<unsubscribeItemResponse> => {
- const res = await fetch(getUnsubscribeItemUrl(itemType, itemId), {
- ...options,
- method: 'POST',
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: unsubscribeItemResponse['data'] = body ? JSON.parse(body) : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as unsubscribeItemResponse;
-};
-
-/**
- * @summary Removes a unsubscribe item for a user.
- */
-export type removeUnsubscribeItemResponse200 = {
- data: EmptyResponse;
- status: 200;
-};
-
-export type removeUnsubscribeItemResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type removeUnsubscribeItemResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type removeUnsubscribeItemResponseSuccess =
- removeUnsubscribeItemResponse200 & {
- headers: Headers;
- };
-export type removeUnsubscribeItemResponseError = (
- | removeUnsubscribeItemResponse401
- | removeUnsubscribeItemResponse500
-) & {
- headers: Headers;
-};
-
-export type removeUnsubscribeItemResponse =
- | removeUnsubscribeItemResponseSuccess
- | removeUnsubscribeItemResponseError;
-
-export const getRemoveUnsubscribeItemUrl = (
- itemType: string,
- itemId: string
-) => {
- return `/unsubscribe/item/${itemType}/${itemId}`;
-};
-
-export const removeUnsubscribeItem = async (
- itemType: string,
- itemId: string,
- options?: RequestInit
-): Promise<removeUnsubscribeItemResponse> => {
- const res = await fetch(getRemoveUnsubscribeItemUrl(itemType, itemId), {
- ...options,
- method: 'DELETE',
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: removeUnsubscribeItemResponse['data'] = body
- ? JSON.parse(body)
- : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as removeUnsubscribeItemResponse;
-};
-
-/**
- * @summary Unsubscribes user from all notifications.
- */
-export type unsubscribeAllResponse200 = {
- data: EmptyResponse;
- status: 200;
-};
-
-export type unsubscribeAllResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type unsubscribeAllResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type unsubscribeAllResponseSuccess = unsubscribeAllResponse200 & {
- headers: Headers;
-};
-export type unsubscribeAllResponseError = (
- | unsubscribeAllResponse401
- | unsubscribeAllResponse500
-) & {
- headers: Headers;
-};
-
-export type unsubscribeAllResponse =
- | unsubscribeAllResponseSuccess
- | unsubscribeAllResponseError;
-
-export const getUnsubscribeAllUrl = () => {
- return `/unsubscribe/mute`;
-};
-
-export const unsubscribeAll = async (
- options?: RequestInit
-): Promise<unsubscribeAllResponse> => {
- const res = await fetch(getUnsubscribeAllUrl(), {
- ...options,
- method: 'POST',
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: unsubscribeAllResponse['data'] = body ? JSON.parse(body) : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as unsubscribeAllResponse;
-};
-
-/**
- * @summary Unmutes all notifications.
-Existing notifications that were muted manually will remain muted.
- */
-export type removeUnsubscribeAllResponse200 = {
- data: EmptyResponse;
- status: 200;
-};
-
-export type removeUnsubscribeAllResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type removeUnsubscribeAllResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type removeUnsubscribeAllResponseSuccess =
- removeUnsubscribeAllResponse200 & {
- headers: Headers;
- };
-export type removeUnsubscribeAllResponseError = (
- | removeUnsubscribeAllResponse401
- | removeUnsubscribeAllResponse500
-) & {
- headers: Headers;
-};
-
-export type removeUnsubscribeAllResponse =
- | removeUnsubscribeAllResponseSuccess
- | removeUnsubscribeAllResponseError;
-
-export const getRemoveUnsubscribeAllUrl = () => {
- return `/unsubscribe/mute`;
-};
-
-export const removeUnsubscribeAll = async (
- options?: RequestInit
-): Promise<removeUnsubscribeAllResponse> => {
- const res = await fetch(getRemoveUnsubscribeAllUrl(), {
- ...options,
- method: 'DELETE',
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: removeUnsubscribeAllResponse['data'] = body
- ? JSON.parse(body)
- : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as removeUnsubscribeAllResponse;
-};
-
-/**
- * Rows that fail to deserialize are dropped with a warning log.
- * @summary Wrapper handler that calls the inner generic list handler with `serde_json::Value`,
-then converts each row to [`UserNotificationRow<NotifEvent>`].
- */
-export type listTypedNotificationsResponse200 = {
- data: GetAllUserNotificationsResponse;
- status: 200;
-};
-
-export type listTypedNotificationsResponse400 = {
- data: ErrorResponse;
- status: 400;
-};
-
-export type listTypedNotificationsResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type listTypedNotificationsResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type listTypedNotificationsResponseSuccess =
- listTypedNotificationsResponse200 & {
- headers: Headers;
- };
-export type listTypedNotificationsResponseError = (
- | listTypedNotificationsResponse400
- | listTypedNotificationsResponse401
- | listTypedNotificationsResponse500
-) & {
- headers: Headers;
-};
-
-export type listTypedNotificationsResponse =
- | listTypedNotificationsResponseSuccess
- | listTypedNotificationsResponseError;
-
-export const getListTypedNotificationsUrl = (
- params?: ListTypedNotificationsParams
-) => {
- const normalizedParams = new URLSearchParams();
-
- Object.entries(params || {}).forEach(([key, value]) => {
- if (value !== undefined) {
- normalizedParams.append(key, value === null ? 'null' : value.toString());
- }
- });
-
- const stringifiedParams = normalizedParams.toString();
-
- return stringifiedParams.length > 0
- ? `/v1/user_notifications?${stringifiedParams}`
- : `/v1/user_notifications`;
-};
-
-export const listTypedNotifications = async (
- params?: ListTypedNotificationsParams,
- options?: RequestInit
-): Promise<listTypedNotificationsResponse> => {
- const res = await fetch(getListTypedNotificationsUrl(params), {
- ...options,
- method: 'GET',
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: listTypedNotificationsResponse['data'] = body
- ? JSON.parse(body)
- : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as listTypedNotificationsResponse;
-};
-
-/**
- * Rows that fail to deserialize are dropped with a warning log.
- * @summary Wrapper handler that calls the inner generic bulk-get handler with `serde_json::Value`,
-then converts each row to [`UserNotificationRow<NotifEvent>`].
- */
-export type bulkGetTypedNotificationsByEventItemIdsResponse200 = {
- data: GetAllUserNotificationsResponse;
- status: 200;
-};
-
-export type bulkGetTypedNotificationsByEventItemIdsResponse400 = {
- data: ErrorResponse;
- status: 400;
-};
-
-export type bulkGetTypedNotificationsByEventItemIdsResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type bulkGetTypedNotificationsByEventItemIdsResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type bulkGetTypedNotificationsByEventItemIdsResponseSuccess =
- bulkGetTypedNotificationsByEventItemIdsResponse200 & {
- headers: Headers;
- };
-export type bulkGetTypedNotificationsByEventItemIdsResponseError = (
- | bulkGetTypedNotificationsByEventItemIdsResponse400
- | bulkGetTypedNotificationsByEventItemIdsResponse401
- | bulkGetTypedNotificationsByEventItemIdsResponse500
-) & {
- headers: Headers;
-};
-
-export type bulkGetTypedNotificationsByEventItemIdsResponse =
- | bulkGetTypedNotificationsByEventItemIdsResponseSuccess
- | bulkGetTypedNotificationsByEventItemIdsResponseError;
-
-export const getBulkGetTypedNotificationsByEventItemIdsUrl = (
- params?: BulkGetTypedNotificationsByEventItemIdsParams
-) => {
- const normalizedParams = new URLSearchParams();
-
- Object.entries(params || {}).forEach(([key, value]) => {
- if (value !== undefined) {
- normalizedParams.append(key, value === null ? 'null' : value.toString());
- }
- });
-
- const stringifiedParams = normalizedParams.toString();
-
- return stringifiedParams.length > 0
- ? `/v1/user_notifications/item/bulk?${stringifiedParams}`
- : `/v1/user_notifications/item/bulk`;
-};
-
-export const bulkGetTypedNotificationsByEventItemIds = async (
- bulkGetByEventItemIdsRequest: BulkGetByEventItemIdsRequest,
- params?: BulkGetTypedNotificationsByEventItemIdsParams,
- options?: RequestInit
-): Promise<bulkGetTypedNotificationsByEventItemIdsResponse> => {
- const res = await fetch(
- getBulkGetTypedNotificationsByEventItemIdsUrl(params),
- {
- ...options,
- method: 'POST',
- headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(bulkGetByEventItemIdsRequest),
- }
- );
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: bulkGetTypedNotificationsByEventItemIdsResponse['data'] = body
- ? JSON.parse(body)
- : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as bulkGetTypedNotificationsByEventItemIdsResponse;
-};
-
-/**
- * @summary Typed wrapper for getting notifications by a single event item ID.
- */
-export type getTypedNotificationsByEventItemIdResponse200 = {
- data: GetAllUserNotificationsResponse;
- status: 200;
-};
-
-export type getTypedNotificationsByEventItemIdResponse400 = {
- data: ErrorResponse;
- status: 400;
-};
-
-export type getTypedNotificationsByEventItemIdResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type getTypedNotificationsByEventItemIdResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type getTypedNotificationsByEventItemIdResponseSuccess =
- getTypedNotificationsByEventItemIdResponse200 & {
- headers: Headers;
- };
-export type getTypedNotificationsByEventItemIdResponseError = (
- | getTypedNotificationsByEventItemIdResponse400
- | getTypedNotificationsByEventItemIdResponse401
- | getTypedNotificationsByEventItemIdResponse500
-) & {
- headers: Headers;
-};
-
-export type getTypedNotificationsByEventItemIdResponse =
- | getTypedNotificationsByEventItemIdResponseSuccess
- | getTypedNotificationsByEventItemIdResponseError;
-
-export const getGetTypedNotificationsByEventItemIdUrl = (
- eventItemId: string,
- params?: GetTypedNotificationsByEventItemIdParams
-) => {
- const normalizedParams = new URLSearchParams();
-
- Object.entries(params || {}).forEach(([key, value]) => {
- if (value !== undefined) {
- normalizedParams.append(key, value === null ? 'null' : value.toString());
- }
- });
-
- const stringifiedParams = normalizedParams.toString();
-
- return stringifiedParams.length > 0
- ? `/v1/user_notifications/item/${eventItemId}?${stringifiedParams}`
- : `/v1/user_notifications/item/${eventItemId}`;
-};
-
-export const getTypedNotificationsByEventItemId = async (
- eventItemId: string,
- params?: GetTypedNotificationsByEventItemIdParams,
- options?: RequestInit
-): Promise<getTypedNotificationsByEventItemIdResponse> => {
- const res = await fetch(
- getGetTypedNotificationsByEventItemIdUrl(eventItemId, params),
- {
- ...options,
- method: 'GET',
- }
- );
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: getTypedNotificationsByEventItemIdResponse['data'] = body
- ? JSON.parse(body)
- : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as getTypedNotificationsByEventItemIdResponse;
-};
-
-/**
- * @summary Get the notification types that the user has disabled.
- */
-export type getNotificationTypePreferencesResponse200 = {
- data: GetNotificationTypePreferencesResponse;
- status: 200;
-};
-
-export type getNotificationTypePreferencesResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type getNotificationTypePreferencesResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type getNotificationTypePreferencesResponseSuccess =
- getNotificationTypePreferencesResponse200 & {
- headers: Headers;
- };
-export type getNotificationTypePreferencesResponseError = (
- | getNotificationTypePreferencesResponse401
- | getNotificationTypePreferencesResponse500
-) & {
- headers: Headers;
-};
-
-export type getNotificationTypePreferencesResponse =
- | getNotificationTypePreferencesResponseSuccess
- | getNotificationTypePreferencesResponseError;
-
-export const getGetNotificationTypePreferencesUrl = () => {
- return `/v1/user_notifications/preferences`;
-};
-
-export const getNotificationTypePreferences = async (
- options?: RequestInit
-): Promise<getNotificationTypePreferencesResponse> => {
- const res = await fetch(getGetNotificationTypePreferencesUrl(), {
- ...options,
- method: 'GET',
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: getNotificationTypePreferencesResponse['data'] = body
- ? JSON.parse(body)
- : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as getNotificationTypePreferencesResponse;
-};
-
-/**
- * @summary Disable a notification type for the authenticated user.
- */
-export type disableNotificationTypeResponse200 = {
- data: void;
- status: 200;
-};
-
-export type disableNotificationTypeResponse400 = {
- data: ErrorResponse;
- status: 400;
-};
-
-export type disableNotificationTypeResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type disableNotificationTypeResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type disableNotificationTypeResponseSuccess =
- disableNotificationTypeResponse200 & {
- headers: Headers;
- };
-export type disableNotificationTypeResponseError = (
- | disableNotificationTypeResponse400
- | disableNotificationTypeResponse401
- | disableNotificationTypeResponse500
-) & {
- headers: Headers;
-};
-
-export type disableNotificationTypeResponse =
- | disableNotificationTypeResponseSuccess
- | disableNotificationTypeResponseError;
-
-export const getDisableNotificationTypeUrl = (
- notificationEventType: string
-) => {
- return `/v1/user_notifications/preferences/${notificationEventType}/disable`;
-};
-
-export const disableNotificationType = async (
- notificationEventType: string,
- options?: RequestInit
-): Promise<disableNotificationTypeResponse> => {
- const res = await fetch(
- getDisableNotificationTypeUrl(notificationEventType),
- {
- ...options,
- method: 'PUT',
- }
- );
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: disableNotificationTypeResponse['data'] = body
- ? JSON.parse(body)
- : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as disableNotificationTypeResponse;
-};
-
-/**
- * @summary Re-enable a notification type for the authenticated user.
- */
-export type enableNotificationTypeResponse200 = {
- data: void;
- status: 200;
-};
-
-export type enableNotificationTypeResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type enableNotificationTypeResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type enableNotificationTypeResponseSuccess =
- enableNotificationTypeResponse200 & {
- headers: Headers;
- };
-export type enableNotificationTypeResponseError = (
- | enableNotificationTypeResponse401
- | enableNotificationTypeResponse500
-) & {
- headers: Headers;
-};
-
-export type enableNotificationTypeResponse =
- | enableNotificationTypeResponseSuccess
- | enableNotificationTypeResponseError;
-
-export const getEnableNotificationTypeUrl = (notificationEventType: string) => {
- return `/v1/user_notifications/preferences/${notificationEventType}/enable`;
-};
-
-export const enableNotificationType = async (
- notificationEventType: string,
- options?: RequestInit
-): Promise<enableNotificationTypeResponse> => {
- const res = await fetch(getEnableNotificationTypeUrl(notificationEventType), {
- ...options,
- method: 'PUT',
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: enableNotificationTypeResponse['data'] = body
- ? JSON.parse(body)
- : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as enableNotificationTypeResponse;
-};
-
-/**
- * @summary Typed wrapper for getting a single notification by ID.
- */
-export type getTypedNotificationByIdResponse200 = {
- data: ApiUserNotification;
- status: 200;
-};
-
-export type getTypedNotificationByIdResponse400 = {
- data: ErrorResponse;
- status: 400;
-};
-
-export type getTypedNotificationByIdResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type getTypedNotificationByIdResponse404 = {
- data: ErrorResponse;
- status: 404;
-};
-
-export type getTypedNotificationByIdResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type getTypedNotificationByIdResponseSuccess =
- getTypedNotificationByIdResponse200 & {
- headers: Headers;
- };
-export type getTypedNotificationByIdResponseError = (
- | getTypedNotificationByIdResponse400
- | getTypedNotificationByIdResponse401
- | getTypedNotificationByIdResponse404
- | getTypedNotificationByIdResponse500
-) & {
- headers: Headers;
-};
-
-export type getTypedNotificationByIdResponse =
- | getTypedNotificationByIdResponseSuccess
- | getTypedNotificationByIdResponseError;
-
-export const getGetTypedNotificationByIdUrl = (notificationId: string) => {
- return `/v1/user_notifications/${notificationId}`;
-};
-
-export const getTypedNotificationById = async (
- notificationId: string,
- options?: RequestInit
-): Promise<getTypedNotificationByIdResponse> => {
- const res = await fetch(getGetTypedNotificationByIdUrl(notificationId), {
- ...options,
- method: 'GET',
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: getTypedNotificationByIdResponse['data'] = body
- ? JSON.parse(body)
- : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as getTypedNotificationByIdResponse;
-};
-
-/**
- * @summary Soft-delete multiple user notifications.
- */
-export type bulkDeleteUserNotificationsV2Response200 = {
- data: void;
- status: 200;
-};
-
-export type bulkDeleteUserNotificationsV2Response400 = {
- data: ErrorResponse;
- status: 400;
-};
-
-export type bulkDeleteUserNotificationsV2Response401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type bulkDeleteUserNotificationsV2Response500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type bulkDeleteUserNotificationsV2ResponseSuccess =
- bulkDeleteUserNotificationsV2Response200 & {
- headers: Headers;
- };
-export type bulkDeleteUserNotificationsV2ResponseError = (
- | bulkDeleteUserNotificationsV2Response400
- | bulkDeleteUserNotificationsV2Response401
- | bulkDeleteUserNotificationsV2Response500
-) & {
- headers: Headers;
-};
-
-export type bulkDeleteUserNotificationsV2Response =
- | bulkDeleteUserNotificationsV2ResponseSuccess
- | bulkDeleteUserNotificationsV2ResponseError;
-
-export const getBulkDeleteUserNotificationsV2Url = () => {
- return `/v2/user_notifications/bulk`;
-};
-
-export const bulkDeleteUserNotificationsV2 = async (
- notificationBulkRequest: NotificationBulkRequest,
- options?: RequestInit
-): Promise<bulkDeleteUserNotificationsV2Response> => {
- const res = await fetch(getBulkDeleteUserNotificationsV2Url(), {
- ...options,
- method: 'DELETE',
- headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(notificationBulkRequest),
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: bulkDeleteUserNotificationsV2Response['data'] = body
- ? JSON.parse(body)
- : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as bulkDeleteUserNotificationsV2Response;
-};
-
-/**
- * @summary Mark notifications as done.
- */
-export type bulkMarkNotificationsDoneResponse200 = {
- data: void;
- status: 200;
-};
-
-export type bulkMarkNotificationsDoneResponse400 = {
- data: ErrorResponse;
- status: 400;
-};
-
-export type bulkMarkNotificationsDoneResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type bulkMarkNotificationsDoneResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type bulkMarkNotificationsDoneResponseSuccess =
- bulkMarkNotificationsDoneResponse200 & {
- headers: Headers;
- };
-export type bulkMarkNotificationsDoneResponseError = (
- | bulkMarkNotificationsDoneResponse400
- | bulkMarkNotificationsDoneResponse401
- | bulkMarkNotificationsDoneResponse500
-) & {
- headers: Headers;
-};
-
-export type bulkMarkNotificationsDoneResponse =
- | bulkMarkNotificationsDoneResponseSuccess
- | bulkMarkNotificationsDoneResponseError;
-
-export const getBulkMarkNotificationsDoneUrl = () => {
- return `/v2/user_notifications/bulk/done`;
-};
-
-export const bulkMarkNotificationsDone = async (
- notificationBulkRequest: NotificationBulkRequest,
- options?: RequestInit
-): Promise<bulkMarkNotificationsDoneResponse> => {
- const res = await fetch(getBulkMarkNotificationsDoneUrl(), {
- ...options,
- method: 'PATCH',
- headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(notificationBulkRequest),
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: bulkMarkNotificationsDoneResponse['data'] = body
- ? JSON.parse(body)
- : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as bulkMarkNotificationsDoneResponse;
-};
-
-/**
- * @summary Mark notifications as seen.
- */
-export type bulkMarkNotificationsSeenResponse200 = {
- data: void;
- status: 200;
-};
-
-export type bulkMarkNotificationsSeenResponse400 = {
- data: ErrorResponse;
- status: 400;
-};
-
-export type bulkMarkNotificationsSeenResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type bulkMarkNotificationsSeenResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type bulkMarkNotificationsSeenResponseSuccess =
- bulkMarkNotificationsSeenResponse200 & {
- headers: Headers;
- };
-export type bulkMarkNotificationsSeenResponseError = (
- | bulkMarkNotificationsSeenResponse400
- | bulkMarkNotificationsSeenResponse401
- | bulkMarkNotificationsSeenResponse500
-) & {
- headers: Headers;
-};
-
-export type bulkMarkNotificationsSeenResponse =
- | bulkMarkNotificationsSeenResponseSuccess
- | bulkMarkNotificationsSeenResponseError;
-
-export const getBulkMarkNotificationsSeenUrl = () => {
- return `/v2/user_notifications/bulk/seen`;
-};
-
-export const bulkMarkNotificationsSeen = async (
- notificationBulkRequest: NotificationBulkRequest,
- options?: RequestInit
-): Promise<bulkMarkNotificationsSeenResponse> => {
- const res = await fetch(getBulkMarkNotificationsSeenUrl(), {
- ...options,
- method: 'PATCH',
- headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(notificationBulkRequest),
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: bulkMarkNotificationsSeenResponse['data'] = body
- ? JSON.parse(body)
- : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as bulkMarkNotificationsSeenResponse;
-};
-
-/**
- * @summary Mark notifications as not done.
- */
-export type bulkMarkNotificationsUndoneResponse200 = {
- data: void;
- status: 200;
-};
-
-export type bulkMarkNotificationsUndoneResponse400 = {
- data: ErrorResponse;
- status: 400;
-};
-
-export type bulkMarkNotificationsUndoneResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type bulkMarkNotificationsUndoneResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type bulkMarkNotificationsUndoneResponseSuccess =
- bulkMarkNotificationsUndoneResponse200 & {
- headers: Headers;
- };
-export type bulkMarkNotificationsUndoneResponseError = (
- | bulkMarkNotificationsUndoneResponse400
- | bulkMarkNotificationsUndoneResponse401
- | bulkMarkNotificationsUndoneResponse500
-) & {
- headers: Headers;
-};
-
-export type bulkMarkNotificationsUndoneResponse =
- | bulkMarkNotificationsUndoneResponseSuccess
- | bulkMarkNotificationsUndoneResponseError;
-
-export const getBulkMarkNotificationsUndoneUrl = () => {
- return `/v2/user_notifications/bulk/undone`;
-};
-
-export const bulkMarkNotificationsUndone = async (
- notificationBulkRequest: NotificationBulkRequest,
- options?: RequestInit
-): Promise<bulkMarkNotificationsUndoneResponse> => {
- const res = await fetch(getBulkMarkNotificationsUndoneUrl(), {
- ...options,
- method: 'PATCH',
- headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(notificationBulkRequest),
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: bulkMarkNotificationsUndoneResponse['data'] = body
- ? JSON.parse(body)
- : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as bulkMarkNotificationsUndoneResponse;
-};
-
-/**
- * @summary Soft-delete a single user notification.
- */
-export type deleteUserNotificationV2Response200 = {
- data: void;
- status: 200;
-};
-
-export type deleteUserNotificationV2Response400 = {
- data: ErrorResponse;
- status: 400;
-};
-
-export type deleteUserNotificationV2Response401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type deleteUserNotificationV2Response500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type deleteUserNotificationV2ResponseSuccess =
- deleteUserNotificationV2Response200 & {
- headers: Headers;
- };
-export type deleteUserNotificationV2ResponseError = (
- | deleteUserNotificationV2Response400
- | deleteUserNotificationV2Response401
- | deleteUserNotificationV2Response500
-) & {
- headers: Headers;
-};
-
-export type deleteUserNotificationV2Response =
- | deleteUserNotificationV2ResponseSuccess
- | deleteUserNotificationV2ResponseError;
-
-export const getDeleteUserNotificationV2Url = (notificationId: string) => {
- return `/v2/user_notifications/${notificationId}`;
-};
-
-export const deleteUserNotificationV2 = async (
- notificationId: string,
- options?: RequestInit
-): Promise<deleteUserNotificationV2Response> => {
- const res = await fetch(getDeleteUserNotificationV2Url(notificationId), {
- ...options,
- method: 'DELETE',
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: deleteUserNotificationV2Response['data'] = body
- ? JSON.parse(body)
- : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as deleteUserNotificationV2Response;
-};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValue.ts b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValue.ts
new file mode 100644
index 0000000000..9b0b289017
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValue.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+import type { ConnGatewayInnerNotifValueAllOf } from './connGatewayInnerNotifValueAllOf';
+import type { Entity } from './entity';
+
+/**
+ * the value of the inner payload inside [ConnGatewayNotification]
+ */
+export type ConnGatewayInnerNotifValue = Entity &
+ ConnGatewayInnerNotifValueAllOf;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOf.ts b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOf.ts
new file mode 100644
index 0000000000..97c4cdc8a3
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOf.ts
@@ -0,0 +1,35 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { ConnGatewayInnerNotifValueAllOfCreatedAt } from './connGatewayInnerNotifValueAllOfCreatedAt';
+import type { ConnGatewayInnerNotifValueAllOfDeletedAt } from './connGatewayInnerNotifValueAllOfDeletedAt';
+import type { ConnGatewayInnerNotifValueAllOfSenderId } from './connGatewayInnerNotifValueAllOfSenderId';
+import type { ConnGatewayInnerNotifValueAllOfUpdatedAt } from './connGatewayInnerNotifValueAllOfUpdatedAt';
+import type { ConnGatewayInnerNotifValueAllOfViewedAt } from './connGatewayInnerNotifValueAllOfViewedAt';
+import type { TaggedContentValue } from './taggedContentValue';
+
+export type ConnGatewayInnerNotifValueAllOf = {
+ /** When the notification was created. */
+ created_at?: ConnGatewayInnerNotifValueAllOfCreatedAt;
+ /** When the notification was deleted. */
+ deleted_at?: ConnGatewayInnerNotifValueAllOfDeletedAt;
+ /** Whether the notification is marked as done. */
+ done: boolean;
+ /** The notification event type string (e.g. "channel_mention").
+TODO make this a new type */
+ notification_event_type: string;
+ /** The notification ID. */
+ notification_id: string;
+ /** Deserialized notification metadata. */
+ notification_metadata: TaggedContentValue;
+ sender_id?: ConnGatewayInnerNotifValueAllOfSenderId;
+ /** Whether the notification has been sent. */
+ sent: boolean;
+ /** When the notification was last updated. */
+ updated_at?: ConnGatewayInnerNotifValueAllOfUpdatedAt;
+ /** When the notification was viewed/seen. */
+ viewed_at?: ConnGatewayInnerNotifValueAllOfViewedAt;
+};
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfCreatedAt.ts b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfCreatedAt.ts
new file mode 100644
index 0000000000..9ed1b47914
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfCreatedAt.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * When the notification was created.
+ */
+export type ConnGatewayInnerNotifValueAllOfCreatedAt = string | null;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfDeletedAt.ts b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfDeletedAt.ts
new file mode 100644
index 0000000000..fd6b41b598
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfDeletedAt.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * When the notification was deleted.
+ */
+export type ConnGatewayInnerNotifValueAllOfDeletedAt = string | null;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfSenderId.ts b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfSenderId.ts
new file mode 100644
index 0000000000..6e34eaaeda
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfSenderId.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { MacroUserIdStr } from './macroUserIdStr';
+
+export type ConnGatewayInnerNotifValueAllOfSenderId = null | MacroUserIdStr;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfUpdatedAt.ts b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfUpdatedAt.ts
new file mode 100644
index 0000000000..1138385e18
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfUpdatedAt.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * When the notification was last updated.
+ */
+export type ConnGatewayInnerNotifValueAllOfUpdatedAt = string | null;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfViewedAt.ts b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfViewedAt.ts
new file mode 100644
index 0000000000..dbcb01c0b8
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayInnerNotifValueAllOfViewedAt.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * When the notification was viewed/seen.
+ */
+export type ConnGatewayInnerNotifValueAllOfViewedAt = string | null;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayNotificationPayload.ts b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayNotificationPayload.ts
new file mode 100644
index 0000000000..7c06a070d0
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/connGatewayNotificationPayload.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { ConnGatewayInnerNotifValue } from './connGatewayInnerNotifValue';
+
+/**
+ * Concrete schema type for [`ConnGatewayInnerNotif`] with `serde_json::Value` metadata.
+
+Used for OpenAPI schema generation — serializes identically to
+`ConnGatewayInnerNotif<serde_json::Value>`.
+ */
+export type ConnGatewayNotificationPayload = ConnGatewayInnerNotifValue;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/index.ts b/js/app/packages/service-clients/service-notification/generated/schemas/index.ts
index 915bde1ccb..939251e0a1 100644
--- a/js/app/packages/service-clients/service-notification/generated/schemas/index.ts
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/index.ts
@@ -33,6 +33,14 @@ export * from './commentedOnDocumentMetadata';
export * from './commentedOnDocumentMetadataFileType';
export * from './commentedOnDocumentMetadataSenderProfilePictureUrl';
export * from './commonChannelMetadata';
+export * from './connGatewayInnerNotifValue';
+export * from './connGatewayInnerNotifValueAllOf';
+export * from './connGatewayInnerNotifValueAllOfCreatedAt';
+export * from './connGatewayInnerNotifValueAllOfDeletedAt';
+export * from './connGatewayInnerNotifValueAllOfSenderId';
+export * from './connGatewayInnerNotifValueAllOfUpdatedAt';
+export * from './connGatewayInnerNotifValueAllOfViewedAt';
+export * from './connGatewayNotificationPayload';
export * from './createNotification';
export * from './createNotificationAllOf';
export * from './deviceRequest';
@@ -55,6 +63,7 @@ export * from './itemSharedMetadata';
export * from './itemSharedMetadataItemName';
export * from './itemSharedMetadataPermissionLevel';
export * from './listTypedNotificationsParams';
+export * from './macroUserIdStr';
export * from './mentionedInDocumentCommentMetadata';
export * from './mentionedInDocumentCommentMetadataFileType';
export * from './mentionedInDocumentCommentMetadataSenderProfilePictureUrl';
@@ -87,11 +96,13 @@ export * from './notifEventOneOfTwothree';
export * from './notifEventOneOfTwothreeTag';
export * from './notificationBulkRequest';
export * from './notificationServiceApiVersion';
+export * from './notificationTypeName';
export * from './pushNotificationData';
export * from './pushNotificationDataSenderProfilePictureUrl';
export * from './repliedToDocumentCommentThreadMetadata';
export * from './repliedToDocumentCommentThreadMetadataFileType';
export * from './repliedToDocumentCommentThreadMetadataSenderProfilePictureUrl';
+export * from './taggedContentValue';
export * from './taskAssignedMetadata';
export * from './taskAssignedMetadataSenderProfilePictureUrl';
export * from './taskAssignedMetadataTaskName';
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/macroUserIdStr.ts b/js/app/packages/service-clients/service-notification/generated/schemas/macroUserIdStr.ts
new file mode 100644
index 0000000000..f7984043cc
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/macroUserIdStr.ts
@@ -0,0 +1,8 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type MacroUserIdStr = string;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/notificationTypeName.ts b/js/app/packages/service-clients/service-notification/generated/schemas/notificationTypeName.ts
new file mode 100644
index 0000000000..39ad1fda77
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/notificationTypeName.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * newtype wrapper for the the typename of a Notification
+ */
+export type NotificationTypeName = string;
diff --git a/js/app/packages/service-clients/service-notification/generated/schemas/taggedContentValue.ts b/js/app/packages/service-clients/service-notification/generated/schemas/taggedContentValue.ts
new file mode 100644
index 0000000000..9cc63c648e
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/schemas/taggedContentValue.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { NotificationTypeName } from './notificationTypeName';
+
+/**
+ * A notification metadata value tagged with the notification event type.
+ */
+export interface TaggedContentValue {
+ content: unknown;
+ tag: NotificationTypeName;
+}
diff --git a/js/app/packages/service-clients/service-notification/generated/zod.ts b/js/app/packages/service-clients/service-notification/generated/zod.ts
new file mode 100644
index 0000000000..3158876b64
--- /dev/null
+++ b/js/app/packages/service-clients/service-notification/generated/zod.ts
@@ -0,0 +1,1765 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * notification_service
+ * OpenAPI spec version: 0.1.0
+ */
+import { z as zod } from 'zod';
+
+/**
+ * @summary Health check
+ */
+export const healthHandlerResponse = zod
+ .object({})
+ .describe(
+ 'Empty response is required due to custom fetch forcing `response.json()`'
+ );
+
+/**
+ * @summary Gets the users unsubscribe items.
+ */
+export const getUnsubscribesResponseItem = zod.object({
+ item_id: zod.string().describe('The item id'),
+ item_type: zod.string().describe('The item type'),
+});
+export const getUnsubscribesResponse = zod.array(getUnsubscribesResponseItem);
+
+/**
+ * @summary Unsubscribes a user from receiving emails
+ */
+export const unsubscribeEmailResponse = zod
+ .object({})
+ .describe(
+ 'Empty response is required due to custom fetch forcing `response.json()`'
+ );
+
+/**
+ * @summary Unsubscribes a user from a given item for notifications.
+ */
+export const unsubscribeItemParams = zod.object({
+ item_type: zod.string(),
+ item_id: zod.string(),
+});
+
+export const unsubscribeItemResponse = zod
+ .object({})
+ .describe(
+ 'Empty response is required due to custom fetch forcing `response.json()`'
+ );
+
+/**
+ * @summary Removes a unsubscribe item for a user.
+ */
+export const removeUnsubscribeItemParams = zod.object({
+ item_type: zod.string(),
+ item_id: zod.string(),
+});
+
+export const removeUnsubscribeItemResponse = zod
+ .object({})
+ .describe(
+ 'Empty response is required due to custom fetch forcing `response.json()`'
+ );
+
+/**
+ * @summary Unsubscribes user from all notifications.
+ */
+export const unsubscribeAllResponse = zod
+ .object({})
+ .describe(
+ 'Empty response is required due to custom fetch forcing `response.json()`'
+ );
+
+/**
+ * @summary Unmutes all notifications.
+Existing notifications that were muted manually will remain muted.
+ */
+export const removeUnsubscribeAllResponse = zod
+ .object({})
+ .describe(
+ 'Empty response is required due to custom fetch forcing `response.json()`'
+ );
+
+/**
+ * Rows that fail to deserialize are dropped with a warning log.
+ * @summary Wrapper handler that calls the inner generic list handler with `serde_json::Value`,
+then converts each row to [`UserNotificationRow<NotifEvent>`].
+ */
+export const listTypedNotificationsQueryLimitMin = 0;
+
+export const listTypedNotificationsQueryParams = zod.object({
+ limit: zod
+ .number()
+ .min(listTypedNotificationsQueryLimitMin)
+ .optional()
+ .describe('Size limit per page.'),
+ cursor: zod
+ .string()
+ .optional()
+ .describe('Cursor value. Base64 encoded timestamp and item id.'),
+});
+
+export const listTypedNotificationsResponse = zod
+ .object({
+ items: zod
+ .array(
+ zod
+ .object({
+ entity_id: zod.string().describe('The id of that entity'),
+ entity_type: zod
+ .enum([
+ 'user',
+ 'chat',
+ 'channel',
+ 'document',
+ 'project',
+ 'email_thread',
+ 'team',
+ ])
+ .describe('The type of an entity in Macro'),
+ })
+ .describe(
+ 'The Entity describes the minimum amount of information required to describe a unique thing in Macro\nThis contains the type of the entity [EntityType] and the string id of that entity'
+ )
+ .and(
+ zod.object({
+ created_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was created.'),
+ deleted_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was deleted.'),
+ done: zod
+ .boolean()
+ .describe('Whether the notification is marked as done.'),
+ id: zod.string().uuid().describe('The notification ID.'),
+ notification_event_type: zod
+ .string()
+ .describe(
+ 'The notification event type string (e.g. \"channel_mention\").\nTODO make this a new type'
+ ),
+ notification_metadata: zod
+ .union([
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
+ })
+ .describe(
+ 'Common metadata for notifications on channels'
+ )
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .describe('The message content'),
+ messageId: zod
+ .string()
+ .describe('The message you were mentioned in'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ threadId: zod
+ .string()
+ .nullish()
+ .describe('the id of the thread'),
+ })
+ ),
+ tag: zod.enum(['channel_mention']),
+ })
+ .describe('Someone mentioned you in a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ documentName: zod
+ .string()
+ .describe('The name of the document'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document'),
+ owner: zod
+ .string()
+ .describe('The owner of the document'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ })
+ .describe('Someone mentioned a document in a channel'),
+ tag: zod.enum(['document_mention']),
+ })
+ .describe('Someone mentioned a document in a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ commentId: zod.number().describe('the comment id'),
+ documentName: zod
+ .string()
+ .describe('The name of the document.'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document.'),
+ mentionId: zod.string().describe('The mention ID.'),
+ owner: zod
+ .string()
+ .describe('The owner of the document.'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ text: zod
+ .string()
+ .describe('the text of the comment'),
+ threadId: zod.number().describe('the thread id'),
+ })
+ .describe(
+ 'Notification sent when a user is mentioned in a document comment.'
+ ),
+ tag: zod.enum(['mentioned_in_document_comment']),
+ })
+ .describe('User was mentioned in a comment in a document'),
+ zod
+ .object({
+ content: zod
+ .object({
+ commentId: zod.number().describe('the comment id'),
+ documentName: zod
+ .string()
+ .describe('The name of the document.'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document.'),
+ owner: zod
+ .string()
+ .describe('The owner of the document.'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ text: zod
+ .string()
+ .describe('the text of the comment'),
+ threadId: zod.number().describe('the thread id'),
+ })
+ .describe(
+ 'Notification sent when someone replies to a document comment thread.'
+ ),
+ tag: zod.enum(['replied_to_document_comment_thread']),
+ })
+ .describe(
+ 'Someone replied to a document comment thread the user participated in.'
+ ),
+ zod
+ .object({
+ content: zod
+ .object({
+ commentId: zod.number().describe('the comment id'),
+ documentName: zod
+ .string()
+ .describe('The name of the document.'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document.'),
+ owner: zod
+ .string()
+ .describe('The owner of the document.'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ text: zod
+ .string()
+ .describe('the text of the comment'),
+ threadId: zod.number().describe('the thread id'),
+ })
+ .describe(
+ 'Notification sent when someone comments on a document the user owns.'
+ ),
+ tag: zod.enum(['commented_on_document']),
+ })
+ .describe('Someone commented on a document the user owns.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod
+ .string()
+ .optional()
+ .describe('The name of the channel'),
+ invitedBy: zod
+ .string()
+ .describe('The user who sent the invitation'),
+ senderProfilePictureUrl: zod
+ .string()
+ .nullish()
+ .describe(
+ "The sender's profile picture URL, if available."
+ ),
+ })
+ .describe(
+ 'Metadata for when a user is invited to a channel.'
+ ),
+ tag: zod.enum(['channel_invite']),
+ })
+ .describe('The user was invited to a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
+ })
+ .describe(
+ 'Common metadata for notifications on channels'
+ )
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .optional()
+ .describe('The content of the message'),
+ messageId: zod.string().describe('The message id'),
+ sender: zod
+ .string()
+ .describe('The user who sent the message'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ })
+ ),
+ tag: zod.enum(['channel_message_send']),
+ })
+ .describe('A user sent a message in a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
+ })
+ .describe(
+ 'Common metadata for notifications on channels'
+ )
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .describe('The message content'),
+ messageId: zod
+ .string()
+ .describe('The id of the new message'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ threadId: zod
+ .string()
+ .describe(
+ 'The id of the thread that has the reply'
+ ),
+ threadParentSenderId: zod
+ .string()
+ .nullish()
+ .describe(
+ 'The user who sent the root message of the thread'
+ ),
+ userId: zod
+ .string()
+ .describe('The sender id of the reply'),
+ })
+ ),
+ tag: zod.enum(['channel_message_reply']),
+ })
+ .describe(
+ 'Someone replied to a thread in a channel that the user is part of.'
+ ),
+ zod
+ .object({
+ content: zod.object({
+ sender: zod.string().nullish(),
+ snippet: zod.string(),
+ subject: zod.string(),
+ threadId: zod.string(),
+ toEmail: zod.string(),
+ }),
+ tag: zod.enum(['new_email']),
+ })
+ .describe('A new email has been sent to the user.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ invitedBy: zod
+ .string()
+ .describe('The user who sent the invitation'),
+ role: zod
+ .string()
+ .nullish()
+ .describe('Role/permission level in the team'),
+ senderProfilePictureUrl: zod
+ .string()
+ .nullish()
+ .describe(
+ "The sender's profile picture URL, if available."
+ ),
+ teamId: zod
+ .string()
+ .uuid()
+ .describe('The unique identifier of the team'),
+ teamName: zod
+ .string()
+ .describe('The name of the team being invited to'),
+ })
+ .describe(
+ 'Metadata for when a user is invited to a team.'
+ ),
+ tag: zod.enum(['invite_to_team']),
+ })
+ .describe('A user was invited to a team.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ assignedBy: zod
+ .string()
+ .describe('The user who assigned the task'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ taskId: zod
+ .string()
+ .describe('The unique identifier of the task'),
+ taskName: zod
+ .string()
+ .nullish()
+ .describe('The name of the task (optional)'),
+ })
+ .describe(
+ 'Metadata for when a user is assigned to a task'
+ ),
+ tag: zod.enum(['task_assigned']),
+ })
+ .describe('A user was assigned to a task.'),
+ zod
+ .object({
+ content: zod.object({
+ messageId: zod.string(),
+ summary: zod.string(),
+ }),
+ tag: zod.enum(['ai_response']),
+ })
+ .describe('An AI assistant responded to a chat.'),
+ ])
+ .describe(
+ 'Mirrors [`model_notifications::NotificationEvent`] but uses `tag` / `content`\nas the serde adjacently-tagged field names so it can be deserialized from the\nshape produced by [`UserNotificationRow::into_tagged`] +\n[`UserNotificationRow::into_json`].\n\nOnly includes variants whose metadata types implement the `Notification` trait.'
+ ),
+ owner_id: zod
+ .string()
+ .describe('The user who owns this notification.'),
+ sender_id: zod
+ .string()
+ .nullish()
+ .describe('The user who triggered the notification.'),
+ sent: zod
+ .boolean()
+ .describe('Whether the notification has been sent.'),
+ updated_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was last updated.'),
+ viewed_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was viewed/seen.'),
+ })
+ )
+ )
+ .describe('The list of items returned.'),
+ next_cursor: zod
+ .string()
+ .nullish()
+ .describe('The next page cursor if it exists.'),
+ })
+ .describe('The strongly typed response for listing user notifications.');
+
+/**
+ * Rows that fail to deserialize are dropped with a warning log.
+ * @summary Wrapper handler that calls the inner generic bulk-get handler with `serde_json::Value`,
+then converts each row to [`UserNotificationRow<NotifEvent>`].
+ */
+export const bulkGetTypedNotificationsByEventItemIdsQueryLimitMin = 0;
+
+export const bulkGetTypedNotificationsByEventItemIdsQueryParams = zod.object({
+ limit: zod
+ .number()
+ .min(bulkGetTypedNotificationsByEventItemIdsQueryLimitMin)
+ .optional()
+ .describe('Size limit per page. Default 20, max 500.'),
+ cursor: zod
+ .string()
+ .optional()
+ .describe('Cursor value. Base64 encoded timestamp and item id.'),
+});
+
+export const bulkGetTypedNotificationsByEventItemIdsBody = zod
+ .object({
+ eventItemIds: zod
+ .array(zod.string().uuid())
+ .describe('The event item IDs to filter notifications by.'),
+ })
+ .describe('Request body for bulk-fetching notifications by event item IDs.');
+
+export const bulkGetTypedNotificationsByEventItemIdsResponse = zod
+ .object({
+ items: zod
+ .array(
+ zod
+ .object({
+ entity_id: zod.string().describe('The id of that entity'),
+ entity_type: zod
+ .enum([
+ 'user',
+ 'chat',
+ 'channel',
+ 'document',
+ 'project',
+ 'email_thread',
+ 'team',
+ ])
+ .describe('The type of an entity in Macro'),
+ })
+ .describe(
+ 'The Entity describes the minimum amount of information required to describe a unique thing in Macro\nThis contains the type of the entity [EntityType] and the string id of that entity'
+ )
+ .and(
+ zod.object({
+ created_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was created.'),
+ deleted_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was deleted.'),
+ done: zod
+ .boolean()
+ .describe('Whether the notification is marked as done.'),
+ id: zod.string().uuid().describe('The notification ID.'),
+ notification_event_type: zod
+ .string()
+ .describe(
+ 'The notification event type string (e.g. \"channel_mention\").\nTODO make this a new type'
+ ),
+ notification_metadata: zod
+ .union([
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
+ })
+ .describe(
+ 'Common metadata for notifications on channels'
+ )
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .describe('The message content'),
+ messageId: zod
+ .string()
+ .describe('The message you were mentioned in'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ threadId: zod
+ .string()
+ .nullish()
+ .describe('the id of the thread'),
+ })
+ ),
+ tag: zod.enum(['channel_mention']),
+ })
+ .describe('Someone mentioned you in a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ documentName: zod
+ .string()
+ .describe('The name of the document'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document'),
+ owner: zod
+ .string()
+ .describe('The owner of the document'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ })
+ .describe('Someone mentioned a document in a channel'),
+ tag: zod.enum(['document_mention']),
+ })
+ .describe('Someone mentioned a document in a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ commentId: zod.number().describe('the comment id'),
+ documentName: zod
+ .string()
+ .describe('The name of the document.'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document.'),
+ mentionId: zod.string().describe('The mention ID.'),
+ owner: zod
+ .string()
+ .describe('The owner of the document.'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ text: zod
+ .string()
+ .describe('the text of the comment'),
+ threadId: zod.number().describe('the thread id'),
+ })
+ .describe(
+ 'Notification sent when a user is mentioned in a document comment.'
+ ),
+ tag: zod.enum(['mentioned_in_document_comment']),
+ })
+ .describe('User was mentioned in a comment in a document'),
+ zod
+ .object({
+ content: zod
+ .object({
+ commentId: zod.number().describe('the comment id'),
+ documentName: zod
+ .string()
+ .describe('The name of the document.'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document.'),
+ owner: zod
+ .string()
+ .describe('The owner of the document.'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ text: zod
+ .string()
+ .describe('the text of the comment'),
+ threadId: zod.number().describe('the thread id'),
+ })
+ .describe(
+ 'Notification sent when someone replies to a document comment thread.'
+ ),
+ tag: zod.enum(['replied_to_document_comment_thread']),
+ })
+ .describe(
+ 'Someone replied to a document comment thread the user participated in.'
+ ),
+ zod
+ .object({
+ content: zod
+ .object({
+ commentId: zod.number().describe('the comment id'),
+ documentName: zod
+ .string()
+ .describe('The name of the document.'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document.'),
+ owner: zod
+ .string()
+ .describe('The owner of the document.'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ text: zod
+ .string()
+ .describe('the text of the comment'),
+ threadId: zod.number().describe('the thread id'),
+ })
+ .describe(
+ 'Notification sent when someone comments on a document the user owns.'
+ ),
+ tag: zod.enum(['commented_on_document']),
+ })
+ .describe('Someone commented on a document the user owns.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod
+ .string()
+ .optional()
+ .describe('The name of the channel'),
+ invitedBy: zod
+ .string()
+ .describe('The user who sent the invitation'),
+ senderProfilePictureUrl: zod
+ .string()
+ .nullish()
+ .describe(
+ "The sender's profile picture URL, if available."
+ ),
+ })
+ .describe(
+ 'Metadata for when a user is invited to a channel.'
+ ),
+ tag: zod.enum(['channel_invite']),
+ })
+ .describe('The user was invited to a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
+ })
+ .describe(
+ 'Common metadata for notifications on channels'
+ )
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .optional()
+ .describe('The content of the message'),
+ messageId: zod.string().describe('The message id'),
+ sender: zod
+ .string()
+ .describe('The user who sent the message'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ })
+ ),
+ tag: zod.enum(['channel_message_send']),
+ })
+ .describe('A user sent a message in a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
+ })
+ .describe(
+ 'Common metadata for notifications on channels'
+ )
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .describe('The message content'),
+ messageId: zod
+ .string()
+ .describe('The id of the new message'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ threadId: zod
+ .string()
+ .describe(
+ 'The id of the thread that has the reply'
+ ),
+ threadParentSenderId: zod
+ .string()
+ .nullish()
+ .describe(
+ 'The user who sent the root message of the thread'
+ ),
+ userId: zod
+ .string()
+ .describe('The sender id of the reply'),
+ })
+ ),
+ tag: zod.enum(['channel_message_reply']),
+ })
+ .describe(
+ 'Someone replied to a thread in a channel that the user is part of.'
+ ),
+ zod
+ .object({
+ content: zod.object({
+ sender: zod.string().nullish(),
+ snippet: zod.string(),
+ subject: zod.string(),
+ threadId: zod.string(),
+ toEmail: zod.string(),
+ }),
+ tag: zod.enum(['new_email']),
+ })
+ .describe('A new email has been sent to the user.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ invitedBy: zod
+ .string()
+ .describe('The user who sent the invitation'),
+ role: zod
+ .string()
+ .nullish()
+ .describe('Role/permission level in the team'),
+ senderProfilePictureUrl: zod
+ .string()
+ .nullish()
+ .describe(
+ "The sender's profile picture URL, if available."
+ ),
+ teamId: zod
+ .string()
+ .uuid()
+ .describe('The unique identifier of the team'),
+ teamName: zod
+ .string()
+ .describe('The name of the team being invited to'),
+ })
+ .describe(
+ 'Metadata for when a user is invited to a team.'
+ ),
+ tag: zod.enum(['invite_to_team']),
+ })
+ .describe('A user was invited to a team.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ assignedBy: zod
+ .string()
+ .describe('The user who assigned the task'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ taskId: zod
+ .string()
+ .describe('The unique identifier of the task'),
+ taskName: zod
+ .string()
+ .nullish()
+ .describe('The name of the task (optional)'),
+ })
+ .describe(
+ 'Metadata for when a user is assigned to a task'
+ ),
+ tag: zod.enum(['task_assigned']),
+ })
+ .describe('A user was assigned to a task.'),
+ zod
+ .object({
+ content: zod.object({
+ messageId: zod.string(),
+ summary: zod.string(),
+ }),
+ tag: zod.enum(['ai_response']),
+ })
+ .describe('An AI assistant responded to a chat.'),
+ ])
+ .describe(
+ 'Mirrors [`model_notifications::NotificationEvent`] but uses `tag` / `content`\nas the serde adjacently-tagged field names so it can be deserialized from the\nshape produced by [`UserNotificationRow::into_tagged`] +\n[`UserNotificationRow::into_json`].\n\nOnly includes variants whose metadata types implement the `Notification` trait.'
+ ),
+ owner_id: zod
+ .string()
+ .describe('The user who owns this notification.'),
+ sender_id: zod
+ .string()
+ .nullish()
+ .describe('The user who triggered the notification.'),
+ sent: zod
+ .boolean()
+ .describe('Whether the notification has been sent.'),
+ updated_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was last updated.'),
+ viewed_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was viewed/seen.'),
+ })
+ )
+ )
+ .describe('The list of items returned.'),
+ next_cursor: zod
+ .string()
+ .nullish()
+ .describe('The next page cursor if it exists.'),
+ })
+ .describe('The strongly typed response for listing user notifications.');
+
+/**
+ * @summary Typed wrapper for getting notifications by a single event item ID.
+ */
+export const getTypedNotificationsByEventItemIdParams = zod.object({
+ event_item_id: zod.string().uuid().describe('The event item ID'),
+});
+
+export const getTypedNotificationsByEventItemIdQueryLimitMin = 0;
+
+export const getTypedNotificationsByEventItemIdQueryParams = zod.object({
+ limit: zod
+ .number()
+ .min(getTypedNotificationsByEventItemIdQueryLimitMin)
+ .optional()
+ .describe('Size limit per page.'),
+ cursor: zod
+ .string()
+ .optional()
+ .describe('Cursor value. Base64 encoded timestamp and item id.'),
+});
+
+export const getTypedNotificationsByEventItemIdResponse = zod
+ .object({
+ items: zod
+ .array(
+ zod
+ .object({
+ entity_id: zod.string().describe('The id of that entity'),
+ entity_type: zod
+ .enum([
+ 'user',
+ 'chat',
+ 'channel',
+ 'document',
+ 'project',
+ 'email_thread',
+ 'team',
+ ])
+ .describe('The type of an entity in Macro'),
+ })
+ .describe(
+ 'The Entity describes the minimum amount of information required to describe a unique thing in Macro\nThis contains the type of the entity [EntityType] and the string id of that entity'
+ )
+ .and(
+ zod.object({
+ created_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was created.'),
+ deleted_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was deleted.'),
+ done: zod
+ .boolean()
+ .describe('Whether the notification is marked as done.'),
+ id: zod.string().uuid().describe('The notification ID.'),
+ notification_event_type: zod
+ .string()
+ .describe(
+ 'The notification event type string (e.g. \"channel_mention\").\nTODO make this a new type'
+ ),
+ notification_metadata: zod
+ .union([
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
+ })
+ .describe(
+ 'Common metadata for notifications on channels'
+ )
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .describe('The message content'),
+ messageId: zod
+ .string()
+ .describe('The message you were mentioned in'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ threadId: zod
+ .string()
+ .nullish()
+ .describe('the id of the thread'),
+ })
+ ),
+ tag: zod.enum(['channel_mention']),
+ })
+ .describe('Someone mentioned you in a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ documentName: zod
+ .string()
+ .describe('The name of the document'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document'),
+ owner: zod
+ .string()
+ .describe('The owner of the document'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ })
+ .describe('Someone mentioned a document in a channel'),
+ tag: zod.enum(['document_mention']),
+ })
+ .describe('Someone mentioned a document in a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ commentId: zod.number().describe('the comment id'),
+ documentName: zod
+ .string()
+ .describe('The name of the document.'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document.'),
+ mentionId: zod.string().describe('The mention ID.'),
+ owner: zod
+ .string()
+ .describe('The owner of the document.'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ text: zod
+ .string()
+ .describe('the text of the comment'),
+ threadId: zod.number().describe('the thread id'),
+ })
+ .describe(
+ 'Notification sent when a user is mentioned in a document comment.'
+ ),
+ tag: zod.enum(['mentioned_in_document_comment']),
+ })
+ .describe('User was mentioned in a comment in a document'),
+ zod
+ .object({
+ content: zod
+ .object({
+ commentId: zod.number().describe('the comment id'),
+ documentName: zod
+ .string()
+ .describe('The name of the document.'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document.'),
+ owner: zod
+ .string()
+ .describe('The owner of the document.'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ text: zod
+ .string()
+ .describe('the text of the comment'),
+ threadId: zod.number().describe('the thread id'),
+ })
+ .describe(
+ 'Notification sent when someone replies to a document comment thread.'
+ ),
+ tag: zod.enum(['replied_to_document_comment_thread']),
+ })
+ .describe(
+ 'Someone replied to a document comment thread the user participated in.'
+ ),
+ zod
+ .object({
+ content: zod
+ .object({
+ commentId: zod.number().describe('the comment id'),
+ documentName: zod
+ .string()
+ .describe('The name of the document.'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document.'),
+ owner: zod
+ .string()
+ .describe('The owner of the document.'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ text: zod
+ .string()
+ .describe('the text of the comment'),
+ threadId: zod.number().describe('the thread id'),
+ })
+ .describe(
+ 'Notification sent when someone comments on a document the user owns.'
+ ),
+ tag: zod.enum(['commented_on_document']),
+ })
+ .describe('Someone commented on a document the user owns.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod
+ .string()
+ .optional()
+ .describe('The name of the channel'),
+ invitedBy: zod
+ .string()
+ .describe('The user who sent the invitation'),
+ senderProfilePictureUrl: zod
+ .string()
+ .nullish()
+ .describe(
+ "The sender's profile picture URL, if available."
+ ),
+ })
+ .describe(
+ 'Metadata for when a user is invited to a channel.'
+ ),
+ tag: zod.enum(['channel_invite']),
+ })
+ .describe('The user was invited to a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
+ })
+ .describe(
+ 'Common metadata for notifications on channels'
+ )
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .optional()
+ .describe('The content of the message'),
+ messageId: zod.string().describe('The message id'),
+ sender: zod
+ .string()
+ .describe('The user who sent the message'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ })
+ ),
+ tag: zod.enum(['channel_message_send']),
+ })
+ .describe('A user sent a message in a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
+ })
+ .describe(
+ 'Common metadata for notifications on channels'
+ )
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .describe('The message content'),
+ messageId: zod
+ .string()
+ .describe('The id of the new message'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ threadId: zod
+ .string()
+ .describe(
+ 'The id of the thread that has the reply'
+ ),
+ threadParentSenderId: zod
+ .string()
+ .nullish()
+ .describe(
+ 'The user who sent the root message of the thread'
+ ),
+ userId: zod
+ .string()
+ .describe('The sender id of the reply'),
+ })
+ ),
+ tag: zod.enum(['channel_message_reply']),
+ })
+ .describe(
+ 'Someone replied to a thread in a channel that the user is part of.'
+ ),
+ zod
+ .object({
+ content: zod.object({
+ sender: zod.string().nullish(),
+ snippet: zod.string(),
+ subject: zod.string(),
+ threadId: zod.string(),
+ toEmail: zod.string(),
+ }),
+ tag: zod.enum(['new_email']),
+ })
+ .describe('A new email has been sent to the user.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ invitedBy: zod
+ .string()
+ .describe('The user who sent the invitation'),
+ role: zod
+ .string()
+ .nullish()
+ .describe('Role/permission level in the team'),
+ senderProfilePictureUrl: zod
+ .string()
+ .nullish()
+ .describe(
+ "The sender's profile picture URL, if available."
+ ),
+ teamId: zod
+ .string()
+ .uuid()
+ .describe('The unique identifier of the team'),
+ teamName: zod
+ .string()
+ .describe('The name of the team being invited to'),
+ })
+ .describe(
+ 'Metadata for when a user is invited to a team.'
+ ),
+ tag: zod.enum(['invite_to_team']),
+ })
+ .describe('A user was invited to a team.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ assignedBy: zod
+ .string()
+ .describe('The user who assigned the task'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ taskId: zod
+ .string()
+ .describe('The unique identifier of the task'),
+ taskName: zod
+ .string()
+ .nullish()
+ .describe('The name of the task (optional)'),
+ })
+ .describe(
+ 'Metadata for when a user is assigned to a task'
+ ),
+ tag: zod.enum(['task_assigned']),
+ })
+ .describe('A user was assigned to a task.'),
+ zod
+ .object({
+ content: zod.object({
+ messageId: zod.string(),
+ summary: zod.string(),
+ }),
+ tag: zod.enum(['ai_response']),
+ })
+ .describe('An AI assistant responded to a chat.'),
+ ])
+ .describe(
+ 'Mirrors [`model_notifications::NotificationEvent`] but uses `tag` / `content`\nas the serde adjacently-tagged field names so it can be deserialized from the\nshape produced by [`UserNotificationRow::into_tagged`] +\n[`UserNotificationRow::into_json`].\n\nOnly includes variants whose metadata types implement the `Notification` trait.'
+ ),
+ owner_id: zod
+ .string()
+ .describe('The user who owns this notification.'),
+ sender_id: zod
+ .string()
+ .nullish()
+ .describe('The user who triggered the notification.'),
+ sent: zod
+ .boolean()
+ .describe('Whether the notification has been sent.'),
+ updated_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was last updated.'),
+ viewed_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was viewed/seen.'),
+ })
+ )
+ )
+ .describe('The list of items returned.'),
+ next_cursor: zod
+ .string()
+ .nullish()
+ .describe('The next page cursor if it exists.'),
+ })
+ .describe('The strongly typed response for listing user notifications.');
+
+/**
+ * @summary Get the notification types that the user has disabled.
+ */
+export const getNotificationTypePreferencesResponse = zod
+ .object({
+ disabled_types: zod
+ .array(zod.string())
+ .describe('The notification types that the user has disabled.'),
+ })
+ .describe('Response for listing disabled notification types.');
+
+/**
+ * @summary Disable a notification type for the authenticated user.
+ */
+export const disableNotificationTypeParams = zod.object({
+ notification_event_type: zod
+ .string()
+ .describe('The notification event type to disable'),
+});
+
+/**
+ * @summary Re-enable a notification type for the authenticated user.
+ */
+export const enableNotificationTypeParams = zod.object({
+ notification_event_type: zod
+ .string()
+ .describe('The notification event type to enable'),
+});
+
+/**
+ * @summary Typed wrapper for getting a single notification by ID.
+ */
+export const getTypedNotificationByIdParams = zod.object({
+ notification_id: zod.string().uuid().describe('ID of the notification'),
+});
+
+export const getTypedNotificationByIdResponse = zod
+ .object({
+ entity_id: zod.string().describe('The id of that entity'),
+ entity_type: zod
+ .enum([
+ 'user',
+ 'chat',
+ 'channel',
+ 'document',
+ 'project',
+ 'email_thread',
+ 'team',
+ ])
+ .describe('The type of an entity in Macro'),
+ })
+ .describe(
+ 'The Entity describes the minimum amount of information required to describe a unique thing in Macro\nThis contains the type of the entity [EntityType] and the string id of that entity'
+ )
+ .and(
+ zod.object({
+ created_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was created.'),
+ deleted_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was deleted.'),
+ done: zod
+ .boolean()
+ .describe('Whether the notification is marked as done.'),
+ id: zod.string().uuid().describe('The notification ID.'),
+ notification_event_type: zod
+ .string()
+ .describe(
+ 'The notification event type string (e.g. \"channel_mention\").\nTODO make this a new type'
+ ),
+ notification_metadata: zod
+ .union([
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
+ })
+ .describe('Common metadata for notifications on channels')
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .describe('The message content'),
+ messageId: zod
+ .string()
+ .describe('The message you were mentioned in'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ threadId: zod
+ .string()
+ .nullish()
+ .describe('the id of the thread'),
+ })
+ ),
+ tag: zod.enum(['channel_mention']),
+ })
+ .describe('Someone mentioned you in a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ documentName: zod
+ .string()
+ .describe('The name of the document'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document'),
+ owner: zod.string().describe('The owner of the document'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ })
+ .describe('Someone mentioned a document in a channel'),
+ tag: zod.enum(['document_mention']),
+ })
+ .describe('Someone mentioned a document in a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ commentId: zod.number().describe('the comment id'),
+ documentName: zod
+ .string()
+ .describe('The name of the document.'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document.'),
+ mentionId: zod.string().describe('The mention ID.'),
+ owner: zod.string().describe('The owner of the document.'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ text: zod.string().describe('the text of the comment'),
+ threadId: zod.number().describe('the thread id'),
+ })
+ .describe(
+ 'Notification sent when a user is mentioned in a document comment.'
+ ),
+ tag: zod.enum(['mentioned_in_document_comment']),
+ })
+ .describe('User was mentioned in a comment in a document'),
+ zod
+ .object({
+ content: zod
+ .object({
+ commentId: zod.number().describe('the comment id'),
+ documentName: zod
+ .string()
+ .describe('The name of the document.'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document.'),
+ owner: zod.string().describe('The owner of the document.'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ text: zod.string().describe('the text of the comment'),
+ threadId: zod.number().describe('the thread id'),
+ })
+ .describe(
+ 'Notification sent when someone replies to a document comment thread.'
+ ),
+ tag: zod.enum(['replied_to_document_comment_thread']),
+ })
+ .describe(
+ 'Someone replied to a document comment thread the user participated in.'
+ ),
+ zod
+ .object({
+ content: zod
+ .object({
+ commentId: zod.number().describe('the comment id'),
+ documentName: zod
+ .string()
+ .describe('The name of the document.'),
+ fileType: zod
+ .string()
+ .nullish()
+ .describe('The file type of the document.'),
+ owner: zod.string().describe('The owner of the document.'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ text: zod.string().describe('the text of the comment'),
+ threadId: zod.number().describe('the thread id'),
+ })
+ .describe(
+ 'Notification sent when someone comments on a document the user owns.'
+ ),
+ tag: zod.enum(['commented_on_document']),
+ })
+ .describe('Someone commented on a document the user owns.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod
+ .string()
+ .optional()
+ .describe('The name of the channel'),
+ invitedBy: zod
+ .string()
+ .describe('The user who sent the invitation'),
+ senderProfilePictureUrl: zod
+ .string()
+ .nullish()
+ .describe(
+ "The sender's profile picture URL, if available."
+ ),
+ })
+ .describe('Metadata for when a user is invited to a channel.'),
+ tag: zod.enum(['channel_invite']),
+ })
+ .describe('The user was invited to a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
+ })
+ .describe('Common metadata for notifications on channels')
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .optional()
+ .describe('The content of the message'),
+ messageId: zod.string().describe('The message id'),
+ sender: zod
+ .string()
+ .describe('The user who sent the message'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ })
+ ),
+ tag: zod.enum(['channel_message_send']),
+ })
+ .describe('A user sent a message in a channel.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ channelName: zod.string().optional(),
+ channelType: zod.enum([
+ 'public',
+ 'organization',
+ 'private',
+ 'directMessage',
+ 'team',
+ ]),
+ })
+ .describe('Common metadata for notifications on channels')
+ .and(
+ zod.object({
+ messageContent: zod
+ .string()
+ .describe('The message content'),
+ messageId: zod
+ .string()
+ .describe('The id of the new message'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ threadId: zod
+ .string()
+ .describe('The id of the thread that has the reply'),
+ threadParentSenderId: zod
+ .string()
+ .nullish()
+ .describe(
+ 'The user who sent the root message of the thread'
+ ),
+ userId: zod.string().describe('The sender id of the reply'),
+ })
+ ),
+ tag: zod.enum(['channel_message_reply']),
+ })
+ .describe(
+ 'Someone replied to a thread in a channel that the user is part of.'
+ ),
+ zod
+ .object({
+ content: zod.object({
+ sender: zod.string().nullish(),
+ snippet: zod.string(),
+ subject: zod.string(),
+ threadId: zod.string(),
+ toEmail: zod.string(),
+ }),
+ tag: zod.enum(['new_email']),
+ })
+ .describe('A new email has been sent to the user.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ invitedBy: zod
+ .string()
+ .describe('The user who sent the invitation'),
+ role: zod
+ .string()
+ .nullish()
+ .describe('Role/permission level in the team'),
+ senderProfilePictureUrl: zod
+ .string()
+ .nullish()
+ .describe(
+ "The sender's profile picture URL, if available."
+ ),
+ teamId: zod
+ .string()
+ .uuid()
+ .describe('The unique identifier of the team'),
+ teamName: zod
+ .string()
+ .describe('The name of the team being invited to'),
+ })
+ .describe('Metadata for when a user is invited to a team.'),
+ tag: zod.enum(['invite_to_team']),
+ })
+ .describe('A user was invited to a team.'),
+ zod
+ .object({
+ content: zod
+ .object({
+ assignedBy: zod
+ .string()
+ .describe('The user who assigned the task'),
+ senderProfilePictureUrl: zod.string().nullish(),
+ taskId: zod
+ .string()
+ .describe('The unique identifier of the task'),
+ taskName: zod
+ .string()
+ .nullish()
+ .describe('The name of the task (optional)'),
+ })
+ .describe('Metadata for when a user is assigned to a task'),
+ tag: zod.enum(['task_assigned']),
+ })
+ .describe('A user was assigned to a task.'),
+ zod
+ .object({
+ content: zod.object({
+ messageId: zod.string(),
+ summary: zod.string(),
+ }),
+ tag: zod.enum(['ai_response']),
+ })
+ .describe('An AI assistant responded to a chat.'),
+ ])
+ .describe(
+ 'Mirrors [`model_notifications::NotificationEvent`] but uses `tag` / `content`\nas the serde adjacently-tagged field names so it can be deserialized from the\nshape produced by [`UserNotificationRow::into_tagged`] +\n[`UserNotificationRow::into_json`].\n\nOnly includes variants whose metadata types implement the `Notification` trait.'
+ ),
+ owner_id: zod.string().describe('The user who owns this notification.'),
+ sender_id: zod
+ .string()
+ .nullish()
+ .describe('The user who triggered the notification.'),
+ sent: zod.boolean().describe('Whether the notification has been sent.'),
+ updated_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was last updated.'),
+ viewed_at: zod
+ .string()
+ .datetime({})
+ .nullish()
+ .describe('When the notification was viewed/seen.'),
+ })
+ );
+
+/**
+ * @summary Soft-delete multiple user notifications.
+ */
+export const bulkDeleteUserNotificationsV2Body = zod
+ .object({
+ notificationIds: zod
+ .array(zod.string().uuid())
+ .describe('The ids of the notifications to handle'),
+ })
+ .describe('the notification ids that we are bulk updating');
+
+/**
+ * @summary Mark notifications as done.
+ */
+export const bulkMarkNotificationsDoneBody = zod
+ .object({
+ notificationIds: zod
+ .array(zod.string().uuid())
+ .describe('The ids of the notifications to handle'),
+ })
+ .describe('the notification ids that we are bulk updating');
+
+/**
+ * @summary Mark notifications as seen.
+ */
+export const bulkMarkNotificationsSeenBody = zod
+ .object({
+ notificationIds: zod
+ .array(zod.string().uuid())
+ .describe('The ids of the notifications to handle'),
+ })
+ .describe('the notification ids that we are bulk updating');
+
+/**
+ * @summary Mark notifications as not done.
+ */
+export const bulkMarkNotificationsUndoneBody = zod
+ .object({
+ notificationIds: zod
+ .array(zod.string().uuid())
+ .describe('The ids of the notifications to handle'),
+ })
+ .describe('the notification ids that we are bulk updating');
+
+/**
+ * @summary Soft-delete a single user notification.
+ */
+export const deleteUserNotificationV2Params = zod.object({
+ notification_id: zod.string().uuid().describe('ID of the notification'),
+});
diff --git a/js/app/packages/service-clients/service-notification/openapi.json b/js/app/packages/service-clients/service-notification/openapi.json
index 571d7c7188..da807b4d98 100644
--- a/js/app/packages/service-clients/service-notification/openapi.json
+++ b/js/app/packages/service-clients/service-notification/openapi.json
@@ -1265,6 +1265,83 @@
}
}
},
+ "ConnGatewayInnerNotif_Value": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/Entity",
+ "description": "The entity the notification is about."
+ },
+ {
+ "type": "object",
+ "required": [
+ "notification_id",
+ "notification_event_type",
+ "sent",
+ "done",
+ "notification_metadata"
+ ],
+ "properties": {
+ "created_at": {
+ "type": ["string", "null"],
+ "format": "date-time",
+ "description": "When the notification was created."
+ },
+ "deleted_at": {
+ "type": ["string", "null"],
+ "format": "date-time",
+ "description": "When the notification was deleted."
+ },
+ "done": {
+ "type": "boolean",
+ "description": "Whether the notification is marked as done."
+ },
+ "notification_event_type": {
+ "type": "string",
+ "description": "The notification event type string (e.g. \"channel_mention\").\nTODO make this a new type"
+ },
+ "notification_id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "The notification ID."
+ },
+ "notification_metadata": {
+ "$ref": "#/components/schemas/TaggedContent_Value",
+ "description": "Deserialized notification metadata."
+ },
+ "sender_id": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/MacroUserIdStr",
+ "description": "The user who triggered the notification."
+ }
+ ]
+ },
+ "sent": {
+ "type": "boolean",
+ "description": "Whether the notification has been sent."
+ },
+ "updated_at": {
+ "type": ["string", "null"],
+ "format": "date-time",
+ "description": "When the notification was last updated."
+ },
+ "viewed_at": {
+ "type": ["string", "null"],
+ "format": "date-time",
+ "description": "When the notification was viewed/seen."
+ }
+ }
+ }
+ ],
+ "description": "the value of the inner payload inside [ConnGatewayNotification]"
+ },
+ "ConnGatewayNotificationPayload": {
+ "$ref": "#/components/schemas/ConnGatewayInnerNotif_Value",
+ "description": "Concrete schema type for [`ConnGatewayInnerNotif`] with `serde_json::Value` metadata.\n\nUsed for OpenAPI schema generation — serializes identically to\n`ConnGatewayInnerNotif<serde_json::Value>`."
+ },
"CreateNotification": {
"allOf": [
{
@@ -1467,6 +1544,9 @@
}
}
},
+ "MacroUserIdStr": {
+ "type": "string"
+ },
"MentionedInDocumentCommentMetadata": {
"type": "object",
"description": "Notification sent when a user is mentioned in a document comment.",
@@ -1739,6 +1819,10 @@
"type": "string",
"enum": ["v1"]
},
+ "NotificationTypeName": {
+ "type": "string",
+ "description": "newtype wrapper for the the typename of a Notification"
+ },
"PushNotificationData": {
"type": "object",
"required": ["notificationId"],
@@ -1790,6 +1874,17 @@
}
}
},
+ "TaggedContent_Value": {
+ "type": "object",
+ "description": "A notification metadata value tagged with the notification event type.",
+ "required": ["tag", "content"],
+ "properties": {
+ "content": {},
+ "tag": {
+ "$ref": "#/components/schemas/NotificationTypeName"
+ }
+ }
+ },
"TaskAssignedMetadata": {
"type": "object",
"description": "Metadata for when a user is assigned to a task",
diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lock
index c1ea14137d..ef8cf79e63 100644
--- a/rust/cloud-storage/Cargo.lock
+++ b/rust/cloud-storage/Cargo.lock
@@ -6195,6 +6195,7 @@ dependencies = [
"serde",
"thiserror 2.0.17",
"tracing",
+ "utoipa",
]
[[package]]
diff --git a/rust/cloud-storage/macro_user_id/Cargo.toml b/rust/cloud-storage/macro_user_id/Cargo.toml
index 125fbeadd1..2eb92e33b2 100644
--- a/rust/cloud-storage/macro_user_id/Cargo.toml
+++ b/rust/cloud-storage/macro_user_id/Cargo.toml
@@ -4,6 +4,9 @@ name = "macro_user_id"
publish = false
version = "0.1.0"
+[features]
+schema = ["dep:utoipa"]
+
[dependencies]
cowlike = { path = "../cowlike" }
doppleganger = { workspace = true }
@@ -11,3 +14,4 @@ nom = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }
+utoipa = { workspace = true, optional = true }
diff --git a/rust/cloud-storage/macro_user_id/src/user_id.rs b/rust/cloud-storage/macro_user_id/src/user_id.rs
index 3f38bff768..9d8cd15d80 100644
--- a/rust/cloud-storage/macro_user_id/src/user_id.rs
+++ b/rust/cloud-storage/macro_user_id/src/user_id.rs
@@ -75,6 +75,20 @@ where
#[serde(try_from = "String", into = "String")]
pub struct MacroUserIdStr<'a>(pub MacroUserId<Lowercase<'a>>);
+#[cfg(feature = "schema")]
+impl<'a> utoipa::ToSchema for MacroUserIdStr<'a> {
+ fn name() -> std::borrow::Cow<'static, str> {
+ std::borrow::Cow::Borrowed("MacroUserIdStr")
+ }
+}
+
+#[cfg(feature = "schema")]
+impl<'a> utoipa::PartialSchema for MacroUserIdStr<'a> {
+ fn schema() -> utoipa::openapi::RefOr<utoipa::openapi::schema::Schema> {
+ String::schema()
+ }
+}
+
impl<'a> std::fmt::Debug for MacroUserIdStr<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0.as_ref())
diff --git a/rust/cloud-storage/notification/Cargo.toml b/rust/cloud-storage/notification/Cargo.toml
index c0e77ab5c3..6d3cdcb9a5 100644
--- a/rust/cloud-storage/notification/Cargo.toml
+++ b/rust/cloud-storage/notification/Cargo.toml
@@ -16,7 +16,7 @@ axum = [
]
docs = ["dep:aquamarine"]
redis-tests = []
-schema = ["dep:utoipa"]
+schema = ["dep:utoipa", "macro_user_id/schema"]
[dependencies]
ai = { path = "../ai", optional = true }
diff --git a/rust/cloud-storage/notification/src/domain/models.rs b/rust/cloud-storage/notification/src/domain/models.rs
index a46833683f..3741ce7034 100644
--- a/rust/cloud-storage/notification/src/domain/models.rs
+++ b/rust/cloud-storage/notification/src/domain/models.rs
@@ -152,6 +152,7 @@ impl<T> UserNotificationRow<T> {
/// newtype wrapper for the the typename of a Notification
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(transparent)]
+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
pub(crate) struct NotificationTypeName(Cow<'static, str>);
impl NotificationTypeName {
@@ -168,6 +169,7 @@ impl AsRef<str> for NotificationTypeName {
/// A notification metadata value tagged with the notification event type.
#[derive(Debug, Clone, Serialize, Deserialize)]
+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
pub struct TaggedContent<T> {
pub(crate) tag: NotificationTypeName,
pub(crate) content: T,
diff --git a/rust/cloud-storage/notification/src/domain/models/queue_message.rs b/rust/cloud-storage/notification/src/domain/models/queue_message.rs
index 59774a7a7d..b6d575da6f 100644
--- a/rust/cloud-storage/notification/src/domain/models/queue_message.rs
+++ b/rust/cloud-storage/notification/src/domain/models/queue_message.rs
@@ -113,6 +113,7 @@ impl<'a> EmailNotification<'a> {
/// the value of the inner payload inside [ConnGatewayNotification]
#[derive(Debug, Clone, Serialize, Deserialize)]
+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
pub struct ConnGatewayInnerNotif<T> {
/// The notification ID.
pub notification_id: uuid::Uuid,
@@ -140,8 +141,18 @@ pub struct ConnGatewayInnerNotif<T> {
pub sender_id: Option<MacroUserIdStr<'static>>,
}
+/// Concrete schema type for [`ConnGatewayInnerNotif`] with `serde_json::Value` metadata.
+///
+/// Used for OpenAPI schema generation — serializes identically to
+/// `ConnGatewayInnerNotif<serde_json::Value>`.
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(transparent)]
+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
+pub struct ConnGatewayNotificationPayload(pub ConnGatewayInnerNotif<serde_json::Value>);
+
/// Connection gateway (WebSocket) notification payload.
#[derive(Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
pub(crate) struct ConnGatewayNotification<'a, T> {
/// The notification payload to send.
pub(crate) notif: ConnGatewayInnerNotif<T>,
diff --git a/rust/cloud-storage/notification_service/src/api/swagger.rs b/rust/cloud-storage/notification_service/src/api/swagger.rs
index a75af79d36..af4b22f8b1 100644
--- a/rust/cloud-storage/notification_service/src/api/swagger.rs
+++ b/rust/cloud-storage/notification_service/src/api/swagger.rs
@@ -86,6 +86,9 @@ use crate::{
model_notifications::NotifEvent,
user_notification::ApiUserNotification,
user_notification::GetAllUserNotificationsResponse,
+
+ // WebSocket notification payload
+ notification_crate::domain::models::queue_message::ConnGatewayNotificationPayload,
notification_crate::inbound::http::BulkGetByEventItemIdsRequest,
notification_crate::inbound::http::preferences::GetNotificationTypePreferencesResponse,
),