-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.go
53 lines (45 loc) · 1.81 KB
/
app.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package clubhouse
import "net/http"
type CheckForUpdateParams struct {
IsTestFlight int `url:"is_testflight"`
}
type CheckForUpdateResponse struct {
Response
AppBuild *int `json:"app_build,omitempty"`
AppURL *string `json:"app_url,omitempty"`
AppVersion *string `json:"app_version,omitempty"`
HasUpdate bool `json:"has_update"`
IsMandatory *bool `json:"is_mandatory,omitempty"`
}
func (c *Client) CheckForUpdate(params *CheckForUpdateParams) (*CheckForUpdateResponse, *http.Response, error) {
apiRes := new(CheckForUpdateResponse)
apiError := new(APIError)
res, err := c.sling.New().Get("check_for_update").QueryStruct(params).Receive(apiRes, apiError)
return apiRes, res, relevantError(err, *apiError)
}
type GetFeedResponse struct {
Items []struct {
Channel *Channel `json:"channel,omitempty"`
} `json:"items"`
}
func (c *Client) GetFeed() (*GetFeedResponse, *http.Response, error) {
apiRes := new(GetFeedResponse)
apiError := new(APIError)
res, err := c.sling.New().Get("get_feed").Receive(apiRes, apiError)
return apiRes, res, relevantError(err, *apiError)
}
type GetSettingsResponse struct {
Response
NotificationsEnableOther bool `json:"notifications_enable_other"`
NotificationsEnableRoom bool `json:"notifications_enable_room"`
NotificationsEnableSendFewer bool `json:"notifications_enable_send_fewer"`
NotificationsEnableTrending bool `json:"notifications_enable_trending"`
NotificationsFrequency int `json:"notifications_frequency"`
NotificationsIsPaused bool `json:"notifications_is_paused"`
}
func (c *Client) GetSettings() (*GetSettingsResponse, *http.Response, error) {
apiRes := new(GetSettingsResponse)
apiError := new(APIError)
res, err := c.sling.New().Get("get_settings").Receive(apiRes, apiError)
return apiRes, res, relevantError(err, *apiError)
}