Repository navigation
Expand file tree
/
Copy pathtypes.ts
More file actions
131 lines (117 loc) · 2.65 KB
/
Copy pathtypes.ts
File metadata and controls
131 lines (117 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import type { UserFile } from '@/executor/types'
import type { ToolResponse } from '@/tools/types'
// Base parameters shared by all operations
interface BaseGmailParams {
accessToken: string
}
// Send operation parameters
export interface GmailSendParams extends BaseGmailParams {
to: string
cc?: string
bcc?: string
subject?: string
body: string
contentType?: 'text' | 'html'
threadId?: string
replyToMessageId?: string
attachments?: UserFile[]
}
// Read operation parameters
export interface GmailReadParams extends BaseGmailParams {
messageId: string
folder: string
unreadOnly?: boolean
maxResults?: number
includeAttachments?: boolean
}
// Search operation parameters
export interface GmailSearchParams extends BaseGmailParams {
query: string
maxResults?: number
}
// Move operation parameters
export interface GmailMoveParams extends BaseGmailParams {
messageId: string
addLabelIds: string
removeLabelIds?: string
}
// Mark as read/unread parameters (reuses simple messageId pattern)
export interface GmailMarkReadParams extends BaseGmailParams {
messageId: string
}
// Label management parameters
export interface GmailLabelParams extends BaseGmailParams {
messageId: string
labelIds: string
}
// Union type for all Gmail tool parameters
export type GmailToolParams =
| GmailSendParams
| GmailReadParams
| GmailSearchParams
| GmailMoveParams
| GmailMarkReadParams
| GmailLabelParams
// Response metadata
interface BaseGmailMetadata {
id?: string
threadId?: string
labelIds?: string[]
}
interface EmailMetadata extends BaseGmailMetadata {
from?: string
to?: string
subject?: string
date?: string
hasAttachments?: boolean
attachmentCount?: number
}
interface SearchMetadata extends BaseGmailMetadata {
results: Array<{
id: string
threadId: string
}>
}
// Response format
export interface GmailToolResponse extends ToolResponse {
output: {
content: string
metadata: EmailMetadata | SearchMetadata
attachments?: GmailAttachment[]
}
}
// Email Message Interface
export interface GmailMessage {
id: string
threadId: string
labelIds: string[]
snippet: string
payload: {
headers: Array<{
name: string
value: string
}>
body: {
data?: string
attachmentId?: string
size?: number
}
parts?: Array<{
mimeType: string
filename?: string
body: {
data?: string
attachmentId?: string
size?: number
}
parts?: Array<any>
}>
}
}
// Gmail Attachment Interface (for processed attachments)
export interface GmailAttachment {
name: string
data: string
mimeType: string
size: number
}