github.com/twilio/twilio-go@v1.20.1/rest/flex/v1/plugin_service_plugins_archive.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 "strings" 21 ) 22 23 // Optional parameters for the method 'UpdatePluginArchive' 24 type UpdatePluginArchiveParams struct { 25 // The Flex-Metadata HTTP request header 26 FlexMetadata *string `json:"Flex-Metadata,omitempty"` 27 } 28 29 func (params *UpdatePluginArchiveParams) SetFlexMetadata(FlexMetadata string) *UpdatePluginArchiveParams { 30 params.FlexMetadata = &FlexMetadata 31 return params 32 } 33 34 // 35 func (c *ApiService) UpdatePluginArchive(Sid string, params *UpdatePluginArchiveParams) (*FlexV1PluginArchive, error) { 36 path := "/v1/PluginService/Plugins/{Sid}/Archive" 37 path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) 38 39 data := url.Values{} 40 headers := make(map[string]interface{}) 41 42 if params != nil && params.FlexMetadata != nil { 43 headers["Flex-Metadata"] = *params.FlexMetadata 44 } 45 resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) 46 if err != nil { 47 return nil, err 48 } 49 50 defer resp.Body.Close() 51 52 ps := &FlexV1PluginArchive{} 53 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 54 return nil, err 55 } 56 57 return ps, err 58 }