Files
mail/src/types/composition.ts
T
2026-06-22 22:54:02 -04:00

119 lines
2.6 KiB
TypeScript

import type { EntityIdentifier } from '@MailManager/types/common'
import type { MessageAddressInterface } from '@MailManager/types/message'
export interface CompositionSenderInterface {
provider: string
service: string | number | null
address: string
name: string | null
}
export interface CompositionMessageInterface {
to: MessageAddressInterface[]
cc: MessageAddressInterface[]
bcc: MessageAddressInterface[]
subject: string
body: {
text: string
html: string
}
}
export interface CompositionAttachmentInterface {
identifier: string
composition: string
origin: 'source' | 'upload'
name: string
type: string
size: number
source: EntityIdentifier | null
data?: string
}
export interface CompositionStageRequest {
identifier: string
action: 'fresh' | 'reply' | 'forward'
sender: CompositionSenderInterface
source?: EntityIdentifier | null
message: CompositionMessageInterface
}
export interface CompositionStageResponse {
identifier: string
revision: number
disposition: 'staged'
attachments: Record<string, CompositionAttachmentInterface>
}
export interface CompositionPatchRequest {
identifier: string
revision: number
sender: CompositionSenderInterface
message: CompositionMessageInterface
}
export interface CompositionPatchResponse {
identifier: string
revision: number
message: CompositionMessageInterface
}
export interface CompositionDiscardRequest {
identifier: string
}
export interface CompositionDiscardResponse {
identifier: string
disposition: 'discarded' | 'error'
error?: {
type: string
message: string
}
}
export interface CompositionSendRequest {
identifier: string
revision: number
sender: CompositionSenderInterface
message: CompositionMessageInterface
attachments: Record<string, CompositionAttachmentInterface>
}
export interface CompositionSendResponse {
identifier: string
disposition: 'sent' | 'error'
error?: {
type: string
message: string
}
}
export interface CompositionAttachmentAddRequest {
composition: string
attachments: Record<string, CompositionAttachmentInterface>
}
export interface CompositionAttachmentAddResponse {
disposition: 'added' | 'error'
error?: {
type: string
message: string
}
composition: string
attachments: Record<string, CompositionAttachmentInterface>
}
export interface CompositionAttachmentRemoveRequest {
composition: string
identifier: string
}
export interface CompositionAttachmentRemoveResponse {
disposition: 'removed' | 'error'
error?: {
type: string
message: string
}
composition: string
identifier: string
}