當前位置: 首頁>>代碼示例>>Golang>>正文


Golang IssueListByRepoOptions.Labels方法代碼示例

本文整理匯總了Golang中github.com/google/go-github/github.IssueListByRepoOptions.Labels方法的典型用法代碼示例。如果您正苦於以下問題:Golang IssueListByRepoOptions.Labels方法的具體用法?Golang IssueListByRepoOptions.Labels怎麽用?Golang IssueListByRepoOptions.Labels使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/google/go-github/github.IssueListByRepoOptions的用法示例。


在下文中一共展示了IssueListByRepoOptions.Labels方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: getIssuesList

func (t *Github) getIssuesList(input *messages.GetIssuesList) []github.Issue {

	if input.Repo == "" {
		options := github.IssueListOptions{
			Filter: "all",
		}
		if input.Status != "" {
			options.Labels = []string{input.Status}
		}
		options.Page = 0
		options.PerPage = 100
		githubIssues, _, err := t.client.Issues.ListByOrg(input.Org, &options)
		if err != nil {
			log.Println(err.Error())
		}
		return githubIssues
	}

	options := github.IssueListByRepoOptions{}
	if input.Status != "" {
		options.Labels = []string{input.Status}
	}
	options.Page = 0
	options.PerPage = 100
	githubIssues, _, err := t.client.Issues.ListByRepo(input.Org, input.Repo, &options)
	if err != nil {
		log.Println(err.Error())
	}
	return githubIssues
}
開發者ID:supu-io,項目名稱:issue-tracker,代碼行數:30,代碼來源:github.go

示例2: IssuesFilter

// Filters issues based on mileston, assignee, creatoror, labels or state.
// Pass empty strings for things that arnt to be filtered.
// Returns array of issues in order asked for.
// TODO(butlerx) filter offline issues if query of repo fails.
func IssuesFilter(repo, state, milestone, assignee, creator, sort, order string, labels []string) ([]github.Issue, error) {
	s := strings.Split(repo, "/")
	sorting := new(github.IssueListByRepoOptions)
	if len(labels) != 0 {
		sorting.Labels = labels
	}
	if state != "" {
		sorting.State = state
	}
	if milestone != "" {
		sorting.Milestone = milestone
	}
	if assignee != "" {
		sorting.Assignee = assignee
	}
	if creator != "" {
		sorting.Creator = creator
	}
	if sort != "" {
		sorting.Sort = sort
	}
	if order != "" {
		sorting.Direction = order
	}
	issues, _, err := client.Issues.ListByRepo(s[0], s[1], sorting)
	return issues, err
}
開發者ID:butlerx,項目名稱:AgileGit,代碼行數:31,代碼來源:gitissue.go


注:本文中的github.com/google/go-github/github.IssueListByRepoOptions.Labels方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。