-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinfo.go
More file actions
24 lines (21 loc) · 679 Bytes
/
info.go
File metadata and controls
24 lines (21 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package wallabago
import "encoding/json"
// Information represents the object being returned from the API request /info
type Information struct {
Appname string `json:"appname"`
Version string `json:"version"`
AllowedRegistration bool `json:"allowed_registration"`
}
// Info returns the info of the configured wallabag instance
func Info(bodyByteGetterFunc BodyByteGetter) (Information, error) {
var info Information
infoJSONByte, err := bodyByteGetterFunc(LibConfig.WallabagURL+"/api/info", "GET", nil)
if err != nil {
return info, err
}
err = json.Unmarshal(infoJSONByte, &info)
if err != nil {
return info, err
}
return info, err
}