From ec03aeb834e4f6cf6bb665c97c1ba7b47810c54b Mon Sep 17 00:00:00 2001 From: Mura Li Date: Fri, 3 Mar 2017 22:45:18 +0800 Subject: [PATCH 1/2] Add new API 'ServerVersion' --- gitea/miscellaneous.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gitea/miscellaneous.go b/gitea/miscellaneous.go index 30aaee7..bdb7ede 100644 --- a/gitea/miscellaneous.go +++ b/gitea/miscellaneous.go @@ -11,3 +11,12 @@ type MarkdownOption struct { Context string Wiki bool } + +type ServerVersion struct { + Version string +} + +func (c *Client) ServerVersion() (string, error) { + v := ServerVersion{} + return v.Version, c.getParsedResponse("GET", "/api/v1/version", nil, nil, &v) +} From 439ea6ca7522d30ca0c0f43ce419e65c93fb32f5 Mon Sep 17 00:00:00 2001 From: Mura Li Date: Fri, 3 Mar 2017 22:55:07 +0800 Subject: [PATCH 2/2] Add comment for exported struct and method --- gitea/miscellaneous.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gitea/miscellaneous.go b/gitea/miscellaneous.go index bdb7ede..dc56177 100644 --- a/gitea/miscellaneous.go +++ b/gitea/miscellaneous.go @@ -12,10 +12,12 @@ type MarkdownOption struct { Wiki bool } +// ServerVersion wraps the version of the server type ServerVersion struct { Version string } +// ServerVersion returns the version of the server func (c *Client) ServerVersion() (string, error) { v := ServerVersion{} return v.Version, c.getParsedResponse("GET", "/api/v1/version", nil, nil, &v)