提交 5befb4e3 编写于 作者: 徐晓伟's avatar 徐晓伟

议题 API: 列出议题: 补充参数

上级 c1871604
......@@ -131,3 +131,19 @@ func WithLabelsDetails() cli.Flag {
Usage: "若为 true 则返回更详尽的标签信息::name、:color、:description、:description_html、:text_color。默认值是 false。description_html 属性引入于 12.7 版本。",
}
}
func CreatedAfter() cli.Flag {
return &cli.TimestampFlag{
Name: constant.CreatedAfter,
Usage: "对于给定的时间戳,返回不早于该时间创建的议题。时间戳应符合 ISO 8601 格式(2019-03-15T08:00:00Z)",
Layout: "2006-01-02T15:04:05Z",
}
}
func CreatedBefore() cli.Flag {
return &cli.TimestampFlag{
Name: constant.CreatedBefore,
Usage: "对于给定的时间戳,返回不晚于该时间创建的议题。时间戳应符合 ISO 8601 格式(2019-03-15T08:00:00Z)。",
Layout: "2006-01-02T15:04:05Z",
}
}
......@@ -20,7 +20,8 @@ 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.WithLabelsDetails()),
flag.Sort(), flag.State(), flag.WithLabelsDetails(),
flag.CreatedAfter(), flag.CreatedBefore()),
Subcommands: []*cli.Command{
{
Name: "list",
......@@ -29,7 +30,8 @@ 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.WithLabelsDetails()),
flag.Sort(), flag.State(), flag.WithLabelsDetails(),
flag.CreatedAfter(), flag.CreatedBefore()),
Action: func(context *cli.Context) error {
var baseUrl = context.String(constant.BaseUrl)
var token = context.String(constant.Token)
......@@ -38,13 +40,13 @@ func Issues() *cli.Command {
var printJson = context.Bool(constant.PrintJson)
var printTime = context.Bool(constant.PrintTime)
// var assigneeId = context.Int(constant.AssigneeId)
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)
// var createdBefore = context.String(constant.CreatedBefore)
var createdAfter = context.Timestamp(constant.CreatedAfter)
var createdBefore = context.Timestamp(constant.CreatedBefore)
var dueDate = context.String(constant.DueDate)
// var epicId = context.String(constant.EpicId)
// var healthStatus = context.String(constant.HealthStatus)
......@@ -73,7 +75,6 @@ func Issues() *cli.Command {
if err != nil {
return err
}
opt := &gitlab.ListIssuesOptions{
WithLabelDetails: &withLabelsDetails,
Scope: &scope,
......@@ -86,7 +87,18 @@ func Issues() *cli.Command {
PerPage: perPage,
},
}
if assigneeId != 0 {
opt.AssigneeID = gitlab.AssigneeID(assigneeId)
}
if authorId != 0 {
opt.AuthorID = &authorId
}
if createdAfter != nil {
opt.CreatedAfter = createdAfter
}
if createdBefore != nil {
opt.CreatedBefore = createdBefore
}
if search != "" {
opt.Search = &search
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册