From d7c13103534639023badb5e1af8e1ecb72b9c594 Mon Sep 17 00:00:00 2001 From: 6543 <24977596+6543@users.noreply.github.com> Date: Fri, 29 Nov 2019 16:14:24 +0100 Subject: [PATCH] expose PR counter on Repo API (#9202) --- models/repo.go | 1 + modules/structs/repo.go | 1 + templates/swagger/v1_json.tmpl | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/models/repo.go b/models/repo.go index 6c293da6f84..cbe1ccc4f64 100644 --- a/models/repo.go +++ b/models/repo.go @@ -368,6 +368,7 @@ func (repo *Repository) innerAPIFormat(e Engine, mode AccessMode, isParent bool) Forks: repo.NumForks, Watchers: repo.NumWatches, OpenIssues: repo.NumOpenIssues, + OpenPulls: repo.NumOpenPulls, DefaultBranch: repo.DefaultBranch, Created: repo.CreatedUnix.AsTime(), Updated: repo.UpdatedUnix.AsTime(), diff --git a/modules/structs/repo.go b/modules/structs/repo.go index ebfb0a05869..283eddb059f 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -67,6 +67,7 @@ type Repository struct { Forks int `json:"forks_count"` Watchers int `json:"watchers_count"` OpenIssues int `json:"open_issues_count"` + OpenPulls int `json:"open_pr_counter"` DefaultBranch string `json:"default_branch"` Archived bool `json:"archived"` // swagger:strfmt date-time diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 338ab104e9e..9c5db480804 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -10329,6 +10329,11 @@ "format": "int64", "x-go-name": "OpenIssues" }, + "open_pr_counter": { + "type": "integer", + "format": "int64", + "x-go-name": "OpenPulls" + }, "original_url": { "type": "string", "x-go-name": "OriginalURL"