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

src/helpers/response.js   A

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 15
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1
mnd 0
bc 0
fnc 1
bpm 0
cpm 1
noi 1
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