bitbucket

package
v0.0.0-...-6c6fd2d Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultBaseURL defines the default Bitbucket API URL
	DefaultBaseURL = "https://api.bitbucket.org/2.0"
)

Variables

View Source
var (
	// ErrResponseNotOK defines non-200 HTTP response error
	ErrResponseNotOK = errors.New("response is not 200")
)

Functions

This section is empty.

Types

type AccessTokenResponse

type AccessTokenResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type,omitempty"`
	RefreshToken string `json:"refresh_token,omitempty"`
	Expiry       int64  `json:"expires_in,omitempty"`
}

AccessTokenResponse fields

type Bitbucket

type Bitbucket struct {
	Client *http.Client
	// contains filtered or unexported fields
}

Bitbucket service client

func NewClient

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

NewClient generates a new Bitbucket service client

func NewOauth2Client

func NewOauth2Client(OAuthKey, OAuthSecret, username, password string, client *http.Client, endpoint *oauth2.Endpoint) (*Bitbucket, error)

NewOauth2Client generates a new Bitbucket service client with OAuth2 cred.

func (*Bitbucket) UserRepository

func (bb *Bitbucket) UserRepository(userSlug, repoSlug string) (*Repository, error)

UserRepository fetches a user's repository

type BranchInfo

type BranchInfo struct {
	Type string `json:"type"`
	Name string `json:"name"`
}

BranchInfo fields

type Link struct {
	Href string `json:"href"`
	Name string `json:"name,omitempty"`
}

Link fields

type OAuth2Config

type OAuth2Config struct {
	oauth2.Config
	BaseURL  string
	Username string
	Password string
}

OAuth2Config contains OAuth2 configs for Bitbucket

type Owner

type Owner struct {
	Username    string `json:"username"`
	DisplayName string `json:"display_name"`
	Type        string `json:"type"`
	UUID        string `json:"uuid"`
}

Owner fields

type Project

type Project struct {
	Key   string        `json:"key"`
	Type  string        `json:"type"`
	UUID  string        `json:"uuid"`
	Links *ProjectLinks `json:"links"`
	Name  string        `json:"name"`
}

Project fields

type ProjectLinks struct {
	Self   *Link `json:"self"`
	HTML   *Link `json:"html"`
	Avatar *Link `json:"avatar"`
}

ProjectLinks fields

type Repository

type Repository struct {
	SCM         string           `json:"scm"`
	Website     string           `json:"website"`
	HasWiki     bool             `json:"has_wiki"`
	UUID        string           `json:"uuid"`
	Links       *RepositoryLinks `json:"links"`
	ForkPolicy  string           `json:"fork_policy"`
	Name        string           `json:"name"`
	Project     *Project         `json:"project"`
	Language    string           `json:"language"`
	CreatedOn   string           `json:"created_on"`
	MainBranch  *BranchInfo      `json:"mainbranch"`
	FullName    string           `json:"full_name"`
	HasIssues   bool             `json:"has_issues"`
	Owner       *Owner           `json:"owner"`
	UpdatedOn   string           `json:"updated_on"`
	Size        int64            `json:"size"`
	Type        string           `json:"type"`
	Slug        string           `json:"slug"`
	IsPrivate   bool             `json:"is_private"`
	Description string           `json:"description"`
}

Repository fields

type RepositoryLinks struct {
	Watchers     *Link   `json:"watchers"`
	Branches     *Link   `json:"branches"`
	Tags         *Link   `json:"tags"`
	Commits      *Link   `json:"commits"`
	Clone        []*Link `json:"clone"`
	Self         *Link   `json:"self"`
	Source       *Link   `json:"source"`
	HTML         *Link   `json:"html"`
	Avatar       *Link   `json:"avatar"`
	Hooks        *Link   `json:"hooks"`
	Forks        *Link   `json:"forks"`
	Downloads    *Link   `json:"downloads"`
	PullRequests *Link   `json:"pullrequests"`
}

RepositoryLinks fields

Jump to

Keyboard shortcuts

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