Documentation ¶
Index ¶
- Constants
- Variables
- func IsValidSender(ip string) bool
- type Account
- type Branch
- type BranchFile
- type Broker
- type BrokerField
- type BrokerProfile
- type BrokerResource
- func (r *BrokerResource) Create(owner, slug, link, brokerType string) (*Broker, error)
- func (r *BrokerResource) CreateUpdate(owner, slug, link, brokerType string) (*Broker, error)
- func (r *BrokerResource) Delete(owner, slug string, id int) error
- func (r *BrokerResource) DeleteUrl(owner, slug, url, brokerType string) error
- func (r *BrokerResource) Find(owner, slug string, id int) (*Broker, error)
- func (r *BrokerResource) FindUrl(owner, slug, link, brokerType string) (*Broker, error)
- func (r *BrokerResource) GetPatch(owner, slug string, id int) (string, error)
- func (r *BrokerResource) List(owner, slug string) ([]*Broker, error)
- func (r *BrokerResource) Update(owner, slug, link, brokerType string, id int) (*Broker, error)
- type Client
- type Commit
- type Email
- type EmailResource
- type File
- type Key
- type KeyResource
- func (r *KeyResource) Create(account, key, label string) (*Key, error)
- func (r *KeyResource) CreateUpdate(account, key, label string) (*Key, error)
- func (r *KeyResource) Delete(account string, id int) error
- func (r *KeyResource) Find(account string, id int) (*Key, error)
- func (r *KeyResource) FindName(account, label string) (*Key, error)
- func (r *KeyResource) List(account string) ([]*Key, error)
- func (r *KeyResource) Update(account, key, label string, id int) (*Key, error)
- type PostReceiveHook
- type PullRequestHook
- type Repo
- type RepoKeyResource
- func (r *RepoKeyResource) Create(owner, slug, key, label string) (*Key, error)
- func (r *RepoKeyResource) CreateUpdate(owner, slug, key, label string) (*Key, error)
- func (r *RepoKeyResource) Delete(owner, slug string, id int) error
- func (r *RepoKeyResource) DeleteName(owner, slug, label string) error
- func (r *RepoKeyResource) Find(owner, slug string, id int) (*Key, error)
- func (r *RepoKeyResource) FindName(owner, slug, label string) (*Key, error)
- func (r *RepoKeyResource) List(owner, slug string) ([]*Key, error)
- func (r *RepoKeyResource) Update(owner, slug, key, label string, id int) (*Key, error)
- type RepoResource
- func (r *RepoResource) Find(owner, slug string) (*Repo, error)
- func (r *RepoResource) List() ([]*Repo, error)
- func (r *RepoResource) ListBranches(owner, slug string) ([]*Branch, error)
- func (r *RepoResource) ListDashboard() ([]*Account, error)
- func (r *RepoResource) ListDashboardRepos() ([]*Repo, error)
- func (r *RepoResource) ListUser(owner string) ([]*Repo, error)
- type Source
- type SourceResource
- type Team
- type TeamResource
- type User
- type UserResource
Constants ¶
const ( TeamRoleAdmin = "admin" TeamRoleCollab = "collaborator" )
const BrokerTypePost = "POST"
Bitbucket POSTs to the service URL you specify. The service receives an POST whenever user pushes to the repository.
const BrokerTypePullRequestPost = "Pull Request POST"
Variables ¶
var ( // Returned if the specified resource does not exist. ErrNotFound = errors.New("Not Found") // Returned if the caller attempts to make a call or modify a resource // for which the caller is not authorized. // // The request was a valid request, the caller's authentication credentials // succeeded but those credentials do not grant the caller permission to // access the resource. ErrForbidden = errors.New("Forbidden") // Returned if the call requires authentication and either the credentials // provided failed or no credentials were provided. ErrNotAuthorized = errors.New("Unauthorized") // Returned if the caller submits a badly formed request. For example, // the caller can receive this return if you forget a required parameter. ErrBadRequest = errors.New("Bad Request") )
var DefaultClient = http.DefaultClient
DefaultClient uses DefaultTransport, and is used internall to execute all http.Requests. This may be overriden for unit testing purposes.
IMPORTANT: this is not thread safe and should not be touched with the exception overriding for mock unit testing.
var ErrInvalidPostReceiveHook = errors.New("Invalid Post Receive Hook")
var (
ErrNilClient = errors.New("client is nil")
)
var Guest = New("", "", "", "")
Guest Client that can be used to access public APIs that do not require authentication.
Functions ¶
func IsValidSender ¶
Check's to see if the Post-Receive Build Hook is coming from a valid sender (IP Address)
Types ¶
type BranchFile ¶
type Broker ¶
type Broker struct { // A Bitbucket assigned integer representing a unique // identifier for the service. Id int `json:"id"` // A profile describing the service. Profile *BrokerProfile `json:"service"` }
type BrokerField ¶
type BrokerProfile ¶
type BrokerProfile struct { // One of the supported services. The type is a // case-insensitive value. Type string `json:"type"` // A parameter array containing a name and value pair // for each parameter associated with the service. Fields []*BrokerField `json:"fields"` }
type BrokerResource ¶
type BrokerResource struct {
// contains filtered or unexported fields
}
Bitbucket offers integration with external services by allowing a set of services, or brokers, to run at certain events.
The Bitbucket services resource provides functionality for adding, removing, and configuring brokers on your repositories. All the methods on this resource require the caller to authenticate.
https://confluence.atlassian.com/display/BITBUCKET/services+Resource
func (*BrokerResource) Create ¶
func (r *BrokerResource) Create(owner, slug, link, brokerType string) (*Broker, error)
func (*BrokerResource) CreateUpdate ¶
func (r *BrokerResource) CreateUpdate(owner, slug, link, brokerType string) (*Broker, error)
CreateUpdate will attempt to Create a Broker (Server Hook) if it doesn't already exist in the Bitbucket.
func (*BrokerResource) DeleteUrl ¶
func (r *BrokerResource) DeleteUrl(owner, slug, url, brokerType string) error
func (*BrokerResource) Find ¶
func (r *BrokerResource) Find(owner, slug string, id int) (*Broker, error)
func (*BrokerResource) FindUrl ¶
func (r *BrokerResource) FindUrl(owner, slug, link, brokerType string) (*Broker, error)
type Client ¶
type Client struct { ConsumerKey string ConsumerSecret string AccessToken string TokenSecret string Repos *RepoResource Users *UserResource Emails *EmailResource Keys *KeyResource Brokers *BrokerResource Teams *TeamResource Sources *SourceResource RepoKeys *RepoKeyResource }
type EmailResource ¶
type EmailResource struct {
// contains filtered or unexported fields
}
An account can have one or more email addresses associated with it. Use this end point to list, change, or create an email address.
https://confluence.atlassian.com/display/BITBUCKET/emails+Resource
func (*EmailResource) Create ¶
func (r *EmailResource) Create(account, address string) (*Email, error)
Adds additional email addresses to an account. This call requires authentication.
func (*EmailResource) Find ¶
func (r *EmailResource) Find(account, address string) (*Email, error)
Gets an individual email address associated with an account. This call requires authentication.
func (*EmailResource) FindPrimary ¶
func (r *EmailResource) FindPrimary(account string) (*Email, error)
Gets an individual's primary email address.
type KeyResource ¶
type KeyResource struct {
// contains filtered or unexported fields
}
Use the ssh-keys resource to manipulate the ssh-keys on an individual or team account.
https://confluence.atlassian.com/display/BITBUCKET/ssh-keys+Resource
func (*KeyResource) Create ¶
func (r *KeyResource) Create(account, key, label string) (*Key, error)
Creates a key on the specified account. You must supply a valid key that is unique across the Bitbucket service.
func (*KeyResource) CreateUpdate ¶
func (r *KeyResource) CreateUpdate(account, key, label string) (*Key, error)
func (*KeyResource) Delete ¶
func (r *KeyResource) Delete(account string, id int) error
Deletes the key specified by the key_id value. This call requires authentication
func (*KeyResource) Find ¶
func (r *KeyResource) Find(account string, id int) (*Key, error)
Gets the content of the specified key_id. This call requires authentication.
func (*KeyResource) FindName ¶
func (r *KeyResource) FindName(account, label string) (*Key, error)
Gets the content of the specified key with the given label.
type PostReceiveHook ¶
type PostReceiveHook struct { Repo *Repo `json:"repository"` User string `json:"user"` Url string `json:"canon_url"` Commits []*Commit `json:"commits"` }
func ParseHook ¶
func ParseHook(raw []byte) (*PostReceiveHook, error)
type PullRequestHook ¶
type PullRequestHook struct {
Id string `json:"id"`
}
func ParsePullRequestHook ¶
func ParsePullRequestHook(raw []byte) (*PullRequestHook, error)
type RepoKeyResource ¶
type RepoKeyResource struct {
// contains filtered or unexported fields
}
Use the ssh-keys resource to manipulate the ssh-keys associated with a repository
https://confluence.atlassian.com/display/BITBUCKET/deploy-keys+Resource
func (*RepoKeyResource) Create ¶
func (r *RepoKeyResource) Create(owner, slug, key, label string) (*Key, error)
Creates a key on the specified repo. You must supply a valid key that is unique across the Bitbucket service.
func (*RepoKeyResource) CreateUpdate ¶
func (r *RepoKeyResource) CreateUpdate(owner, slug, key, label string) (*Key, error)
func (*RepoKeyResource) Delete ¶
func (r *RepoKeyResource) Delete(owner, slug string, id int) error
Deletes the key specified by the key_id value. This call requires authentication
func (*RepoKeyResource) DeleteName ¶
func (r *RepoKeyResource) DeleteName(owner, slug, label string) error
Deletes the named key. This call requires authentication
func (*RepoKeyResource) Find ¶
func (r *RepoKeyResource) Find(owner, slug string, id int) (*Key, error)
Gets the content of the specified key_id. This call requires authentication.
func (*RepoKeyResource) FindName ¶
func (r *RepoKeyResource) FindName(owner, slug, label string) (*Key, error)
Gets the content of the specified key with the given label.
type RepoResource ¶
type RepoResource struct {
// contains filtered or unexported fields
}
func (*RepoResource) Find ¶
func (r *RepoResource) Find(owner, slug string) (*Repo, error)
Gets the named repository.
func (*RepoResource) List ¶
func (r *RepoResource) List() ([]*Repo, error)
Gets the repositories owned by the individual or team account.
func (*RepoResource) ListBranches ¶
func (r *RepoResource) ListBranches(owner, slug string) ([]*Branch, error)
Gets the list of Branches for the repository
func (*RepoResource) ListDashboard ¶
func (r *RepoResource) ListDashboard() ([]*Account, error)
Gets the repositories list from the account's dashboard.
func (*RepoResource) ListDashboardRepos ¶
func (r *RepoResource) ListDashboardRepos() ([]*Repo, error)
Gets the repositories list from the account's dashboard, and converts the response to a list of Repos, instead of a list of Accounts.
type SourceResource ¶
type SourceResource struct {
// contains filtered or unexported fields
}
Use the Bitbucket src resource to browse directories and view files. This is a read-only resource.
https://confluence.atlassian.com/display/BITBUCKET/src+Resources
type TeamResource ¶
type TeamResource struct {
// contains filtered or unexported fields
}
Use this resource to manage privilege settings for a team account. Team accounts can grant groups account privileges as well as repository access. Groups with account privileges are those with can administer this account (admin rights) or can create repositories in this account (collaborator rights) checked.
https://confluence.atlassian.com/display/BITBUCKET/privileges+Resource
func (*TeamResource) List ¶
func (r *TeamResource) List() ([]*Team, error)
Gets the groups with account privileges defined for a team account.
type User ¶
type User struct { Username string `json:"username"` // The name associated with the account. FirstName string `json:"first_name"` // The first name associated with account. LastName string `json:"last_name"` // The last name associated with the account. For a team account, this value is always empty. DisplayName string `json:"display_name"` Avatar string `json:"avatar"` // An avatar associated with the account. IsTeam bool `json:"is_team"` // Indicates if this is a Team account. }
type UserResource ¶
type UserResource struct {
// contains filtered or unexported fields
}
Use the /user endpoints to gets information related to a user or team account
https://confluence.atlassian.com/display/BITBUCKET/user+Endpoint
func (*UserResource) Current ¶
func (r *UserResource) Current() (*Account, error)
Gets the basic information associated with an account and a list of all its repositories both public and private.