Documentation
¶
Index ¶
- Variables
- func ExtractCloneLinks(clones []CloneLink) (httpLink, sshLink string)
- type Attachment
- type AttachmentRoot
- type AuthInfo
- type Change
- type ChangesProperties
- type ChangesPropertiesValues
- type ChangesResponse
- type Client
- type CloneLink
- type Error
- type ErrorList
- type File
- type Link
- type Links
- type MergeResult
- type Project
- type ProjectsService
- type PullRequest
- func (pr *PullRequest) AddComment(commentText string, paths []string) (*PullRequest, error)
- func (pr *PullRequest) AddRole(role, login string) (*UserData, error)
- func (pr *PullRequest) AttachFileToRepository(path string) (*Attachment, string, error)
- func (pr *PullRequest) GetChanges() (*[]Change, error)
- func (pr *PullRequest) SetStatus(status, login string) (*PullRequest, error)
- type PullRequestsService
- type Reference
- type RepositoriesService
- type Repository
- type Response
- type User
- type UserData
Constants ¶
This section is empty.
Variables ¶
var ( // ChangeTypes defines the possible types of changes in a pull request. // TODO: move to global config ChangeTypes = []string{"ADD", "MODIFY"} )
Functions ¶
func ExtractCloneLinks ¶
ExtractCloneLinks parses the clone links from the repository information and returns the HTTP and SSH URLs.
Types ¶
type Attachment ¶
type Attachment struct { ID string `json:"id"` URL string `json:"url"` Links struct { Self Link `json:"self,omitempty"` Attachment Link `json:"attachment,omitempty"` } `json:"links"` }
Attachments represents an attachment with associated links.
type AttachmentRoot ¶
type AttachmentRoot struct {
Attachments []Attachment `json:"attachments"`
}
AttachmentRoot represents the root structure of the attachment's JSON response.
type AuthInfo ¶
type AuthInfo struct { Username string // Username for Bitbucket access Token string // Token for basic authentication }
AuthInfo holds authentication details for Bitbucket access.
type Change ¶
type Change struct { ContentID string `json:"contentId"` FromContentID string `json:"fromContentId"` Path *File `json:"path,omitempty"` Executable bool `json:"executable,omitempty"` Type string `json:"type"` NodeType string `json:"nodeType"` PercentUnchanged int `json:"percentUnchanged,omitempty"` Links Links `json:"links,omitempty"` Properties *ChangesPropertiesValues `json:"properties"` }
Change details a single file change within a repository, providing metadata about the modification.
type ChangesProperties ¶
type ChangesProperties struct {
ChangeScope string `json:"changeScope"`
}
ChangesProperties defines properties associated with a set of changes, typically related to the scope.
type ChangesPropertiesValues ¶
type ChangesPropertiesValues struct {
ChangeScope string `json:"changeScope"`
}
ChangesPropertiesValues holds detailed values for properties associated with a single change.
type ChangesResponse ¶
type ChangesResponse[T any] struct { Response[T] FromHash string `json:"fromHash"` ToHash string `json:"toHash"` Properties *ChangesProperties `json:"properties"` }
ChangesResponse represents a collection of change details within a git context.
type Client ¶
type Client struct { HTTPClient *httpclient.Client BaseURL string Logger hclog.Logger Repositories RepositoriesService Projects ProjectsService PullRequests PullRequestsService }
Client configures and manages access to the API, holding service implementations and an HTTP client.
type Error ¶
type Error struct { Context string `json:"context"` Message string `json:"message"` ExceptionName string `json:"exceptionName"` }
Error provides detailed information about an error occurred during API interactions.
type ErrorList ¶
type ErrorList struct {
Errors []Error `json:"errors"`
}
ErrorList encapsulates potential API error responses.
type File ¶
type File struct { Components []string `json:"components"` Parent string `json:"parent"` Name string `json:"name"` Extension string `json:"extension"` ToString string `json:"toString"` }
File represents a file within a repository showing its structure and metadata.
type Link ¶
type Link struct {
Href string `json:"href,omitempty"`
}
Link represents a direct link to the resource itself.
type Links ¶
type Links struct { Clone []CloneLink `json:"clone,omitempty"` Self []Link `json:"self,omitempty"` }
Links stores URLs for accessing related resources.
type MergeResult ¶
MergeResult encapsulates the result of a merge attempt in a pull request.
type Project ¶
type Project struct { Key string `json:"key"` ID int `json:"id"` Name string `json:"name"` Description string `json:"description"` Public bool `json:"public,omitempty"` Type string `json:"type"` Links Links `json:"links"` }
Project represents a project within Bitbucket, providing a container for repositories.
type ProjectsService ¶
ProjectsService defines the interface for project-related operations.
func NewProjectsService ¶
func NewProjectsService(client *Client, limit int) ProjectsService
NewProjectsService initializes a new projects service with a given pagination limit.
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,omitempty"` Closed bool `json:"closed,omitempty"` CreatedDate int64 `json:"createdDate"` UpdatedDate int64 `json:"updatedDate"` FromReference Reference `json:"fromRef"` ToReference Reference `json:"toRef"` Locked bool `json:"locked,omitempty"` Author *UserData `json:"author,omitempty"` Reviewers []UserData `json:"reviewers"` Participants []UserData `json:"participants,omitempty"` Properties struct { MergeResult MergeResult `json:"mergeResult"` ResolvedTaskCount int `json:"resolvedTaskCount"` OpenTaskCount int `json:"openTaskCount"` } `json:"properties"` Links Links `json:"links"` // contains filtered or unexported fields }
PullRequest defines the basic structure of a pull request within Bitbucket.
func (*PullRequest) AddComment ¶
func (pr *PullRequest) AddComment(commentText string, paths []string) (*PullRequest, error)
AddComment adds a comment to a specific pull request along with optional file attachments.
func (*PullRequest) AddRole ¶
func (pr *PullRequest) AddRole(role, login string) (*UserData, error)
AddRole adds a user to a pull request with a specified role.
func (*PullRequest) AttachFileToRepository ¶
func (pr *PullRequest) AttachFileToRepository(path string) (*Attachment, string, error)
AttachFileToRepository uploads a file to a specific repository and returns the attachment details and file name.
func (*PullRequest) GetChanges ¶
func (pr *PullRequest) GetChanges() (*[]Change, error)
GetChanges retrieves the changes for a pull request.
func (*PullRequest) SetStatus ¶
func (pr *PullRequest) SetStatus(status, login string) (*PullRequest, error)
SetStatus sets the status of a specified pull request.
type PullRequestsService ¶
type PullRequestsService interface {
Get(project, repository string, id int) (*PullRequest, error)
}
PullRequestsService defines the interface for pull request-related operations.
func NewPullRequestsService ¶
func NewPullRequestsService(client *Client, limit int) PullRequestsService
NewPullRequestsService initializes a new pull requests service with a given pagination limit.
type Reference ¶
type Reference struct { ID string `json:"id"` DisplayID string `json:"displayId"` LatestCommit string `json:"latestCommit"` Repository Repository `json:"repository"` }
Reference represents a specific state or reference point in a repository.
type RepositoriesService ¶
type RepositoriesService interface { List(project string) (*[]Repository, error) ListUserRepos(username string) (*[]Repository, error) }
RepositoriesService defines the interface for repository-related operations.
func NewRepositoriesService ¶
func NewRepositoriesService(client *Client, limit int) RepositoriesService
NewRepositoriesService initializes a new repositories service with a given pagination limit.
type Repository ¶
type Repository 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,omitempty"` Project *Project `json:"project,omitempty"` Public bool `json:"public"` Archived bool `json:"archived,omitempty"` Links Links `json:"links"` Origin *Repository `json:"origin,omitempty"` }
Repository represents a repository in Bitbucket, including its project container and metadata.
type Response ¶
type Response[T any] struct { NextPageStart *int `json:"nextPageStart"` IsLastPage bool `json:"isLastPage"` Limit int `json:"limit"` Size int `json:"size"` Start int `json:"start"` Values []T `json:"values"` }
Response wraps API responses that include pagination details.
type User ¶
type User struct { Name string `json:"name,omitempty"` EmailAddress string `json:"emailAddress,omitempty"` ID int `json:"id,omitempty"` DisplayName string `json:"displayName,omitempty"` Active bool `json:"active,omitempty"` Slug string `json:"slug,omitempty"` Type string `json:"type,omitempty"` Links Links `json:"links,omitempty"` }
User represents a user within Bitbucket.