bitbucket

package module
v0.0.0-...-b56ff05 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: MIT Imports: 5 Imported by: 0

README

go-bitbucket

client package for the bitbucket.org api 2.0

MIT License, (c) 2015, http://ernestmicklei.com

example

  func main() {
    c := bitbucket.New("your-user-name", "its-password")
    err := c.RepositoriesDo(func(each bitbucket.Repository) error {
      log.Println(each.Name)
      return nil
    })
    log.Println(err)
  }

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(user, password string) *Client

func (Client) AuthorizedURL

func (c Client) AuthorizedURL(unauthorizedURL string) *url.URL

func (*Client) RepositoriesDo

func (c *Client) RepositoriesDo(block func(Repository) error) error

func (*Client) Repository

func (c *Client) Repository(repo_slug string) (repo Repository, err error)

func (Client) URLTo

func (c Client) URLTo(pathsegments ...string) *url.URL

type Page

type Page struct {
	Size   int64  `json:"size"`    // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute.
	Number int    `json:"page"`    // Page number of the current results. This is an optional element that is not provided in all responses.
	Length int    `json:"pagelen"` // Current number of objects on the existing page. Globally, the minimum length is 10 and the maximum is 100. Some APIs may specify a different default.
	Next   string `json:"next"`    // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.
	// Link toe previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available.Client
	// Use this link to navigate the result set and refrain from constructing your own URLs.
	Previous string        `json:"previous"`
	Values   []interface{} `json:"values"` // The list of objects. This contains at most pagelen objects.
}

func (Page) Repositories

func (p Page) Repositories() []Repository

type Repository

type Repository struct {
	SCM         string        `json:"scm"`                                  //	The source control manager for the repository. This is either hg or git.
	HasWiki     bool          `json:"has_wiki" mapstructure:"has_wiki"`     //	A boolean indicating if the repository has a wiki.
	Description string        `json:"description"`                          //	A string containing the repository's description.
	Links       []interface{} `json:"links"`                                //	An array of related objects.
	UpdatedOn   string        `json:"updated_on" mapstructure:"updated_on"` //	A date timestamp of the last update to this repository.
	ForkPolicy  string        `json:"fork_policy"  mapstructure:"fork_policy"`
	/*
	   Control the rules for forking this repository. Available values are:

	   allow_forks: unrestricted forking
	   no_public_forks: restrict forking to private forks (forks cannot be made public later)
	   no_forks: deny all forking
	*/
	CreatedOn string `json:"created_on" mapstructure:"created_on"` //	An ISO-8601 date timestamp of this repository's creation date.
	Owner     string `json:"owner"`                                //	The owner's account.
	Size      int64  `json:"size"`                                 //    The size of the repository in bytes.
	Parent    string `json:"parent"`                               //	The parent repository this repository was forked off (only present on forks). This is a repository object itself.
	HasIssues bool   `json:"has_issues" mapstructure:"has_issues"` //	A boolean indicating a repository has an issue tracker.
	IsPrivate bool   `json:"is_private" mapstructure:"is_private"` //	A boolean indicating if a repository is private or public.
	Fullname  string `json:"full_name" mapstructure:"full_name"`   //	The unique key into the repository. This key has the format: {owner}/{repo_slug}
	Name      string `json:"name"`                                 //	The display name of the repository.
	Language  string `json:"language"`                             //	The main (programming) language of the repository source files.
}

Jump to

Keyboard shortcuts

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