utils

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package utils provides utility functions for the application

Package utils provides utility functions for the application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsMarkdownSyntax

func ContainsMarkdownSyntax(text string) bool

ContainsMarkdownSyntax checks if the message contains any Markdown formatting

func ConvertMarkdownToPlainText

func ConvertMarkdownToPlainText(markdown string) string

ConvertMarkdownToPlainText converts markdown to plain text for fallback

func ConvertToTeamsPayload

func ConvertToTeamsPayload(powerAutomateURL, messageText string, incident *m.Incident) ([]byte, error)

ConvertToTeamsPayload takes the rendered template message and converts it to the appropriate payload format for Power Automate.

func GetTemplateFuncMaps

func GetTemplateFuncMaps() template.FuncMap

GetTemplateFuncMaps returns a map of template functions that can be used in templates

func StripMarkdown

func StripMarkdown(text string) string

StripMarkdown removes common markdown syntax from text

Types

type AdaptiveCard

type AdaptiveCard struct {
	Type    string        `json:"type"`
	Body    []interface{} `json:"body"`
	Schema  string        `json:"$schema"`
	Version string        `json:"version"`
	// Required MS Teams fields
	Text    string `json:"text,omitempty"`    // Fallback text for clients that don't support cards
	Summary string `json:"summary,omitempty"` // Required by MS Teams for notification
}

AdaptiveCard represents a basic Adaptive Card structure for MS Teams

func ConvertMarkdownToAdaptiveCard

func ConvertMarkdownToAdaptiveCard(markdown string) AdaptiveCard

ConvertMarkdownToAdaptiveCard converts Markdown-like text to an Adaptive Card

type MSTeamsMessage

type MSTeamsMessage struct {
	Text string `json:"text"`
}

MSTeamsMessage represents a basic message for MS Teams

Jump to

Keyboard shortcuts

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