Passed
Push — master ( 9fd386...5991f5 )
by Muhammad Dyas
01:38
created

src/helpers/cards.ts   A

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 27
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 17
mnd 0
bc 0
fnc 2
dl 0
loc 27
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A cards.ts ➔ createButton 0 13 1
A cards.ts ➔ createButtonLink 0 7 1
1
import {chat_v1 as chatV1} from '@googleapis/chat/build/v1';
2
3
export function createButtonLink(text: string, url: string): chatV1.Schema$GoogleAppsCardV1Button {
4
  return {
5
    text,
6
    'onClick': {
7
      'openLink': {
8
        url,
9
      },
10
    },
11
  };
12
}
13
14
export function createButton(
15
  text: string, action: string, interaction: string | undefined = undefined): chatV1.Schema$GoogleAppsCardV1Button {
16
  const button: chatV1.Schema$GoogleAppsCardV1Button = {
17
    text,
18
    'onClick': {
19
      'action': {
20
        'function': action,
21
      },
22
    },
23
  };
24
  interaction && (button.onClick!.action!.interaction = interaction);
25
  return button;
26
}
27