github.com/twilio/twilio-go@v1.20.1/rest/flex/v1/insights_user_roles.go (about) 1 /* 2 * This code was generated by 3 * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 * 7 * Twilio - Flex 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 ) 21 22 // Optional parameters for the method 'FetchInsightsUserRoles' 23 type FetchInsightsUserRolesParams struct { 24 // The Authorization HTTP request header 25 Authorization *string `json:"Authorization,omitempty"` 26 } 27 28 func (params *FetchInsightsUserRolesParams) SetAuthorization(Authorization string) *FetchInsightsUserRolesParams { 29 params.Authorization = &Authorization 30 return params 31 } 32 33 // This is used by Flex UI and Quality Management to fetch the Flex Insights roles for the user 34 func (c *ApiService) FetchInsightsUserRoles(params *FetchInsightsUserRolesParams) (*FlexV1InsightsUserRoles, error) { 35 path := "/v1/Insights/UserRoles" 36 37 data := url.Values{} 38 headers := make(map[string]interface{}) 39 40 if params != nil && params.Authorization != nil { 41 headers["Authorization"] = *params.Authorization 42 } 43 resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) 44 if err != nil { 45 return nil, err 46 } 47 48 defer resp.Body.Close() 49 50 ps := &FlexV1InsightsUserRoles{} 51 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 52 return nil, err 53 } 54 55 return ps, err 56 }