Documentation
¶
Index ¶
- type Activity
- type Actor
- type AddCommentInput
- type AddDeployKeyInput
- type Approval
- type Branch
- type BranchResource
- type BranchRestriction
- type BranchRestrictionResource
- type BranchTarget
- type Client
- func (c *Client) Branches(workspace, repo string) *BranchResource
- func (c *Client) Comments(workspace, repo string, prID int) *CommentResource
- func (c *Client) Commits(workspace, repo string) *CommitResource
- func (c *Client) DeployKeys(workspace, repo string) *DeployKeyResource
- func (c *Client) Deployments(workspace, repo string) *DeploymentResource
- func (c *Client) Downloads(workspace, repo string) *DownloadResource
- func (c *Client) Environments(workspace, repo string) *EnvironmentResource
- func (c *Client) Issues(workspace, repo string) *IssueResource
- func (c *Client) Members(workspace string) *MemberResource
- func (c *Client) PRs(workspace, repo string) *PRResource
- func (c *Client) Pipelines(workspace, repo string) *PipelineResource
- func (c *Client) Repos(workspace string) *RepoResource
- func (c *Client) Restrictions(workspace, repo string) *BranchRestrictionResource
- func (c *Client) Tags(workspace, repo string) *TagResource
- func (c *Client) Tasks(workspace, repo string, prID int) *TaskResource
- func (c *Client) User() *UserResource
- func (c *Client) Webhooks(workspace, repo string) *WebhookResource
- type Comment
- type CommentResource
- type Commit
- type CommitAuthor
- type CommitParent
- type CommitResource
- type Content
- type CreateBranchInput
- type CreateBranchRestrictionInput
- type CreateIssueInput
- type CreatePRInput
- type CreateTagInput
- type CreateWebhookInput
- type DeployKey
- type DeployKeyResource
- type Deployable
- type DeployableCommit
- type DeployablePipeline
- type Deployment
- type DeploymentEnvRef
- type DeploymentResource
- type DeploymentState
- type DeploymentStatus
- type Download
- type DownloadResource
- type Endpoint
- type Environment
- type EnvironmentLock
- type EnvironmentResource
- type EnvironmentType
- type Inline
- type Issue
- type IssueResource
- type Links
- type MemberResource
- type PR
- type PRResource
- func (r *PRResource) Activity(ctx context.Context, prID int) ([]Activity, error)
- func (r *PRResource) Approve(ctx context.Context, prID int) error
- func (r *PRResource) Create(ctx context.Context, input CreatePRInput) (PR, error)
- func (r *PRResource) Decline(ctx context.Context, prID int) error
- func (r *PRResource) Diff(ctx context.Context, prID int) (string, error)
- func (r *PRResource) Get(ctx context.Context, prID int) (PR, error)
- func (r *PRResource) List(ctx context.Context, state string) ([]PR, error)
- func (r *PRResource) Merge(ctx context.Context, prID int, strategy string) error
- func (r *PRResource) Statuses(ctx context.Context, prID int) ([]PRStatus, error)
- type PRStatus
- type PRUpdate
- type Parent
- type Pipeline
- type PipelineCommit
- type PipelineResource
- func (r *PipelineResource) Get(ctx context.Context, pipelineUUID string) (Pipeline, error)
- func (r *PipelineResource) List(ctx context.Context) ([]Pipeline, error)
- func (r *PipelineResource) Log(ctx context.Context, pipelineUUID, stepUUID string) (string, error)
- func (r *PipelineResource) Steps(ctx context.Context, pipelineUUID string) ([]PipelineStep, error)
- func (r *PipelineResource) Stop(ctx context.Context, pipelineUUID string) error
- func (r *PipelineResource) Trigger(ctx context.Context, branch string) (Pipeline, error)
- type PipelineResult
- type PipelineState
- type PipelineStep
- type PipelineTarget
- type Repo
- type RepoResource
- type Tag
- type TagResource
- type Task
- type TaskResource
- type TriggerPipelineInput
- type TriggerTarget
- type User
- type UserResource
- type Webhook
- type WebhookResource
- type WorkspaceMember
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actor ¶
type Actor struct {
DisplayName string `json:"display_name"`
}
Actor is a Bitbucket user reference.
type AddCommentInput ¶
type AddCommentInput struct {
Content Content `json:"content"`
Inline *Inline `json:"inline,omitempty"`
Parent *Parent `json:"parent,omitempty"`
}
AddCommentInput holds the request body for adding a comment.
type AddDeployKeyInput ¶
type Branch ¶
type Branch struct {
Name string `json:"name"`
Target BranchTarget `json:"target"`
Links Links `json:"links"`
}
type BranchResource ¶
type BranchResource struct {
// contains filtered or unexported fields
}
BranchResource provides operations on repository branches.
func (*BranchResource) Create ¶
Create creates a new branch from the given commit hash or branch name.
type BranchRestriction ¶
type BranchRestrictionResource ¶
type BranchRestrictionResource struct {
// contains filtered or unexported fields
}
BranchRestrictionResource provides operations on repository branch restrictions.
func (*BranchRestrictionResource) Create ¶
func (r *BranchRestrictionResource) Create(ctx context.Context, input CreateBranchRestrictionInput) (BranchRestriction, error)
Create adds a new branch restriction to the repository.
func (*BranchRestrictionResource) Delete ¶
func (r *BranchRestrictionResource) Delete(ctx context.Context, id int) error
Delete removes a branch restriction by its integer ID.
func (*BranchRestrictionResource) List ¶
func (r *BranchRestrictionResource) List(ctx context.Context) ([]BranchRestriction, error)
List returns all branch restrictions for the repository.
type BranchTarget ¶
type BranchTarget struct {
Hash string `json:"hash"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the Bitbucket Cloud HTTP client.
func NewWithBaseURL ¶
NewWithBaseURL creates a Client with a custom base URL. Used in tests.
func (*Client) Branches ¶
func (c *Client) Branches(workspace, repo string) *BranchResource
Branches returns a resource for branch operations on the given repo.
func (*Client) Comments ¶
func (c *Client) Comments(workspace, repo string, prID int) *CommentResource
Comments returns a CommentResource scoped to a specific PR.
func (*Client) Commits ¶
func (c *Client) Commits(workspace, repo string) *CommitResource
Commits returns a resource for commit history and file access on the given repo.
func (*Client) DeployKeys ¶
func (c *Client) DeployKeys(workspace, repo string) *DeployKeyResource
DeployKeys returns a resource for deploy key operations on the given repo.
func (*Client) Deployments ¶
func (c *Client) Deployments(workspace, repo string) *DeploymentResource
Deployments returns a resource for deployment operations on the given repo.
func (*Client) Downloads ¶
func (c *Client) Downloads(workspace, repo string) *DownloadResource
Downloads returns a resource for download artifact operations on the given repo.
func (*Client) Environments ¶
func (c *Client) Environments(workspace, repo string) *EnvironmentResource
Environments returns a resource for deployment environment operations on the given repo.
func (*Client) Issues ¶
func (c *Client) Issues(workspace, repo string) *IssueResource
Issues returns a resource for issue operations on the given repo.
func (*Client) Members ¶
func (c *Client) Members(workspace string) *MemberResource
Members returns a resource for workspace member operations.
func (*Client) PRs ¶
func (c *Client) PRs(workspace, repo string) *PRResource
PRs returns a PRResource scoped to the given workspace and repo.
func (*Client) Pipelines ¶
func (c *Client) Pipelines(workspace, repo string) *PipelineResource
Pipelines returns a resource for pipeline operations on the given repo.
func (*Client) Repos ¶
func (c *Client) Repos(workspace string) *RepoResource
Repos returns a resource for listing repositories in a workspace.
func (*Client) Restrictions ¶
func (c *Client) Restrictions(workspace, repo string) *BranchRestrictionResource
Restrictions returns a resource for branch restriction operations on the given repo.
func (*Client) Tags ¶
func (c *Client) Tags(workspace, repo string) *TagResource
Tags returns a resource for tag operations on the given repo.
func (*Client) Tasks ¶
func (c *Client) Tasks(workspace, repo string, prID int) *TaskResource
Tasks returns a TaskResource scoped to a specific PR.
func (*Client) User ¶
func (c *Client) User() *UserResource
User returns a resource for authenticated user operations.
func (*Client) Webhooks ¶
func (c *Client) Webhooks(workspace, repo string) *WebhookResource
Webhooks returns a resource for webhook operations on the given repo.
type Comment ¶
type Comment struct {
ID int `json:"id"`
Content Content `json:"content"`
User Actor `json:"user"`
Inline *Inline `json:"inline,omitempty"`
Parent *Parent `json:"parent,omitempty"`
}
Comment represents a PR comment.
type CommentResource ¶
type CommentResource struct {
// contains filtered or unexported fields
}
CommentResource provides operations on pull request comments.
func (*CommentResource) Add ¶
func (r *CommentResource) Add(ctx context.Context, input AddCommentInput) (Comment, error)
Add posts a new comment. Set input.Inline for an inline comment on a specific file/line.
type Commit ¶
type Commit struct {
Hash string `json:"hash"`
Date string `json:"date"`
Message string `json:"message"`
Author CommitAuthor `json:"author"`
Parents []CommitParent `json:"parents"`
}
type CommitAuthor ¶
type CommitParent ¶
type CommitParent struct {
Hash string `json:"hash"`
}
type CommitResource ¶
type CommitResource struct {
// contains filtered or unexported fields
}
CommitResource provides operations on commits and file contents within a repository.
func (*CommitResource) File ¶
File returns the raw content of a file at the given ref (branch, tag, or commit hash). The response is plain text, not JSON.
type Content ¶
type Content struct {
Raw string `json:"raw"`
}
Content holds the raw text of a comment.
type CreateBranchInput ¶
type CreateBranchInput struct {
Name string `json:"name"`
Target BranchTarget `json:"target"`
}
type CreateIssueInput ¶
type CreatePRInput ¶
type CreatePRInput struct {
Title string `json:"title"`
Description string `json:"description,omitempty"`
Source Endpoint `json:"source"`
Destination Endpoint `json:"destination"`
CloseSourceBranch bool `json:"close_source_branch"`
}
CreatePRInput holds the request body for creating a PR.
type CreateTagInput ¶
type CreateTagInput struct {
Name string `json:"name"`
Target BranchTarget `json:"target"`
}
type CreateWebhookInput ¶
type DeployKeyResource ¶
type DeployKeyResource struct {
// contains filtered or unexported fields
}
DeployKeyResource provides operations on repository deploy keys.
func (*DeployKeyResource) Add ¶
Add creates a new deploy key with the given label and SSH public key.
type Deployable ¶
type Deployable struct {
Commit *DeployableCommit `json:"commit,omitempty"`
Pipeline *DeployablePipeline `json:"pipeline,omitempty"`
}
type DeployableCommit ¶
type DeployableCommit struct {
Hash string `json:"hash"`
}
type DeployablePipeline ¶
type DeployablePipeline struct {
UUID string `json:"uuid"`
}
type Deployment ¶
type Deployment struct {
UUID string `json:"uuid"`
State DeploymentState `json:"state"`
Environment DeploymentEnvRef `json:"environment"`
Deployable Deployable `json:"deployable"`
LastUpdateTime string `json:"last_update_time"`
}
type DeploymentEnvRef ¶
type DeploymentEnvRef struct {
UUID string `json:"uuid"`
}
type DeploymentResource ¶
type DeploymentResource struct {
// contains filtered or unexported fields
}
DeploymentResource provides operations on repository deployments.
func (*DeploymentResource) List ¶
func (r *DeploymentResource) List(ctx context.Context) ([]Deployment, error)
List returns the most recent deployments, newest first.
type DeploymentState ¶
type DeploymentState struct {
Name string `json:"name"`
Status *DeploymentStatus `json:"status,omitempty"`
}
type DeploymentStatus ¶
type DeploymentStatus struct {
Name string `json:"name"` // "SUCCESSFUL", "FAILED"
}
type DownloadResource ¶
type DownloadResource struct {
// contains filtered or unexported fields
}
DownloadResource provides operations on repository downloads.
func (*DownloadResource) Delete ¶
func (r *DownloadResource) Delete(ctx context.Context, filename string) error
Delete removes a download artifact by filename.
func (*DownloadResource) List ¶
func (r *DownloadResource) List(ctx context.Context) ([]Download, error)
List returns all downloads attached to the repository.
type Endpoint ¶
type Endpoint struct {
Branch struct {
Name string `json:"name"`
} `json:"branch"`
}
Endpoint is a branch reference used in PR source/destination.
func NewEndpoint ¶
NewEndpoint builds an Endpoint from a branch name.
type Environment ¶
type Environment struct {
UUID string `json:"uuid"`
Name string `json:"name"`
EnvironmentType EnvironmentType `json:"environment_type"`
Lock EnvironmentLock `json:"lock"`
}
type EnvironmentLock ¶
type EnvironmentLock struct {
Name string `json:"name"` // "UNLOCKED", "LOCKED"
}
type EnvironmentResource ¶
type EnvironmentResource struct {
// contains filtered or unexported fields
}
EnvironmentResource provides operations on repository deployment environments.
func (*EnvironmentResource) List ¶
func (r *EnvironmentResource) List(ctx context.Context) ([]Environment, error)
List returns all deployment environments in the repository.
type EnvironmentType ¶
type EnvironmentType struct {
Name string `json:"name"` // "Production", "Staging", "Test"
}
type Issue ¶
type Issue struct {
ID int `json:"id"`
Title string `json:"title"`
State string `json:"state"`
Priority string `json:"priority"`
Kind string `json:"kind"`
Content Content `json:"content"`
Reporter Actor `json:"reporter"`
Assignee *Actor `json:"assignee,omitempty"`
CreatedOn string `json:"created_on"`
UpdatedOn string `json:"updated_on"`
Links Links `json:"links"`
}
type IssueResource ¶
type IssueResource struct {
// contains filtered or unexported fields
}
IssueResource provides operations on repository issues.
func (*IssueResource) Create ¶
func (r *IssueResource) Create(ctx context.Context, input CreateIssueInput) (Issue, error)
Create creates a new issue with the provided fields.
type Links ¶
type Links struct {
HTML struct {
Href string `json:"href"`
} `json:"html"`
}
Links holds href references returned by the API.
type MemberResource ¶
type MemberResource struct {
// contains filtered or unexported fields
}
MemberResource provides operations on workspace members.
func (*MemberResource) List ¶
func (r *MemberResource) List(ctx context.Context) ([]WorkspaceMember, error)
List returns all members of the workspace.
type PR ¶
type PR struct {
ID int `json:"id"`
Title string `json:"title"`
State string `json:"state"`
Description string `json:"description"`
Source Endpoint `json:"source"`
Destination Endpoint `json:"destination"`
Author Actor `json:"author"`
Links Links `json:"links"`
}
PR represents a Bitbucket pull request.
type PRResource ¶
type PRResource struct {
// contains filtered or unexported fields
}
PRResource provides operations on pull requests within a specific repo.
func (*PRResource) Approve ¶
func (r *PRResource) Approve(ctx context.Context, prID int) error
Approve approves the pull request.
func (*PRResource) Create ¶
func (r *PRResource) Create(ctx context.Context, input CreatePRInput) (PR, error)
Create opens a new pull request.
func (*PRResource) Decline ¶
func (r *PRResource) Decline(ctx context.Context, prID int) error
Decline declines the pull request.
func (*PRResource) Diff ¶
Diff returns the raw patch text for the pull request. The response is plain text (not JSON).
type Parent ¶
type Parent struct {
ID int `json:"id"`
}
Parent is a reference to a parent comment for replies.
type Pipeline ¶
type Pipeline struct {
UUID string `json:"uuid"`
BuildNumber int `json:"build_number"`
State PipelineState `json:"state"`
Target PipelineTarget `json:"target"`
CreatedOn string `json:"created_on"`
CompletedOn string `json:"completed_on"`
}
type PipelineCommit ¶
type PipelineCommit struct {
Hash string `json:"hash"`
}
type PipelineResource ¶
type PipelineResource struct {
// contains filtered or unexported fields
}
PipelineResource provides operations on repository pipelines.
func (*PipelineResource) List ¶
func (r *PipelineResource) List(ctx context.Context) ([]Pipeline, error)
List returns the most recent pipelines, newest first.
func (*PipelineResource) Log ¶
Log returns the raw log output for a pipeline step (plain text, not JSON).
func (*PipelineResource) Steps ¶
func (r *PipelineResource) Steps(ctx context.Context, pipelineUUID string) ([]PipelineStep, error)
Steps returns all steps of a pipeline.
type PipelineResult ¶
type PipelineResult struct {
Name string `json:"name"`
}
type PipelineState ¶
type PipelineState struct {
Name string `json:"name"`
Result *PipelineResult `json:"result,omitempty"`
}
type PipelineStep ¶
type PipelineStep struct {
UUID string `json:"uuid"`
Name string `json:"name"`
State PipelineState `json:"state"`
StartedOn string `json:"started_on"`
CompletedOn string `json:"completed_on"`
}
type PipelineTarget ¶
type PipelineTarget struct {
RefType string `json:"ref_type"`
RefName string `json:"ref_name"`
Commit *PipelineCommit `json:"commit,omitempty"`
}
type RepoResource ¶
type RepoResource struct {
// contains filtered or unexported fields
}
RepoResource provides operations on repositories within a workspace.
type Tag ¶
type Tag struct {
Name string `json:"name"`
Target BranchTarget `json:"target"`
Links Links `json:"links"`
}
type TagResource ¶
type TagResource struct {
// contains filtered or unexported fields
}
TagResource provides operations on repository tags.
func (*TagResource) Create ¶
Create creates a new tag pointing at the given commit hash or branch name.
type Task ¶
type Task struct {
ID int `json:"id"`
Description string `json:"description"`
State string `json:"state"` // RESOLVED or UNRESOLVED
}
Task represents a PR task.
type TaskResource ¶
type TaskResource struct {
// contains filtered or unexported fields
}
TaskResource provides operations on pull request tasks.
type TriggerPipelineInput ¶
type TriggerPipelineInput struct {
Target TriggerTarget `json:"target"`
}
type TriggerTarget ¶
type UserResource ¶
type UserResource struct {
// contains filtered or unexported fields
}
UserResource provides operations on the authenticated user.
type WebhookResource ¶
type WebhookResource struct {
// contains filtered or unexported fields
}
WebhookResource provides operations on repository webhooks.
func (*WebhookResource) Create ¶
func (r *WebhookResource) Create(ctx context.Context, input CreateWebhookInput) (Webhook, error)
Create adds a new webhook to the repository.