| Total Complexity | 3 |
| Complexity/F | 1 |
| Lines of Code | 36 |
| Function Count | 3 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import {chat_v1 as chatV1} from 'googleapis/build/src/apis/chat/v1'; |
||
| 2 | |||
| 3 | interface Card { |
||
| 4 | buildHeader?(): void; |
||
| 5 | |||
| 6 | buildSections(): void; |
||
| 7 | |||
| 8 | buildButtons?(): void; |
||
| 9 | |||
| 10 | buildFooter?(): void; |
||
| 11 | |||
| 12 | make(): chatV1.Schema$CardWithId; |
||
| 13 | } |
||
| 14 | |||
| 15 | export abstract class BaseCard implements Card { |
||
| 16 | private id: string = 'cardId'; |
||
| 17 | private _content: chatV1.Schema$GoogleAppsCardV1Section[] = []; |
||
| 18 | |||
| 19 | protected card: chatV1.Schema$GoogleAppsCardV1Card = { |
||
| 20 | sections: this._content, |
||
| 21 | }; |
||
| 22 | |||
| 23 | abstract buildSections(): void; |
||
| 24 | |||
| 25 | make(): chatV1.Schema$CardWithId { |
||
| 26 | return { |
||
| 27 | 'cardId': this.id, |
||
| 28 | 'card': this.card, |
||
| 29 | }; |
||
| 30 | } |
||
| 31 | |||
| 32 | buildMessage(): chatV1.Schema$Message { |
||
| 33 | return {cardsV2: [this.make()]}; |
||
| 34 | } |
||
| 35 | } |
||
| 36 |