Documentation
¶
Index ¶
- Constants
- type AnnotationType
- type Client
- func (b *Client) CreateReport(ctx context.Context, commit string, r *CommitReport) (*CommitReport, error)
- func (b *Client) CreateReportAnnotations(ctx context.Context, commit, reportID string, annotations []ReportAnnotation) ([]ReportAnnotation, error)
- func (b *Client) PullRequestComments(ctx context.Context, prID int) (result []PullRequestComment, err error)
- func (b *Client) PullRequestCreateComment(ctx context.Context, prID int, raw string) (*PullRequestComment, error)
- func (b *Client) PullRequestUpdateComment(ctx context.Context, prID, id int, raw string) (*PullRequestComment, error)
- type ClientOption
- type CommitReport
- func (r *CommitReport) AddBoolean(title string, value bool)
- func (r *CommitReport) AddDate(title string, value time.Time)
- func (r *CommitReport) AddDuration(title string, value time.Duration)
- func (r *CommitReport) AddLink(title string, text string, u *url.URL)
- func (r *CommitReport) AddNumber(title string, value int64)
- func (r *CommitReport) AddPercentage(title string, value float64)
- func (r *CommitReport) AddText(title, value string)
- type Error
- type PaginatedResponse
- type PullRequestComment
- type Rendered
- type ReportAnnotation
- type ReportData
- type ReportType
- type Result
- type Severity
Constants ¶
const DefaultBaseURL = "https://api.bitbucket.org/2.0"
DefaultBaseURL is the default base URL for the Bitbucket API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnnotationType ¶
type AnnotationType string
AnnotationType: VULNERABILITY, CODE_SMELL, BUG
const ( AnnotationTypeVulnerability AnnotationType = "VULNERABILITY" AnnotationTypeCodeSmell AnnotationType = "CODE_SMELL" AnnotationTypeBug AnnotationType = "BUG" )
AnnotationType values.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the Bitbucket client.
func (*Client) CreateReport ¶
func (b *Client) CreateReport(ctx context.Context, commit string, r *CommitReport) (*CommitReport, error)
CreateReport creates a commit report for the given commit.
func (*Client) CreateReportAnnotations ¶
func (b *Client) CreateReportAnnotations(ctx context.Context, commit, reportID string, annotations []ReportAnnotation) ([]ReportAnnotation, error)
func (*Client) PullRequestComments ¶
func (b *Client) PullRequestComments(ctx context.Context, prID int) (result []PullRequestComment, err error)
PullRequestComments returns the comments of a pull request.
func (*Client) PullRequestCreateComment ¶
func (b *Client) PullRequestCreateComment(ctx context.Context, prID int, raw string) (*PullRequestComment, error)
PullRequestCreateComment creates a comment on a pull request.
func (*Client) PullRequestUpdateComment ¶
func (b *Client) PullRequestUpdateComment(ctx context.Context, prID, id int, raw string) (*PullRequestComment, error)
PullRequestUpdateComment updates a comment on a pull request.
type ClientOption ¶
ClientOption is the option when creating a new client.
type CommitReport ¶
type CommitReport struct {
Title string `json:"title"`
Details string `json:"details"`
ReportType ReportType `json:"report_type"`
ExternalID string `json:"external_id,omitempty"`
Reporter string `json:"reporter,omitempty"`
Link string `json:"link,omitempty"`
RemoteLinkEnabled bool `json:"remote_link_enabled,omitempty"`
LogoURL string `json:"logo_url,omitempty"`
Result Result `json:"result,omitempty"`
// Map of data to be reported.
// Maximum of 10 data points.
Data []ReportData `json:"data,omitempty"`
}
CommitReport is a report for a commit.
func (*CommitReport) AddBoolean ¶
func (r *CommitReport) AddBoolean(title string, value bool)
AddBoolean adds a boolean data to the commit report.
func (*CommitReport) AddDate ¶
func (r *CommitReport) AddDate(title string, value time.Time)
AddDate adds a date data to the commit report.
func (*CommitReport) AddDuration ¶
func (r *CommitReport) AddDuration(title string, value time.Duration)
AddDuration adds a duration data to the commit report.
func (*CommitReport) AddLink ¶
func (r *CommitReport) AddLink(title string, text string, u *url.URL)
AddLink adds a link data to the commit report.
func (*CommitReport) AddNumber ¶
func (r *CommitReport) AddNumber(title string, value int64)
AddNumber adds a number data to the commit report.
func (*CommitReport) AddPercentage ¶
func (r *CommitReport) AddPercentage(title string, value float64)
AddPercentage adds a percentage data to the commit report.
func (*CommitReport) AddText ¶
func (r *CommitReport) AddText(title, value string)
AddText adds a text data to the commit report.
type Error ¶
type Error struct {
ID string `json:"id"`
Message string `json:"message"`
Detail string `json:"detail"`
Fields map[string][]string `json:"fields"`
Data map[string]string `json:"data"`
}
Error is an API error.
type PaginatedResponse ¶
type PaginatedResponse[T any] struct { Size int `json:"size"` Page int `json:"page"` PageLen int `json:"pagelen"` Next string `json:"next"` Previous string `json:"previous"` Values []T `json:"values"` }
PaginatedResponse is a paginated response.
type PullRequestComment ¶
PullRequestComment is a comment.
type ReportAnnotation ¶
type ReportAnnotation struct {
AnnotationType AnnotationType `json:"annotation_type"`
Summary string `json:"summary"`
Result Result `json:"result,omitempty"`
Severity Severity `json:"severity,omitempty"`
ExternalID string `json:"external_id,omitempty"`
Path string `json:"path,omitempty"`
Line int `json:"line,omitempty"`
Details string `json:"details,omitempty"`
Link string `json:"link,omitempty"`
}
ReportAnnotation is the annotation to be reported.
type ReportData ¶
type ReportData struct {
Title string `json:"title"`
Value any `json:"value"`
Type string `json:"type,omitempty"`
}
ReportData is the data to be reported.
type ReportType ¶
type ReportType string
ReportType: SECURITY, COVERAGE, TEST, BUG
const ( ReportTypeSecurity ReportType = "SECURITY" ReportTypeCoverage ReportType = "COVERAGE" ReportTypeTest ReportType = "TEST" ReportTypeBug ReportType = "BUG" )
ReportType values.