File: message.go

package info (click to toggle)
golang-github-owenrumney-go-sarif 2.3.3-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 712 kB
  • sloc: makefile: 13
file content (49 lines) | stat: -rw-r--r-- 1,081 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package sarif

// Message ...
type Message struct { // https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10540897
	PropertyBag
	Text      *string  `json:"text,omitempty"`
	Markdown  *string  `json:"markdown,omitempty"`
	Id        *string  `json:"id,omitempty"`
	Arguments []string `json:"arguments,omitempty"`
}

// NewMessage ...
func NewMessage() *Message {
	return &Message{}
}

// NewTextMessage ...
func NewTextMessage(text string) *Message {
	return NewMessage().WithText(text)
}

// NewMarkdownMessage ...
func NewMarkdownMessage(markdown string) *Message {
	return NewMessage().WithMarkdown(markdown)
}

// WithText ...
func (m *Message) WithText(text string) *Message {
	m.Text = &text
	return m
}

// WithMarkdown ...
func (m *Message) WithMarkdown(markdown string) *Message {
	m.Markdown = &markdown
	return m
}

// WithId ...
func (m *Message) WithId(id string) *Message {
	m.Id = &id
	return m
}

// WithArgument ...
func (m *Message) WithArgument(argument string) *Message {
	m.Arguments = append(m.Arguments, argument)
	return m
}