Documentation ¶
Index ¶
- func BuildCloudAPIContext(ctx context.Context, user, password, token string) context.Context
- func BuildServerAPIContext(ctx context.Context, bbURL, user, password, token string) (context.Context, error)
- type APIClient
- type AnnotationsRequest
- type CloudAPIClient
- type CloudAPIHelper
- type ReportAnnotator
- type ReportRequest
- type ServerAPIClient
- type ServerAPIHelper
- type UnexpectedResponseError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCloudAPIContext ¶
BuildCloudAPIContext builds context.Context used to call Bitbucket Cloud Code Insights API
Types ¶
type APIClient ¶
type APIClient interface { // CreateOrUpdateReport creates or updates specified report CreateOrUpdateReport(ctx context.Context, req *ReportRequest) error // CreateOrUpdateAnnotations creates or updates annotations CreateOrUpdateAnnotations(ctx context.Context, req *AnnotationsRequest) error }
APIClient is client for Bitbucket Code Insights API
func NewCloudAPIClient ¶
NewCloudAPIClient creates client for Bitbucket Cloud Insights API
func NewCloudAPIClientWithConfigurations ¶
func NewCloudAPIClientWithConfigurations(client *http.Client, server bbapi.ServerConfiguration) APIClient
NewCloudAPIClientWithConfigurations creates client for Bitbucket Cloud Insights API with specified configuration
func NewServerAPIClient ¶
func NewServerAPIClient() APIClient
NewServerAPIClient creates client for Bitbucket Server Code Insights API
type AnnotationsRequest ¶
type AnnotationsRequest struct { Owner string Repository string Commit string ReportID string Comments []*reviewdog.Comment }
AnnotationsRequest is an object that represent parameters used to create/update annotations
type CloudAPIClient ¶
type CloudAPIClient struct {
// contains filtered or unexported fields
}
CloudAPIClient is wrapper for Bitbucket Cloud Code Insights API client
func (*CloudAPIClient) CreateOrUpdateAnnotations ¶
func (c *CloudAPIClient) CreateOrUpdateAnnotations(ctx context.Context, req *AnnotationsRequest) error
CreateOrUpdateAnnotations creates or updates annotations
func (*CloudAPIClient) CreateOrUpdateReport ¶
func (c *CloudAPIClient) CreateOrUpdateReport(ctx context.Context, req *ReportRequest) error
CreateOrUpdateReport creates or updates specified report
type CloudAPIHelper ¶
type CloudAPIHelper struct{}
CloudAPIHelper is collection of utility functions used to build requests for Bitbucket Cloud Code Insights API
func (*CloudAPIHelper) BuildAnnotations ¶
func (c *CloudAPIHelper) BuildAnnotations(comments []*reviewdog.Comment) []bbapi.ReportAnnotation
BuildAnnotations builds list of Code Insights API annotation objects for specified comments
func (*CloudAPIHelper) BuildReport ¶
func (c *CloudAPIHelper) BuildReport(req *ReportRequest) bbapi.Report
BuildReport builds Code Insights API report object
type ReportAnnotator ¶
type ReportAnnotator struct {
// contains filtered or unexported fields
}
ReportAnnotator is a comment service for Bitbucket Code Insights reports.
Cloud API:
https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/commit/%7Bcommit%7D/reports/%7BreportId%7D/annotations#post POST /2.0/repositories/{username}/{repo_slug}/commit/{commit}/reports/{reportId}/annotations
Server API:
https://docs.atlassian.com/bitbucket-server/rest/5.15.0/bitbucket-code-insights-rest.html#idm288218233536 /rest/insights/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations
func NewReportAnnotator ¶
func NewReportAnnotator(cli APIClient, owner, repo, sha string, runners []string) *ReportAnnotator
NewReportAnnotator creates new Bitbucket ReportRequest Annotator
type ReportRequest ¶
type ReportRequest struct { Owner string Repository string Commit string ReportID string Type string Title string Reporter string Result string Details string LogoURL string }
ReportRequest is an object that represent parameters used to create/update report
type ServerAPIClient ¶
type ServerAPIClient struct {
// contains filtered or unexported fields
}
ServerAPIClient is wrapper for Bitbucket Server Code Insights API client
func (*ServerAPIClient) CreateOrUpdateAnnotations ¶
func (c *ServerAPIClient) CreateOrUpdateAnnotations(ctx context.Context, req *AnnotationsRequest) error
CreateOrUpdateAnnotations creates or updates annotations
func (*ServerAPIClient) CreateOrUpdateReport ¶
func (c *ServerAPIClient) CreateOrUpdateReport(ctx context.Context, req *ReportRequest) error
CreateOrUpdateReport creates or updates specified report
type ServerAPIHelper ¶
type ServerAPIHelper struct{}
ServerAPIHelper is collection of utility functions used to build requests for Bitbucket Server Code Insights API
func (*ServerAPIHelper) BuildAnnotations ¶
func (h *ServerAPIHelper) BuildAnnotations(comments []*reviewdog.Comment) insights.AnnotationsList
BuildAnnotations builds list of Code Insights API annotation objects for specified comments
func (*ServerAPIHelper) BuildReport ¶
func (h *ServerAPIHelper) BuildReport(req *ReportRequest) insights.Report
BuildReport builds Code Insights API report object
type UnexpectedResponseError ¶
UnexpectedResponseError is triggered when we have unexpected response from Code Insights API
func (UnexpectedResponseError) Error ¶
func (e UnexpectedResponseError) Error() string