| 1 |
package sarif |
| 2 |
|
| 3 |
// ThreadFlow ... |
| 4 |
type ThreadFlow struct { |
| 5 |
ID *string `json:"id,omitempty"` |
| 6 |
ImmutableState map[string]*MultiformatMessageString `json:"immutableState,omitempty"` |
| 7 |
InitialState map[string]*MultiformatMessageString `json:"initialState,omitempty"` |
| 8 |
Locations []*ThreadFlowLocation `json:"locations"` |
| 9 |
Message *Message `json:"message,omitempty"` |
| 10 |
PropertyBag |
| 11 |
|
| 12 |
} |
| 13 |
|
| 14 |
// NewThreadFlow creates a new ThreadFlow and returns a pointer to it |
| 15 |
func NewThreadFlow() *ThreadFlow { |
| 16 |
return &ThreadFlow{} |
| 17 |
} |
| 18 |
|
| 19 |
// WithID sets the ID |
| 20 |
func (threadFlow *ThreadFlow) WithID(id string) *ThreadFlow { |
| 21 |
threadFlow.ID = &id |
| 22 |
return threadFlow |
| 23 |
} |
| 24 |
|
| 25 |
// WithImmutableState sets the ImmutableState |
| 26 |
func (threadFlow *ThreadFlow) WithImmutableState(immutableState map[string]*MultiformatMessageString) *ThreadFlow { |
| 27 |
threadFlow.ImmutableState = immutableState |
| 28 |
return threadFlow |
| 29 |
} |
| 30 |
|
| 31 |
// WithInitialState sets the InitialState |
| 32 |
func (threadFlow *ThreadFlow) WithInitialState(initialState map[string]*MultiformatMessageString) *ThreadFlow { |
| 33 |
threadFlow.InitialState = initialState |
| 34 |
return threadFlow |
| 35 |
} |
| 36 |
|
| 37 |
// WithLocations sets the Locations |
| 38 |
func (threadFlow *ThreadFlow) WithLocations(locations []*ThreadFlowLocation) *ThreadFlow { |
| 39 |
threadFlow.Locations = locations |
| 40 |
return threadFlow |
| 41 |
} |
| 42 |
|
| 43 |
// AddLocation ... |
| 44 |
func (threadFlow *ThreadFlow) AddLocation(location *ThreadFlowLocation) { |
| 45 |
threadFlow.Locations = append(threadFlow.Locations, location) |
| 46 |
} |
| 47 |
|
| 48 |
// WithMessage sets the Message |
| 49 |
func (threadFlow *ThreadFlow) WithMessage(message *Message) *ThreadFlow { |
| 50 |
threadFlow.Message = message |
| 51 |
return threadFlow |
| 52 |
} |
| 53 |
|
| 54 |
// WithTextMessage sets the Message text |
| 55 |
func (threadFlow *ThreadFlow) WithTextMessage(text string) *ThreadFlow { |
| 56 |
if threadFlow.Message == nil { |
| 57 |
threadFlow.Message = &Message{} |
| 58 |
} |
| 59 |
threadFlow.Message.Text = &text |
| 60 |
return threadFlow |
| 61 |
} |
| 62 |
|
| 63 |
// WithMessageMarkdown sets the Message markdown |
| 64 |
func (threadFlow *ThreadFlow) WithMessageMarkdown(markdown string) *ThreadFlow { |
| 65 |
if threadFlow.Message == nil { |
| 66 |
threadFlow.Message = &Message{} |
| 67 |
} |
| 68 |
threadFlow.Message.Markdown = &markdown |
| 69 |
return threadFlow |
| 70 |
} |