1 import type { SPAM_ACTION } from '../mail/mailSettings';
2 import { getAppropriateSort } from './helpers/snoozeSort';
3 import type { MailboxItemsQueryParams } from './mailbox';
5 export const queryConversations = ({
29 }: MailboxItemsQueryParams) => ({
31 url: 'mail/v4/conversations',
38 Sort: getAppropriateSort(LabelID, Sort),
59 export const getConversation = (conversationID: string, MessageID?: string) => ({
61 url: `mail/v4/conversations/${conversationID}`,
62 params: { MessageID },
65 export const queryConversationCount = (AddressID?: string) => ({
67 url: 'mail/v4/conversations/count',
68 params: { AddressID },
71 export const markConversationsAsRead = (IDs: string[]) => ({
73 url: 'mail/v4/conversations/read',
77 export const markConversationsAsUnread = (IDs: string[], LabelID: string) => ({
79 url: 'mail/v4/conversations/unread',
80 data: { IDs, LabelID },
83 export const deleteConversations = (IDs: string[], LabelID: string) => ({
85 url: 'mail/v4/conversations/delete',
86 data: { IDs, LabelID },
89 interface LabelConversationsProps {
92 SpamAction?: SPAM_ACTION;
95 export const labelConversations = ({ LabelID, IDs, SpamAction }: LabelConversationsProps) => ({
97 url: 'mail/v4/conversations/label',
98 data: { LabelID, IDs, SpamAction },
101 export const unlabelConversations = ({ LabelID, IDs }: LabelConversationsProps) => ({
103 url: 'mail/v4/conversations/unlabel',
104 data: { LabelID, IDs },
107 export const setExpiration = (IDs: string[], ExpirationTime: number | null) => ({
109 url: 'mail/v4/conversations/expire',
110 data: { IDs, ExpirationTime },
113 export const snoozeConversations = (IDs: string[], SnoozeTime: number) => ({
115 url: 'mail/v4/conversations/snooze',
116 data: { IDs, SnoozeTime },
119 export const unsnoozeConversations = (IDs: string[]) => ({
121 url: 'mail/v4/conversations/unsnooze',