rocketchat

package
v0.0.0-...-386ad9e Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Unlicense Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlwaysValid

func AlwaysValid(validator.FieldLevel) bool

func ValidateBots

func ValidateBots(config *config.Rocketchat) func(validator.FieldLevel) bool

func ValidateChannelStructLevel

func ValidateChannelStructLevel(config *config.Rocketchat) func(validator.StructLevel)

func ValidateEdits

func ValidateEdits(config *config.Rocketchat) func(validator.FieldLevel) bool

func ValidateInputMessageStructLevel

func ValidateInputMessageStructLevel(config *config.Rocketchat) func(validator.StructLevel)

func ValidateToken

func ValidateToken(config *config.Rocketchat) func(validator.FieldLevel) bool

func ValidateUserStructLevel

func ValidateUserStructLevel(config *config.Rocketchat) func(validator.StructLevel)

Types

type Attachment

type Attachment struct {
	AuthorName  string  `json:"author_name"`
	AuthorLink  string  `json:"author_link,omitempty"`
	AuthorIcon  string  `json:"author_icon,omitempty"`
	Collapsed   bool    `json:"collapsed"`
	Title       string  `json:"title"`
	TitleLink   string  `json:"title_link,omitempty"`
	MessageLink string  `json:"message_link,omitempty"`
	ImageURL    string  `json:"image_url,omitempty"`
	ThumbURL    string  `json:"thumb_url,omitempty"`
	Color       string  `json:"color"`
	Text        string  `json:"text"`
	Fields      []Field `json:"fields"`
}

func (*Attachment) AddField

func (attachment *Attachment) AddField(title string, value string, short bool)

func (*Attachment) AddShortField

func (attachment *Attachment) AddShortField(title string, value string)

type Bot

type Bot bool

func (*Bot) UnmarshalJSON

func (bot *Bot) UnmarshalJSON(b []byte) error

type ConfluenceOutput

type ConfluenceOutput struct {
	*ConfluenceOutputBuilder
	// contains filtered or unexported fields
}

func (*ConfluenceOutput) Attachments

func (o *ConfluenceOutput) Attachments() []Attachment

func (*ConfluenceOutput) AttachmentsLen

func (o *ConfluenceOutput) AttachmentsLen() int

func (*ConfluenceOutput) Color

func (o *ConfluenceOutput) Color() string

func (*ConfluenceOutput) GetText

func (o *ConfluenceOutput) GetText() string

func (*ConfluenceOutput) NextIconGetter

func (o *ConfluenceOutput) NextIconGetter() func() string

type ConfluenceOutputBuilder

type ConfluenceOutputBuilder struct {
	*OutputBuilder
	// contains filtered or unexported fields
}

func NewConfluenceOutputBuilder

func NewConfluenceOutputBuilder(cfg *config.MessageConfluence) *ConfluenceOutputBuilder

func (*ConfluenceOutputBuilder) AddFields

func (o *ConfluenceOutputBuilder) AddFields(page *confluence.Page, attachment *Attachment)

func (*ConfluenceOutputBuilder) New

func (*ConfluenceOutputBuilder) Output

func (o *ConfluenceOutputBuilder) Output(pages []*confluence.Page) *Output

type Field

type Field struct {
	Title string `json:"title"`
	Value string `json:"value"`
	Short bool   `json:"short"`
}

type Input

type Input struct {
	Token       string    `json:"token" validate:"token"`
	ChannelID   string    `json:"channel_id"`
	ChannelName string    `json:"channel_name"`
	UserID      string    `json:"user_id"`
	UserName    string    `json:"user_name"`
	Text        string    `json:"text" validate:"required"`
	MessageID   string    `json:"message_id"`
	SiteURL     string    `json:"siteUrl"`
	Timestamp   time.Time `json:"timestamp"`
	IsEdited    bool      `json:"IsEdited" validate:"edits"`
	Bot         Bot       `json:"bot" validate:"bots"`
	Alias       string    `json:"alias"`
	TriggerWord string    `json:"trigger_word"`
}

func (*Input) TextWithoutReply

func (i *Input) TextWithoutReply() string

type JiraOutput

type JiraOutput struct {
	*JiraOutputBuilder
	// contains filtered or unexported fields
}

func (*JiraOutput) Attachments

func (o *JiraOutput) Attachments() []Attachment

func (*JiraOutput) AttachmentsLen

func (o *JiraOutput) AttachmentsLen() int

func (*JiraOutput) GetText

func (o *JiraOutput) GetText() string

type JiraOutputBuilder

type JiraOutputBuilder struct {
	*OutputBuilder
	// contains filtered or unexported fields
}

func NewJiraOutputBuilder

func NewJiraOutputBuilder(cfg *config.MessageJira) *JiraOutputBuilder

func (*JiraOutputBuilder) AddFields

func (o *JiraOutputBuilder) AddFields(issue *jira.Issue, attachment *Attachment)

func (*JiraOutputBuilder) Color

func (o *JiraOutputBuilder) Color(priority *jira.Priority) (color string)

func (*JiraOutputBuilder) New

func (o *JiraOutputBuilder) New(issues []*jira.Issue) *JiraOutput

func (*JiraOutputBuilder) NextIconGetter

func (o *JiraOutputBuilder) NextIconGetter() func(issue *jira.Issue) string

func (*JiraOutputBuilder) Output

func (o *JiraOutputBuilder) Output(issues []*jira.Issue) *Output

type MultiplexOutput

type MultiplexOutput struct {
	// contains filtered or unexported fields
}

func (*MultiplexOutput) Attachments

func (o *MultiplexOutput) Attachments() []Attachment

func (*MultiplexOutput) AttachmentsLen

func (o *MultiplexOutput) AttachmentsLen() int

func (*MultiplexOutput) GetText

func (o *MultiplexOutput) GetText() string

func (*MultiplexOutput) IconURL

func (o *MultiplexOutput) IconURL() string

func (*MultiplexOutput) Username

func (o *MultiplexOutput) Username() string

type MultiplexOutputBuilder

type MultiplexOutputBuilder struct{}

func NewMultiplexOutputBuilder

func NewMultiplexOutputBuilder() *MultiplexOutputBuilder

func (*MultiplexOutputBuilder) Output

func (o *MultiplexOutputBuilder) Output(o1, o2 OutputInterface) *Output

type Output

type Output struct {
	Alias       string       `json:"alias"`
	Avatar      string       `json:"avatar"`
	Text        string       `json:"text"`
	Attachments []Attachment `json:"attachments,omitempty"`
}

func New

func New(out OutputInterface) *Output

type OutputBuilder

type OutputBuilder struct {
	*config.Message
	// contains filtered or unexported fields
}

func NewOutputBuilder

func NewOutputBuilder(cfg *config.Message) *OutputBuilder

func (*OutputBuilder) AddQuote

func (o *OutputBuilder) AddQuote(attachment *Attachment)

func (*OutputBuilder) BuildAuthor

func (o *OutputBuilder) BuildAuthor(data interface{}) string

func (*OutputBuilder) BuildMessage

func (o *OutputBuilder) BuildMessage(key string, data ...interface{}) string

func (*OutputBuilder) BuildTitle

func (o *OutputBuilder) BuildTitle(data interface{}) string

func (*OutputBuilder) GetPersonName

func (o *OutputBuilder) GetPersonName(p Person) string

func (*OutputBuilder) IconURL

func (o *OutputBuilder) IconURL() string

func (*OutputBuilder) StripTags

func (o *OutputBuilder) StripTags(text string) string

func (*OutputBuilder) TrimMaxLen

func (o *OutputBuilder) TrimMaxLen(text string) string

func (*OutputBuilder) Unescape

func (o *OutputBuilder) Unescape(text string) string

func (*OutputBuilder) Username

func (o *OutputBuilder) Username() string

type OutputInterface

type OutputInterface interface {
	Username() string
	IconURL() string
	GetText() string
	Attachments() []Attachment
	AttachmentsLen() int
}

type Person

type Person interface {
	RealName() string
	JiraName() string
}

type TextOutput

type TextOutput struct {
	*TextOutputBuilder
	// contains filtered or unexported fields
}

func (*TextOutput) Attachments

func (o *TextOutput) Attachments() []Attachment

func (*TextOutput) AttachmentsLen

func (o *TextOutput) AttachmentsLen() int

func (*TextOutput) GetText

func (o *TextOutput) GetText() string

type TextOutputBuilder

type TextOutputBuilder struct {
	*OutputBuilder
}

func NewTextOutputBuilder

func NewTextOutputBuilder(cfg *config.Message) *TextOutputBuilder

func (*TextOutputBuilder) Output

func (o *TextOutputBuilder) Output(text string) *Output

type Validate

type Validate struct {
	*validator.Validate
	// contains filtered or unexported fields
}

func SetupValidator

func SetupValidator(cfg *config.Rocketchat) *Validate

func (*Validate) ValidateJiraKeys

func (v *Validate) ValidateJiraKeys(keys []string) []string

Jump to

Keyboard shortcuts

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