-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfig.go
30 lines (27 loc) · 974 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package wallabago
import "encoding/json"
// Configuration represents the object being returned from the API request /config
type Configuration struct {
ID int `json:"id"`
ItemsPerPage int `json:"items_per_page"`
Language string `json:"language"`
FeedToken string `json:"feed_token"`
FeedLimit int `json:"feed_limit"`
ReadingSpeed float64 `json:"reading_speed"`
ActionMarkAsRead int `json:"action_mark_as_read"`
ListMode int `json:"list_mode"`
DisplayThumbnails int `json:"display_thumbnails"`
}
// Config returns the config of the configured wallabag instance
func Config(bodyByteGetterFunc BodyByteGetter) (Configuration, error) {
var c Configuration
configJSONByte, err := bodyByteGetterFunc(LibConfig.WallabagURL+"/api/config", "GET", nil)
if err != nil {
return c, err
}
err = json.Unmarshal(configJSONByte, &c)
if err != nil {
return c, err
}
return c, err
}