Skip to content

Commit 88c47ae

Browse files
fix(integrations/trello): add missing titles & descriptions (botpress#14928)
1 parent 883957a commit 88c47ae

6 files changed

Lines changed: 81 additions & 67 deletions

File tree

integrations/trello/definitions/actions/board-actions.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ActionDefinition, z } from '@botpress/sdk'
22
import { boardSchema } from 'definitions/schemas'
3-
import { hasBoardId, noInput, outputsBoard, outputsBoards } from './common'
3+
import { hasBoardId, noInput } from './common'
44

55
export const getBoardById = {
66
title: 'Get board by ID',
@@ -9,7 +9,9 @@ export const getBoardById = {
99
schema: hasBoardId.describe('Input schema for getting a board from its ID'),
1010
},
1111
output: {
12-
schema: outputsBoard.describe('Output schema for getting a board from its ID'),
12+
schema: z.object({
13+
board: boardSchema.title('Trello Board').describe('The details of the Trello board associated with the given ID'),
14+
}),
1315
},
1416
} as const satisfies ActionDefinition
1517

@@ -24,7 +26,12 @@ export const getBoardsByDisplayName = {
2426
.describe('Input schema for getting a board ID from its name'),
2527
},
2628
output: {
27-
schema: outputsBoards.describe('Output schema for getting a board from its name'),
29+
schema: z.object({
30+
boards: z
31+
.array(boardSchema)
32+
.title('Trello Boards')
33+
.describe('A list of boards that match the given display name'),
34+
}),
2835
},
2936
} as const satisfies ActionDefinition
3037

@@ -35,6 +42,8 @@ export const getAllBoards = {
3542
schema: noInput.describe('Input schema for getting all boards'),
3643
},
3744
output: {
38-
schema: outputsBoards.describe('Output schema for getting all boards'),
45+
schema: z.object({
46+
boards: z.array(boardSchema).title('Trello Boards').describe('A list of Trello boards'),
47+
}),
3948
},
4049
} as const satisfies ActionDefinition

integrations/trello/definitions/actions/card-actions.ts

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ActionDefinition, z } from '@botpress/sdk'
22
import { cardSchema, listSchema, trelloIdSchema } from 'definitions/schemas'
3-
import { hasCardId, hasListId, hasMessage, outputsCard, outputsCards } from './common'
3+
import { hasCardId, hasListId, hasMessage } from './common'
44

55
export const getCardById = {
66
title: 'Get card by ID',
@@ -9,13 +9,15 @@ export const getCardById = {
99
schema: hasCardId.describe('Input schema for getting a card from its ID'),
1010
},
1111
output: {
12-
schema: outputsCard.describe('Output schema for getting a card from its ID'),
12+
schema: z.object({
13+
card: cardSchema.title('Trello Card').describe("The Trello card that's associated with the given card ID"),
14+
}),
1315
},
1416
} as const satisfies ActionDefinition
1517

1618
export const getCardsByDisplayName = {
17-
title: 'Find cards by name name',
18-
description: 'Find all lists whose display name match this name',
19+
title: 'Find cards by name',
20+
description: 'Find all cards whose display name match this name',
1921
input: {
2022
schema: hasListId
2123
.extend({
@@ -24,7 +26,9 @@ export const getCardsByDisplayName = {
2426
.describe('Input schema for getting a card ID from its name'),
2527
},
2628
output: {
27-
schema: outputsCards.describe('Output schema for getting a card ID from its name'),
29+
schema: z.object({
30+
cards: z.array(cardSchema).title('Trello Cards').describe('A list of cards that match the given card name'),
31+
}),
2832
},
2933
} as const satisfies ActionDefinition
3034

@@ -35,7 +39,12 @@ export const getCardsInList = {
3539
schema: hasListId.describe('Input schema for getting all cards in a list'),
3640
},
3741
output: {
38-
schema: outputsCards.describe('Output schema for getting all cards in a list'),
42+
schema: z.object({
43+
cards: z
44+
.array(cardSchema)
45+
.title('Trello Cards')
46+
.describe('An array of cards that are contained within the given list'),
47+
}),
3948
},
4049
} as const satisfies ActionDefinition
4150

@@ -73,8 +82,11 @@ export const createCard = {
7382
.describe('Input schema for creating a new card'),
7483
},
7584
output: {
76-
schema: hasMessage
77-
.extend({
85+
schema: z
86+
.object({
87+
message: hasMessage.shape.message
88+
.title('Action message')
89+
.describe('A message that says if the card was successfully created or not'),
7890
newCardId: cardSchema.shape.id.describe('Unique identifier of the new card'),
7991
})
8092
.describe('Output schema for creating a card'),
@@ -201,11 +213,13 @@ export const addCardComment = {
201213
.describe('Input schema for adding a comment to a card'),
202214
},
203215
output: {
204-
schema: hasMessage
205-
.extend({
206-
newCommentId: trelloIdSchema.describe('Unique identifier of the newly created comment'),
207-
})
208-
.describe('Output schema for adding a comment to a card'),
216+
schema: z.object({
217+
message: z
218+
.string()
219+
.title('Action message')
220+
.describe('A message that says if the comment was successfully created or not'),
221+
newCommentId: trelloIdSchema.title('New Comment ID').describe('Unique identifier of the newly created comment'),
222+
}),
209223
},
210224
} as const satisfies ActionDefinition
211225

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { z } from '@botpress/sdk'
2-
import { boardSchema, listSchema, cardSchema, memberSchema } from 'definitions/schemas'
2+
import { boardSchema, listSchema, cardSchema } from 'definitions/schemas'
33

44
// ==== Common Input Schemas ====
55
export const noInput = z.object({})
@@ -18,37 +18,5 @@ export const hasCardId = z.object({
1818

1919
// ==== Common Output Schemas ====
2020
export const hasMessage = z.object({
21-
message: z.string().describe('Output message'),
22-
})
23-
24-
export const outputsMember = z.object({
25-
member: memberSchema.describe('The member object'),
26-
})
27-
28-
export const outputsMembers = z.object({
29-
members: z.array(memberSchema).describe('Array of member objects'),
30-
})
31-
32-
export const outputsCard = z.object({
33-
card: cardSchema.describe('The card object'),
34-
})
35-
36-
export const outputsCards = z.object({
37-
cards: z.array(cardSchema).describe('Array of card objects'),
38-
})
39-
40-
export const outputsList = z.object({
41-
list: listSchema.describe('The list object'),
42-
})
43-
44-
export const outputsLists = z.object({
45-
lists: z.array(listSchema).describe('Array of list objects'),
46-
})
47-
48-
export const outputsBoard = z.object({
49-
board: boardSchema.describe('The board object'),
50-
})
51-
52-
export const outputsBoards = z.object({
53-
boards: z.array(boardSchema).describe('Array of board objects'),
21+
message: z.string().title('Output message').describe('Output message'),
5422
})

integrations/trello/definitions/actions/list-actions.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { ActionDefinition } from '@botpress/sdk'
1+
import { ActionDefinition, z } from '@botpress/sdk'
22
import { listSchema } from 'definitions/schemas'
3-
import { hasBoardId, hasListId, outputsList, outputsLists } from './common'
3+
import { hasBoardId, hasListId } from './common'
44

55
export const getListById = {
66
title: 'Get list by ID',
@@ -9,7 +9,9 @@ export const getListById = {
99
schema: hasListId.describe('Input schema for getting a list from its ID'),
1010
},
1111
output: {
12-
schema: outputsList.describe('Output schema for getting a list from its ID'),
12+
schema: z.object({
13+
list: listSchema.title('Trello List').describe("The Trello list that's associated with the given list ID"),
14+
}),
1315
},
1416
} as const satisfies ActionDefinition
1517

@@ -24,7 +26,12 @@ export const getListsByDisplayName = {
2426
.describe('Input schema for getting a list ID from its name'),
2527
},
2628
output: {
27-
schema: outputsLists.describe('Output schema for getting a list ID from its name'),
29+
schema: z.object({
30+
lists: z
31+
.array(listSchema)
32+
.title('Trello Lists')
33+
.describe('A set of lists that are associated with the given board ID and match the given display name'),
34+
}),
2835
},
2936
} as const satisfies ActionDefinition
3037

@@ -35,6 +42,11 @@ export const getListsInBoard = {
3542
schema: hasBoardId.describe('Input schema for getting all lists in a board'),
3643
},
3744
output: {
38-
schema: outputsLists.describe('Output schema for getting all lists in a board'),
45+
schema: z.object({
46+
lists: z
47+
.array(listSchema)
48+
.title('Trello Lists')
49+
.describe('A set of all the lists that are associated with the given board ID'),
50+
}),
3951
},
4052
} as const satisfies ActionDefinition

integrations/trello/definitions/actions/member-actions.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ActionDefinition, z } from '@botpress/sdk'
22
import { boardSchema, memberSchema } from 'definitions/schemas'
3-
import { hasBoardId, hasCardId, outputsMember, outputsMembers } from './common'
3+
import { hasBoardId, hasCardId } from './common'
44

55
export const getMemberByIdOrUsername = {
66
title: 'Get member by ID or username',
@@ -16,7 +16,11 @@ export const getMemberByIdOrUsername = {
1616
.describe('Input schema for getting a member from its ID or username'),
1717
},
1818
output: {
19-
schema: outputsMember.describe('Output schema for getting a member by its ID or username'),
19+
schema: z.object({
20+
member: memberSchema
21+
.title('Trello Member')
22+
.describe('The Trello member who is associated with the specified member ID or username'),
23+
}),
2024
},
2125
} as const satisfies ActionDefinition
2226

@@ -27,7 +31,12 @@ export const getAllCardMembers = {
2731
schema: hasCardId.describe('Input schema for getting all members of a card'),
2832
},
2933
output: {
30-
schema: outputsMembers.describe('Output schema for getting all members of a card'),
34+
schema: z.object({
35+
members: z
36+
.array(memberSchema)
37+
.title('Card Members')
38+
.describe('A list of members who have been assigned to the card'),
39+
}),
3140
},
3241
} as const satisfies ActionDefinition
3342

@@ -38,21 +47,23 @@ export const getAllBoardMembers = {
3847
schema: hasBoardId.describe('Input schema for getting all members of a board'),
3948
},
4049
output: {
41-
schema: outputsMembers.describe('Output schema for getting all members of a board'),
50+
schema: z.object({
51+
members: z.array(memberSchema).title('Board Members').describe('A list of members who have access to the board'),
52+
}),
4253
},
4354
} as const satisfies ActionDefinition
4455

4556
export const getBoardMembersByDisplayName = {
4657
title: 'Get members by name',
4758
description: 'Find all members whose display name match this name',
4859
input: {
49-
schema: hasBoardId
50-
.extend({
51-
displayName: boardSchema.shape.name.title('Display Name').describe('Display name of the member'),
52-
})
53-
.describe('Input schema for getting a member from its name'),
60+
schema: hasBoardId.extend({
61+
displayName: boardSchema.shape.name.title('Display Name').describe('Display name of the member'),
62+
}),
5463
},
5564
output: {
56-
schema: outputsMembers.describe('Output schema for getting a member from its name'),
65+
schema: z.object({
66+
members: z.array(memberSchema).title('Board Members').describe('A list of members that match the specified name'),
67+
}),
5768
},
5869
} as const satisfies ActionDefinition

integrations/trello/integration.definition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { trelloIdSchema } from 'definitions/schemas'
55
import { events, actions, channels, user, configuration, entities } from './definitions'
66

77
export const INTEGRATION_NAME = 'trello'
8-
export const INTEGRATION_VERSION = '2.1.1'
8+
export const INTEGRATION_VERSION = '2.1.2'
99

1010
export default new sdk.IntegrationDefinition({
1111
name: INTEGRATION_NAME,

0 commit comments

Comments
 (0)