util

package
v0.0.0-...-1b9a21c Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScrapPullRequestToCSV

func ScrapPullRequestToCSV(cfg Config)

Types

type BitbucketConfig

type BitbucketConfig struct {
	Token           string   `mapstructure:"token"`
	Workspace       string   `mapstructure:"workspace"`
	RepoList        []string `mapstructure:"repo_list"`
	PRPagelen       int      `mapstructure:"pr_page_len"`
	ActivityPagelen int      `mapstructure:"activity_page_len"`
	MaxPage         int      `mapstructure:"max_page"`
	QueryFilter     string   `mapstructure:"query_filter"`
	PullRequestURL  string   `mapstructure:"pull_request_url"`
}

type Config

type Config struct {
	Bitbucket BitbucketConfig `mapstructure:"bitbucket"`
	Report    ReportConfig    `mapstructure:"report"`
}

func LoadConfig

func LoadConfig(path string, name string) (config Config, err error)

LoadConfig reads configuration from file or environment variables.

type DiffStatActivity

type DiffStatActivity struct {
	Values        []DiffStatActivityData `json:"values"`
	Pagelen       int                    `json:"pagelen"`
	Size          int                    `json:"size"`
	Page          int                    `json:"page"`
	PullRequestID int
}

type DiffStatActivityData

type DiffStatActivityData struct {
	Type         string `json:"type"`
	LinesAdded   int    `json:"lines_added"`
	LinesRemoved int    `json:"lines_removed"`
	Status       string `json:"status"`
	Old          struct {
		Path        string `json:"path"`
		Type        string `json:"type"`
		EscapedPath string `json:"escaped_path"`
		Links       struct {
			Self struct {
				Href string `json:"href"`
			} `json:"self"`
		} `json:"links"`
	} `json:"old"`
	New struct {
		Path        string `json:"path"`
		Type        string `json:"type"`
		EscapedPath string `json:"escaped_path"`
		Links       struct {
			Self struct {
				Href string `json:"href"`
			} `json:"self"`
		} `json:"links"`
	} `json:"new"`
	PullRequestID int
}

type PullRequestActivity

type PullRequestActivity struct {
	Values  []PullRequestActivityData `json:"values"`
	Pagelen int                       `json:"pagelen"`
	Next    string                    `json:"next"`
}

type PullRequestActivityData

type PullRequestActivityData struct {
	PullRequest struct {
		Type  string `json:"type"`
		ID    int    `json:"id"`
		Title string `json:"title"`
		Links struct {
			Self struct {
				Href string `json:"href"`
			} `json:"self"`
			HTML struct {
				Href string `json:"href"`
			} `json:"html"`
		} `json:"links"`
	} `json:"pull_request"`
	Approval struct {
		Date time.Time `json:"date"`
		User struct {
			DisplayName string `json:"display_name"`
			Links       struct {
				Self struct {
					Href string `json:"href"`
				} `json:"self"`
				Avatar struct {
					Href string `json:"href"`
				} `json:"avatar"`
				HTML struct {
					Href string `json:"href"`
				} `json:"html"`
			} `json:"links"`
			Type      string `json:"type"`
			UUID      string `json:"uuid"`
			AccountID string `json:"account_id"`
			Nickname  string `json:"nickname"`
		} `json:"user"`
		Pullrequest struct {
			Type  string `json:"type"`
			ID    int    `json:"id"`
			Title string `json:"title"`
			Links struct {
				Self struct {
					Href string `json:"href"`
				} `json:"self"`
				HTML struct {
					Href string `json:"href"`
				} `json:"html"`
			} `json:"links"`
		} `json:"pullrequest"`
	} `json:"approval,omitempty"`
	Comment struct {
		ID        int       `json:"id"`
		CreatedOn time.Time `json:"created_on"`
		UpdatedOn time.Time `json:"updated_on"`
		Content   struct {
			Type   string `json:"type"`
			Raw    string `json:"raw"`
			Markup string `json:"markup"`
			HTML   string `json:"html"`
		} `json:"content"`
		User struct {
			DisplayName string `json:"display_name"`
			Links       struct {
				Self struct {
					Href string `json:"href"`
				} `json:"self"`
				Avatar struct {
					Href string `json:"href"`
				} `json:"avatar"`
				HTML struct {
					Href string `json:"href"`
				} `json:"html"`
			} `json:"links"`
			Type      string `json:"type"`
			UUID      string `json:"uuid"`
			AccountID string `json:"account_id"`
			Nickname  string `json:"nickname"`
		} `json:"user"`
		Deleted bool `json:"deleted"`
		Parent  struct {
			ID    int `json:"id"`
			Links struct {
				Self struct {
					Href string `json:"href"`
				} `json:"self"`
				HTML struct {
					Href string `json:"href"`
				} `json:"html"`
			} `json:"links"`
		} `json:"parent"`
		Type  string `json:"type"`
		Links struct {
			Self struct {
				Href string `json:"href"`
			} `json:"self"`
			HTML struct {
				Href string `json:"href"`
			} `json:"html"`
		} `json:"links"`
		Pullrequest struct {
			Type  string `json:"type"`
			ID    int    `json:"id"`
			Title string `json:"title"`
			Links struct {
				Self struct {
					Href string `json:"href"`
				} `json:"self"`
				HTML struct {
					Href string `json:"href"`
				} `json:"html"`
			} `json:"links"`
		} `json:"pullrequest"`
	} `json:"comment,omitempty"`
	Update struct {
		State       string `json:"state"`
		Title       string `json:"title"`
		Description string `json:"description"`
		Reviewers   []struct {
			DisplayName string `json:"display_name"`
			Links       struct {
				Self struct {
					Href string `json:"href"`
				} `json:"self"`
				Avatar struct {
					Href string `json:"href"`
				} `json:"avatar"`
				HTML struct {
					Href string `json:"href"`
				} `json:"html"`
			} `json:"links"`
			Type      string `json:"type"`
			UUID      string `json:"uuid"`
			AccountID string `json:"account_id"`
			Nickname  string `json:"nickname"`
		} `json:"reviewers"`
		Changes struct {
			Status struct {
				Old string `json:"old"`
				New string `json:"new"`
			} `json:"status"`
		} `json:"changes"`
		Reason string `json:"reason"`
		Author struct {
			DisplayName string `json:"display_name"`
			Links       struct {
				Self struct {
					Href string `json:"href"`
				} `json:"self"`
				Avatar struct {
					Href string `json:"href"`
				} `json:"avatar"`
				HTML struct {
					Href string `json:"href"`
				} `json:"html"`
			} `json:"links"`
			Type      string `json:"type"`
			UUID      string `json:"uuid"`
			AccountID string `json:"account_id"`
			Nickname  string `json:"nickname"`
		} `json:"author"`
		Date        time.Time `json:"date"`
		Destination struct {
			Branch struct {
				Name string `json:"name"`
			} `json:"branch"`
			Commit struct {
				Type  string `json:"type"`
				Hash  string `json:"hash"`
				Links struct {
					Self struct {
						Href string `json:"href"`
					} `json:"self"`
					HTML struct {
						Href string `json:"href"`
					} `json:"html"`
				} `json:"links"`
			} `json:"commit"`
			Repository struct {
				Type     string `json:"type"`
				FullName string `json:"full_name"`
				Links    struct {
					Self struct {
						Href string `json:"href"`
					} `json:"self"`
					HTML struct {
						Href string `json:"href"`
					} `json:"html"`
					Avatar struct {
						Href string `json:"href"`
					} `json:"avatar"`
				} `json:"links"`
				Name string `json:"name"`
				UUID string `json:"uuid"`
			} `json:"repository"`
		} `json:"destination"`
		Source struct {
			Branch struct {
				Name string `json:"name"`
			} `json:"branch"`
			Commit struct {
				Type  string `json:"type"`
				Hash  string `json:"hash"`
				Links struct {
					Self struct {
						Href string `json:"href"`
					} `json:"self"`
					HTML struct {
						Href string `json:"href"`
					} `json:"html"`
				} `json:"links"`
			} `json:"commit"`
			Repository struct {
				Type     string `json:"type"`
				FullName string `json:"full_name"`
				Links    struct {
					Self struct {
						Href string `json:"href"`
					} `json:"self"`
					HTML struct {
						Href string `json:"href"`
					} `json:"html"`
					Avatar struct {
						Href string `json:"href"`
					} `json:"avatar"`
				} `json:"links"`
				Name string `json:"name"`
				UUID string `json:"uuid"`
			} `json:"repository"`
		} `json:"source"`
	} `json:"update,omitempty"`
}

type PullRequestData

type PullRequestData struct {
	CommentCount      int         `json:"comment_count"`
	TaskCount         int         `json:"task_count"`
	Type              string      `json:"type"`
	ID                int         `json:"id"`
	Title             string      `json:"title"`
	Description       string      `json:"description"`
	State             string      `json:"state"`
	MergeCommit       interface{} `json:"merge_commit"`
	CloseSourceBranch bool        `json:"close_source_branch"`
	ClosedBy          interface{} `json:"closed_by"`
	Author            struct {
		DisplayName string `json:"display_name"`
		Links       struct {
			Self struct {
				Href string `json:"href"`
			} `json:"self"`
			Avatar struct {
				Href string `json:"href"`
			} `json:"avatar"`
			HTML struct {
				Href string `json:"href"`
			} `json:"html"`
		} `json:"links"`
		Type      string `json:"type"`
		UUID      string `json:"uuid"`
		AccountID string `json:"account_id"`
		Nickname  string `json:"nickname"`
	} `json:"author"`
	Reason      string    `json:"reason"`
	CreatedOn   time.Time `json:"created_on"`
	UpdatedOn   time.Time `json:"updated_on"`
	Destination struct {
		Branch struct {
			Name string `json:"name"`
		} `json:"branch"`
		Commit struct {
			Type  string `json:"type"`
			Hash  string `json:"hash"`
			Links struct {
				Self struct {
					Href string `json:"href"`
				} `json:"self"`
				HTML struct {
					Href string `json:"href"`
				} `json:"html"`
			} `json:"links"`
		} `json:"commit"`
		Repository struct {
			Type     string `json:"type"`
			FullName string `json:"full_name"`
			Links    struct {
				Self struct {
					Href string `json:"href"`
				} `json:"self"`
				HTML struct {
					Href string `json:"href"`
				} `json:"html"`
				Avatar struct {
					Href string `json:"href"`
				} `json:"avatar"`
			} `json:"links"`
			Name string `json:"name"`
			UUID string `json:"uuid"`
		} `json:"repository"`
	} `json:"destination"`
	Source struct {
		Branch struct {
			Name string `json:"name"`
		} `json:"branch"`
		Commit struct {
			Type  string `json:"type"`
			Hash  string `json:"hash"`
			Links struct {
				Self struct {
					Href string `json:"href"`
				} `json:"self"`
				HTML struct {
					Href string `json:"href"`
				} `json:"html"`
			} `json:"links"`
		} `json:"commit"`
		Repository struct {
			Type     string `json:"type"`
			FullName string `json:"full_name"`
			Links    struct {
				Self struct {
					Href string `json:"href"`
				} `json:"self"`
				HTML struct {
					Href string `json:"href"`
				} `json:"html"`
				Avatar struct {
					Href string `json:"href"`
				} `json:"avatar"`
			} `json:"links"`
			Name string `json:"name"`
			UUID string `json:"uuid"`
		} `json:"repository"`
	} `json:"source"`
	Links struct {
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
		HTML struct {
			Href string `json:"href"`
		} `json:"html"`
		Commits struct {
			Href string `json:"href"`
		} `json:"commits"`
		Approve struct {
			Href string `json:"href"`
		} `json:"approve"`
		RequestChanges struct {
			Href string `json:"href"`
		} `json:"request-changes"`
		Diff struct {
			Href string `json:"href"`
		} `json:"diff"`
		Diffstat struct {
			Href string `json:"href"`
		} `json:"diffstat"`
		Comments struct {
			Href string `json:"href"`
		} `json:"comments"`
		Activity struct {
			Href string `json:"href"`
		} `json:"activity"`
		Merge struct {
			Href string `json:"href"`
		} `json:"merge"`
		Decline struct {
			Href string `json:"href"`
		} `json:"decline"`
		Statuses struct {
			Href string `json:"href"`
		} `json:"statuses"`
	} `json:"links"`
	Summary struct {
		Type   string `json:"type"`
		Raw    string `json:"raw"`
		Markup string `json:"markup"`
		HTML   string `json:"html"`
	} `json:"summary"`
}

type PullRequestList

type PullRequestList struct {
	Values  []PullRequestData `json:"values"`
	Pagelen int               `json:"pagelen"`
	Size    int               `json:"size"`
	Page    int               `json:"page"`
	Next    string            `json:"next"`
}

type PullRequestReportData

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

type ReportConfig

type ReportConfig struct {
	ActivityFormatPath string `mapstructure:"activity_format_path"`
}

Jump to

Keyboard shortcuts

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