github.com/twilio/twilio-go@v1.20.1/rest/api/v2010/model_api_v2010_available_phone_number_voip.go (about) 1 /* 2 * This code was generated by 3 * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 * 7 * Twilio - Api 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 20 "github.com/twilio/twilio-go/client" 21 ) 22 23 // ApiV2010AvailablePhoneNumberVoip struct for ApiV2010AvailablePhoneNumberVoip 24 type ApiV2010AvailablePhoneNumberVoip struct { 25 // A formatted version of the phone number. 26 FriendlyName *string `json:"friendly_name,omitempty"` 27 // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. 28 PhoneNumber *string `json:"phone_number,omitempty"` 29 // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. 30 Lata *string `json:"lata,omitempty"` 31 // The locality or city of this phone number's location. 32 Locality *string `json:"locality,omitempty"` 33 // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. 34 RateCenter *string `json:"rate_center,omitempty"` 35 // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. 36 Latitude *float32 `json:"latitude,omitempty"` 37 // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. 38 Longitude *float32 `json:"longitude,omitempty"` 39 // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. 40 Region *string `json:"region,omitempty"` 41 // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. 42 PostalCode *string `json:"postal_code,omitempty"` 43 // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. 44 IsoCountry *string `json:"iso_country,omitempty"` 45 // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. 46 AddressRequirements *string `json:"address_requirements,omitempty"` 47 // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. 48 Beta *bool `json:"beta,omitempty"` 49 Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities,omitempty"` 50 } 51 52 func (response *ApiV2010AvailablePhoneNumberVoip) UnmarshalJSON(bytes []byte) (err error) { 53 raw := struct { 54 FriendlyName *string `json:"friendly_name"` 55 PhoneNumber *string `json:"phone_number"` 56 Lata *string `json:"lata"` 57 Locality *string `json:"locality"` 58 RateCenter *string `json:"rate_center"` 59 Latitude *interface{} `json:"latitude"` 60 Longitude *interface{} `json:"longitude"` 61 Region *string `json:"region"` 62 PostalCode *string `json:"postal_code"` 63 IsoCountry *string `json:"iso_country"` 64 AddressRequirements *string `json:"address_requirements"` 65 Beta *bool `json:"beta"` 66 Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` 67 }{} 68 69 if err = json.Unmarshal(bytes, &raw); err != nil { 70 return err 71 } 72 73 *response = ApiV2010AvailablePhoneNumberVoip{ 74 FriendlyName: raw.FriendlyName, 75 PhoneNumber: raw.PhoneNumber, 76 Lata: raw.Lata, 77 Locality: raw.Locality, 78 RateCenter: raw.RateCenter, 79 Region: raw.Region, 80 PostalCode: raw.PostalCode, 81 IsoCountry: raw.IsoCountry, 82 AddressRequirements: raw.AddressRequirements, 83 Beta: raw.Beta, 84 Capabilities: raw.Capabilities, 85 } 86 87 responseLatitude, err := client.UnmarshalFloat32(raw.Latitude) 88 if err != nil { 89 return err 90 } 91 response.Latitude = responseLatitude 92 93 responseLongitude, err := client.UnmarshalFloat32(raw.Longitude) 94 if err != nil { 95 return err 96 } 97 response.Longitude = responseLongitude 98 99 return 100 }