| 1 |
package sarif |
| 2 |
|
| 3 |
// Message ... |
| 4 |
type Message struct { |
| 5 |
Text *string `json:"text,omitempty"` |
| 6 |
Markdown *string `json:"markdown,omitempty"` |
| 7 |
ID *string `json:"id,omitempty"` |
| 8 |
Arguments []string `json:"arguments,omitempty"` |
| 9 |
PropertyBag |
| 10 |
} |
| 11 |
|
| 12 |
// NewMessage creates a new Message and returns a pointer to it |
| 13 |
func NewMessage() *Message { |
| 14 |
return &Message{} |
| 15 |
} |
| 16 |
|
| 17 |
// NewTextMessage creates a new TextMessage and returns a pointer to it |
| 18 |
func NewTextMessage(text string) *Message { |
| 19 |
return NewMessage().WithText(text) |
| 20 |
} |
| 21 |
|
| 22 |
// NewMarkdownMessage creates a new MarkdownMessage and returns a pointer to it |
| 23 |
func NewMarkdownMessage(markdown string) *Message { |
| 24 |
return NewMessage().WithMarkdown(markdown) |
| 25 |
} |
| 26 |
|
| 27 |
// WithText sets the Text |
| 28 |
func (message *Message) WithText(text string) *Message { |
| 29 |
message.Text = &text |
| 30 |
return message |
| 31 |
} |
| 32 |
|
| 33 |
// WithMarkdown sets the Markdown |
| 34 |
func (message *Message) WithMarkdown(markdown string) *Message { |
| 35 |
message.Markdown = &markdown |
| 36 |
return message |
| 37 |
} |
| 38 |
|
| 39 |
// WithId sets the ID |
| 40 |
func (message *Message) WithID(id string) *Message { |
| 41 |
message.ID = &id |
| 42 |
return message |
| 43 |
} |
| 44 |
|
| 45 |
// WithArguments sets the Arguments |
| 46 |
func (message *Message) WithArguments(arguments []string) *Message { |
| 47 |
message.Arguments = arguments |
| 48 |
return message |
| 49 |
} |
| 50 |
|
| 51 |
// AddArgument ... |
| 52 |
func (message *Message) AddArgument(argument string) { |
| 53 |
message.Arguments = append(message.Arguments, argument) |
| 54 |
} |