gitbucket

package
v0.0.0-...-1d547ce Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IssuesEvent                   = WebHookEvent("issues")
	IssueCommentEvent             = WebHookEvent("issue_comment")
	PullRequestEvent              = WebHookEvent("pull_request")
	PullRequestReviewCommentEvent = WebHookEvent("pull_request_review_comment")
	PushEvent                     = WebHookEvent("push")
)

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

func CheckResponse

func CheckResponse(r *http.Response) error

func Int

func Int(v int) *int

func String

func String(v string) *string

func Version

func Version() string

Types

type Client

type Client struct {
	BaseURL      *url.URL
	UserAgent    string
	Users        *UsersService
	Repositories *RepositoriesService
	PullRequests *PullRequestsService
	Issues       *IssuesService
	Organisation *OrganisationService
	// contains filtered or unexported fields
}

Client represents a GitBucket API client.

func NewClient

func NewClient(urlStr, token string) (*Client, error)

NewClient initializes and returns a API client.

func (*Client) Do

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

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

func (*Client) NewRequest

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

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

func (*Client) RateLimit

func (c *Client) RateLimit() (*RateLimit, *http.Response, error)

type CombinedStatus

type CombinedStatus struct {
	State      *string      `json:"state"`
	SHA        *string      `json:"sha"`
	TotalCount *int         `json:"total_count"`
	Statuses   []RepoStatus `json:"statuses"`
	Repository *Repository  `json:"repository"`
	URL        *string      `json:"url"`
}

type Commit

type Commit struct {
	SHA       *string       `json:"sha,omitempty"`
	Message   *string       `json:"message,omitempty"`
	Author    *CommitAuthor `json:"author,omitempty"`
	Committer *CommitAuthor `json:"committer,omitempty"`
	URL       *string       `json:"url,omitempty"`
}

type CommitAuthor

type CommitAuthor struct {
	Name  *string    `json:"name"`
	Email *string    `json:"email"`
	Date  *time.Time `json:"date"`
}

type ErrorResponse

type ErrorResponse struct {
	Response         *http.Response // HTTP response that caused this error
	Message          string         `json:"message"` // error message
	DocumentationURL *string        `json:"documentation_url,omitempty"`
}

func (ErrorResponse) Error

func (r ErrorResponse) Error() string

type IssueComment

type IssueComment struct {
	ID        *int       `json:"id,omitempty"`
	User      *User      `json:"user,omitempty"`
	Body      *string    `json:"body"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
	HTMLURL   *string    `json:"html_url,omitempty"`
}

type IssuesService

type IssuesService struct {
	// contains filtered or unexported fields
}

func (*IssuesService) CreateComment

func (s *IssuesService) CreateComment(owner, repo string, id int, comment *IssueComment) (*IssueComment, *http.Response, error)

func (*IssuesService) ListComments

func (s *IssuesService) ListComments(owner, repo string, id int) ([]IssueComment, *http.Response, error)

type Organisation

type Organisation struct {
	Login       *string    `json:"login"`
	Url         *string    `json:"url"`
	Description *string    `json:"description"`
	CreatedAt   *time.Time `json:"created_at"`
	AvatarUrl   *string    `json:"avatar_url"`
}

type OrganisationService

type OrganisationService struct {
	// contains filtered or unexported fields
}

func (*OrganisationService) List

func (*OrganisationService) ListAll

func (s *OrganisationService) ListAll() ([]Organisation, *http.Response, error)

type PullRequest

type PullRequest struct {
	Number            *int               `json:"number"`
	UpdatedAt         *time.Time         `json:"updated_at"`
	CreatedAt         *time.Time         `json:"created_at"`
	Head              *PullRequestBranch `json:"head"`
	Base              *PullRequestBranch `json:"base"`
	Mergeable         *bool              `json:"mergeable,omitempty"`
	Title             *string            `json:"title"`
	Body              *string            `json:"body"`
	User              *User              `json:"user"`
	HTMLURL           *string            `json:"html_url"`
	URL               *string            `json:"url"`
	CommitsURL        *string            `json:"commits_url"`
	ReviewCommentsURL *string            `json:"review_comments_url"`
	ReviewCommentURL  *string            `json:"review_comment_url"`
	CommentsURL       *string            `json:"comments_url"`
	StatusesURL       *string            `json:"statuses_url"`
}

type PullRequestBranch

type PullRequestBranch struct {
	SHA   *string     `json:"sha"`
	Ref   *string     `json:"ref"`
	Repo  *Repository `json:"repo"`
	Label *string     `json:"label"`
	User  *User       `json:"user"`
}

type PullRequestsService

type PullRequestsService struct {
	// contains filtered or unexported fields
}

func (*PullRequestsService) Get

func (s *PullRequestsService) Get(owner, repo string, id int) (*PullRequest, *http.Response, error)

func (*PullRequestsService) List

func (s *PullRequestsService) List(owner, repo string) ([]PullRequest, *http.Response, error)

func (*PullRequestsService) ListCommits

func (s *PullRequestsService) ListCommits(owner, repo string, id int) ([]RepositoryCommit, *http.Response, error)

type RateLimit

type RateLimit struct {
}

type RepoStatus

type RepoStatus struct {
	CreatedAt   *time.Time `json:"created_at,omitempty"`
	UpdatedAt   *time.Time `json:"updated_at,omitempty"`
	State       *string    `json:"state"`
	TargetURL   *string    `json:"target_url,omitempty"`
	Description *string    `json:"description,omitempty"`
	ID          *int       `json:"id,omitempty"`
	Context     *string    `json:"context,omitempty"`
	Creator     *User      `json:"creator,omitempty"`
	URL         *string    `json:"url,omitempty"`
}

type RepositoriesService

type RepositoriesService struct {
	// contains filtered or unexported fields
}

func (*RepositoriesService) Create

func (s *RepositoriesService) Create(org string, repo *Repository) (*Repository, *http.Response, error)

func (*RepositoriesService) CreateStatus

func (s *RepositoriesService) CreateStatus(owner, repo, sha string, status *RepoStatus) (*RepoStatus, *http.Response, error)

func (*RepositoriesService) GetCombinedStatus

func (s *RepositoriesService) GetCombinedStatus(owner, repo, ref string) (*CombinedStatus, *http.Response, error)

func (*RepositoriesService) GetRepositories

func (s *RepositoriesService) GetRepositories() (*[]Repository, *http.Response, error)

func (*RepositoriesService) GetUserRepositories

func (s *RepositoriesService) GetUserRepositories(owner string) (*[]Repository, *http.Response, error)

func (*RepositoriesService) GetUserRepository

func (s *RepositoriesService) GetUserRepository(owner, repo string) (*Repository, *http.Response, error)

func (*RepositoriesService) List

func (s *RepositoriesService) List(owner string) ([]Repository, *http.Response, error)

func (*RepositoriesService) ListStatuses

func (s *RepositoriesService) ListStatuses(owner, repo, ref string) ([]RepoStatus, *http.Response, error)

type Repository

type Repository struct {
	Name          *string `json:"name"`
	FullName      *string `json:"full_name"`
	Description   *string `json:"description"`
	Watchers      *int    `json:"watchers"`
	Forks         *int    `json:"forks"`
	Private       *bool   `json:"private"`
	AutoInit      *bool   `json:"auto_init"`
	DefaultBranch *string `json:"default_branch"`
	Owner         *User   `json:"owner"`
	ForksCount    *int    `json:"forks_count"`
	WatchersCount *int    `json:"watchers_count"`
	URL           *string `json:"url"`
	HTTPURL       *string `json:"http_url"`
	SSHURL        *string `json:"ssh_url"`
	CloneURL      *string `json:"clone_url"`
	HTMLURL       *string `json:"html_url"`
}

Repository represents a API user.

type RepositoryCommit

type RepositoryCommit struct {
	SHA       string   `json:"sha"`
	Commit    *Commit  `json:"commit"`
	Author    *User    `json:"author,omitempty"`
	Committer *User    `json:"committer,omitempty"`
	Parents   []Commit `json:"parents"`
	URL       *string  `json:"url"`
}

type User

type User struct {
	Login     *string    `json:"login"`
	Email     *string    `json:"email"`
	Type      *string    `json:"type"`
	SiteAdmin *bool      `json:"site_admin"`
	CreatedAt *time.Time `json:"created_at"`
	URL       *string    `json:"url"`
	HTMLURL   *string    `json:"html_url"`
}

User represents a API user.

type UsersService

type UsersService struct {
	// contains filtered or unexported fields
}

func (*UsersService) Get

func (s *UsersService) Get(user string) (*User, *http.Response, error)

func (*UsersService) GetAll

func (s *UsersService) GetAll() ([]User, *http.Response, error)

type WebHookEvent

type WebHookEvent string

func GetWebHookEvent

func GetWebHookEvent(req *http.Request) WebHookEvent

type WebHookIssueCommentPayload

type WebHookIssueCommentPayload struct {
	Action     *string       `json:"action"`
	Sender     *User         `json:"sender"`
	Issue      *issue        `json:"issue"`
	Comment    *IssueComment `json:"comment"`
	Repository *Repository   `json:"repository"`
}

Action is only "created"

type WebHookIssuesPayload

type WebHookIssuesPayload struct {
	Action     *string     `json:"action"`
	Sender     *User       `json:"sender"`
	Number     *int        `json:"number"`
	Issue      *issue      `json:"issue"`
	Repository *Repository `json:"repository"`
}

Action is one of "opened", "reopen", "closed"

type WebHookPullRequestPayload

type WebHookPullRequestPayload struct {
	Action      *string      `json:"action"`
	Sender      *User        `json:"sender"`
	Number      *int         `json:"number"`
	PullRequest *PullRequest `json:"pull_request"`
	Repository  *Repository  `json:"repository"`
}

Action is one of "created", "synchronize"

type WebHookPullRequestReviewCommentPayload

type WebHookPullRequestReviewCommentPayload struct {
	Action      *string      `json:"action"`
	Comment     *comment     `json:"comment"`
	PullRequest *PullRequest `json:"pull_request"`
	Repository  *Repository  `json:"repository"`
	Sender      *User        `json:"sender"`
}

Action is only "created"

type WebHookPushPayload

type WebHookPushPayload struct {
	Commits    []commit    `json:"commits"`
	Pusher     *pusher     `json:"pusher"`
	Sender     *User       `json:"sender"`
	Ref        *string     `json:"ref"`
	Before     *string     `json:"before"`
	After      *string     `json:"after"`
	Repository *Repository `json:"repository"`
	Compare    *string     `json:"compare"`
	HeadCommit *commit     `json:"head_commit"`
}

Jump to

Keyboard shortcuts

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