github.com/bshelton229/agent@v3.5.4+incompatible/api/annotations.go (about) 1 package api 2 3 import "fmt" 4 5 // AnnotationsService handles communication with the annotation related methods of the 6 // Buildkite Agent API. 7 type AnnotationsService struct { 8 client *Client 9 } 10 11 // Annotation represents a Buildkite Agent API Annotation 12 type Annotation struct { 13 Body string `json:"body,omitempty"` 14 Context string `json:"context,omitempty"` 15 Style string `json:"style,omitempty"` 16 Append bool `json:"append,omitempty"` 17 } 18 19 // Annotates a build in the Buildkite UI 20 func (cs *AnnotationsService) Create(jobId string, annotation *Annotation) (*Response, error) { 21 u := fmt.Sprintf("jobs/%s/annotations", jobId) 22 23 req, err := cs.client.NewRequest("POST", u, annotation) 24 if err != nil { 25 return nil, err 26 } 27 28 return cs.client.Do(req, nil) 29 }