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

cards.ts ➔ createButtonLink   A

Complexity

Conditions 1

Size

Total Lines 7
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 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