-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
code_flow.go
50 lines (41 loc) · 1.23 KB
/
code_flow.go
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
50
package sarif
// CodeFlow ...
type CodeFlow struct {
Message *Message `json:"message,omitempty"`
ThreadFlows []*ThreadFlow `json:"threadFlows,omitempty"`
PropertyBag
}
// NewCodeFlow creates a new CodeFlow and returns a pointer to it
func NewCodeFlow() *CodeFlow {
return &CodeFlow{}
}
// WithMessage sets the Message
func (codeFlow *CodeFlow) WithMessage(message *Message) *CodeFlow {
codeFlow.Message = message
return codeFlow
}
// WithTextMessage sets the Message text
func (codeFlow *CodeFlow) WithTextMessage(text string) *CodeFlow {
if codeFlow.Message == nil {
codeFlow.Message = &Message{}
}
codeFlow.Message.Text = &text
return codeFlow
}
// WithMessageMarkdown sets the Message markdown
func (codeFlow *CodeFlow) WithMessageMarkdown(markdown string) *CodeFlow {
if codeFlow.Message == nil {
codeFlow.Message = &Message{}
}
codeFlow.Message.Markdown = &markdown
return codeFlow
}
// WithThreadFlows sets the ThreadFlows
func (codeFlow *CodeFlow) WithThreadFlows(threadFlows []*ThreadFlow) *CodeFlow {
codeFlow.ThreadFlows = threadFlows
return codeFlow
}
// AddThreadFlow ...
func (codeFlow *CodeFlow) AddThreadFlow(threadFlow *ThreadFlow) {
codeFlow.ThreadFlows = append(codeFlow.ThreadFlows, threadFlow)
}