Documentation
¶
Index ¶
- func AuthCodeURL() string
- func CheckResponse(r *http.Response) error
- func Exchange(c string) (*oauth2.Token, error)
- func NewEngine(c *Config)
- type Avatar
- type CollectionOptions
- type Comment
- type CommentRequest
- type Config
- type File
- type GitlabContext
- func (g *GitlabContext) CreateComment(project_id, issue_id string, com *CommentRequest) (*Comment, *http.Response, error)
- func (g *GitlabContext) CreateIssue(project_id string, issue *IssueRequest) (*Issue, *http.Response, error)
- func (g *GitlabContext) CreateLabel(project_id string, label *LabelRequest) (*Label, *http.Response, error)
- func (g *GitlabContext) CreateMilestone(project_id string, m *MilestoneRequest) (*Milestone, *http.Response, error)
- func (g *GitlabContext) CurrentUser() (*User, error)
- func (g *GitlabContext) DeleteLabel(project_id string, label *LabelRequest) (*Label, *http.Response, error)
- func (g *GitlabContext) Do(req *http.Request, v interface{}) (*http.Response, error)
- func (g *GitlabContext) EditLabel(project_id string, label *LabelRequest) (*Label, *http.Response, error)
- func (g *GitlabContext) ItemProject(projectID string) (*Project, error)
- func (g *GitlabContext) ListComments(project_id, issue_id string, o *ListOptions) ([]*Comment, error)
- func (g *GitlabContext) ListGroupMembers(group_id string, o *ListOptions) ([]*User, error)
- func (g *GitlabContext) ListIssues(projectID string, o *IssueListOptions) ([]*Issue, *CollectionOptions, error)
- func (g *GitlabContext) ListLabels(project_id string, o *ListOptions) ([]*Label, error)
- func (g *GitlabContext) ListMilestones(project_id string, o *ListOptions) ([]*Milestone, error)
- func (g *GitlabContext) ListProjectMembers(project_id string, o *ListOptions) ([]*User, error)
- func (g *GitlabContext) ListProjects(o *ProjectListOptions) ([]*Project, *CollectionOptions, error)
- func (g *GitlabContext) MoveAnIssue(projectID, issueID, toProjectId string) (*Issue, *http.Response, error)
- func (c *GitlabContext) NewRequest(method string, urlStr []string, body interface{}) (*http.Request, error)
- func (g *GitlabContext) StarredProjects(opt *ProjectListOptions) ([]*Project, *CollectionOptions, error)
- func (g *GitlabContext) UpdateIssue(project_id, issue_id string, issue *IssueRequest) (*Issue, *http.Response, error)
- func (g *GitlabContext) UpdateMilestone(project_id string, m_id string, m *MilestoneRequest) (*Milestone, *http.Response, error)
- func (g *GitlabContext) UploadFile(projectID, name string, file io.Reader) (*File, error)
- type Issue
- type IssueListOptions
- type IssueRequest
- type Label
- type LabelDeleteOptions
- type LabelRequest
- type ListOptions
- type Milestone
- type MilestoneRequest
- type MoveIssueRequest
- type Namespace
- type Project
- type ProjectListOptions
- type ResponseError
- type Transport
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthCodeURL ¶
func AuthCodeURL() string
AuthCodeURL returns a URL to OAuth 2.0 provider's consent page that asks for permissions for the required scopes explicitly.
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
Types ¶
type CollectionOptions ¶
type CollectionOptions struct {
Total string
NextPage string
TotalPages string
PerPage string
Page string
PrevPage string
}
CollectionOptions represents collection options on http headers
func NewCollectionOption ¶
func NewCollectionOption(resp *http.Response) *CollectionOptions
NewCollectionOption gets pagination options
type Comment ¶
type Comment struct {
Id int64 `json:"id"`
Author *User `json:"author"`
Body string `json:"body"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
System bool `json:"system"`
Upvote bool `json:"upvote"`
Downvote bool `json:"downvote"`
}
Comment represents a GitLab note.
GitLab API docs: http://doc.gitlab.com/ce/api/notes.html
type CommentRequest ¶
type CommentRequest struct {
Body string `json:"body"`
}
CommentRequest represents the available CreateComment() and UpdateComment() options.
GitLab API docs: http://doc.gitlab.com/ce/api/notes.html#create-new-issue-note
type File ¶
type File struct {
Alt string `json:"alt"`
URL string `json:"url"`
Markdown string `json:"markdown"`
}
File represents uploaded file to gitlab
Gitlab API docs: http://docs.gitlab.com/ee/api/projects.html#upload-a-file
type GitlabContext ¶
type GitlabContext struct {
// contains filtered or unexported fields
}
func (*GitlabContext) CreateComment ¶
func (g *GitlabContext) CreateComment(project_id, issue_id string, com *CommentRequest) (*Comment, *http.Response, error)
CreateComment creates a new note to a single project issue.
GitLab API docs: http://doc.gitlab.com/ce/api/notes.html#create-new-issue-note
func (*GitlabContext) CreateIssue ¶
func (g *GitlabContext) CreateIssue(project_id string, issue *IssueRequest) (*Issue, *http.Response, error)
CreateIssue creates a new project issue.
GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#new-issues
func (*GitlabContext) CreateLabel ¶
func (g *GitlabContext) CreateLabel(project_id string, label *LabelRequest) (*Label, *http.Response, error)
CreateIssue creates a new project issue.
GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#new-issues
func (*GitlabContext) CreateMilestone ¶
func (g *GitlabContext) CreateMilestone(project_id string, m *MilestoneRequest) (*Milestone, *http.Response, error)
CreateMilestone creates a new project milestone.
GitLab API docs: http://doc.gitlab.com/ce/api/milestones.html#create-new-milestone
func (*GitlabContext) CurrentUser ¶
func (g *GitlabContext) CurrentUser() (*User, error)
CurrentUser gets currently authenticated user.
GitLab API docs: http://doc.gitlab.com/ce/api/users.html#current-user
func (*GitlabContext) DeleteLabel ¶
func (g *GitlabContext) DeleteLabel(project_id string, label *LabelRequest) (*Label, *http.Response, error)
DeleteLabel deletes an existing project label
GitLab API docs: http://doc.gitlab.com/ce/api/labels.html#delete-a-label
func (*GitlabContext) Do ¶
Do sends an HTTP request and returns an HTTP response, following policy (e.g. redirects, cookies, auth) as configured on the client.
func (*GitlabContext) EditLabel ¶
func (g *GitlabContext) EditLabel(project_id string, label *LabelRequest) (*Label, *http.Response, error)
EditLabel updates an existing project labels
GitLab API docs: http://doc.gitlab.com/ce/api/labels.html#edit-an-existing-label
func (*GitlabContext) ItemProject ¶
func (g *GitlabContext) ItemProject(projectID string) (*Project, error)
ItemProject gets a specific project, identified by project ID or NAMESPACE/PROJECT_NAME, which is owned by the authenticated user.
GitLab API docs: http://doc.gitlab.com/ce/api/projects.html#get-single-project
func (*GitlabContext) ListComments ¶
func (g *GitlabContext) ListComments(project_id, issue_id string, o *ListOptions) ([]*Comment, error)
ListComments gets a list of all notes for a single issue.
GitLab API docs: http://doc.gitlab.com/ce/api/notes.html#list-project-issue-notes
func (*GitlabContext) ListGroupMembers ¶
func (g *GitlabContext) ListGroupMembers(group_id string, o *ListOptions) ([]*User, error)
ListProjectMembers gets a list of a group's team members.
GitLab API docs: http://doc.gitlab.com/ce/api/groups.html#list-group-members
func (*GitlabContext) ListIssues ¶
func (g *GitlabContext) ListIssues(projectID string, o *IssueListOptions) ([]*Issue, *CollectionOptions, error)
ListIssues gets all issues created by authenticated user. This function takes pagination parameters page and per_page to restrict the list of issues.
GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#list-issues
func (*GitlabContext) ListLabels ¶
func (g *GitlabContext) ListLabels(project_id string, o *ListOptions) ([]*Label, error)
ListLabels gets all labels for given project.
GitLab API docs: http://doc.gitlab.com/ce/api/labels.html#list-labels
func (*GitlabContext) ListMilestones ¶
func (g *GitlabContext) ListMilestones(project_id string, o *ListOptions) ([]*Milestone, error)
ListMilestones returns a list of project milestones.
GitLab API docs: http://doc.gitlab.com/ce/api/milestones.html#list-project-milestones
func (*GitlabContext) ListProjectMembers ¶
func (g *GitlabContext) ListProjectMembers(project_id string, o *ListOptions) ([]*User, error)
ListProjectMembers gets a list of a project's team members.
GitLab API docs: http://doc.gitlab.com/ce/api/projects.html#list-project-team-members
func (*GitlabContext) ListProjects ¶
func (g *GitlabContext) ListProjects(o *ProjectListOptions) ([]*Project, *CollectionOptions, error)
ListProjects gets a list of projects accessible by the authenticated user.
GitLab API docs: http://doc.gitlab.com/ce/api/projects.html#list-projects
func (*GitlabContext) MoveAnIssue ¶
func (g *GitlabContext) MoveAnIssue(projectID, issueID, toProjectId string) (*Issue, *http.Response, error)
MoveAnIssue Moves an issue to a different project.
Gitlab API docs: https://docs.gitlab.com/ee/api/issues.html#move-an-issue
func (*GitlabContext) NewRequest ¶
func (c *GitlabContext) NewRequest(method string, 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 (*GitlabContext) StarredProjects ¶
func (g *GitlabContext) StarredProjects(opt *ProjectListOptions) ([]*Project, *CollectionOptions, error)
StarredProjects gets a list starred project for user.
GitLab API docs: http://doc.gitlab.com/ce/api/projects.html#list-starred-projects
func (*GitlabContext) UpdateIssue ¶
func (g *GitlabContext) UpdateIssue(project_id, issue_id string, issue *IssueRequest) (*Issue, *http.Response, error)
UpdateIssue updates an existing project issue. This function is also used to mark an issue as closed.
GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#edit-issues
func (*GitlabContext) UpdateMilestone ¶
func (g *GitlabContext) UpdateMilestone(project_id string, m_id string, m *MilestoneRequest) (*Milestone, *http.Response, error)
UpdateMilestone updates a project milestone.
GitLab API docs: http://doc.gitlab.com/ce/api/milestones.html#edit-milestone
func (*GitlabContext) UploadFile ¶
UploadFile uploads file to gitlab project
Gitlab API docs: http://docs.gitlab.com/ee/api/projects.html#upload-a-file
type Issue ¶
type Issue struct {
Assignee *User `json:"assignee"`
Author *User `json:"author"`
Description string `json:"description"`
Milestone *Milestone `json:"milestone"`
Id int64 `json:"id"`
Iid int64 `json:"iid"`
Labels *[]string `json:"labels"`
ProjectId int64 `json:"project_id"`
State string `json:"state"`
Title string `json:"title"`
UserNotesCount int `json:"user_notes_count"`
Subscribed bool `json:"subscribed"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DueDate string `json:"due_date"`
Confidential bool `json:"confidential"`
WebURL string `json:"web_url"`
}
Issue represents a GitLab issue.
GitLab API docs: http://doc.gitlab.com/ce/api/issues.html
type IssueListOptions ¶
type IssueListOptions struct {
// State filters issues based on their state. Possible values are: open,
// closed. Default is "open".
State string `url:"state,omitempty"`
ListOptions
}
ListIssuesOptions represents the available ListIssues() options.
GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#list-issues
type IssueRequest ¶
type IssueRequest struct {
Title string `json:"title"`
Description string `json:"description"`
AssigneeId *int64 `json:"assignee_id"`
MilestoneId *int64 `json:"milestone_id"`
Labels string `json:"labels"`
StateEvent string `json:"state_event,omitempty"`
DueDate string `json:"due_date,omitempty"`
}
IssueRequest represents the available CreateIssue() and UpdateIssue() options.
GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#new-issues
type Label ¶
type Label struct {
ID int64 `json:"id"`
Color string `json:"color"`
Name string `json:"name"`
Description string `json:"description"`
OpenIssueCount int `json:"open_issue_count"`
ClosedIssueCount int `json:"closed_issue_count"`
OpenMergeRequestCount int `json:"open_merge_requests_count"`
Subscribed bool `json:"subscribed"`
Priority int `json:"priority"`
}
Label represents a GitLab label.
GitLab API docs: http://doc.gitlab.com/ce/api/labels.html
type LabelDeleteOptions ¶
type LabelDeleteOptions struct {
Name string `url:"name,omitempty"`
}
type LabelRequest ¶
type LabelRequest struct {
Color string `json:"color"`
Name string `json:"name"`
NewName string `json:"new_name,omitempty"`
}
LabelRequest represents the available CreateLabel() and UpdateLabel() options.
type ListOptions ¶
type ListOptions struct {
// For paginated result sets, page of results to retrieve.
Page string `url:"page,omitempty"`
// For paginated result sets, the number of results to include per page.
PerPage string `url:"per_page,omitempty"`
}
ListOptions specifies the optional parameters to various List methods that support pagination.
type Milestone ¶
type Milestone struct {
ID int64 `json:"id"`
IID int64 `json:"iid"`
State string `json:"state,omitempty"`
Title string `json:"title,omitempty"`
DueDate string `json:"due_date,omitempty"`
Description string `json:"description"`
UpdatedAt string `json:"updated_at"`
CreatedAt string `json:"created_at"`
}
Milestone represents a GitLab milestone.
GitLab API docs: http://doc.gitlab.com/ce/api/branches.html
type MilestoneRequest ¶
type MilestoneRequest struct {
Title string `json:"title"`
Description string `json:"description"`
DueDate string `json:"due_date"`
}
MilestoneRequest represents the available CreateMilestone() and UpdateMilestone() options.
GitLab API docs: http://doc.gitlab.com/ce/api/milestones.html#create-new-milestone
type MoveIssueRequest ¶
type MoveIssueRequest struct {
ToProjectID string `json:"to_project_id"`
}
MoveIssueRequest moved issue to another project
type Namespace ¶
type Namespace struct {
Id int64 `json:"id"`
Name string `json:"name,omitempty"`
Avatar *Avatar `json:"avatar,nil,omitempty"`
}
Namespace represents a GitLab namespace.
GitLab API docs: http://doc.gitlab.com/ce/api/namespaces.html
type Project ¶
type Project struct {
Id int64 `json:"id"`
Name string `json:"name"`
NamespaceWithName string `json:"name_with_namespace"`
PathWithNamespace string `json:"path_with_namespace"`
Namespace *Namespace `json:"namespace,nil,omitempty"`
Description string `json:"description"`
LastModified string `json:"last_modified"`
CreatedAt string `json:"created_at"`
Owner *User `json:"owner,nil,omitempty"`
AvatarUrl string `json:"avatar_url,nil,omitempty"`
}
Project represents a GitLab project.
GitLab API docs: http://doc.gitlab.com/ce/api/projects.html
type ProjectListOptions ¶
type ProjectListOptions struct {
// State filters issues based on their state. Possible values are: open,
// closed. Default is "open".
Archived string `url:"archived,omitempty"`
// Search find projects by criteria
Search string `url:"search,omitempty"`
ListOptions
}
ProjectListOptions represents the available ListProjects() options.
GitLab API docs: http://doc.gitlab.com/ce/api/projects.html#list-projects
type ResponseError ¶
type ResponseError struct {
StatusCode int
// contains filtered or unexported fields
}
func (ResponseError) Error ¶
func (r ResponseError) Error() string
Type response error for usage logic
type Transport ¶
type Transport struct {
Token string
Base http.RoundTripper
}
type User ¶
type User struct {
Id int64 `json:"id"`
Name string `json:"name,omitempty"`
AvatarUrl string `json:"avatar_url,nil,omitempty"`
State string `json:"state,omitempty"`
Username string `json:"username,omitempty"`
WebUrl string `json:"web_url,omitempty"`
PrivateToken string `json:"private_token"`
}
User represents a GitLab user.
GitLab API docs: http://doc.gitlab.com/ce/api/users.html