Documentation ¶
Index ¶
- Constants
- func BuildStatusKey(preferredName, name string) string
- type Branch
- type BranchClientInterface
- type BranchListParams
- type BranchPage
- type BuildStatus
- type BuildStatusCreatePayload
- type BuildStatusPage
- type Client
- func (c *Client) BranchList(projectKey string, repositorySlug string, params BranchListParams) (*BranchPage, error)
- func (c *Client) BuildStatusCreate(gitCommit string, payload BuildStatusCreatePayload) error
- func (c *Client) BuildStatusList(gitCommit string) (*BuildStatusPage, error)
- func (c *Client) CommitGet(projectKey, repositorySlug, commitID string) (*Commit, error)
- func (c *Client) CommitList(projectKey string, repositorySlug string, params CommitListParams) (*CommitPage, error)
- func (c *Client) CommitPullRequestList(projectKey, repositorySlug, commitID string) (*PullRequestPage, error)
- func (c *Client) InsightReportCreate(projectKey, repositorySlug, commitID, key string, ...) (*InsightReport, error)
- func (c *Client) ProjectCreate(payload ProjectCreatePayload) (*Project, error)
- func (c *Client) RawGet(project, repository, filename, gitFullRef string) ([]byte, error)
- func (c *Client) RepoCreate(projectKey string, payload RepoCreatePayload) (*Repo, error)
- func (c *Client) RepoList(projectKey string) (*RepoPage, error)
- func (c *Client) TagCreate(projectKey string, repositorySlug string, payload TagCreatePayload) (*Tag, error)
- func (c *Client) TagGet(projectKey string, repositorySlug string, name string) (*Tag, error)
- func (c *Client) TagList(projectKey string, repositorySlug string, params TagListParams) (*TagPage, error)
- func (c *Client) WebhookCreate(projectKey, repositorySlug string, payload WebhookCreatePayload) (*Webhook, error)
- type ClientConfig
- type Commit
- type CommitClientInterface
- type CommitListParams
- type CommitPage
- type InsightReport
- type InsightReportCreatePayload
- type InsightReportData
- type Project
- type ProjectCreatePayload
- type PullRequest
- type PullRequestPage
- type RawClientInterface
- type Ref
- type Repo
- type RepoClientInterface
- type RepoCreatePayload
- type RepoPage
- type Tag
- type TagClientInterface
- type TagCreatePayload
- type TagListParams
- type TagPage
- type TestClient
- func (c *TestClient) BranchList(projectKey string, repositorySlug string, params BranchListParams) (*BranchPage, error)
- func (c *TestClient) CommitGet(projectKey, repositorySlug, commitID string) (*Commit, error)
- func (c *TestClient) CommitList(projectKey string, repositorySlug string, params CommitListParams) (*CommitPage, error)
- func (c *TestClient) CommitPullRequestList(projectKey, repositorySlug, commitID string) (*PullRequestPage, error)
- func (c *TestClient) RawGet(project, repository, filename, gitFullRef string) ([]byte, error)
- func (c *TestClient) RepoCreate(projectKey string, payload RepoCreatePayload) (*Repo, error)
- func (c *TestClient) RepoList(projectKey string) (*RepoPage, error)
- func (c *TestClient) TagCreate(projectKey string, repositorySlug string, payload TagCreatePayload) (*Tag, error)
- func (c *TestClient) TagGet(projectKey string, repositorySlug string, name string) (*Tag, error)
- func (c *TestClient) TagList(projectKey string, repositorySlug string, params TagListParams) (*TagPage, error)
- type User
- type Webhook
- type WebhookConfiguration
- type WebhookCreatePayload
Constants ¶
const ( BuildStatusInProgress = "INPROGRESS" BuildStatusSuccessful = "SUCCESSFUL" BuildStatusFailed = "FAILED" )
const ( InsightReportPass = "PASS" InsightReportFail = "FAIL" )
Variables ¶
This section is empty.
Functions ¶
func BuildStatusKey ¶ added in v0.15.0
BuildStatusKey returns the key to use for the Bitbucket build status.
Types ¶
type BranchClientInterface ¶
type BranchClientInterface interface {
BranchList(projectKey string, repositorySlug string, params BranchListParams) (*BranchPage, error)
}
type BranchListParams ¶
type BranchListParams struct { // Base is the base branch or tag to compare each branch to (for the // metadata providers that uses that information). Base string `json:"base"` // Details controls whether to retrieve plugin-provided metadata about each branch. Details bool `json:"details"` // FilterText is the the text to match on. The match seems to be a prefix match. FilterText string `json:"filterText"` // OrderBy determines ordering of refs. // Either ALPHABETICAL (by name) or MODIFICATION (last updated). OrderBy string `json:"orderBy"` // BoostMatches controls whether exact and prefix matches will be boosted to the top BoostMatches bool `json:"boostMatches"` }
type BranchPage ¶
type BuildStatus ¶
type BuildStatusPage ¶
type BuildStatusPage struct { Size int `json:"size"` Limit int `json:"limit"` IsLastPage bool `json:"isLastPage"` Values []BuildStatus `json:"values"` // newest build status appears first Start int `json:"start"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Loosely based on https://github.com/brandur/wanikaniapi.
func NewClient ¶
func NewClient(clientConfig *ClientConfig) (*Client, error)
func (*Client) BranchList ¶
func (c *Client) BranchList(projectKey string, repositorySlug string, params BranchListParams) (*BranchPage, error)
BranchList retrieves the branches matching the supplied filterText param. The authenticated user must have REPO_READ permission for the specified repository to call this resource. https://docs.atlassian.com/bitbucket-server/rest/7.14.0/bitbucket-rest.html#idp211
func (*Client) BuildStatusCreate ¶
func (c *Client) BuildStatusCreate(gitCommit string, payload BuildStatusCreatePayload) error
BuildStatusCreate associates a build status with a commit. The state, the key and the url are mandatory. The name and description fields are optional. All fields (mandatory or optional) are limited to 255 characters, except for the url, which is limited to 450 characters. Supported values for the state are SUCCESSFUL, FAILED and INPROGRESS. The authenticated user must have LICENSED permission or higher to call this resource. https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-build-rest.html#idp6
func (*Client) BuildStatusList ¶
func (c *Client) BuildStatusList(gitCommit string) (*BuildStatusPage, error)
BuildStatusList gets the build statuses associated with a commit. https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-build-rest.html#idp8
func (*Client) CommitGet ¶
CommitGet etrieves a single commit identified by its ID. In general, that ID is a SHA1. From 2.11, ref names like "refs/heads/master" are no longer accepted by this resource. The authenticated user must have REPO_READ permission for the specified repository to call this resource. https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-rest.html#idp224
func (*Client) CommitList ¶
func (c *Client) CommitList(projectKey string, repositorySlug string, params CommitListParams) (*CommitPage, error)
CommitList retrieves a page of commits from a given starting commit or "between" two commits. If no explicit commit is specified, the tip of the repository's default branch is assumed. commits may be identified by branch or tag name or by ID. A path may be supplied to restrict the returned commits to only those which affect that path. The authenticated user must have REPO_READ permission for the specified repository to call this resource. https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-rest.html#idp222
func (*Client) CommitPullRequestList ¶
func (c *Client) CommitPullRequestList(projectKey, repositorySlug, commitID string) (*PullRequestPage, error)
CommitPullRequestList retrieves a page of pull requests in the current repository that contain the given commit. The user must be authenticated and have access to the specified repository to call this resource. https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-rest.html#idp243
func (*Client) InsightReportCreate ¶
func (c *Client) InsightReportCreate(projectKey, repositorySlug, commitID, key string, payload InsightReportCreatePayload) (*InsightReport, error)
InsightReportCreate creates a new insight report, or replace the existing one if a report already exists for the given repository, commit, and report key. A request to replace an existing report will be rejected if the authenticated user was not the creator of the specified report. The report key should be a unique string chosen by the reporter and should be unique enough not to potentially clash with report keys from other reporters. We recommend using reverse DNS namespacing or a similar standard to ensure that collision is avoided.
https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-code-insights-rest.html#idp9
func (*Client) ProjectCreate ¶
func (c *Client) ProjectCreate(payload ProjectCreatePayload) (*Project, error)
ProjectCreate creates a new project. To include a custom avatar for the project, the project definition should contain an additional attribute with the key avatar and the value a data URI containing Base64-encoded image data. The URI should be in the following format:
data:(content type, e.g. image/png);base64,(data)
If the data is not Base64-encoded, or if a character set is defined in the URI, or the URI is otherwise invalid, project creation will fail. The authenticated user must have PROJECT_CREATE permission to call this resource. https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-rest.html#idp148
func (*Client) RawGet ¶
RawGet retrieves the raw content for a file path at a specified revision. The authenticated user must have REPO_READ permission for the specified repository to call this resource. https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-rest.html#idp359
func (*Client) RepoCreate ¶
func (c *Client) RepoCreate(projectKey string, payload RepoCreatePayload) (*Repo, error)
RepoCreate creates a new repository. Requires an existing project in which this repository will be created. The only parameters which will be used are name and scmId. The authenticated user must have PROJECT_ADMIN permission for the context project to call this resource. https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-rest.html#idp174
func (*Client) RepoList ¶
RepoList retrieves repositories from the project corresponding to the supplied projectKey. The authenticated user must have REPO_READ permission for the context repository to call this resource. https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-rest.html#idp175
func (*Client) TagCreate ¶
func (c *Client) TagCreate(projectKey string, repositorySlug string, payload TagCreatePayload) (*Tag, error)
TagCreate creates a tag in the specified repository. The authenticated user must have an effective REPO_WRITE permission to call this resource.
'LIGHTWEIGHT' and 'ANNOTATED' are the two type of tags that can be created. The 'startPoint' can either be a ref or a 'commit'.
https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-rest.html#idp395
func (*Client) TagGet ¶
TagGet retrieves a tag in the specified repository.. The authenticated user must have REPO_READ permission for the context repository to call this resource. https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-rest.html#idp398
func (*Client) TagList ¶
func (c *Client) TagList(projectKey string, repositorySlug string, params TagListParams) (*TagPage, error)
TagList retrieves the tags matching the supplied filterText param. The authenticated user must have REPO_READ permission for the context repository to call this resource. https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-rest.html#idp396
func (*Client) WebhookCreate ¶
func (c *Client) WebhookCreate(projectKey, repositorySlug string, payload WebhookCreatePayload) (*Webhook, error)
type ClientConfig ¶
type Commit ¶
type Commit struct { ID string `json:"id"` DisplayID string `json:"displayId"` Author struct { Name string `json:"name"` EmailAddress string `json:"emailAddress"` } `json:"author"` AuthorTimestamp int64 `json:"authorTimestamp"` Committer struct { Name string `json:"name"` EmailAddress string `json:"emailAddress"` } `json:"committer"` CommitterTimestamp int64 `json:"committerTimestamp"` Message string `json:"message"` Parents []struct { ID string `json:"id"` DisplayID string `json:"displayId"` } `json:"parents"` }
type CommitClientInterface ¶
type CommitClientInterface interface { CommitList(projectKey string, repositorySlug string, params CommitListParams) (*CommitPage, error) CommitGet(projectKey, repositorySlug, commitID string) (*Commit, error) CommitPullRequestList(projectKey, repositorySlug, commitID string) (*PullRequestPage, error) }
type CommitListParams ¶
type CommitPage ¶
type InsightReport ¶
type InsightReport struct { Data []InsightReportData `json:"data"` CreatedDate int `json:"createdDate"` Details string `json:"details"` Key string `json:"key"` Link string `json:"link"` LogoURL string `json:"logoUrl"` Result string `json:"result"` Title string `json:"title"` Reporter string `json:"reporter"` }
type InsightReportCreatePayload ¶
type InsightReportCreatePayload struct { Data []InsightReportData `json:"data"` Details string `json:"details,omitempty"` Title string `json:"title"` Reporter string `json:"reporter,omitempty"` CreatedDate int64 `json:"createdDate"` Link string `json:"link,omitempty"` LogoURL string `json:"logoUrl,omitempty"` Result string `json:"result,omitempty"` }
type InsightReportData ¶
type ProjectCreatePayload ¶
type PullRequest ¶
type PullRequest struct { ID int `json:"id"` Version int `json:"version"` Title string `json:"title"` Description string `json:"description"` State string `json:"state"` Open bool `json:"open"` Closed bool `json:"closed"` CreatedDate int `json:"createdDate"` UpdatedDate int `json:"updatedDate"` FromRef Ref `json:"fromRef"` ToRef Ref `json:"toRef"` Locked bool `json:"locked"` Author struct { User User `json:"user"` Role string `json:"role"` Approved bool `json:"approved"` Status string `json:"status"` } `json:"author"` Reviewers []struct { User User `json:"user"` LastReviewedCommit string `json:"lastReviewedCommit"` Role string `json:"role"` Approved bool `json:"approved"` Status string `json:"status"` } `json:"reviewers"` Participants []struct { User User `json:"user"` Role string `json:"role"` Approved bool `json:"approved"` Status string `json:"status"` } `json:"participants"` Links struct { Self []struct { Href string `json:"href"` } `json:"self"` } `json:"links"` }
type PullRequestPage ¶
type PullRequestPage struct { Size int `json:"size"` Limit int `json:"limit"` IsLastPage bool `json:"isLastPage"` Values []PullRequest Start int `json:"start"` }
type RawClientInterface ¶
type Repo ¶
type Repo struct { Slug string `json:"slug"` ID int `json:"id"` Name string `json:"name"` Description string `json:"description"` Hierarchyid string `json:"hierarchyId"` SCMID string `json:"scmId"` State string `json:"state"` StatusMessage string `json:"statusMessage"` Forkable bool `json:"forkable"` Project Project `json:"project"` Public bool `json:"public"` Links struct { Clone []struct { Href string `json:"href"` Name string `json:"name"` } `json:"clone"` Self []struct { Href string `json:"href"` } `json:"self"` } `json:"links"` }
type RepoClientInterface ¶
type RepoCreatePayload ¶
type TagClientInterface ¶
type TagCreatePayload ¶
type TagListParams ¶
type TestClient ¶
type TestClient struct { Branches []Branch Tags []Tag Repos []Repo Commits []Commit PullRequests []PullRequest // Files contains byte slices for filenames Files map[string][]byte }
TestClient returns mocked branches and tags.
func (*TestClient) BranchList ¶
func (c *TestClient) BranchList(projectKey string, repositorySlug string, params BranchListParams) (*BranchPage, error)
func (*TestClient) CommitGet ¶
func (c *TestClient) CommitGet(projectKey, repositorySlug, commitID string) (*Commit, error)
func (*TestClient) CommitList ¶
func (c *TestClient) CommitList(projectKey string, repositorySlug string, params CommitListParams) (*CommitPage, error)
func (*TestClient) CommitPullRequestList ¶
func (c *TestClient) CommitPullRequestList(projectKey, repositorySlug, commitID string) (*PullRequestPage, error)
func (*TestClient) RawGet ¶
func (c *TestClient) RawGet(project, repository, filename, gitFullRef string) ([]byte, error)
func (*TestClient) RepoCreate ¶
func (c *TestClient) RepoCreate(projectKey string, payload RepoCreatePayload) (*Repo, error)
func (*TestClient) TagCreate ¶
func (c *TestClient) TagCreate(projectKey string, repositorySlug string, payload TagCreatePayload) (*Tag, error)
func (*TestClient) TagList ¶
func (c *TestClient) TagList(projectKey string, repositorySlug string, params TagListParams) (*TagPage, error)
type WebhookConfiguration ¶
type WebhookConfiguration struct {
Secret string `json:"secret"`
}
type WebhookCreatePayload ¶
type WebhookCreatePayload struct { Name string `json:"name"` Events []string `json:"events"` Configuration WebhookConfiguration `json:"configuration"` URL string `json:"url"` Active bool `json:"active"` }