11import { ActionDefinition , z } from '@botpress/sdk'
22import { cardSchema , listSchema , trelloIdSchema } from 'definitions/schemas'
3- import { hasCardId , hasListId , hasMessage , outputsCard , outputsCards } from './common'
3+ import { hasCardId , hasListId , hasMessage } from './common'
44
55export 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
1618export 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
0 commit comments