-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
attachment.go
55 lines (47 loc) · 1.66 KB
/
attachment.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
51
52
53
54
55
package sarif
// Attachment ...
type Attachment struct {
ArtifactLocation *ArtifactLocation `json:"artifactLocation,omitempty"`
Description *Message `json:"description,omitempty"`
Rectangles []*Rectangle `json:"rectangles,omitempty"`
PropertyBag
}
// NewAttachment creates a new Attachment and returns a pointer to it
func NewAttachment() *Attachment {
return &Attachment{}
}
// WithArtifactionLocation sets the ArtifactionLocation
func (attachment *Attachment) WithArtifactionLocation(artifactLocation *ArtifactLocation) *Attachment {
attachment.ArtifactLocation = artifactLocation
return attachment
}
// WithDescription sets the Description
func (attachment *Attachment) WithDescription(description *Message) *Attachment {
attachment.Description = description
return attachment
}
// WithDescriptionText sets the DescriptionText
func (attachment *Attachment) WithDescriptionText(text string) *Attachment {
if attachment.Description == nil {
attachment.Description = &Message{}
}
attachment.Description.Text = &text
return attachment
}
// WithDescriptionMarkdown sets the DescriptionMarkdown
func (attachment *Attachment) WithDescriptionMarkdown(markdown string) *Attachment {
if attachment.Description == nil {
attachment.Description = &Message{}
}
attachment.Description.Markdown = &markdown
return attachment
}
// WithRectangles sets the Rectangles
func (attachment *Attachment) WithRectangles(rectangles []*Rectangle) *Attachment {
attachment.Rectangles = rectangles
return attachment
}
// AddRectangle ...
func (attachment *Attachment) AddRectangle(rectangle *Rectangle) {
attachment.Rectangles = append(attachment.Rectangles, rectangle)
}