Documentation ¶
Index ¶
- Constants
- type Action
- type Description
- type Element
- type Photo
- type PhotoID
- type Template
- func (template *Template) Action(properties ...any) *Template
- func (template *Template) Add(element Element) *Template
- func (template *Template) Buttons(properties ...any) *Template
- func (template *Template) Description(properties ...any) *Template
- func (template *Template) Element(properties ...any) *Template
- func (template *Template) JSON() string
- func (template *Template) Photo(properties ...any) *Template
- func (template *Template) Title(properties ...any) *Template
- type Title
Constants ¶
const ( LINK = "open_link" PHOTO = "open_photo" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
Action - 🌲 action when clicking on a carousel element 🌱 Type - action type. Available: open_link or open_photo 🌳 OpenLink opens a link, OpenPhoto opens a photo of the object 👩🌾 Link - link with the type «open_link». Important: not «open_photo».
type Element ¶
type Element struct { Title string `json:"title"` Description string `json:"description"` PhotoID string `json:"photo_id"` Action Action `json:"action"` Buttons *keyboard.Buttons `json:"buttons"` }
Element 💐 is a carousel object that is displayed horizontally 🌈 Title - element header. Limited to 80 characters 🐰 Description - element description. Limited to 80 characters 🌷 PhotoID - VK photo ID format «#owner_id_#photo_id» 🐇 Action - the action that should happen when you click on the element 🐣 Buttons - pointer to the buttons from the «Keyboard» package, which are arranged vertically.
type Template ¶
Template 🍂 presents VK API template objects ☠️ Type specifies the type of template to create. Available Type: «carousel» 🎃 Elements - the list of Element objects arranged horizontally in the carousel.
func New ¶
New 🌷 is responsible for creating the template 🌈 It takes String - type Template and optional type []Element 🌺 Returns a pointer to the Template object.
func NewCarousel ¶
NewCarousel 🐸 creates a carousel object based on the Template structure 🍄 This is the easiest way to work with carousels 🌷 Does not require manual placement of elements, specifying the type, etc. 🌈 Pre-created elements can be used as arguments 🦌 Always returns a pointer to a Template object 🦋.
func (*Template) Action ¶
Action - 🌴 method of creating an action with a template element 🏖️ Accepts the following arguments: 🍹 Action Structure 😎 String - 1: Type, 2: Link 🚎 And the custom types described in the String argument 🦩 Returns the modified pattern by setting the Action to the last element.
func (*Template) Buttons ¶
Buttons - 🤡 add buttons to the last created carousel element 🍔 Accepts arguments: * Keyboard.Buttons 🍟 Returns the modified template.
func (*Template) Description ¶
func (*Template) Element ¶
Element - adding a new element to the template Accepted values: String - 1: Title, 2 - Description, 3 - PhotoID Element - element of the element to be added Action - action when clicking on the Action element keyboard.Buttons - vertical set of buttons *keyboard.Buttons - the same, but via the pointer Also available are custom types which are listed in the String argument Returns modified Template object with a new element.