feat: expose url field on issue api. (#982)

* Add api url func.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* fix: Add unit testing.

* fix: conflicts

* fix: remove trim

* fix: revert test function name.
This commit is contained in:
Bo-Yi Wu 2017-03-03 22:35:42 +08:00 committed by Lunny Xiao
parent 0afab87631
commit d76d67de23
4 changed files with 28 additions and 0 deletions

View file

@ -264,6 +264,11 @@ func (repo *Repository) HTMLURL() string {
return setting.AppURL + repo.FullName()
}
// APIURL returns the repository API URL
func (repo *Repository) APIURL() string {
return setting.AppURL + path.Join("api/v1/repos", repo.FullName())
}
// APIFormat converts a Repository to api.Repository
func (repo *Repository) APIFormat(mode AccessMode) *api.Repository {
cloneLink := repo.CloneLink()