Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 27 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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 |