Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 24 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /** |
||
2 | * Creates an action response. |
||
3 | * Action Response is parameter that a Chat app can use to configure how its |
||
4 | * response is posted. |
||
5 | * ref: https://developers.google.com/chat/api/reference/rest/v1/spaces.messages#actionresponse |
||
6 | * |
||
7 | * @param {string} message - Number of votes for this option |
||
8 | * @param {string} status - Status of |
||
9 | * @returns {object} - ActionResponse |
||
10 | */ |
||
11 | export function buildActionResponse(message: string, status = 'OK') { |
||
12 | return { |
||
13 | actionResponse: { |
||
14 | type: 'DIALOG', |
||
15 | dialogAction: { |
||
16 | actionStatus: { |
||
17 | statusCode: status, |
||
18 | userFacingMessage: message, |
||
19 | }, |
||
20 | }, |
||
21 | }, |
||
22 | }; |
||
23 | } |
||
24 | |||
25 |