From 0f05470cb84a4dcfd00e69e5af51b4420b74e9d4 Mon Sep 17 00:00:00 2001 From: "Kim \"BKC\" Carlbäcker" Date: Fri, 2 Dec 2016 12:10:39 +0100 Subject: [API] Pull Requests (#248) --- models/issue.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'models/issue.go') diff --git a/models/issue.go b/models/issue.go index 990d4a4bc5..7ef3d00e41 100644 --- a/models/issue.go +++ b/models/issue.go @@ -170,6 +170,22 @@ func (issue *Issue) HTMLURL() string { return fmt.Sprintf("%s/%s/%d", issue.Repo.HTMLURL(), path, issue.Index) } +// DiffURL returns the absolute URL to this diff +func (issue *Issue) DiffURL() string { + if issue.IsPull { + return fmt.Sprintf("%s/pulls/%d.diff", issue.Repo.HTMLURL(), issue.Index) + } + return "" +} + +// PatchURL returns the absolute URL to this patch +func (issue *Issue) PatchURL() string { + if issue.IsPull { + return fmt.Sprintf("%s/pulls/%d.patch", issue.Repo.HTMLURL(), issue.Index) + } + return "" +} + // State returns string representation of issue status. func (issue *Issue) State() api.StateType { if issue.IsClosed { -- cgit v1.2.3