(value: unknown)
| 207 | } |
| 208 | |
| 209 | export function mapTrelloAction(value: unknown): TrelloAction { |
| 210 | if (!isRecordLike(value)) { |
| 211 | throw new Error('Trello returned an invalid action object') |
| 212 | } |
| 213 | |
| 214 | const data = isRecordLike(value.data) ? value.data : null |
| 215 | |
| 216 | return { |
| 217 | id: getRequiredString(value.id, 'id'), |
| 218 | type: getRequiredString(value.type, 'type'), |
| 219 | date: getRequiredString(value.date, 'date'), |
| 220 | idMemberCreator: getRequiredString(value.idMemberCreator, 'idMemberCreator'), |
| 221 | text: data ? getOptionalString(data.text) : null, |
| 222 | memberCreator: mapTrelloMember(value.memberCreator), |
| 223 | card: data ? mapActionCardTarget(data.card) : null, |
| 224 | board: data ? mapActionBoardTarget(data.board) : null, |
| 225 | list: data ? mapActionListTarget(data.list) : null, |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | export function mapTrelloComment(value: unknown): TrelloComment { |
| 230 | return mapTrelloAction(value) |
no test coverage detected