merge_request

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApproveConfig = &request.Config{
	Action:   "POST",
	Resource: "projects/:project_id/merge_requests/:merge_request_id/approve",
}
View Source
var CreateConfig = &request.Config{
	Action:   "POST",
	Resource: "projects/:project_id/merge_requests",
	Headers: map[string]string{
		"Content-Type": "application/json",
	},
}
View Source
var DeleteConfig = &request.Config{
	Action:   "DELETE",
	Resource: "projects/:project_id/merge_requests/:merge_request_id",
}
View Source
var GetConfig = &request.Config{
	Action:   "GET",
	Resource: "projects/:project_id/merge_requests/:merge_request_id",
}
View Source
var MergeConfig = &request.Config{
	Action:   "PUT",
	Resource: "projects/:project_id/merge_requests/:merge_request_id/merge",
}

Functions

func Delete

func Delete(client client.Client, cfg *DeleteRequest) error

func IsConflict

func IsConflict(client client.Client, req *IsConflictRequest) (bool, error)

Types

type ApproveRequest

type ApproveRequest struct {
	ProjectID      int64 `json:"project_id"`
	MergeRequestID int64 `json:"merge_request_id"`
}

type ApproveResponse

type ApproveResponse struct {
	ID          int64     `json:"id"`
	IID         int64     `json:"iid"`
	ProjectID   int64     `json:"project_id"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	// opened, closed, merged, locked
	State string `json:"state"`
	// unchecked, checking, can_be_merged, cannot_be_merged, cannot_be_merged_recheck
	MergeStatus string `json:"merge_status"`
	//
	Approve bool `json:"approve"`
}

func Approve

func Approve(client client.Client, req *ApproveRequest) (*ApproveResponse, error)

type CreateRequest

type CreateRequest struct {
	// the id of the project
	RepositoryID int64 `json:"repository_id"`
	// the name of the project
	RepositoryName string `json:"repository_name"`
	SourceBranch   string `json:"source_branch"`
	TargetBranch   string `json:"target_branch"`
	Title          string `json:"title"`
	//
	Description string `json:"description"`
	AssigneeID  int64  `json:"assignee_id"`
	Labels      string `json:"labels"`
	//
	RemoveSourceBranch bool `json:"remove_source_branch"`
	Squash             bool `json:"squash"`
}

type CreateResponse

type CreateResponse = MergeRequest

func Create

func Create(client client.Client, req *CreateRequest) (*CreateResponse, error)

type DeleteRequest

type DeleteRequest struct {
	ProjectID      int64 `json:"project_id"`
	MergeRequestID int64 `json:"merge_request_id"`
}

type GetRequest

type GetRequest struct {
	ProjectID      int64 `json:"project_id"`
	MergeRequestID int64 `json:"merge_request_id"`
}

type GetResponse

type GetResponse = MergeRequest

func Get

func Get(client client.Client, cfg *GetRequest) (*GetResponse, error)

type IsConflictRequest

type IsConflictRequest struct {
	ProjectID      int64 `json:"project_id"`
	MergeRequestID int64 `json:"merge_request_id"`
}

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"`
	SourceBranch    string    `json:"source_branch"`
	TargetBranch    string    `json:"target_branch"`
	SourceProjectID int64     `json:"source_project_id"`
	TargetProjectID int64     `json:"target_project_id"`
	Labels          []string  `json:"labels"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
	WebURL          string    `json:"web_url"`
	//
	Author User `json:"author"`
	//
	MergedAt   time.Time `json:"merged_at"`
	MergedUser User      `json:"merged_by"`
	// opened, closed, merged, locked
	State string `json:"state"`
	// unchecked, checking, can_be_merged, cannot_be_merged, cannot_be_merged_recheck
	MergeStatus  string `json:"merge_status"`
	MergeError   string `json:"merge_error"`
	HasConflicts bool   `json:"has_conflicts"`
	// contains filtered or unexported fields
}

func (*MergeRequest) Approve

func (r *MergeRequest) Approve(req *ApproveRequest) (*ApproveResponse, error)

func (*MergeRequest) Create

func (r *MergeRequest) Create(req *CreateRequest) (*MergeRequest, error)

func (*MergeRequest) Delete

func (r *MergeRequest) Delete(req *DeleteRequest) error

func (*MergeRequest) Get

func (r *MergeRequest) Get(req *GetRequest) (*MergeRequest, error)

func (*MergeRequest) Merge

func (r *MergeRequest) Merge(req *MergeeRequest) (*MergeResponse, error)

type MergeRequestImpl

type MergeRequestImpl interface {
	Create(req *CreateRequest) (*MergeRequest, error)
	Get(req *GetRequest) (*MergeRequest, error)
	Delete(req *DeleteRequest) error
	Approve(req *ApproveRequest) (*ApproveResponse, error)
	Merge(req *MergeeRequest) (*MergeResponse, error)
}

func New

func New(client client.Client) MergeRequestImpl

type MergeResponse

type MergeResponse = MergeRequest

func Merge

func Merge(client client.Client, req *MergeeRequest) (*MergeResponse, error)

type MergeeRequest

type MergeeRequest struct {
	RepositoryID int64 `json:"repository_id"`
	// the name of the project
	RepositoryName string `json:"repository_name"`
	//
	MergeRequestID int64 `json:"merge_request_id"`
	//
	MergeCommitMessage string `json:"merge_commit_message"`
	//
	Squash              bool   `json:"squash"`
	SquashCommitMessage string `json:"squash_commit_message"`
	//
	ShouldRemoveSourceBranch bool `json:"should_remove_source_branch"`
}

type User

type User struct {
	ID        int64  `json:"id"`
	Username  string `json:"username"`
	Name      string `json:"name"`
	State     string `json:"state"`
	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