如何在对 Gitlab API 的一次调用中添加评论和花费的时间?
How to add comment and spent time in one call to Gitlab API?
我有两个单独的电话
addSpentTime(projectId, issueIid, duration, date) {
const endpoint = this.apiUrl(
`/projects/${projectId}/issues/${issueIid}/notes?body=/spend ${duration} ${date}`
);
return this.ajaxRequest("POST", endpoint);
}
addComment(projectId, issueIid, comment) {
const endpoint = this.apiUrl(
`/projects/${projectId}/issues/${issueIid}/notes?body=${comment}`
);
return this.ajaxRequest("POST", endpoint);
}
第一个用于发送在问题上花费了多少时间,后者用于向问题添加评论。
我想像这样在一次通话中完成这两项操作
addSpentTimeAndComment(projectId, issueIid, duration, date, comment) {
const endpoint = this.apiUrl(
`/projects/${projectId}/issues/${issueIid}/notes?body=${comment}/spend ${duration} ${date}`
);
return this.ajaxRequest("POST", endpoint);
}
但后缀 /spend ${duration} ${date}
也出现在评论中。 API 似乎将 body=
之后的所有内容都作为注释的一部分。我尝试添加 \n
、\n
、空格、反斜杠来表示注释的结尾,以便 /spend
部分也得到评估,我还尝试更改顺序以便 /spend
在评论正文之前,但似乎没有任何效果。 GitLab API docs 没有提到结束评论的任何标准方式,或者他们可能提到了但我无法在任何地方找到它。此外,我什至不知道它叫什么 - 分隔符,转义符号...?
有没有一种方法可以表示注释的结尾,从而提供一种附加其他命令的方法?
作为评论(项目说明)调用的一部分,使用 /spend <time> call
.
将时间附加为 Quick Action
通过将其与评论一起发布到 API,GitLab 将在添加评论的同时添加时间。
我有两个单独的电话
addSpentTime(projectId, issueIid, duration, date) {
const endpoint = this.apiUrl(
`/projects/${projectId}/issues/${issueIid}/notes?body=/spend ${duration} ${date}`
);
return this.ajaxRequest("POST", endpoint);
}
addComment(projectId, issueIid, comment) {
const endpoint = this.apiUrl(
`/projects/${projectId}/issues/${issueIid}/notes?body=${comment}`
);
return this.ajaxRequest("POST", endpoint);
}
第一个用于发送在问题上花费了多少时间,后者用于向问题添加评论。
我想像这样在一次通话中完成这两项操作
addSpentTimeAndComment(projectId, issueIid, duration, date, comment) {
const endpoint = this.apiUrl(
`/projects/${projectId}/issues/${issueIid}/notes?body=${comment}/spend ${duration} ${date}`
);
return this.ajaxRequest("POST", endpoint);
}
但后缀 /spend ${duration} ${date}
也出现在评论中。 API 似乎将 body=
之后的所有内容都作为注释的一部分。我尝试添加 \n
、\n
、空格、反斜杠来表示注释的结尾,以便 /spend
部分也得到评估,我还尝试更改顺序以便 /spend
在评论正文之前,但似乎没有任何效果。 GitLab API docs 没有提到结束评论的任何标准方式,或者他们可能提到了但我无法在任何地方找到它。此外,我什至不知道它叫什么 - 分隔符,转义符号...?
有没有一种方法可以表示注释的结尾,从而提供一种附加其他命令的方法?
作为评论(项目说明)调用的一部分,使用 /spend <time> call
.
通过将其与评论一起发布到 API,GitLab 将在添加评论的同时添加时间。