| 1 | package sarif |
| 2 | |
| 3 | // Message ... |
| 4 | type Message struct { // https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10540897 |
| 5 | PropertyBag |
| 6 | Text *string `json:"text,omitempty"` |
| 7 | Markdown *string `json:"markdown,omitempty"` |
| 8 | Id *string `json:"id,omitempty"` |
| 9 | Arguments []string `json:"arguments,omitempty"` |
| 10 | } |
| 11 | |
| 12 | // NewMessage ... |
| 13 | func NewMessage() *Message { |
| 14 | return &Message{} |
| 15 | } |
| 16 | |
| 17 | // NewTextMessage ... |
| 18 | func NewTextMessage(text string) *Message { |
| 19 | return NewMessage().WithText(text) |
| 20 | } |
| 21 | |
| 22 | // NewMarkdownMessage ... |
| 23 | func NewMarkdownMessage(markdown string) *Message { |
| 24 | return NewMessage().WithMarkdown(markdown) |
| 25 | } |
| 26 | |
| 27 | // WithText ... |
| 28 | func (m *Message) WithText(text string) *Message { |
| 29 | m.Text = &text |
| 30 | return m |
| 31 | } |
| 32 | |
| 33 | // WithMarkdown ... |
| 34 | func (m *Message) WithMarkdown(markdown string) *Message { |
| 35 | m.Markdown = &markdown |
| 36 | return m |
| 37 | } |
| 38 | |
| 39 | // WithId ... |
| 40 | func (m *Message) WithId(id string) *Message { |
| 41 | m.Id = &id |
| 42 | return m |
| 43 | } |
| 44 | |
| 45 | // WithArgument ... |
| 46 | func (m *Message) WithArgument(argument string) *Message { |
| 47 | m.Arguments = append(m.Arguments, argument) |
| 48 | return m |
| 49 | } |