✨ 议题 API: 列出议题: 修正部分参数
This commit is contained in:
parent
79041688f3
commit
db7ab756df
|
@ -29,8 +29,9 @@ func AuthorUsername() cli.Flag {
|
|||
}
|
||||
|
||||
func Confidential() cli.Flag {
|
||||
return &cli.StringFlag{
|
||||
return &cli.BoolFlag{
|
||||
Name: constant.Confidential,
|
||||
Value: false,
|
||||
Usage: "筛选私密议题与公开议题。",
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +53,7 @@ func Iids() cli.Flag {
|
|||
func In() cli.Flag {
|
||||
return &cli.StringFlag{
|
||||
Name: constant.In,
|
||||
Value: "title,description",
|
||||
Usage: "修改 search 属性的范围。可以使用 title、description 或使用半角逗号对他们进行连接。默认值是 title,description。",
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +96,7 @@ func MyReactionEmoji() cli.Flag {
|
|||
func OrderBy() cli.Flag {
|
||||
return &cli.StringFlag{
|
||||
Name: constant.OrderBy,
|
||||
Value: "created_at",
|
||||
Usage: "返回根据 created_at、due_date、label_priority、milestone_due、popularity、priority、relative_position、title、updated_at 或 weight 排序的议题。默认值是 created_at。",
|
||||
}
|
||||
}
|
||||
|
@ -101,6 +104,7 @@ func OrderBy() cli.Flag {
|
|||
func Scope() cli.Flag {
|
||||
return &cli.StringFlag{
|
||||
Name: constant.Scope,
|
||||
Value: "created_by_me",
|
||||
Usage: "返回满足范围 created_by_me、assigned_to_me 或 all 的议题。默认值是 created_by_me。",
|
||||
}
|
||||
}
|
||||
|
@ -115,6 +119,15 @@ func Search() cli.Flag {
|
|||
func State() cli.Flag {
|
||||
return &cli.StringFlag{
|
||||
Name: constant.State,
|
||||
Value: "all",
|
||||
Usage: "返回全部 all 议题或仅返回处于 opened 或 closed 状态的议题。",
|
||||
}
|
||||
}
|
||||
|
||||
func WithLabelsDetails() cli.Flag {
|
||||
return &cli.BoolFlag{
|
||||
Name: constant.WithLabelsDetails,
|
||||
Value: false,
|
||||
Usage: "若为 true 则返回更详尽的标签信息::name、:color、:description、:description_html、:text_color。默认值是 false。description_html 属性引入于 12.7 版本。",
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ func Issues() *cli.Command {
|
|||
flag.AssigneeUsername(), flag.AuthorId(), flag.AuthorUsername(), flag.Confidential(),
|
||||
flag.DueDate(), flag.Iids(), flag.In(), flag.IssueType(), flag.IterationId(), flag.Milestone(),
|
||||
flag.MilestoneId(), flag.MyReactionEmoji(), flag.OrderBy(), flag.Scope(), flag.Search(),
|
||||
flag.Sort(), flag.State()),
|
||||
flag.Sort(), flag.State(), flag.WithLabelsDetails()),
|
||||
Subcommands: []*cli.Command{
|
||||
{
|
||||
Name: "list",
|
||||
|
@ -29,7 +29,7 @@ func Issues() *cli.Command {
|
|||
flag.AssigneeUsername(), flag.AuthorId(), flag.AuthorUsername(), flag.Confidential(),
|
||||
flag.DueDate(), flag.Iids(), flag.In(), flag.IssueType(), flag.IterationId(), flag.Milestone(),
|
||||
flag.MilestoneId(), flag.MyReactionEmoji(), flag.OrderBy(), flag.Scope(), flag.Search(),
|
||||
flag.Sort(), flag.State()),
|
||||
flag.Sort(), flag.State(), flag.WithLabelsDetails()),
|
||||
Action: func(context *cli.Context) error {
|
||||
var baseUrl = context.String(constant.BaseUrl)
|
||||
var token = context.String(constant.Token)
|
||||
|
@ -38,7 +38,7 @@ func Issues() *cli.Command {
|
|||
|
||||
// var assigneeId = context.Int(constant.AssigneeId)
|
||||
var assigneeUsername = context.String(constant.AssigneeUsername)
|
||||
var authorId = context.Int(constant.AuthorId)
|
||||
//var authorId = context.Int(constant.AuthorId)
|
||||
var authorUsername = context.String(constant.AuthorUsername)
|
||||
var confidential = context.Bool(constant.Confidential)
|
||||
// var createdAfter = context.String(constant.CreatedAfter)
|
||||
|
@ -48,7 +48,7 @@ func Issues() *cli.Command {
|
|||
// var healthStatus = context.String(constant.HealthStatus)
|
||||
var iids = context.IntSlice(constant.Iids)
|
||||
var in = context.String(constant.In)
|
||||
var issueType = context.String(constant.IssueType)
|
||||
//var issueType = context.String(constant.IssueType)
|
||||
var iterationId = context.Int(constant.IterationId)
|
||||
// var iterationTitle = context.Int(constant.IterationTitle)
|
||||
// var labels = context.StringSlice(constant.Labels)
|
||||
|
@ -73,43 +73,71 @@ func Issues() *cli.Command {
|
|||
}
|
||||
|
||||
opt := &gitlab.ListIssuesOptions{
|
||||
State: &state,
|
||||
// Labels: labels,
|
||||
// NotLabels: notLabels,
|
||||
WithLabelDetails: &withLabelsDetails,
|
||||
Milestone: &milestone,
|
||||
// NotMilestone: notMilestone,
|
||||
Scope: &scope,
|
||||
AuthorID: &authorId,
|
||||
AuthorUsername: &authorUsername,
|
||||
// NotAuthorUsername: notAuthorUsername,
|
||||
// NotAuthorID: notAuthorID,
|
||||
// AssigneeID: &assigneeId,
|
||||
// NotAssigneeID: notAssigneeID,
|
||||
AssigneeUsername: &assigneeUsername,
|
||||
// NotAssigneeUsername: notAssigneeUsername,
|
||||
MyReactionEmoji: &myReactionEmoji,
|
||||
// NotMyReactionEmoji: notMyReactionEmoji,
|
||||
IIDs: &iids,
|
||||
In: &in,
|
||||
// NotIn: notIn,
|
||||
OrderBy: &orderBy,
|
||||
Sort: &sort,
|
||||
Search: &search,
|
||||
// NotSearch: notSearch,
|
||||
// CreatedAfter: createdAfter,
|
||||
// CreatedBefore: createdBefore,
|
||||
DueDate: &dueDate,
|
||||
// UpdatedAfter: updatedAfter,
|
||||
// UpdatedBefore: updatedBefore,
|
||||
Confidential: &confidential,
|
||||
IssueType: &issueType,
|
||||
IterationID: &iterationId,
|
||||
Scope: &scope,
|
||||
In: &in,
|
||||
OrderBy: &orderBy,
|
||||
Sort: &sort,
|
||||
Confidential: &confidential,
|
||||
ListOptions: gitlab.ListOptions{
|
||||
Page: page,
|
||||
PerPage: perPage,
|
||||
},
|
||||
}
|
||||
|
||||
if search != "" {
|
||||
opt.Search = &search
|
||||
}
|
||||
if state != "" {
|
||||
opt.State = &state
|
||||
}
|
||||
if milestone != "" {
|
||||
opt.Milestone = &milestone
|
||||
}
|
||||
if authorUsername != "" {
|
||||
opt.AuthorUsername = &authorUsername
|
||||
}
|
||||
if assigneeUsername != "" {
|
||||
opt.AssigneeUsername = &assigneeUsername
|
||||
}
|
||||
if myReactionEmoji != "" {
|
||||
opt.MyReactionEmoji = &myReactionEmoji
|
||||
}
|
||||
if len(iids) > 0 {
|
||||
opt.IIDs = &iids
|
||||
}
|
||||
if dueDate != "" {
|
||||
opt.DueDate = &dueDate
|
||||
}
|
||||
if iterationId != 0 {
|
||||
opt.IterationID = &iterationId
|
||||
}
|
||||
|
||||
//opt := &gitlab.ListIssuesOptions{
|
||||
// // Labels: labels,
|
||||
// // NotLabels: notLabels,
|
||||
// // NotMilestone: notMilestone,
|
||||
// // AuthorID: &authorId,
|
||||
// // NotAuthorUsername: notAuthorUsername,
|
||||
// // NotAuthorID: notAuthorID,
|
||||
// // AssigneeID: &assigneeId,
|
||||
// // NotAssigneeID: notAssigneeID,
|
||||
// // NotAssigneeUsername: notAssigneeUsername,
|
||||
// // NotMyReactionEmoji: notMyReactionEmoji,
|
||||
// // NotIn: notIn,
|
||||
// // NotSearch: notSearch,
|
||||
// // CreatedAfter: createdAfter,
|
||||
// // CreatedBefore: createdBefore,
|
||||
// // UpdatedAfter: updatedAfter,
|
||||
// // UpdatedBefore: updatedBefore,
|
||||
// Confidential: &confidential,
|
||||
// //IssueType: &issueType,
|
||||
// IterationID: &iterationId,
|
||||
// ListOptions: gitlab.ListOptions{
|
||||
// Page: page,
|
||||
// PerPage: perPage,
|
||||
// },
|
||||
//}
|
||||
issues, response, err := gitClient.Issues.ListIssues(opt)
|
||||
log.Printf("Response StatusCode: %d\n", response.Response.StatusCode)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue