forked from joefitzgerald/forecast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserconnection.go
More file actions
27 lines (22 loc) · 739 Bytes
/
userconnection.go
File metadata and controls
27 lines (22 loc) · 739 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
25
26
27
package forecast
import "time"
type userConnectionsContainer struct {
UserConnections UserConnections `json:"user_connections"`
}
// UserConnections is a list of UserConnection items
type UserConnections []UserConnection
// UserConnection includes information about currently connected users
type UserConnection struct {
ID int `json:"id"`
PersonID int `json:"person_id"`
LastActiveAt time.Time `json:"last_active_at"`
}
// UserConnections returns all current user connections
func (api *API) UserConnections() (UserConnections, error) {
var container userConnectionsContainer
err := api.do("user_connections", &container)
if err != nil {
return nil, err
}
return container.UserConnections, nil
}