github.com/twilio/twilio-go@v1.20.1/rest/taskrouter/v1/workspaces_workers_real_time_statistics.go (about) 1 /* 2 * This code was generated by 3 * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 * 7 * Twilio - Taskrouter 8 * This is the public Twilio REST API. 9 * 10 * NOTE: This class is auto generated by OpenAPI Generator. 11 * https://openapi-generator.tech 12 * Do not edit the class manually. 13 */ 14 15 package openapi 16 17 import ( 18 "encoding/json" 19 "net/url" 20 "strings" 21 ) 22 23 // Optional parameters for the method 'FetchWorkersRealTimeStatistics' 24 type FetchWorkersRealTimeStatisticsParams struct { 25 // Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. 26 TaskChannel *string `json:"TaskChannel,omitempty"` 27 } 28 29 func (params *FetchWorkersRealTimeStatisticsParams) SetTaskChannel(TaskChannel string) *FetchWorkersRealTimeStatisticsParams { 30 params.TaskChannel = &TaskChannel 31 return params 32 } 33 34 // 35 func (c *ApiService) FetchWorkersRealTimeStatistics(WorkspaceSid string, params *FetchWorkersRealTimeStatisticsParams) (*TaskrouterV1WorkersRealTimeStatistics, error) { 36 path := "/v1/Workspaces/{WorkspaceSid}/Workers/RealTimeStatistics" 37 path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) 38 39 data := url.Values{} 40 headers := make(map[string]interface{}) 41 42 if params != nil && params.TaskChannel != nil { 43 data.Set("TaskChannel", *params.TaskChannel) 44 } 45 46 resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) 47 if err != nil { 48 return nil, err 49 } 50 51 defer resp.Body.Close() 52 53 ps := &TaskrouterV1WorkersRealTimeStatistics{} 54 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 55 return nil, err 56 } 57 58 return ps, err 59 }