/
workspaces_workers_real_time_statistics.go
59 lines (48 loc) · 1.79 KB
/
workspaces_workers_real_time_statistics.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
54
55
56
57
58
59
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Taskrouter
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package openapi
import (
"encoding/json"
"net/url"
"strings"
)
// Optional parameters for the method 'FetchWorkersRealTimeStatistics'
type FetchWorkersRealTimeStatisticsParams struct {
// Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`.
TaskChannel *string `json:"TaskChannel,omitempty"`
}
func (params *FetchWorkersRealTimeStatisticsParams) SetTaskChannel(TaskChannel string) *FetchWorkersRealTimeStatisticsParams {
params.TaskChannel = &TaskChannel
return params
}
//
func (c *ApiService) FetchWorkersRealTimeStatistics(WorkspaceSid string, params *FetchWorkersRealTimeStatisticsParams) (*TaskrouterV1WorkersRealTimeStatistics, error) {
path := "/v1/Workspaces/{WorkspaceSid}/Workers/RealTimeStatistics"
path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1)
data := url.Values{}
headers := make(map[string]interface{})
if params != nil && params.TaskChannel != nil {
data.Set("TaskChannel", *params.TaskChannel)
}
resp, err := c.requestHandler.Get(c.baseURL+path, data, headers)
if err != nil {
return nil, err
}
defer resp.Body.Close()
ps := &TaskrouterV1WorkersRealTimeStatistics{}
if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
return nil, err
}
return ps, err
}