gitlab

package
v0.0.0-...-344556e Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

Types

type Client

type Client struct {
	UserAgent string

	MergeRequests *MergeRequestsService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config ClientConfig, options ...ClientOptionsFunc) (*Client, error)

func (*Client) Do

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

func (*Client) NewRequest

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

type ClientConfig

type ClientConfig struct {
	User   string `json:"user"`
	UserID int    `json:"user_id"`
	Server string `json:"server"`
	Token  string `json:"token"`
}

func LoadConfig

func LoadConfig(cfg io.ReadCloser) (ClientConfig, error)

type ClientOptionsFunc

type ClientOptionsFunc func(client *Client) error

type DiffRefs

type DiffRefs struct {
	BaseSha  string `json:"base_sha"`
	HeadSha  string `json:"head_sha"`
	StartSha string `json:"start_sha"`
}

type ErrorResponse

type ErrorResponse struct {
	Body     []byte
	Response *http.Response
	Message  string
}

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type ListMergeRequestsOptions

type ListMergeRequestsOptions struct {
	ApproverUsernames []string `url:"approver_usernames,brackets,omitempty" json:"approver_usernames,omitempty"`
	ApproverIDs       []int    `url:"approver_ids,brackets,omitempty" json:"approver_ids,omitempty"`
	AssigneeUsername  *string  `url:"assignee_username,omitempty" json:"assignee_username,omitempty"`
	AuthorUsername    *string  `url:"author_username,omitempty" json:"author_username,omitempty"`
	AuthorID          *int     `url:"author_id,omitempty" json:"author_id,omitempty"`
	State             *string  `url:"state,omitempty" json:"state,omitempty"`
	Scope             *string  `url:"scope,omitempty" json:"scope,omitempty"`
}

type MergeRequest

type MergeRequest struct {
	ID                          int64                 `json:"id"`
	IID                         int64                 `json:"iid"`
	ProjectID                   int64                 `json:"project_id"`
	Title                       string                `json:"title"`
	Description                 string                `json:"description"`
	State                       string                `json:"state"`
	CreatedAt                   string                `json:"created_at"`
	UpdatedAt                   *time.Time            `json:"updated_at"`
	MergedBy                    *User                 `json:"merged_by"`
	MergedAt                    *time.Time            `json:"merged_at"`
	ClosedBy                    *User                 `json:"closed_by"`
	ClosedAt                    *time.Time            `json:"closed_at"`
	TargetBranch                string                `json:"target_branch"`
	SourceBranch                string                `json:"source_branch"`
	UserNotesCount              int64                 `json:"user_notes_count"`
	Upvotes                     int64                 `json:"upvotes"`
	Downvotes                   int64                 `json:"downvotes"`
	Assignee                    *User                 `json:"assignee"`
	Author                      *User                 `json:"author"`
	Assignees                   []*User               `json:"assignees"`
	SourceProjectID             int64                 `json:"source_project_id"`
	TargetProjectID             int64                 `json:"target_project_id"`
	Labels                      []string              `json:"labels"`
	WorkInProgress              bool                  `json:"work_in_progress"`
	Milestone                   *Milestone            `json:"milestone"`
	MergeWhenPipelineSucceeds   bool                  `json:"merge_when_pipeline_succeeds"`
	MergeStatus                 string                `json:"merge_status"`
	SHA                         string                `json:"sha"`
	MergeCommitSHA              string                `json:"merge_commit_sha"`
	SquashCommitSHA             string                `json:"squash_commit_sha"`
	DiscussionLocked            bool                  `json:"discussion_locked"`
	ShouldRemoveSourceBranch    bool                  `json:"should_remove_source_branch"`
	ForceRemoveSourceBranch     bool                  `json:"force_remove_source_branch"`
	Reference                   string                `json:"reference"`
	References                  *References           `json:"references"`
	WebURL                      string                `json:"web_url"`
	TimeStats                   *TimeStats            `json:"time_stats"`
	Squash                      bool                  `json:"squash"`
	TaskCompletionStatus        *TaskCompletionStatus `json:"task_completion_status"`
	DiffRefs                    *DiffRefs             `json:"diff_refs"`
	HasConflicts                bool                  `json:"has_conflicts"`
	BlockingDiscussionsResolved bool                  `json:"blocking_discussions_resolved"`
	ApprovalsBeforeMerge        int64                 `json:"approvals_before_merge"`
}

type MergeRequestsService

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

func (*MergeRequestsService) ListMergeRequests

func (s *MergeRequestsService) ListMergeRequests(opt *ListMergeRequestsOptions) ([]*MergeRequest, *Response, error)

type Milestone

type Milestone struct {
	ID          int        `json:"id"`
	IID         int        `json:"iid"`
	ProjectID   int        `json:"project_id"`
	Title       string     `json:"title"`
	Description string     `json:"description"`
	StartDate   *time.Time `json:"start_date"`
	DueDate     *time.Time `json:"due_date"`
	State       string     `json:"state"`
	WebURL      string     `json:"web_url"`
	UpdatedAt   *time.Time `json:"updated_at"`
	CreatedAt   *time.Time `json:"created_at"`
}

type References

type References struct {
	Short    string `json:"short"`
	Relative string `json:"relative"`
	Full     string `json:"full"`
}

type RequestOptionFunc

type RequestOptionFunc func(*http.Request) error

type Response

type Response struct {
	*http.Response

	TotalItems   int
	TotalPages   int
	ItemsPerPage int
	CurrentPage  int
	NextPage     int
	PreviousPage int
}

type TaskCompletionStatus

type TaskCompletionStatus struct {
	Count          int64 `json:"count"`
	CompletedCount int64 `json:"completed_count"`
}

type TimeStats

type TimeStats struct {
	TimeEstimate        int64  `json:"time_estimate"`
	TotalTimeSpent      int64  `json:"total_time_spent"`
	HumanTimeEstimate   string `json:"human_time_estimate"`
	HumanTotalTimeSpent string `json:"human_total_time_spent"`
}

type User

type User struct {
	ID        int64      `json:"id"`
	Name      string     `json:"name"`
	Username  string     `json:"username"`
	State     string     `json:"state"`
	CreatedAt *time.Time `json:"created_at"`
	AvatarURL string     `json:"avatar_url"`
	WebURL    string     `json:"web_url"`
}

Jump to

Keyboard shortcuts

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