teams

package
v0.0.0-...-d5826a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const BatchSize = 5

Variables

This section is empty.

Functions

This section is empty.

Types

type AdaptiveCards

type AdaptiveCards struct {
	Type        string       `json:"type"`
	Attachments []Attachment `json:"attachments"`
}

func NewAdaptiveCards

func NewAdaptiveCards() *AdaptiveCards

func (*AdaptiveCards) AddAttachment

func (ac *AdaptiveCards) AddAttachment(attach Attachment) *AdaptiveCards

type Attachment

type Attachment struct {
	ContentType string  `json:"contentType"`
	ContentURL  any     `json:"contentUrl"`
	Content     Content `json:"content"`
}

func NewAttachment

func NewAttachment(content Content) Attachment

type Config

type Config struct {
	WebhookURL  string `json:"webhook_url" validate:"required,url" required:"true"`
	SendSummary bool   `json:"send_summary"`
}

type Content

type Content struct {
	Schema  string                   `json:"$schema"`
	Type    string                   `json:"type"`
	Version string                   `json:"version"`
	Body    []map[string]interface{} `json:"body"`
	Actions []map[string]interface{} `json:"action"`
}

func NewContent

func NewContent(body, actions []map[string]interface{}) Content

type Payload

type Payload struct {
	CardType   string    `json:"@type"`
	Context    string    `json:"@context"`
	Markdown   bool      `json:"markdown"`
	Text       string    `json:"text,omitempty"`
	Title      string    `json:"title,omitempty"`
	Summary    string    `json:"summary,omitempty"`
	Sections   []section `json:"sections,omitempty"`
	ThemeColor string    `json:"themeColor,omitempty"`
}

Payloads

type Teams

type Teams struct {
	Config           Config                  `json:"config"`
	IntegrationType  string                  `json:"integration_type"`
	NotificationType string                  `json:"notification_type"`
	Filters          reporters.FieldsFilters `json:"filters"`
	Message          string                  `json:"message"`
	Resource         string                  `json:"resource"`
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, b []byte) (*Teams, error)

func (Teams) FormatMessage

func (t Teams) FormatMessage(message map[string]interface{}, position int, entiremsg *strings.Builder) string

func (Teams) IsValidCredential

func (t Teams) IsValidCredential(ctx context.Context) (bool, error)

func (Teams) SendNotification

func (t Teams) SendNotification(ctx context.Context,
	message []map[string]interface{}, extras map[string]interface{}) error
func (t Teams) SendSummaryLink() bool

func (Teams) Sender

func (t Teams) Sender(in chan any, wg *sync.WaitGroup)

func (Teams) ValidateConfig

func (t Teams) ValidateConfig(validate *validator.Validate) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL