github.com/twilio/twilio-go@v1.20.1/rest/flex/v1/configuration.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 'FetchConfiguration' 23 type FetchConfigurationParams struct { 24 // The Pinned UI version of the Configuration resource to fetch. 25 UiVersion *string `json:"UiVersion,omitempty"` 26 } 27 28 func (params *FetchConfigurationParams) SetUiVersion(UiVersion string) *FetchConfigurationParams { 29 params.UiVersion = &UiVersion 30 return params 31 } 32 33 // 34 func (c *ApiService) FetchConfiguration(params *FetchConfigurationParams) (*FlexV1Configuration, error) { 35 path := "/v1/Configuration" 36 37 data := url.Values{} 38 headers := make(map[string]interface{}) 39 40 if params != nil && params.UiVersion != nil { 41 data.Set("UiVersion", *params.UiVersion) 42 } 43 44 resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) 45 if err != nil { 46 return nil, err 47 } 48 49 defer resp.Body.Close() 50 51 ps := &FlexV1Configuration{} 52 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 53 return nil, err 54 } 55 56 return ps, err 57 } 58 59 // Optional parameters for the method 'UpdateConfiguration' 60 type UpdateConfigurationParams struct { 61 // 62 Body *map[string]interface{} `json:"body,omitempty"` 63 } 64 65 func (params *UpdateConfigurationParams) SetBody(Body map[string]interface{}) *UpdateConfigurationParams { 66 params.Body = &Body 67 return params 68 } 69 70 // 71 func (c *ApiService) UpdateConfiguration(params *UpdateConfigurationParams) (*FlexV1Configuration, error) { 72 path := "/v1/Configuration" 73 74 data := url.Values{} 75 headers := map[string]interface{}{ 76 "Content-Type": "application/json", 77 } 78 79 body := []byte{} 80 if params != nil && params.Body != nil { 81 b, err := json.Marshal(*params.Body) 82 if err != nil { 83 return nil, err 84 } 85 body = b 86 } 87 88 resp, err := c.requestHandler.Post(c.baseURL+path, data, headers, body...) 89 if err != nil { 90 return nil, err 91 } 92 93 defer resp.Body.Close() 94 95 ps := &FlexV1Configuration{} 96 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 97 return nil, err 98 } 99 100 return ps, err 101 }