From ae64c7ed9b85039c2b3892db736e7d047356c524 Mon Sep 17 00:00:00 2001 From: Pavel Sukhodoev Date: Sun, 19 Jul 2020 22:37:55 +0300 Subject: [PATCH] add input field state --- keyboard.go | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/keyboard.go b/keyboard.go index d73d04a..10f6223 100644 --- a/keyboard.go +++ b/keyboard.go @@ -1,11 +1,21 @@ package viber +type InputFieldStateType string + +// InputFieldState Values +const ( + RegularState = InputFieldStateType("regular") + MinimizedState = InputFieldStateType("minimized") + HiddenState = InputFieldStateType("hidden") +) + // Keyboard struct type Keyboard struct { - Type string `json:"Type"` - DefaultHeight bool `json:"DefaultHeight,omitempty"` - BgColor string `json:"BgColor,omitempty"` - Buttons []Button `json:"Buttons"` + Type string `json:"Type"` + DefaultHeight bool `json:"DefaultHeight,omitempty"` + BgColor string `json:"BgColor,omitempty"` + Buttons []Button `json:"Buttons"` + InputFieldState InputFieldStateType `json:"InputFieldState,omitempty"` } // AddButton to keyboard @@ -13,6 +23,11 @@ func (k *Keyboard) AddButton(b *Button) { k.Buttons = append(k.Buttons, *b) } +func (k *Keyboard) SetInputFieldState(state InputFieldStateType) *Keyboard { + k.InputFieldState = state + return k +} + // NewKeyboard struct with attribs init func (v *Viber) NewKeyboard(bgcolor string, defaultHeight bool) *Keyboard { return &Keyboard{