Documentation
¶
Index ¶
- Constants
- func Bool(v bool) *bool
- func CheckResponse(r *http.Response) error
- func Int(v int) *int
- func String(v string) *string
- func Version() string
- type Client
- type CombinedStatus
- type Commit
- type CommitAuthor
- type ErrorResponse
- type IssueComment
- type IssuesService
- type Organisation
- type OrganisationService
- type PullRequest
- type PullRequestBranch
- type PullRequestsService
- func (s *PullRequestsService) Get(owner, repo string, id int) (*PullRequest, *http.Response, error)
- func (s *PullRequestsService) List(owner, repo string) ([]PullRequest, *http.Response, error)
- func (s *PullRequestsService) ListCommits(owner, repo string, id int) ([]RepositoryCommit, *http.Response, error)
- type RateLimit
- type RepoStatus
- type RepositoriesService
- func (s *RepositoriesService) Create(org string, repo *Repository) (*Repository, *http.Response, error)
- func (s *RepositoriesService) CreateStatus(owner, repo, sha string, status *RepoStatus) (*RepoStatus, *http.Response, error)
- func (s *RepositoriesService) GetCombinedStatus(owner, repo, ref string) (*CombinedStatus, *http.Response, error)
- func (s *RepositoriesService) GetRepositories() (*[]Repository, *http.Response, error)
- func (s *RepositoriesService) GetUserRepositories(owner string) (*[]Repository, *http.Response, error)
- func (s *RepositoriesService) GetUserRepository(owner, repo string) (*Repository, *http.Response, error)
- func (s *RepositoriesService) List(owner string) ([]Repository, *http.Response, error)
- func (s *RepositoriesService) ListStatuses(owner, repo, ref string) ([]RepoStatus, *http.Response, error)
- type Repository
- type RepositoryCommit
- type User
- type UsersService
- type WebHookEvent
- type WebHookIssueCommentPayload
- type WebHookIssuesPayload
- type WebHookPullRequestPayload
- type WebHookPullRequestReviewCommentPayload
- type WebHookPushPayload
Constants ¶
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 CheckResponse ¶
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 (*Client) Do ¶
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 ¶
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.
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 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 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 OrganisationService ¶
type OrganisationService struct {
// contains filtered or unexported fields
}
func (*OrganisationService) List ¶
func (s *OrganisationService) List() ([]Organisation, *http.Response, error)
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 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 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
}
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"` }