merge

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIModel added in v1.3.0

type APIModel struct {
	Id          int       `json:"id"`
	Iid         int       `json:"iid"`
	ProjectId   int       `json:"project_id"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	State       string    `json:"state"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	MergedBy    struct {
		Id        int    `json:"id"`
		Username  string `json:"username"`
		Name      string `json:"name"`
		State     string `json:"state"`
		Locked    bool   `json:"locked"`
		AvatarUrl string `json:"avatar_url"`
		WebUrl    string `json:"web_url"`
	} `json:"merged_by"`
	MergeUser struct {
		Id        int    `json:"id"`
		Username  string `json:"username"`
		Name      string `json:"name"`
		State     string `json:"state"`
		Locked    bool   `json:"locked"`
		AvatarUrl string `json:"avatar_url"`
		WebUrl    string `json:"web_url"`
	} `json:"merge_user"`
	MergedAt                  time.Time   `json:"merged_at"`
	ClosedBy                  interface{} `json:"closed_by"`
	ClosedAt                  interface{} `json:"closed_at"`
	TargetBranch              string      `json:"target_branch"`
	SourceBranch              string      `json:"source_branch"`
	UserNotesCount            int         `json:"user_notes_count"`
	Upvotes                   int         `json:"upvotes"`
	Downvotes                 int         `json:"downvotes"`
	Author                    `json:"author"`
	Assignees                 []interface{} `json:"assignees"`
	Assignee                  interface{}   `json:"assignee"`
	Reviewers                 Reviewers     `json:"reviewers"`
	SourceProjectId           int           `json:"source_project_id"`
	TargetProjectId           int           `json:"target_project_id"`
	Labels                    []interface{} `json:"labels"`
	Draft                     bool          `json:"draft"`
	WorkInProgress            bool          `json:"work_in_progress"`
	Milestone                 interface{}   `json:"milestone"`
	MergeWhenPipelineSucceeds bool          `json:"merge_when_pipeline_succeeds"`
	MergeStatus               string        `json:"merge_status"`
	DetailedMergeStatus       string        `json:"detailed_merge_status"`
	Sha                       string        `json:"sha"`
	MergeCommitSha            string        `json:"merge_commit_sha"`
	SquashCommitSha           string        `json:"squash_commit_sha"`
	DiscussionLocked          interface{}   `json:"discussion_locked"`
	ShouldRemoveSourceBranch  bool          `json:"should_remove_source_branch"`
	ForceRemoveSourceBranch   bool          `json:"force_remove_source_branch"`
	PreparedAt                time.Time     `json:"prepared_at"`
	Reference                 string        `json:"reference"`
	References                struct {
		Short    string `json:"short"`
		Relative string `json:"relative"`
		Full     string `json:"full"`
	} `json:"references"`
	WebUrl    string `json:"web_url"`
	TimeStats struct {
		TimeEstimate        int         `json:"time_estimate"`
		TotalTimeSpent      int         `json:"total_time_spent"`
		HumanTimeEstimate   interface{} `json:"human_time_estimate"`
		HumanTotalTimeSpent interface{} `json:"human_total_time_spent"`
	} `json:"time_stats"`
	Squash               bool `json:"squash"`
	SquashOnMerge        bool `json:"squash_on_merge"`
	TaskCompletionStatus struct {
		Count          int `json:"count"`
		CompletedCount int `json:"completed_count"`
	} `json:"task_completion_status"`
	HasConflicts                bool        `json:"has_conflicts"`
	BlockingDiscussionsResolved bool        `json:"blocking_discussions_resolved"`
	Subscribed                  bool        `json:"subscribed"`
	ChangesCount                string      `json:"changes_count"`
	LatestBuildStartedAt        time.Time   `json:"latest_build_started_at"`
	LatestBuildFinishedAt       time.Time   `json:"latest_build_finished_at"`
	FirstDeployedToProductionAt interface{} `json:"first_deployed_to_production_at"`
	Pipeline                    struct {
		Id        int       `json:"id"`
		Iid       int       `json:"iid"`
		ProjectId int       `json:"project_id"`
		Sha       string    `json:"sha"`
		Ref       string    `json:"ref"`
		Status    string    `json:"status"`
		Source    string    `json:"source"`
		CreatedAt time.Time `json:"created_at"`
		UpdatedAt time.Time `json:"updated_at"`
		WebUrl    string    `json:"web_url"`
	} `json:"pipeline"`
	HeadPipeline struct {
		Id         int         `json:"id"`
		Iid        int         `json:"iid"`
		ProjectId  int         `json:"project_id"`
		Sha        string      `json:"sha"`
		Ref        string      `json:"ref"`
		Status     string      `json:"status"`
		Source     string      `json:"source"`
		CreatedAt  time.Time   `json:"created_at"`
		UpdatedAt  time.Time   `json:"updated_at"`
		WebUrl     string      `json:"web_url"`
		BeforeSha  string      `json:"before_sha"`
		Tag        bool        `json:"tag"`
		YamlErrors interface{} `json:"yaml_errors"`
		User       struct {
			Id        int    `json:"id"`
			Username  string `json:"username"`
			Name      string `json:"name"`
			State     string `json:"state"`
			Locked    bool   `json:"locked"`
			AvatarUrl string `json:"avatar_url"`
			WebUrl    string `json:"web_url"`
		} `json:"user"`
		StartedAt      time.Time   `json:"started_at"`
		FinishedAt     time.Time   `json:"finished_at"`
		CommittedAt    interface{} `json:"committed_at"`
		Duration       int         `json:"duration"`
		QueuedDuration int         `json:"queued_duration"`
		Coverage       interface{} `json:"coverage"`
		DetailedStatus struct {
			Icon         string      `json:"icon"`
			Text         string      `json:"text"`
			Label        string      `json:"label"`
			Group        string      `json:"group"`
			Tooltip      string      `json:"tooltip"`
			HasDetails   bool        `json:"has_details"`
			DetailsPath  string      `json:"details_path"`
			Illustration interface{} `json:"illustration"`
			Favicon      string      `json:"favicon"`
		} `json:"detailed_status"`
	} `json:"head_pipeline"`
	DiffRefs struct {
		BaseSha  string `json:"base_sha"`
		HeadSha  string `json:"head_sha"`
		StartSha string `json:"start_sha"`
	} `json:"diff_refs"`
	MergeError        interface{} `json:"merge_error"`
	FirstContribution bool        `json:"first_contribution"`
	User              struct {
		CanMerge bool `json:"can_merge"`
	} `json:"user"`
}

type Author added in v1.3.0

type Author struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type Diff added in v1.2.1

type Diff struct {
	Diff        string `json:"diff"`
	NewPath     string `json:"new_path"`
	OldPath     string `json:"old_path"`
	AMode       string `json:"a_mode"`
	BMode       string `json:"b_mode"`
	NewFile     bool   `json:"new_file"`
	RenamedFile bool   `json:"renamed_file"`
	DeletedFile bool   `json:"deleted_file"`
}

func (Diff) GetDiffChanges added in v1.2.1

func (d Diff) GetDiffChanges() (int, int)

type DiffConfig added in v1.2.1

type DiffConfig struct {
	Enabled bool `mapstructure:"enabled"`
}

type DiffResponse added in v1.2.1

type DiffResponse []Diff

type Event added in v1.0.0

type Event struct {
	ObjectKind string `json:"object_kind"`
	EventType  string `json:"event_type"`

	Attributes struct {
		AssigneeId     int         `json:"assignee_id"`
		AuthorId       int         `json:"author_id"`
		CreatedAt      string      `json:"created_at"`
		Description    string      `json:"description"`
		HeadPipelineId int         `json:"head_pipeline_id"`
		Id             int         `json:"id"`
		Iid            int         `json:"iid"`
		LastEditedAt   string      `json:"last_edited_at"`
		LastEditedById int         `json:"last_edited_by_id"`
		MergeCommitSha string      `json:"merge_commit_sha"`
		MergeError     interface{} `json:"merge_error"`
		MergeParams    struct {
			ForceRemoveSourceBranch string `json:"force_remove_source_branch"`
		} `json:"merge_params"`
		MergeStatus               string      `json:"merge_status"`
		MergeUserId               interface{} `json:"merge_user_id"`
		MergeWhenPipelineSucceeds bool        `json:"merge_when_pipeline_succeeds"`
		MilestoneId               interface{} `json:"milestone_id"`
		SourceBranch              string      `json:"source_branch"`
		SourceProjectId           int         `json:"source_project_id"`
		StateId                   int         `json:"state_id"`
		TargetBranch              string      `json:"target_branch"`
		TargetProjectId           int         `json:"target_project_id"`
		TimeEstimate              int         `json:"time_estimate"`
		Title                     string      `json:"title"`
		UpdatedAt                 string      `json:"updated_at"`
		UpdatedById               int         `json:"updated_by_id"`
		Url                       string      `json:"url"`
		Source                    struct {
			Id                int         `json:"id"`
			Name              string      `json:"name"`
			Description       string      `json:"description"`
			WebUrl            string      `json:"web_url"`
			AvatarUrl         interface{} `json:"avatar_url"`
			GitSshUrl         string      `json:"git_ssh_url"`
			GitHttpUrl        string      `json:"git_http_url"`
			Namespace         string      `json:"namespace"`
			VisibilityLevel   int         `json:"visibility_level"`
			PathWithNamespace string      `json:"path_with_namespace"`
			DefaultBranch     string      `json:"default_branch"`
			CiConfigPath      string      `json:"ci_config_path"`
			Homepage          string      `json:"homepage"`
			Url               string      `json:"url"`
			SshUrl            string      `json:"ssh_url"`
			HttpUrl           string      `json:"http_url"`
		} `json:"source"`
		Target struct {
			Id                int         `json:"id"`
			Name              string      `json:"name"`
			Description       string      `json:"description"`
			WebUrl            string      `json:"web_url"`
			AvatarUrl         interface{} `json:"avatar_url"`
			GitSshUrl         string      `json:"git_ssh_url"`
			GitHttpUrl        string      `json:"git_http_url"`
			Namespace         string      `json:"namespace"`
			VisibilityLevel   int         `json:"visibility_level"`
			PathWithNamespace string      `json:"path_with_namespace"`
			DefaultBranch     string      `json:"default_branch"`
			CiConfigPath      string      `json:"ci_config_path"`
			Homepage          string      `json:"homepage"`
			Url               string      `json:"url"`
			SshUrl            string      `json:"ssh_url"`
			HttpUrl           string      `json:"http_url"`
		} `json:"target"`
		LastCommit struct {
			Id        string    `json:"id"`
			Message   string    `json:"message"`
			Title     string    `json:"title"`
			Timestamp time.Time `json:"timestamp"`
			Url       string    `json:"url"`
			Author    `json:"author"`
		} `json:"last_commit"`
		WorkInProgress              bool          `json:"work_in_progress"`
		TotalTimeSpent              int           `json:"total_time_spent"`
		TimeChange                  int           `json:"time_change"`
		HumanTotalTimeSpent         interface{}   `json:"human_total_time_spent"`
		HumanTimeChange             interface{}   `json:"human_time_change"`
		HumanTimeEstimate           interface{}   `json:"human_time_estimate"`
		AssigneeIds                 []int         `json:"assignee_ids"`
		Labels                      []interface{} `json:"labels"`
		State                       string        `json:"state"`
		BlockingDiscussionsResolved bool          `json:"blocking_discussions_resolved"`
		Action                      string        `json:"action"`
	} `json:"object_attributes"`

	Labels  []interface{} `json:"labels"`
	Changes struct {
		StateId struct {
			Previous int `json:"previous"`
			Current  int `json:"current"`
		} `json:"state_id"`
		UpdatedAt struct {
			Previous string `json:"previous"`
			Current  string `json:"current"`
		} `json:"updated_at"`
	} `json:"changes"`

	Assignees []struct {
		Id        int    `json:"id"`
		Name      string `json:"name"`
		Username  string `json:"username"`
		AvatarUrl string `json:"avatar_url"`
		Email     string `json:"email"`
	} `json:"assignees"`

	gitlab.User `json:"user"`

	Reviewers `json:"reviewers"`

	gitlab.Project    `json:"project"`
	gitlab.Repository `json:"repository"`
}

type Handler

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

func NewHandler added in v1.2.4

func NewHandler(brokers []clients.MessageBroker, config MergeConfig, gitConfig git.GitConfig) Handler

func (Handler) Handle added in v1.0.0

func (h Handler) Handle(ctx context.Context, projectID, iid int, title, description, url string,
	author Author, reviewers Reviewers) error

func (Handler) Notifier

func (h Handler) Notifier(resp http.ResponseWriter, req *http.Request)

type MergeConfig added in v1.2.1

type MergeConfig struct {
	Diff DiffConfig `mapstructure:"diff"`
}

type Reviewers added in v1.3.0

type Reviewers []struct {
	Id        int    `json:"id"`
	Name      string `json:"name"`
	Username  string `json:"username"`
	AvatarUrl string `json:"avatar_url"`
	Email     string `json:"email"`
}

Jump to

Keyboard shortcuts

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