Crate google_chat_types

Source
Expand description

Google Chat Types

§About Google Chat Message

type helper for construct Google Chat message There two type of Google Chat message

  • Text Message
  • Card Message

they are all represented as a json string.

Text Message represented like

{
    "text":"some text"
}  

Card Message represented like

{
 "cards": [
    {
      "sections": [
        {
          "widgets": [
            {
              "image": { "imageUrl": "https://..." }
            },
            {
              "buttons": [
                {
                  "textButton": {
                    "text": "OPEN IN GOOGLE MAPS",
                    "onClick": {
                      "openLink": {
                        "url": "https://..."
                      }
                    }
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

the relationship between elements of cards should looks like below

§How to use this crate

you should construct Cards or Text struct, then serialize them to json string as a Google Chat API(for instance incoming webhook) http request body.

Structs§

Button
ButtonBuilder
Builder for Button.
Card
the Card response. construct this by call default() method of this type
CardBuilder
Builder for Card.
Cards
The Card message type
CardsBuilder
Builder for Cards.
ChatTypeBuildError
Header
HeaderBuilder
Builder for Header.
Image
ImageBuilder
Builder for Image.
ImageButton
ImageButtonBuilder
Builder for ImageButton.
KeyValue
KeyValueBuilder
Builder for KeyValue.
OnClick
OnClickBuilder
Builder for OnClick.
OpenLink
OpenLinkBuilder
Builder for OpenLink.
Section
SectionBuilder
Builder for Section.
Text
The Text message type
TextBuilder
Builder for Text.
TextButton
TextButtonBuilder
Builder for TextButton.
TextParagraph
TextParagraphBuilder
Builder for TextParagraph.
Widget
WidgetBuilder
Builder for Widget.