chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const changeMessageLabels = {
|
||||
title: 'Change Message Labels',
|
||||
description: 'Modifies the labels on the specified message by adding or removing label IDs.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
id: z.string().title('Message ID').describe('The ID of the message to modify.'),
|
||||
addLabelIds: z
|
||||
.array(z.string())
|
||||
.optional()
|
||||
.title('Add Label IDs')
|
||||
.describe('A list of IDs of labels to add to this message.'),
|
||||
removeLabelIds: z
|
||||
.array(z.string())
|
||||
.optional()
|
||||
.title('Remove Label IDs')
|
||||
.describe('A list of IDs of labels to remove from this message.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({}).title('Empty').describe('Empty output'),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,27 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const createDraft = {
|
||||
title: 'Create Draft',
|
||||
description: 'Creates a new draft with the specified email content.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
to: z.string().title('To').describe('The recipient email address.'),
|
||||
subject: z.string().title('Subject').describe('The subject of the email.'),
|
||||
body: z.string().title('Body').describe('The body content of the email.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
id: z.string().optional().title('Draft ID').describe('The immutable ID of the created draft.'),
|
||||
message: z
|
||||
.object({
|
||||
id: z.string().optional().describe('The ID of the message.'),
|
||||
threadId: z.string().optional().describe('The ID of the thread.'),
|
||||
})
|
||||
.optional()
|
||||
.title('Message')
|
||||
.describe('The message content of the draft.'),
|
||||
}),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,19 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const createLabel = {
|
||||
title: 'Create Label',
|
||||
description: "Creates a new label in the user's mailbox.",
|
||||
input: {
|
||||
schema: z.object({
|
||||
name: z.string().title('Name').describe('The display name of the label to create.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
id: z.string().optional().title('Label ID').describe('The immutable ID of the created label.'),
|
||||
name: z.string().optional().title('Name').describe('The display name of the label.'),
|
||||
type: z.string().optional().title('Type').describe('The owner type for the label (system or user).'),
|
||||
}),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,15 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const deleteDraft = {
|
||||
title: 'Delete Draft',
|
||||
description: 'Immediately and permanently deletes the specified draft. This operation cannot be undone.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
id: z.string().title('Draft ID').describe('The ID of the draft to delete.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({}).title('Empty').describe('Empty output'),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,16 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const deleteLabel = {
|
||||
title: 'Delete Label',
|
||||
description:
|
||||
'Immediately and permanently deletes the specified label. Messages and threads are not deleted, they simply lose this label.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
id: z.string().title('Label ID').describe('The ID of the label to delete.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({}).title('Empty').describe('Empty output'),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,16 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const deleteMessage = {
|
||||
title: 'Delete Message',
|
||||
description:
|
||||
'Immediately and permanently deletes the specified message using its ID. This operation cannot be undone. Prefer messages.trash instead',
|
||||
input: {
|
||||
schema: z.object({
|
||||
id: z.string().title('Message ID').describe('The ID of the message to delete.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({}).title('Empty').describe('Empty output'),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,27 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const getDraft = {
|
||||
title: 'Get Draft',
|
||||
description: 'Gets the specified draft by its ID.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
id: z.string().title('Draft ID').describe('The ID of the draft to retrieve.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
id: z.string().optional().title('Draft ID').describe('The immutable ID of the draft.'),
|
||||
message: z
|
||||
.object({
|
||||
id: z.string().optional().describe('The ID of the message.'),
|
||||
threadId: z.string().optional().describe('The ID of the thread.'),
|
||||
labelIds: z.array(z.string()).optional().describe('List of label IDs applied to the draft message.'),
|
||||
snippet: z.string().optional().describe('A short part of the message text.'),
|
||||
})
|
||||
.optional()
|
||||
.title('Message')
|
||||
.describe('The message content of the draft.'),
|
||||
}),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,57 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const getLabel = {
|
||||
title: 'Get Label',
|
||||
description: 'Gets the specified label by its ID.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
id: z.string().title('Label ID').describe('The ID of the label to retrieve.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
id: z.string().optional().title('Label ID').describe('The immutable ID of the label.'),
|
||||
name: z.string().optional().title('Name').describe('The display name of the label.'),
|
||||
type: z.string().optional().title('Type').describe('The owner type for the label (system or user).'),
|
||||
messageListVisibility: z
|
||||
.string()
|
||||
.optional()
|
||||
.title('Message List Visibility')
|
||||
.describe('The visibility of messages with this label in the message list.'),
|
||||
labelListVisibility: z
|
||||
.string()
|
||||
.optional()
|
||||
.title('Label List Visibility')
|
||||
.describe('The visibility of the label in the label list.'),
|
||||
messagesTotal: z
|
||||
.number()
|
||||
.optional()
|
||||
.title('Messages Total')
|
||||
.describe('The total number of messages with the label.'),
|
||||
messagesUnread: z
|
||||
.number()
|
||||
.optional()
|
||||
.title('Messages Unread')
|
||||
.describe('The number of unread messages with the label.'),
|
||||
threadsTotal: z
|
||||
.number()
|
||||
.optional()
|
||||
.title('Threads Total')
|
||||
.describe('The total number of threads with the label.'),
|
||||
threadsUnread: z
|
||||
.number()
|
||||
.optional()
|
||||
.title('Threads Unread')
|
||||
.describe('The number of unread threads with the label.'),
|
||||
color: z
|
||||
.object({
|
||||
backgroundColor: z.string().optional().describe('The background color.'),
|
||||
textColor: z.string().optional().describe('The text color.'),
|
||||
})
|
||||
.optional()
|
||||
.title('Color')
|
||||
.describe('The color to assign to the label.'),
|
||||
}),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,18 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { attachmentSchema } from './get-message-attachment'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const getMessageAttachmentFromMail = {
|
||||
title: 'Get Message Attachment From Mail',
|
||||
description: 'Gets the first attachment from a message by automatically finding the attachment ID from the message.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
messageId: z.string().title('Message ID').describe('The ID of the message containing the attachment.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
attachment: attachmentSchema,
|
||||
}),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,37 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const attachmentSchema = z
|
||||
.object({
|
||||
size: z.number().nullable().optional().title('Size').describe('The size of the attachment in bytes.'),
|
||||
data: z
|
||||
.string()
|
||||
.nullable()
|
||||
.optional()
|
||||
.title('Data')
|
||||
.describe('The body data of a MIME message part as a base64url encoded string.'),
|
||||
attachmentId: z
|
||||
.string()
|
||||
.nullable()
|
||||
.optional()
|
||||
.title('Attachment ID')
|
||||
.describe('The immutable ID of the attachment.'),
|
||||
})
|
||||
.title('Attachment')
|
||||
.describe('The attachment retrieved from the message.')
|
||||
|
||||
export const getMessageAttachment = {
|
||||
title: 'Get Message Attachment',
|
||||
description: 'Gets the specified message attachment by its ID.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
messageId: z.string().title('Message ID').describe('The ID of the message containing the attachment.'),
|
||||
attachmentId: z.string().title('Attachment ID').describe('The ID of the attachment to retrieve.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
attachment: attachmentSchema,
|
||||
}),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,31 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const getThread = {
|
||||
title: 'Get Thread',
|
||||
description: 'Gets the specified thread by its ID, including all messages in the thread.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
id: z.string().title('Thread ID').describe('The ID of the thread to retrieve.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
id: z.string().optional().title('Thread ID').describe('The unique ID of the thread.'),
|
||||
snippet: z.string().optional().title('Snippet').describe('A short part of the message text.'),
|
||||
historyId: z.string().optional().title('History ID').describe('The history ID of the thread.'),
|
||||
messages: z
|
||||
.array(
|
||||
z.object({
|
||||
id: z.string().optional().describe('The ID of the message.'),
|
||||
threadId: z.string().optional().describe('The ID of the thread the message belongs to.'),
|
||||
labelIds: z.array(z.string()).optional().describe('List of label IDs applied to this message.'),
|
||||
snippet: z.string().optional().describe('A short part of the message text.'),
|
||||
})
|
||||
)
|
||||
.optional()
|
||||
.title('Messages')
|
||||
.describe('The list of messages in the thread.'),
|
||||
}),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,35 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const listDrafts = {
|
||||
title: 'List Drafts',
|
||||
description: "Lists all drafts in the user's mailbox.",
|
||||
input: {
|
||||
schema: z.object({}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
drafts: z
|
||||
.array(
|
||||
z.object({
|
||||
id: z.string().optional().describe('The immutable ID of the draft.'),
|
||||
message: z
|
||||
.object({
|
||||
id: z.string().optional().describe('The ID of the message contained in the draft.'),
|
||||
threadId: z.string().optional().describe('The ID of the thread the draft belongs to.'),
|
||||
})
|
||||
.optional()
|
||||
.describe('The message content of the draft.'),
|
||||
})
|
||||
)
|
||||
.optional()
|
||||
.title('Drafts')
|
||||
.describe('List of drafts.'),
|
||||
resultSizeEstimate: z
|
||||
.number()
|
||||
.optional()
|
||||
.title('Result Size Estimate')
|
||||
.describe('Estimated total number of results.'),
|
||||
}),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,25 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const listLabels = {
|
||||
title: 'List Labels',
|
||||
description: "Lists all labels in the user's mailbox, including system labels and user-created labels.",
|
||||
input: {
|
||||
schema: z.object({}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
labels: z
|
||||
.array(
|
||||
z.object({
|
||||
id: z.string().optional().describe('The immutable ID of the label.'),
|
||||
name: z.string().optional().describe('The display name of the label.'),
|
||||
type: z.string().optional().describe('The owner type for the label (system or user).'),
|
||||
})
|
||||
)
|
||||
.optional()
|
||||
.title('Labels')
|
||||
.describe('List of labels.'),
|
||||
}),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,30 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const listThreads = {
|
||||
title: 'List Threads',
|
||||
description: "Lists all email threads in the user's mailbox.",
|
||||
input: {
|
||||
schema: z.object({}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
threads: z
|
||||
.array(
|
||||
z.object({
|
||||
id: z.string().optional().describe('The unique ID of the thread.'),
|
||||
snippet: z.string().optional().describe('A short part of the message text.'),
|
||||
historyId: z.string().optional().describe('The history ID of the thread.'),
|
||||
})
|
||||
)
|
||||
.optional()
|
||||
.title('Threads')
|
||||
.describe('List of threads in the mailbox.'),
|
||||
resultSizeEstimate: z
|
||||
.number()
|
||||
.optional()
|
||||
.title('Result Size Estimate')
|
||||
.describe('Estimated total number of results.'),
|
||||
}),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,23 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const sendDraft = {
|
||||
title: 'Send Draft',
|
||||
description: 'Sends the specified draft. The draft will be deleted after being sent.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
id: z.string().title('Draft ID').describe('The ID of the draft to send.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
id: z.string().optional().title('Message ID').describe('The ID of the sent message.'),
|
||||
threadId: z.string().optional().title('Thread ID').describe('The ID of the thread the message belongs to.'),
|
||||
labelIds: z
|
||||
.array(z.string())
|
||||
.optional()
|
||||
.title('Label IDs')
|
||||
.describe('List of label IDs applied to the sent message.'),
|
||||
}),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,16 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const trashMessage = {
|
||||
title: 'Trash Message',
|
||||
description:
|
||||
'Moves the specified message to the trash. The message can be restored from the trash using untrashMessage.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
id: z.string().title('Message ID').describe('The ID of the message to trash.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({}).title('Empty').describe('Empty output'),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,16 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const trashThread = {
|
||||
title: 'Trash Thread',
|
||||
description:
|
||||
'Moves the specified thread to the trash. All messages in the thread will be moved to trash. The thread can be restored using untrashThread.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
id: z.string().title('Thread ID').describe('The ID of the thread to trash.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({}).title('Empty').describe('Empty output'),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,4 @@
|
||||
import * as sdk from '@botpress/sdk'
|
||||
|
||||
export type ActionDefinitions = NonNullable<sdk.IntegrationDefinitionProps['actions']>
|
||||
export type ActionDef = ActionDefinitions[string]
|
||||
@@ -0,0 +1,15 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const untrashMessage = {
|
||||
title: 'Untrash Message',
|
||||
description: 'Removes the specified message from the trash and restores it to the inbox.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
id: z.string().title('Message ID').describe('The ID of the message to untrash.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({}).title('Empty').describe('Empty output'),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,15 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const untrashThread = {
|
||||
title: 'Untrash Thread',
|
||||
description: 'Removes the specified thread from the trash. All messages in the thread will be restored.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
id: z.string().title('Thread ID').describe('The ID of the thread to restore from trash.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({}).title('Empty').describe('Empty output'),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,28 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const updateDraft = {
|
||||
title: 'Update Draft',
|
||||
description: "Replaces a draft's content with the new email content provided.",
|
||||
input: {
|
||||
schema: z.object({
|
||||
id: z.string().title('Draft ID').describe('The ID of the draft to update.'),
|
||||
to: z.string().title('To').describe('The recipient email address.'),
|
||||
subject: z.string().title('Subject').describe('The subject of the email.'),
|
||||
body: z.string().title('Body').describe('The body content of the email.'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
id: z.string().optional().title('Draft ID').describe('The immutable ID of the updated draft.'),
|
||||
message: z
|
||||
.object({
|
||||
id: z.string().optional().describe('The ID of the message.'),
|
||||
threadId: z.string().optional().describe('The ID of the thread.'),
|
||||
})
|
||||
.optional()
|
||||
.title('Message')
|
||||
.describe('The message content of the draft.'),
|
||||
}),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
@@ -0,0 +1,34 @@
|
||||
import { z } from '@botpress/sdk'
|
||||
import { ActionDef } from './types'
|
||||
|
||||
export const updateLabel = {
|
||||
title: 'Update Label',
|
||||
description: 'Updates the specified label with new properties like name or color.',
|
||||
input: {
|
||||
schema: z.object({
|
||||
id: z.string().title('Label ID').describe('The ID of the label to update.'),
|
||||
name: z.string().optional().title('Name').describe('The new display name for the label.'),
|
||||
backgroundColor: z
|
||||
.string()
|
||||
.optional()
|
||||
.title('Background Color')
|
||||
.describe('The background color as hex string (e.g., #ffffff).'),
|
||||
textColor: z.string().optional().title('Text Color').describe('The text color as hex string (e.g., #000000).'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: z.object({
|
||||
id: z.string().optional().title('Label ID').describe('The immutable ID of the label.'),
|
||||
name: z.string().optional().title('Name').describe('The display name of the label.'),
|
||||
type: z.string().optional().title('Type').describe('The owner type for the label (system or user).'),
|
||||
color: z
|
||||
.object({
|
||||
backgroundColor: z.string().optional().describe('The background color.'),
|
||||
textColor: z.string().optional().describe('The text color.'),
|
||||
})
|
||||
.optional()
|
||||
.title('Color')
|
||||
.describe('The color assigned to the label.'),
|
||||
}),
|
||||
},
|
||||
} as const satisfies ActionDef
|
||||
Reference in New Issue
Block a user