Documentation ¶
Overview ¶
Package hangouts offers both helpers for connecting with the Google Hangouts Chat API as well as building and sending messages.
Index ¶
Constants ¶
const ( // MESSAGE event type MESSAGE = "MESSAGE" // ADDED event type ADDED = "ADDED_TO_SPACE" // REMOVED event type REMOVED = "REMOVED_FROM_SPACE" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { Label string `json:"actionLabel,omitempty"` OnClick *OnClick `json:"onClick,omitempty"` }
Action struct
type ActionParameter ¶
type ActionParameter struct { Key string `json:"key,omitempty"` Value string `json:"value,omitempty"` }
ActionParameter struct
func NewActionParameter ¶
func NewActionParameter(key, value string) *ActionParameter
NewActionParameter for use in KeyValue
type Button ¶
type Button struct { TextButton *TextButton `json:"textButton,omitempty"` ImageButton *ImageButton `json:"imageButton,omitempty"` }
Button struct
func NewImageActionButton ¶
func NewImageActionButton(icon, iconURL, action string, parameters ...*ActionParameter) *Button
NewImageActionButton containing FormAction
func NewImageLinkButton ¶
NewImageLinkButton containing OpenLink
func NewTextActionButton ¶
func NewTextActionButton(text, action string, parameters ...*ActionParameter) *Button
NewTextActionButton containing FormAction
func NewTextLinkButton ¶
NewTextLinkButton containing OpenLink
type Card ¶
type Card struct { Header *Header `json:"header,omitempty"` Sections []*Section `json:"sections"` Actions []*Action `json:"cardActions,omitempty"` }
Card struct
func (*Card) WithAction ¶
WithAction adds a new Action to Card
func (*Card) WithHeader ¶
WithHeader adds the defined header values to card
func (*Card) WithSection ¶
WithSection adds a new Section to Card
type Event ¶
type Event struct { Type string `json:"type"` Space struct { Name string `json:"name"` Type string `json:"type"` } `json:"space"` Message Message `json:"message,omitempty"` User User `json:"user"` }
Event struct
type FormAction ¶
type FormAction struct { MethodName string `json:"actionMethodName,omitempty"` Parameters []*ActionParameter `json:"parameters,omitempty"` }
FormAction struct
type Hangouts ¶
Hangouts handler
func NewWebhookClient ¶
NewWebhookClient for Hangouts
type Header ¶
type Header struct { Title string `json:"title"` Subtitle string `json:"subtitle,omitempty"` ImageURL string `json:"imageUrl,omitempty"` ImageStyle string `json:"imageStyle,omitempty"` }
Header struct
type Image ¶
type Image struct { ImageURL string `json:"imageUrl,omitempty"` OnClick *OnClick `json:"onClick,omitempty"` AspectRatio int `json:"aspectRatio,omitempty"` }
Image struct
func (*Image) WithAction ¶
func (i *Image) WithAction(name string, parameters ...*ActionParameter) *Image
WithAction adds OnClick with FormAction to Image
func (*Image) WithOpenLink ¶
WithOpenLink adds OnClick with OpenLink to Image
type ImageButton ¶
type ImageButton struct { IconURL string `json:"iconUrl,omitempty"` Icon string `json:"icon,omitempty"` OnClick *OnClick `json:"onClick,omitempty"` }
ImageButton struct
type KeyValue ¶
type KeyValue struct { TopLabel string `json:"topLabel,omitempty"` Content string `json:"content,omitempty"` ContentMultiline bool `json:"contentMultiline,omitempty"` BottomLabel string `json:"bottomLabel,omitempty"` OnClick *OnClick `json:"onClick,omitempty"` Icon string `json:"icon,omitempty"` IconURL string `json:"iconUrl,omitempty"` Button *Button `json:"button,omitempty"` }
KeyValue struct
func NewKeyValue ¶
NewKeyValue for use in Widget TopLabel and Content are required
func (*KeyValue) WithAction ¶
func (kv *KeyValue) WithAction(name string, parameters ...*ActionParameter) *KeyValue
WithAction adds OnClick containing a FormAction to KeyValue
func (*KeyValue) WithBottomLabel ¶
WithBottomLabel for KeyValue
func (*KeyValue) WithButton ¶
WithButton adds new Button to KeyValue
func (*KeyValue) WithOpenLink ¶
WithOpenLink adds OnClick containing an OpenLink action to KeyValue
type Message ¶
type Message struct { Name string `json:"name,omitempty"` Sender User `json:"sender,omitempty"` CreateTime string `json:"createTime,omitempty"` Text string `json:"text,omitempty"` Thread *Thread `json:"thread,omitempty"` Cards []*Card `json:"cards,omitempty"` }
Message struct
func (*Message) WithSender ¶
WithSender adds a User to Message
type OnClick ¶
type OnClick struct { Action *FormAction `json:"action,omitempty"` OpenLink *OpenLink `json:"openLink,omitempty"` }
OnClick struct
type Section ¶
type Section struct { Header string `json:"header,omitempty"` Widgets []*Widget `json:"widgets,omitempty"` }
Section struct
func (*Section) WithWidget ¶
WithWidget adds a new Widget to Section
type TextButton ¶
type TextButton struct { Text string `json:"text,omitempty"` OnClick *OnClick `json:"onClick,omitempty"` }
TextButton struct
type User ¶
type User struct { Type string `json:"type"` Name string `json:"name"` DisplayName string `json:"displayName"` AvatarURL string `json:"avatarUrl"` Email string `json:"email"` }
User struct
type Widget ¶
type Widget struct { TextParagraph *TextParagraph `json:"textParagraph,omitempty"` KeyValue *KeyValue `json:"keyValue,omitempty"` Buttons []*Button `json:"buttons,omitempty"` Image *Image `json:"image,omitempty"` }
Widget struct
func NewWidget ¶
func NewWidget() *Widget
NewWidget which may **either** contain TextParagraph, KeyValue or Buttons
func (*Widget) WithButton ¶
WithButton adds new Button to Widget
func (*Widget) WithKeyValue ¶
WithKeyValue adds KeyValue object to widget
func (*Widget) WithTextParagraph ¶
WithTextParagraph adds text to widget