1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Add /v1/version endpoint

This commit is contained in:
Frédéric Guillot 2023-10-08 15:21:38 -07:00
parent e4285c2cba
commit 52cf236699
6 changed files with 118 additions and 0 deletions

View file

@ -30,6 +30,22 @@ func New(endpoint string, credentials ...string) *Client {
return &Client{request: &request{endpoint: endpoint, apiKey: credentials[0]}}
}
// Version returns the version of the Miniflux instance.
func (c *Client) Version() (*VersionResponse, error) {
body, err := c.request.Get("/v1/version")
if err != nil {
return nil, err
}
defer body.Close()
var versionResponse *VersionResponse
if err := json.NewDecoder(body).Decode(&versionResponse); err != nil {
return nil, fmt.Errorf("miniflux: json error (%v)", err)
}
return versionResponse, nil
}
// Me returns the logged user information.
func (c *Client) Me() (*User, error) {
body, err := c.request.Get("/v1/me")