Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徐晓伟工作室
gitlab-go
提交
c389d6a5
G
gitlab-go
项目概览
徐晓伟工作室
/
gitlab-go
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-go
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c389d6a5
编写于
10月 09, 2023
作者:
徐晓伟
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
✨
使用 log 替换 fmt
上级
2b856302
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
78 addition
and
0 deletion
+78
-0
README.md
README.md
+22
-0
boards/boards.go
boards/boards.go
+54
-0
main.go
main.go
+2
-0
未找到文件。
README.md
浏览文件 @
c389d6a5
...
...
@@ -156,6 +156,7 @@ AUTHOR:
COMMANDS:
access-request, access-requests, ar 群组和项目访问请求 API,中文文档:https://docs.gitlab.cn/jh/api/access_requests.html
board, boards 项目议题板 API,中文文档:https://docs.gitlab.cn/jh/api/boards.html
instance-level-ci-variable, instance-level-ci-variables, ilcv 实例级 CI/CD 变量 API,中文文档:https://docs.gitlab.cn/jh/api/instance_level_ci_variables.html
job-artifact, job-artifacts, ja 作业产物 API,中文文档:https://docs.gitlab.cn/jh/api/job_artifacts.html
job,
jobs
, j 作业 API,中文文档:https://docs.gitlab.cn/jh/api/jobs.html
...
...
@@ -193,6 +194,27 @@ COPYRIGHT:
--help, -h show help
```
-
[
board - 项目议题板 API
](
https://docs.gitlab.cn/jh/api/boards.html
)
```shell
$ go run main.go board --help
NAME:
gitlab-go board - 项目议题板 API,中文文档:https://docs.gitlab.cn/jh/api/boards.html
USAGE:
gitlab-go board command [command options] [arguments...]
COMMANDS:
list 列出项目议题板
help, h Shows a list of commands or help for one command
OPTIONS:
--base-url value 实例地址,例如:https://gitlab.xuxiaowei.com.cn/api/v4 (default: "https://gitlab.com/api/v4") [%CI_API_V4_URL%]
--token value your_access_token
--id value 项目 ID 或 URL 编码的路径
--help, -h show help
```
-
[
instance-level-ci-variable - 实例级 CI/CD 变量 API
](
https://docs.gitlab.cn/jh/api/instance_level_ci_variables.html
)
```shell
...
...
boards/boards.go
0 → 100644
浏览文件 @
c389d6a5
package
boards
import
(
"encoding/json"
"github.com/urfave/cli/v2"
"github.com/xanzy/go-gitlab"
"github.com/xuxiaowei-com-cn/gitlab-go/constant"
"github.com/xuxiaowei-com-cn/gitlab-go/flag"
"log"
)
// Boards 项目议题板 API https://docs.gitlab.cn/jh/api/boards.html
func
Boards
()
*
cli
.
Command
{
return
&
cli
.
Command
{
Name
:
"board"
,
Aliases
:
[]
string
{
"boards"
},
Usage
:
"项目议题板 API,中文文档:https://docs.gitlab.cn/jh/api/boards.html"
,
Flags
:
append
(
flag
.
Common
(),
flag
.
Id
(
false
)),
Subcommands
:
[]
*
cli
.
Command
{
{
Name
:
"list"
,
Usage
:
"列出项目议题板"
,
Flags
:
append
(
flag
.
Common
(),
flag
.
Id
(
true
)),
Action
:
func
(
context
*
cli
.
Context
)
error
{
var
baseUrl
=
context
.
String
(
constant
.
BaseUrl
)
var
token
=
context
.
String
(
constant
.
Token
)
var
id
=
context
.
String
(
constant
.
Id
)
gitClient
,
err
:=
gitlab
.
NewClient
(
token
,
gitlab
.
WithBaseURL
(
baseUrl
))
if
err
!=
nil
{
return
err
}
opt
:=
&
gitlab
.
ListIssueBoardsOptions
{}
issueBoards
,
response
,
err
:=
gitClient
.
Boards
.
ListIssueBoards
(
id
,
opt
)
log
.
Printf
(
"Response StatusCode: %d
\n
"
,
response
.
Response
.
StatusCode
)
if
err
!=
nil
{
return
err
}
for
index
,
issueBoard
:=
range
issueBoards
{
jsonData
,
err
:=
json
.
Marshal
(
issueBoard
)
if
err
!=
nil
{
panic
(
err
)
}
log
.
Printf
(
"Index: %d: %s
\n
"
,
index
,
string
(
jsonData
))
}
return
nil
},
},
},
}
}
main.go
浏览文件 @
c389d6a5
...
...
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/xuxiaowei-com-cn/git-go/buildinfo"
"github.com/xuxiaowei-com-cn/gitlab-go/access_requests"
"github.com/xuxiaowei-com-cn/gitlab-go/boards"
"github.com/xuxiaowei-com-cn/gitlab-go/instance_level_ci_variables"
"github.com/xuxiaowei-com-cn/gitlab-go/job_artifacts"
"github.com/xuxiaowei-com-cn/gitlab-go/jobs"
...
...
@@ -63,6 +64,7 @@ func main() {
Copyright
:
Copyright
,
Commands
:
[]
*
cli
.
Command
{
access_requests
.
AccessRequests
(),
boards
.
Boards
(),
instance_level_ci_variables
.
InstanceLevelCiVariables
(),
job_artifacts
.
JobsArtifacts
(),
jobs
.
Jobs
(),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录