bitbucket

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EventIDHeader        = "X-Request-Id"
	EventKeyHeader       = "X-Event-Key"
	EventSignatureHeader = "X-Hub-Signature"
)
View Source
const (
	Version = "v1.0.0"
)

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

func ParsePayload added in v0.1.0

func ParsePayload(r *http.Request, key []byte) (interface{}, []byte, error)

func ParsePayloadWithoutSignature added in v1.0.0

func ParsePayloadWithoutSignature(r *http.Request) (interface{}, []byte, error)

func ValidateSignature added in v1.0.0

func ValidateSignature(r *http.Request, payload []byte, key []byte) error

Types

type AccessToken

type AccessToken struct {
	ID          string       `json:"id,omitempty"`
	Name        string       `json:"name"`
	Permissions []Permission `json:"permissions"`
	Created     *DateTime    `json:"createdDate,omitempty"`
	Expire      *DateTime    `json:"expiryDate,omitempty"`
	ExpireDays  int          `json:"expiryDays,omitempty"`
	Token       string       `json:"token,omitempty"`
	User        *User        `json:"user,omitempty"`
}

type AccessTokenList added in v0.0.4

type AccessTokenList struct {
	ListResponse
	Tokens []*AccessToken `json:"values"`
}

type AccessTokensService

type AccessTokensService service

func (*AccessTokensService) CreateRepositoryToken

func (s *AccessTokensService) CreateRepositoryToken(ctx context.Context, projectKey, repositorySlug string, token *AccessToken) (*AccessToken, *Response, error)

func (*AccessTokensService) CreateUserToken

func (s *AccessTokensService) CreateUserToken(ctx context.Context, userSlug string, token *AccessToken) (*AccessToken, *Response, error)

func (*AccessTokensService) DeleteRepositoryToken

func (s *AccessTokensService) DeleteRepositoryToken(ctx context.Context, projectKey, repositorySlug, tokenId string) (*Response, error)

func (*AccessTokensService) DeleteUserToken

func (s *AccessTokensService) DeleteUserToken(ctx context.Context, userSlug, tokenId string) (*Response, error)

func (*AccessTokensService) GetRepositoryToken

func (s *AccessTokensService) GetRepositoryToken(ctx context.Context, projectKey, repositorySlug, tokenId string) (*AccessToken, *Response, error)

func (*AccessTokensService) GetUserToken

func (s *AccessTokensService) GetUserToken(ctx context.Context, userSlug, tokenId string) (*AccessToken, *Response, error)

func (*AccessTokensService) ListRepositoryTokens

func (s *AccessTokensService) ListRepositoryTokens(ctx context.Context, projectKey, repositorySlug string, opts *ListOptions) ([]*AccessToken, *Response, error)

func (*AccessTokensService) ListUserTokens

func (s *AccessTokensService) ListUserTokens(ctx context.Context, userSlug string, opts *ListOptions) ([]*AccessToken, *Response, error)

type BasicAuthTransport added in v0.0.2

type BasicAuthTransport struct {
	Username string
	Password string
}

BasicAuthTransport supports creating a http client passing username/password as basic authentication header.

func (*BasicAuthTransport) Client added in v0.0.2

func (t *BasicAuthTransport) Client() *http.Client

Client returns an *http.Client that makes requests that are authenticated using HTTP Basic Authentication.

func (*BasicAuthTransport) RoundTrip added in v0.0.2

func (t *BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface.

type Branch added in v0.1.0

type Branch struct {
	ID              string     `json:"id"`
	DisplayID       string     `json:"displayId"`
	Type            BranchType `json:"type"`
	LatestCommit    string     `json:"latestCommit"`
	LatestChangeset string     `json:"latestChangeset"`
	Default         bool       `json:"isDefault"`
}

type BranchList added in v0.1.0

type BranchList struct {
	ListResponse

	Branches []*Branch `json:"values"`
}

type BranchSearchOptions added in v0.1.0

type BranchSearchOptions struct {
	ListOptions

	Filter string            `url:"filterText,omitempty"`
	Order  BranchSearchOrder `url:"orderBy,omitempty"`
}

type BranchSearchOrder added in v0.1.0

type BranchSearchOrder string
const (
	BranchSearchOrderAlpha    BranchSearchOrder = "ALPHABETICAL"
	BranchSearchOrderModified BranchSearchOrder = "MODIFICATION"
)

type BranchType added in v0.1.0

type BranchType string

type BuildStatus added in v0.1.0

type BuildStatus struct {
	Key         string                 `json:"key"`
	State       BuildStatusState       `json:"state"`
	URL         string                 `json:"url"`
	BuildNumber string                 `json:"buildNumber,omitempty"`
	Description string                 `json:"description,omitempty"`
	Duration    uint64                 `json:"duration,omitempty"`
	Ref         string                 `json:"ref,omitempty"`
	TestResult  *BuildStatusTestResult `json:"testResults,omitempty"`
}

type BuildStatusState added in v0.1.0

type BuildStatusState string
const (
	BuildStatusStateCancelled  BuildStatusState = "CANCELLED"
	BuildStatusStateFailed     BuildStatusState = "FAILED"
	BuildStatusStateInProgress BuildStatusState = "INPROGRESS"
	BuildStatusStateSuccessful BuildStatusState = "SUCCESSFUL"
	BuildStatusStateUnknown    BuildStatusState = "UNKNOWN"
)

type BuildStatusTestResult added in v0.1.0

type BuildStatusTestResult struct {
	Failed     uint32 `json:"failed"`
	Skipped    uint32 `json:"skipped"`
	Successful uint32 `json:"successful"`
}

type Change added in v0.1.2

type Change struct {
	ContentId  string            `json:"contentId"`
	Path       ChangePath        `json:"path"`
	Executable bool              `json:"executable"`
	Unchanged  int               `json:"percentUnchanged"`
	Type       ChangeType        `json:"type"`
	NodeType   ChangeNodeType    `json:"nodeType"`
	Properties map[string]string `json:"properties"`
}

type ChangeList added in v0.1.2

type ChangeList struct {
	ListResponse

	Changes []*Change `json:"values"`
}

type ChangeNodeType added in v0.1.2

type ChangeNodeType string

type ChangePath added in v0.1.2

type ChangePath struct {
	Components []string `json:"components"`
	Parent     string   `json:"parent"`
	Name       string   `json:"name"`
	Extension  string   `json:"extension"`
	Title      string   `json:"toString"`
}

type ChangeType added in v0.1.2

type ChangeType string

type Client

type Client struct {
	BaseURL *url.URL

	ApiVersion string
	UserAgent  string

	AccessTokens *AccessTokensService
	Keys         *KeysService
	Projects     *ProjectsService
	Users        *UsersService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseURL string, httpClient *http.Client) (*Client, error)

NewClient returns new Bitbucket client for accessing Bitbucket APIs

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, api, path string, v interface{}) (*Response, error)

func (*Client) GetPaged

func (c *Client) GetPaged(ctx context.Context, api, path string, v interface{}, opts interface{}) (*Response, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method, apiName, path string, body interface{}) (*http.Request, error)

NewRequest created a new http request to call the Bitbucket API

type Commit added in v0.1.0

type Commit struct {
	CommitData
	Parents []CommitData `json:"parents"`
}

type CommitData added in v0.1.0

type CommitData struct {
	ID        string   `json:"id"`
	DisplayID string   `json:"displayId"`
	Message   string   `json:"message"`
	Author    GitUser  `json:"author"`
	Authored  DateTime `json:"authorTimestamp"`
	Comitter  GitUser  `json:"committer"`
	Comitted  DateTime `json:"committerTimestamp"`
}

type CommitList added in v0.1.1

type CommitList struct {
	ListResponse

	Commits []*Commit `json:"values"`
}

type CommitSearchMerges added in v0.1.1

type CommitSearchMerges string
const (
	CommitSearchMergesExclude CommitSearchMerges = "exclude"
	CommitSearchMergesInclude CommitSearchMerges = "include"
	CommitSearchMergesOnly    CommitSearchMerges = "only"
)

type CommitSearchOptions added in v0.1.1

type CommitSearchOptions struct {
	ListOptions

	// An optional path to filter commits by
	Path string `url:"path,omitempty"`

	// If true, the commit history of the specified file will be followed past renames. Only valid for a path to a single file.
	FollowRenames bool `url:"followRenames,omitempty"`

	// The commit ID (SHA1) or ref (inclusively) to retrieve commits before
	Until string `url:"until,omitempty"`

	// The commit ID or ref (exclusively) to retrieve commits after
	Since string `url:"since,omitempty"`

	Merges CommitSearchMerges `json:"merges,omitempty"`

	// true to ignore missing commits, false otherwise
	IgnoreMissing bool `json:"ignoreMissing,omitempty"`
}

type DateTime

type DateTime time.Time

func (DateTime) MarshalJSON

func (t DateTime) MarshalJSON() ([]byte, error)

func (*DateTime) UnmarshalJSON

func (t *DateTime) UnmarshalJSON(bytes []byte) error

type ErrOnlyTextFilesSupported added in v0.0.6

type ErrOnlyTextFilesSupported struct{}

func (*ErrOnlyTextFilesSupported) Error added in v0.0.6

func (e *ErrOnlyTextFilesSupported) Error() string

type ErrorMessage

type ErrorMessage struct {
	Message   string `json:"message,omitempty"`
	Exception string `json:"exceptionName,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	*http.Response
	Errors []ErrorMessage
}

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type Event added in v0.1.1

type Event struct {
	EventKey EventKey `json:"eventKey"`
	Date     ISOTime  `json:"date"`
	Actor    User     `json:"actor"`
}

type EventKey added in v0.1.0

type EventKey string
const (
	EventKeyRepoRefsChanged           EventKey = "repo:refs_changed"      // Repo push
	EventKeyRepoModified              EventKey = "repo:modified"          // Repo changed (name)
	EventKeyRepoFork                  EventKey = "repo:fork"              // Repo forked
	EventKeyCommentAdded              EventKey = "repo:comment:added"     // Repo comment on commit added
	EventKeyCommentEdited             EventKey = "repo:comment:edited"    // Repo comment on commit edited
	EventKeyCommentDeleted            EventKey = "repo:comment:deleted"   // Repo comment on commit deleted
	EventKeyPullRequestOpened         EventKey = "pr:opened"              // Pull request opened
	EventKeyPullRequestFrom           EventKey = "pr:from_ref_updated"    // Pull request source ref updated
	EventKeyPullRequestTo             EventKey = "pr:to_ref_updated"      // Pull request target ref updated
	EventkeyPullRequestModified       EventKey = "pr:modified"            // Pull request modified (title, description, target)
	EventKeyPullRequestReviewer       EventKey = "pr:reviewer:updated"    // Pull request reviewers updated
	EventKeyPullRequestApproved       EventKey = "pr:reviewer:approved"   // Pull request approved by reviewer
	EventKeyPullRequestUnapproved     EventKey = "pr:reviewer:unapproved" // Pull request approval withdrawn by reviewer
	EventKeyPullRequestNeedsWork      EventKey = "pr:reviewer:needs_work" // Pull request reviewer marked "needs work"
	EventKeyPullRequestMerged         EventKey = "pr:merged"
	EventKeyPullRequestDeclined       EventKey = "pr:declined"
	EventKeyPullRequestDeleted        EventKey = "pr:deleted"
	EventKeyPullRequestCommentAdded   EventKey = "pr:comment:added"
	EventKeyPullRequestCommentEdited  EventKey = "pr:comment:edited"
	EventKeyPullRequestCommentDeleted EventKey = "pr:comment:deleted"
)

type FileConentOptions added in v0.0.6

type FileConentOptions struct {
	ListOptions

	At string `url:"at,omitempty"`
}

type FileContent added in v0.0.6

type FileContent struct {
	ListResponse

	Binary   bool       `json:"binary,omitempty"`
	Lines    []FileLine `json:"lines,omitempty"`
	Path     *FilePath  `json:"path,omitempty"`
	Revision string     `json:"revision,omitempty"`
}

type FileLine added in v0.0.6

type FileLine struct {
	Text string `json:"text"`
}

type FileList added in v0.0.6

type FileList struct {
	ListResponse

	Files []string `json:"values"`
}

type FilePath added in v0.0.6

type FilePath struct {
	Components []string `json:"components"`
	Parent     string   `json:"parent"`
	Name       string   `json:"name"`
	Extension  string   `json:"extension"`
}

type FilesListOptions added in v0.0.6

type FilesListOptions struct {
	ListOptions

	At string `url:"at,omitempty"`
}

type GitUser added in v0.1.0

type GitUser struct {
	Name  string `json:"name"`
	Email string `json:"emailAddress"`
}

type ISOTime added in v0.1.0

type ISOTime time.Time

func (ISOTime) MarshalJSON added in v0.1.0

func (t ISOTime) MarshalJSON() ([]byte, error)

func (*ISOTime) UnmarshalJSON added in v0.1.0

func (t *ISOTime) UnmarshalJSON(bytes []byte) error

type InternalSshKey added in v0.0.4

type InternalSshKey struct {
	Key struct {
		ID        uint64 `json:"id,omitempty"`
		Text      string `json:"text"`
		Label     string `json:"label"`
		Algorithm string `json:"algorithmType"`
		Length    uint   `json:"bitLength"`
	} `json:"key"`
	Permission Permission `json:"permission"`
}

type KeysService

type KeysService service

func (*KeysService) CreateRepositoryKey

func (s *KeysService) CreateRepositoryKey(ctx context.Context, projectKey, repositorySlug string, key *SshKey) (*SshKey, *Response, error)

func (*KeysService) DeleteRepositoryKey

func (s *KeysService) DeleteRepositoryKey(ctx context.Context, projectKey, repositorySlug string, keyId uint64) (*Response, error)

func (*KeysService) GetRepositoryKey

func (s *KeysService) GetRepositoryKey(ctx context.Context, projectKey, repositorySlug string, keyId uint64) (*SshKey, *Response, error)

func (*KeysService) ListRepositoryKeys

func (s *KeysService) ListRepositoryKeys(ctx context.Context, projectKey, repositorySlug string, opts *ListOptions) ([]*SshKey, *Response, error)
type Link struct {
	Href string `json:"href"`
	Name string `json:"name,omitempty"`
}

type ListOptions

type ListOptions struct {
	Limit uint `url:"limit,omitempty"`
	Start uint `url:"start,omitepmty"`
}

type ListResponse

type ListResponse struct {
	Size          uint `json:"size"`
	Limit         uint `json:"limit"`
	LastPage      bool `json:"isLastPage"`
	Start         uint `json:"start"`
	NextPageStart uint `json:"nextPageStart"`
}

ListResponse defines the common properties of a list response

func (*ListResponse) Current

func (r *ListResponse) Current() *Page

type Page

type Page struct {
	// The following properties support the paged APIs.
	Size     uint
	Limit    uint
	LastPage bool
	Start    uint
	// The next page start should be used with the ListOptions struct.
	NextPageStart uint
}

type Paged

type Paged interface {
	Current() *Page
}

Paged defines interface to be supported by responses from Paged APIs

type Permission

type Permission string
const (
	PermissionRepoRead      Permission = "REPO_READ"
	PermissionRepoWrite     Permission = "REPO_WRITE"
	PermissionRepoAdmin     Permission = "REPO_ADMIN"
	PermissionRepoCreate    Permission = "REPO_CREATE"
	PermissionProjectView   Permission = "PROJECT_VIEW"
	PermissionProjectRead   Permission = "PROJECT_READ"
	PermissionProjectWrite  Permission = "PROJECT_WRITE"
	PermissionProjectAdmin  Permission = "PROJECT_ADMIN"
	PermissionProjectCreate Permission = "PROJECT_CREATE"
	PermissionUserAdmin     Permission = "USER_ADMIN"
	PermissionLicensedUser  Permission = "LICENSED_USER"
	PermissionAdmin         Permission = "ADMIN"
	PermissionSysAdmin      Permission = "SYS_ADMIN"
)

type Project added in v0.0.7

type Project struct {
	ID    uint64            `json:"id,omitempty"`
	Key   string            `json:"key,omitempty"`
	Name  string            `json:"name"`
	Links map[string][]Link `json:"links,omitempty"`
}

type ProjectsService

type ProjectsService service

func (*ProjectsService) CreateBuildStatus added in v0.1.0

func (s *ProjectsService) CreateBuildStatus(ctx context.Context, projectKey, repositorySlug, commitId string, status *BuildStatus) (*Response, error)

func (*ProjectsService) CreateRepository

func (s *ProjectsService) CreateRepository(ctx context.Context, projectKey string, repo *Repository) (*Repository, *Response, error)

func (*ProjectsService) CreateWebhook added in v0.1.0

func (s *ProjectsService) CreateWebhook(ctx context.Context, projectKey, repositorySlug string, webhook *Webhook) (*Webhook, *Response, error)

func (*ProjectsService) DeleteRepository

func (s *ProjectsService) DeleteRepository(ctx context.Context, projectKey, repositorySlug string) (*Response, error)

func (*ProjectsService) DeleteWebhook added in v0.1.0

func (s *ProjectsService) DeleteWebhook(ctx context.Context, projectKey, repositorySlug string, id uint64) (*Response, error)

func (*ProjectsService) GetCommit added in v0.1.1

func (s *ProjectsService) GetCommit(ctx context.Context, projectKey, repositorySlug, commitId string) (*Commit, *Response, error)

func (*ProjectsService) GetDefaultBranch added in v0.1.0

func (s *ProjectsService) GetDefaultBranch(ctx context.Context, projectKey, repositorySlug string) (*Branch, *Response, error)

func (*ProjectsService) GetPullRequest added in v0.1.1

func (s *ProjectsService) GetPullRequest(ctx context.Context, projectKey, repositorySlug string, pullRequestId uint64) (*PullRequest, *Response, error)

func (*ProjectsService) GetRepository

func (s *ProjectsService) GetRepository(ctx context.Context, projectKey, repositorySlug string) (*Repository, *Response, error)

func (*ProjectsService) GetTextFileContent added in v0.0.6

func (s *ProjectsService) GetTextFileContent(ctx context.Context, projectKey, repositorySlug, path, at string) ([]byte, *Response, error)

func (*ProjectsService) GetWebhook added in v0.1.0

func (s *ProjectsService) GetWebhook(ctx context.Context, projectKey, repositorySlug string, id uint64) (*Webhook, *Response, error)

func (*ProjectsService) ListChanges added in v0.1.2

func (s *ProjectsService) ListChanges(ctx context.Context, projectKey, repositorySlug, commitId string, opts *ListOptions) ([]*Change, *Response, error)

func (*ProjectsService) ListFiles added in v0.0.6

func (s *ProjectsService) ListFiles(ctx context.Context, projectKey, repositorySlug, path string, opts *FilesListOptions) ([]string, *Response, error)

func (*ProjectsService) ListRepositories

func (s *ProjectsService) ListRepositories(ctx context.Context, projectKey string, opts *ListOptions) ([]*Repository, *Response, error)

func (*ProjectsService) ListWebhooks added in v0.1.0

func (s *ProjectsService) ListWebhooks(ctx context.Context, projectKey, repositorySlug string, opts *ListOptions) ([]*Webhook, *Response, error)

func (*ProjectsService) SearchBranches added in v0.1.0

func (s *ProjectsService) SearchBranches(ctx context.Context, projectKey, repositorySlug string, opts *BranchSearchOptions) ([]*Branch, *Response, error)

func (*ProjectsService) SearchCommits added in v0.1.1

func (s *ProjectsService) SearchCommits(ctx context.Context, projectKey, repositorySlug string, opts *CommitSearchOptions) ([]*Commit, *Response, error)

func (*ProjectsService) SearchPullRequests added in v0.1.1

func (s *ProjectsService) SearchPullRequests(ctx context.Context, projectKey, repositorySlug string, opts *PullRequestSearchOptions) ([]*PullRequest, *Response, error)

func (*ProjectsService) SearchRepositories added in v0.0.6

func (s *ProjectsService) SearchRepositories(ctx context.Context, opts *RepositorySearchOptions) ([]*Repository, *Response, error)

type PullRequest added in v0.1.0

type PullRequest struct {
	ID           uint64                   `json:"id,omitempty"`
	Version      uint64                   `json:"version,omitempty"`
	Title        string                   `json:"title"`
	State        PullRequestState         `json:"state"`
	Open         bool                     `json:"open"`
	Closed       bool                     `json:"closed"`
	Created      *DateTime                `json:"createdDate"`
	Updated      *DateTime                `json:"updatedDate"`
	Source       PullRequestRef           `json:"fromRef"`
	Target       PullRequestRef           `json:"toRef"`
	Locked       bool                     `json:"locked"`
	Author       PullRequestParticipant   `json:"author"`
	Reviewers    []PullRequestParticipant `json:"reviewers"`
	Participants []PullRequestParticipant `json:"participants"`
}

type PullRequestAuthorRole added in v0.1.0

type PullRequestAuthorRole string
const (
	PullRequestAuthorRoleAuthor      PullRequestAuthorRole = "AUTHOR"
	PullRequestAuthorRoleReviewer    PullRequestAuthorRole = "REVIEWER"
	PullRequestAuthorRoleParticipant PullRequestAuthorRole = "PARTICIPANT"
)

type PullRequestAuthorStatus added in v0.1.0

type PullRequestAuthorStatus string
const (
	PullRequestAuthorStatusApproved   PullRequestAuthorStatus = "APPROVED"
	PullRequestAuthorStatusUnapproved PullRequestAuthorStatus = "UNAPPROVED"
	PullRequestAuthorStatusNeedsWork  PullRequestAuthorStatus = "NEEDS_WORK"
)

type PullRequestEvent added in v0.1.0

type PullRequestEvent struct {
	Event

	PullRequest PullRequest `json:"pullRequest"`
}

type PullRequestList added in v0.1.1

type PullRequestList struct {
	ListResponse

	PullRequests []*PullRequest `json:"values"`
}

type PullRequestParticipant added in v0.1.0

type PullRequestParticipant struct {
	Author   User                    `json:"user"`
	Role     PullRequestAuthorRole   `json:"role"`
	Approved bool                    `json:"approved"`
	Status   PullRequestAuthorStatus `json:"status"`
	Commit   string                  `json:"lastReviewedCommit,omitempty"`
}

type PullRequestRef added in v0.1.0

type PullRequestRef struct {
	ID         string     `json:"id"`
	DisplayID  string     `json:"displayId"`
	Latest     string     `json:"latestCommit"`
	Repository Repository `json:"repository"`
}

type PullRequestSearchOptions added in v0.1.1

type PullRequestSearchOptions struct {
	ListOptions

	At     string            `url:"at,omitempty"`
	Filter string            `url:"filterText,omitempty"`
	State  *PullRequestState `url:"state,omitempty"`
}

type PullRequestState added in v0.1.0

type PullRequestState string
const (
	PullRequestStateDeclined PullRequestState = "DECLINED"
	PullRequestStateMerged   PullRequestState = "MERGED"
	PullRequestStateOpen     PullRequestState = "OPEN"
)

type Repository

type Repository struct {
	ID          uint64            `json:"id,omitempty"`
	Slug        string            `json:"slug,omitempty"`
	ScmID       string            `json:"scmId"`
	Name        string            `json:"name"`
	Description string            `json:"description,omitempty"`
	Public      bool              `json:"public,omitempty"`
	Archived    bool              `json:"archived,omitempty"`
	State       *RepositoryState  `json:"state,omitempty"`
	Project     *Project          `json:"project,omitempty"`
	Links       map[string][]Link `json:"links,omitempty"`
}

type RepositoryArchived added in v0.0.6

type RepositoryArchived string
const (
	RepositoryArchivedActive   RepositoryArchived = "ACTIVE"
	RepositoryArchivedArchived RepositoryArchived = "ARCHIVED"
	RepositoryArchivedAll      RepositoryArchived = "ALL"
)

type RepositoryList added in v0.0.4

type RepositoryList struct {
	ListResponse
	Repositories []*Repository `json:"values"`
}

type RepositoryPushEvent added in v0.1.0

type RepositoryPushEvent struct {
	Event

	Repository Repository                  `json:"repository"`
	Changes    []RepositoryPushEventChange `json:"changes"`
	Commits    []Commit                    `json:"commits,omitempty"`
	ToCommit   *Commit                     `json:"toCommit,omitempty"`
}

type RepositoryPushEventChange added in v0.1.0

type RepositoryPushEventChange struct {
	Ref      RepositoryPushEventRef        `json:"ref"`
	RefId    string                        `json:"refId"`
	FromHash string                        `json:"fromHash"`
	ToHash   string                        `json:"toHash"`
	Type     RepositoryPushEventChangeType `json:"type"`
}

type RepositoryPushEventChangeType added in v0.1.0

type RepositoryPushEventChangeType string
const (
	RepositoryPushEventChangeTypeAdd    RepositoryPushEventChangeType = "ADD"
	RepositoryPushEventChangeTypeUpdate RepositoryPushEventChangeType = "UPDATE"
	RepositoryPushEventChangeTypeDelete RepositoryPushEventChangeType = "DELETE"
)

type RepositoryPushEventRef added in v0.1.0

type RepositoryPushEventRef struct {
	ID        string                     `json:"id"`
	DisplayID string                     `json:"displayId"`
	Type      RepositoryPushEventRefType `json:"type"`
}

type RepositoryPushEventRefType added in v0.1.0

type RepositoryPushEventRefType string
const (
	RepositoryPushEventRefTypeBranch RepositoryPushEventRefType = "BRANCH"
	RepositoryPushEventRefTypeTag    RepositoryPushEventRefType = "TAG"
)

type RepositorySearchOptions added in v0.0.6

type RepositorySearchOptions struct {
	ListOptions

	Archived    RepositoryArchived   `url:"archived,omitempty"`
	ProjectName string               `url:"projectname,omitempty"`
	ProjectKey  string               `url:"projectkey,omitempty"`
	Visibility  RepositoryVisibility `url:"visibility,omitempty"`
	Name        string               `url:"name,omitempty"`
	Permission  Permission           `url:"permission,omitempty"`
	State       RepositoryState      `url:"state,omitempty"`
}

type RepositoryState

type RepositoryState string
const (
	RepositoryStateAvailable  RepositoryState = "AVAILABLE"
	RepositoryStateInitFailed RepositoryState = "INITIALISATION_FAILED"
	RepositoryStateInit       RepositoryState = "INITIALISING"
	RepositoryStateOffline    RepositoryState = "OFFLINE"
)

type RepositoryVisibility added in v0.0.6

type RepositoryVisibility string
const (
	RepositoryVisbibilityPrivate RepositoryVisibility = "private"
	RepositoryVisbibilityPublic  RepositoryVisibility = "public"
)

type Response

type Response struct {
	*http.Response
	*Page
}

type SshKey

type SshKey struct {
	ID         uint64
	Text       string
	Label      string
	Algorithm  string
	Length     uint
	Permission Permission
}

SshKey defines Bitbucket representation of ssh-key

type SshKeyList added in v0.0.4

type SshKeyList struct {
	ListResponse
	Keys []InternalSshKey `json:"values"`
}

type User added in v0.0.3

type User struct {
	ID          uint64   `json:"id,omitempty"`
	Name        string   `json:"name"`
	Slug        string   `json:"slug"`
	Active      bool     `json:"active"`
	DisplayName string   `json:"displayName"`
	Email       string   `json:"emailAddress,omitempty"`
	Type        UserType `json:"type,omitempty"`
}

type UserType added in v0.1.0

type UserType string
const (
	UserTypeNormal  UserType = "NORMAL"
	UserTypeService UserType = "SERVICE"
)

type UsersService added in v0.1.0

type UsersService service

func (*UsersService) GetUser added in v0.1.0

func (s *UsersService) GetUser(ctx context.Context, userSlug string) (*User, *Response, error)

type Webhook added in v0.1.0

type Webhook struct {
	ID      uint64                `json:"id,omitempty"`
	Name    string                `json:"name"`
	Created *DateTime             `json:"createdDate,omitempty"`
	Updated *DateTime             `json:"updatedDate,omitempty"`
	Events  []EventKey            `json:"events"`
	Config  *WebhookConfiguration `json:"configuration,omitempty"`
	URL     string                `json:"url"`
	Active  bool                  `json:"active"`
}

type WebhookConfiguration added in v0.1.0

type WebhookConfiguration struct {
	Secret string `json:"secret,omitempty"`
}

type WebhookList added in v0.1.0

type WebhookList struct {
	ListResponse
	Webhooks []*Webhook `json:"values"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL