aboutsummaryrefslogtreecommitdiff
path: root/utils.go
diff options
context:
space:
mode:
authorAlexander Kiryukhin <a.kiryukhin@mail.ru>2019-08-09 02:02:05 +0300
committerAlexander Kiryukhin <a.kiryukhin@mail.ru>2019-08-09 02:02:05 +0300
commit94c96cef29cd83bc60b2eabb8bb89c9fd8c7059b (patch)
tree676b3e2b6ffb171e102931e5fac01f7a4621c20a /utils.go
parentd13acd7da9bd1c08de33b91120a479df88d21db2 (diff)
0.1.8 Release
Diffstat (limited to 'utils.go')
-rw-r--r--utils.go76
1 files changed, 0 insertions, 76 deletions
diff --git a/utils.go b/utils.go
deleted file mode 100644
index 0ae24c4..0000000
--- a/utils.go
+++ /dev/null
@@ -1,76 +0,0 @@
-package tamtam
-
-type KeyboardBuilder struct {
- rows []*KeyboardRow
-}
-
-func NewKeyboardBuilder() *KeyboardBuilder {
- return &KeyboardBuilder{
- rows: make([]*KeyboardRow, 0),
- }
-}
-
-func (k *KeyboardBuilder) AddRow() *KeyboardRow {
- kr := &KeyboardRow{}
- k.rows = append(k.rows, kr)
- return kr
-}
-
-func (k *KeyboardBuilder) Build() Keyboard {
- buttons := make([][]interface{}, 0, len(k.rows))
- for _, r := range k.rows {
- buttons = append(buttons, r.Build())
- }
- return Keyboard{Buttons: buttons}
-}
-
-type KeyboardRow struct {
- cols []interface{}
-}
-
-func (k *KeyboardRow) Build() []interface{} {
- return k.cols
-}
-
-func (k *KeyboardRow) AddLink(text string, intent Intent, url string) *KeyboardRow {
- b := LinkButton{
- Text: text,
- Url: url,
- Intent: intent,
- Type: LINK,
- }
- k.cols = append(k.cols, b)
- return k
-}
-
-func (k *KeyboardRow) AddCallback(text string, intent Intent, payload string) *KeyboardRow {
- b := CallbackButton{
- Text: text,
- Payload: payload,
- Intent: intent,
- Type: CALLBACK,
- }
- k.cols = append(k.cols, b)
- return k
-}
-
-func (k *KeyboardRow) AddContact(text string, intent Intent, url string) *KeyboardRow {
- b := RequestContactButton{
- Text: text,
- Intent: intent,
- Type: CONTACT,
- }
- k.cols = append(k.cols, b)
- return k
-}
-
-func (k *KeyboardRow) AddGeolocation(text string, intent Intent, quick bool) *KeyboardRow {
- b := RequestGeoLocationButton{
- Text: text,
- Quick: quick,
- Intent: intent,
- Type: GEOLOCATION,
- }
- k.cols = append(k.cols, b)
- return k
-}