Passed
Push — master ( 46d449...c17029 )
by Muhammad Dyas
01:28
created

response.js ➔ buildActionResponse   A

Complexity

Conditions 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
dl 0
loc 13
rs 10
c 0
b 0
f 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
0 ignored issues
show
Documentation introduced by
The parameter status does not exist. Did you maybe forget to remove this comment?
Loading history...
9
 * @returns {object} - ActionResponse
10
 */
11
function buildActionResponse(message, 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
exports.buildActionResponse = buildActionResponse;
26