equal
deleted
inserted
replaced
|
1 /* |
|
2 Copyright 2017-2018 Mikael Berthe |
|
3 |
|
4 Licensed under the MIT license. Please see the LICENSE file is this directory. |
|
5 */ |
|
6 |
|
7 package madon |
|
8 |
|
9 import ( |
|
10 "github.com/sendgrid/rest" |
|
11 ) |
|
12 |
|
13 // GetCurrentInstance returns current instance information |
|
14 func (mc *Client) GetCurrentInstance() (*Instance, error) { |
|
15 var i Instance |
|
16 if err := mc.apiCall("v1/instance", rest.Get, nil, nil, nil, &i); err != nil { |
|
17 return nil, err |
|
18 } |
|
19 return &i, nil |
|
20 } |
|
21 |
|
22 // GetInstancePeers returns current instance peers |
|
23 // The peers are defined as the domains of users the instance has previously |
|
24 // resolved. |
|
25 func (mc *Client) GetInstancePeers() ([]InstancePeer, error) { |
|
26 var peers []InstancePeer |
|
27 if err := mc.apiCall("v1/instance/peers", rest.Get, nil, nil, nil, &peers); err != nil { |
|
28 return nil, err |
|
29 } |
|
30 return peers, nil |
|
31 } |
|
32 |
|
33 // GetInstanceActivity returns current instance activity |
|
34 // The activity contains the counts of active users, locally posted statuses, |
|
35 // and new registrations in weekly buckets. |
|
36 func (mc *Client) GetInstanceActivity() ([]WeekActivity, error) { |
|
37 var activity []WeekActivity |
|
38 if err := mc.apiCall("v1/instance/activity", rest.Get, nil, nil, nil, &activity); err != nil { |
|
39 return nil, err |
|
40 } |
|
41 return activity, nil |
|
42 } |