github.com/twilio/twilio-go@v1.20.1/rest/voice/v1/dialing_permissions_bulk_country_updates.go (about) 1 /* 2 * This code was generated by 3 * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 * 7 * Twilio - Voice 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 'CreateDialingPermissionsCountryBulkUpdate' 23 type CreateDialingPermissionsCountryBulkUpdateParams struct { 24 // URL encoded JSON array of update objects. example : `[ { \\\"iso_code\\\": \\\"GB\\\", \\\"low_risk_numbers_enabled\\\": \\\"true\\\", \\\"high_risk_special_numbers_enabled\\\":\\\"true\\\", \\\"high_risk_tollfraud_numbers_enabled\\\": \\\"false\\\" } ]` 25 UpdateRequest *string `json:"UpdateRequest,omitempty"` 26 } 27 28 func (params *CreateDialingPermissionsCountryBulkUpdateParams) SetUpdateRequest(UpdateRequest string) *CreateDialingPermissionsCountryBulkUpdateParams { 29 params.UpdateRequest = &UpdateRequest 30 return params 31 } 32 33 // Create a bulk update request to change voice dialing country permissions of one or more countries identified by the corresponding [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) 34 func (c *ApiService) CreateDialingPermissionsCountryBulkUpdate(params *CreateDialingPermissionsCountryBulkUpdateParams) (*VoiceV1DialingPermissionsCountryBulkUpdate, error) { 35 path := "/v1/DialingPermissions/BulkCountryUpdates" 36 37 data := url.Values{} 38 headers := make(map[string]interface{}) 39 40 if params != nil && params.UpdateRequest != nil { 41 data.Set("UpdateRequest", *params.UpdateRequest) 42 } 43 44 resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) 45 if err != nil { 46 return nil, err 47 } 48 49 defer resp.Body.Close() 50 51 ps := &VoiceV1DialingPermissionsCountryBulkUpdate{} 52 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 53 return nil, err 54 } 55 56 return ps, err 57 }