Implement draft pull request related APIs (#2388)

This commit is contained in:
SIkebe
2020-01-01 01:07:19 +09:00
committed by Naoki Takezoe
parent 90f4f5cd89
commit 941f8002e5
4 changed files with 8 additions and 4 deletions

View File

@@ -21,7 +21,8 @@ case class ApiPullRequest(
body: String, body: String,
user: ApiUser, user: ApiUser,
labels: List[ApiLabel], labels: List[ApiLabel],
assignee: Option[ApiUser] assignee: Option[ApiUser],
draft: Option[Boolean]
) { ) {
val id = 0 // dummy id val id = 0 // dummy id
val html_url = ApiPath(s"${base.repo.html_url.path}/pull/${number}") val html_url = ApiPath(s"${base.repo.html_url.path}/pull/${number}")
@@ -62,7 +63,8 @@ object ApiPullRequest {
body = issue.content.getOrElse(""), body = issue.content.getOrElse(""),
user = user, user = user,
labels = labels, labels = labels,
assignee = assignee assignee = assignee,
draft = Some(pullRequest.isDraft)
) )
case class Commit(sha: String, ref: String, repo: ApiRepository)(baseOwner: String) { case class Commit(sha: String, ref: String, repo: ApiRepository)(baseOwner: String) {

View File

@@ -5,7 +5,8 @@ case class CreateAPullRequest(
head: String, head: String,
base: String, base: String,
body: Option[String], body: Option[String],
maintainer_can_modify: Option[Boolean] maintainer_can_modify: Option[Boolean],
draft: Option[Boolean]
) )
case class CreateAPullRequestAlt( case class CreateAPullRequestAlt(

View File

@@ -114,7 +114,7 @@ trait ApiPullRequestControllerBase extends ControllerBase {
requestBranch = reqBranch, requestBranch = reqBranch,
commitIdFrom = commitIdFrom.getName, commitIdFrom = commitIdFrom.getName,
commitIdTo = commitIdTo.getName, commitIdTo = commitIdTo.getName,
isDraft = false, isDraft = createPullReq.draft.getOrElse(false),
loginAccount = context.loginAccount.get, loginAccount = context.loginAccount.get,
settings = context.settings settings = context.settings
) )

View File

@@ -520,6 +520,7 @@ object ApiSpecModels {
|"user":$jsonUser, |"user":$jsonUser,
|"labels":[$jsonLabel], |"labels":[$jsonLabel],
|"assignee":$jsonUser, |"assignee":$jsonUser,
|"draft":true,
|"id":0, |"id":0,
|"html_url":"http://gitbucket.exmple.com/octocat/Hello-World/pull/1347", |"html_url":"http://gitbucket.exmple.com/octocat/Hello-World/pull/1347",
|"url":"http://gitbucket.exmple.com/api/v3/repos/octocat/Hello-World/pulls/1347", |"url":"http://gitbucket.exmple.com/api/v3/repos/octocat/Hello-World/pulls/1347",