twilio_rust_openapi/apis/
api20100401_local_api.rs

1/*
2 * Twilio - Api
3 *
4 * This is the public Twilio REST API.
5 *
6 * The version of the OpenAPI document: 1.0.0
7 * Contact: support@twilio.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17/// struct for passing parameters to the method [`create_incoming_phone_number_local`]
18#[derive(Clone, Debug)]
19pub struct CreateIncomingPhoneNumberLocalParams {
20    /// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource.
21    pub account_sid: String,
22    /// The phone number to purchase specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format.  E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234.
23    pub phone_number: String,
24    /// The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`.
25    pub api_version: Option<String>,
26    /// A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number.
27    pub friendly_name: Option<String>,
28    /// The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application.
29    pub sms_application_sid: Option<String>,
30    /// The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`.
31    pub sms_fallback_method: Option<String>,
32    /// The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`.
33    pub sms_fallback_url: Option<String>,
34    /// The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`.
35    pub sms_method: Option<String>,
36    /// The URL we should call when the new phone number receives an incoming SMS message.
37    pub sms_url: Option<String>,
38    /// The URL we should call using the `status_callback_method` to send status information to your application.
39    pub status_callback: Option<String>,
40    /// The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`.
41    pub status_callback_method: Option<String>,
42    /// The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa.
43    pub voice_application_sid: Option<String>,
44    /// Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`.
45    pub voice_caller_id_lookup: Option<bool>,
46    /// The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`.
47    pub voice_fallback_method: Option<String>,
48    /// The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`.
49    pub voice_fallback_url: Option<String>,
50    /// The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`.
51    pub voice_method: Option<String>,
52    /// The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set.
53    pub voice_url: Option<String>,
54    /// The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations.
55    pub identity_sid: Option<String>,
56    /// The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations.
57    pub address_sid: Option<String>,
58    pub emergency_status: Option<String>,
59    /// The SID of the emergency address configuration to use for emergency calling from the new phone number.
60    pub emergency_address_sid: Option<String>,
61    /// The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa.
62    pub trunk_sid: Option<String>,
63    pub voice_receive_mode: Option<String>,
64    /// The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations.
65    pub bundle_sid: Option<String>
66}
67
68/// struct for passing parameters to the method [`list_available_phone_number_local`]
69#[derive(Clone, Debug)]
70pub struct ListAvailablePhoneNumberLocalParams {
71    /// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources.
72    pub account_sid: String,
73    /// The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country from which to read phone numbers.
74    pub country_code: String,
75    /// The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada.
76    pub area_code: Option<i32>,
77    /// The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource?code-sample=code-find-phone-numbers-by-number-pattern) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource?code-sample=code-find-phone-numbers-by-character-pattern). If specified, this value must have at least two characters.
78    pub contains: Option<String>,
79    /// Whether the phone numbers can receive text messages. Can be: `true` or `false`.
80    pub sms_enabled: Option<bool>,
81    /// Whether the phone numbers can receive MMS messages. Can be: `true` or `false`.
82    pub mms_enabled: Option<bool>,
83    /// Whether the phone numbers can receive calls. Can be: `true` or `false`.
84    pub voice_enabled: Option<bool>,
85    /// Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`.
86    pub exclude_all_address_required: Option<bool>,
87    /// Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`.
88    pub exclude_local_address_required: Option<bool>,
89    /// Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`.
90    pub exclude_foreign_address_required: Option<bool>,
91    /// Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`.
92    pub beta: Option<bool>,
93    /// Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada.
94    pub near_number: Option<String>,
95    /// Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada.
96    pub near_lat_long: Option<String>,
97    /// The search radius, in miles, for a `near_` query.  Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada.
98    pub distance: Option<i32>,
99    /// Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada.
100    pub in_postal_code: Option<String>,
101    /// Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada.
102    pub in_region: Option<String>,
103    /// Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada.
104    pub in_rate_center: Option<String>,
105    /// Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada.
106    pub in_lata: Option<String>,
107    /// Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number.
108    pub in_locality: Option<String>,
109    /// Whether the phone numbers can receive faxes. Can be: `true` or `false`.
110    pub fax_enabled: Option<bool>,
111    /// How many resources to return in each list page. The default is 50, and the maximum is 1000.
112    pub page_size: Option<i32>,
113    /// The page index. This value is simply for client state.
114    pub page: Option<i32>,
115    /// The page token. This is provided by the API.
116    pub page_token: Option<String>
117}
118
119/// struct for passing parameters to the method [`list_incoming_phone_number_local`]
120#[derive(Clone, Debug)]
121pub struct ListIncomingPhoneNumberLocalParams {
122    /// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resources to read.
123    pub account_sid: String,
124    /// Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`.
125    pub beta: Option<bool>,
126    /// A string that identifies the resources to read.
127    pub friendly_name: Option<String>,
128    /// The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit.
129    pub phone_number: Option<String>,
130    /// Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included.
131    pub origin: Option<String>,
132    /// How many resources to return in each list page. The default is 50, and the maximum is 1000.
133    pub page_size: Option<i32>,
134    /// The page index. This value is simply for client state.
135    pub page: Option<i32>,
136    /// The page token. This is provided by the API.
137    pub page_token: Option<String>
138}
139
140
141/// struct for typed errors of method [`create_incoming_phone_number_local`]
142#[derive(Debug, Clone, Serialize, Deserialize)]
143#[serde(untagged)]
144pub enum CreateIncomingPhoneNumberLocalError {
145    UnknownValue(serde_json::Value),
146}
147
148/// struct for typed errors of method [`list_available_phone_number_local`]
149#[derive(Debug, Clone, Serialize, Deserialize)]
150#[serde(untagged)]
151pub enum ListAvailablePhoneNumberLocalError {
152    UnknownValue(serde_json::Value),
153}
154
155/// struct for typed errors of method [`list_incoming_phone_number_local`]
156#[derive(Debug, Clone, Serialize, Deserialize)]
157#[serde(untagged)]
158pub enum ListIncomingPhoneNumberLocalError {
159    UnknownValue(serde_json::Value),
160}
161
162
163/// 
164pub async fn create_incoming_phone_number_local(configuration: &configuration::Configuration, params: CreateIncomingPhoneNumberLocalParams) -> Result<models::ApiPeriodV2010PeriodAccountPeriodIncomingPhoneNumberPeriodIncomingPhoneNumberLocal, Error<CreateIncomingPhoneNumberLocalError>> {
165    let local_var_configuration = configuration;
166
167    // unbox the parameters
168    let account_sid = params.account_sid;
169    let phone_number = params.phone_number;
170    let api_version = params.api_version;
171    let friendly_name = params.friendly_name;
172    let sms_application_sid = params.sms_application_sid;
173    let sms_fallback_method = params.sms_fallback_method;
174    let sms_fallback_url = params.sms_fallback_url;
175    let sms_method = params.sms_method;
176    let sms_url = params.sms_url;
177    let status_callback = params.status_callback;
178    let status_callback_method = params.status_callback_method;
179    let voice_application_sid = params.voice_application_sid;
180    let voice_caller_id_lookup = params.voice_caller_id_lookup;
181    let voice_fallback_method = params.voice_fallback_method;
182    let voice_fallback_url = params.voice_fallback_url;
183    let voice_method = params.voice_method;
184    let voice_url = params.voice_url;
185    let identity_sid = params.identity_sid;
186    let address_sid = params.address_sid;
187    let emergency_status = params.emergency_status;
188    let emergency_address_sid = params.emergency_address_sid;
189    let trunk_sid = params.trunk_sid;
190    let voice_receive_mode = params.voice_receive_mode;
191    let bundle_sid = params.bundle_sid;
192
193
194    let local_var_client = &local_var_configuration.client;
195
196    let local_var_uri_str = format!("{}/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/Local.json", local_var_configuration.base_path, AccountSid=crate::apis::urlencode(account_sid));
197    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
198
199    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
200        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
201    }
202    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
203        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
204    };
205    let mut local_var_form_params = std::collections::HashMap::new();
206    local_var_form_params.insert("PhoneNumber", phone_number.to_string());
207    if let Some(local_var_param_value) = api_version {
208        local_var_form_params.insert("ApiVersion", local_var_param_value.to_string());
209    }
210    if let Some(local_var_param_value) = friendly_name {
211        local_var_form_params.insert("FriendlyName", local_var_param_value.to_string());
212    }
213    if let Some(local_var_param_value) = sms_application_sid {
214        local_var_form_params.insert("SmsApplicationSid", local_var_param_value.to_string());
215    }
216    if let Some(local_var_param_value) = sms_fallback_method {
217        local_var_form_params.insert("SmsFallbackMethod", local_var_param_value.to_string());
218    }
219    if let Some(local_var_param_value) = sms_fallback_url {
220        local_var_form_params.insert("SmsFallbackUrl", local_var_param_value.to_string());
221    }
222    if let Some(local_var_param_value) = sms_method {
223        local_var_form_params.insert("SmsMethod", local_var_param_value.to_string());
224    }
225    if let Some(local_var_param_value) = sms_url {
226        local_var_form_params.insert("SmsUrl", local_var_param_value.to_string());
227    }
228    if let Some(local_var_param_value) = status_callback {
229        local_var_form_params.insert("StatusCallback", local_var_param_value.to_string());
230    }
231    if let Some(local_var_param_value) = status_callback_method {
232        local_var_form_params.insert("StatusCallbackMethod", local_var_param_value.to_string());
233    }
234    if let Some(local_var_param_value) = voice_application_sid {
235        local_var_form_params.insert("VoiceApplicationSid", local_var_param_value.to_string());
236    }
237    if let Some(local_var_param_value) = voice_caller_id_lookup {
238        local_var_form_params.insert("VoiceCallerIdLookup", local_var_param_value.to_string());
239    }
240    if let Some(local_var_param_value) = voice_fallback_method {
241        local_var_form_params.insert("VoiceFallbackMethod", local_var_param_value.to_string());
242    }
243    if let Some(local_var_param_value) = voice_fallback_url {
244        local_var_form_params.insert("VoiceFallbackUrl", local_var_param_value.to_string());
245    }
246    if let Some(local_var_param_value) = voice_method {
247        local_var_form_params.insert("VoiceMethod", local_var_param_value.to_string());
248    }
249    if let Some(local_var_param_value) = voice_url {
250        local_var_form_params.insert("VoiceUrl", local_var_param_value.to_string());
251    }
252    if let Some(local_var_param_value) = identity_sid {
253        local_var_form_params.insert("IdentitySid", local_var_param_value.to_string());
254    }
255    if let Some(local_var_param_value) = address_sid {
256        local_var_form_params.insert("AddressSid", local_var_param_value.to_string());
257    }
258    if let Some(local_var_param_value) = emergency_status {
259        local_var_form_params.insert("EmergencyStatus", local_var_param_value.to_string());
260    }
261    if let Some(local_var_param_value) = emergency_address_sid {
262        local_var_form_params.insert("EmergencyAddressSid", local_var_param_value.to_string());
263    }
264    if let Some(local_var_param_value) = trunk_sid {
265        local_var_form_params.insert("TrunkSid", local_var_param_value.to_string());
266    }
267    if let Some(local_var_param_value) = voice_receive_mode {
268        local_var_form_params.insert("VoiceReceiveMode", local_var_param_value.to_string());
269    }
270    if let Some(local_var_param_value) = bundle_sid {
271        local_var_form_params.insert("BundleSid", local_var_param_value.to_string());
272    }
273    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
274
275    let local_var_req = local_var_req_builder.build()?;
276    let local_var_resp = local_var_client.execute(local_var_req).await?;
277
278    let local_var_status = local_var_resp.status();
279    let local_var_content = local_var_resp.text().await?;
280
281    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
282        serde_json::from_str(&local_var_content).map_err(Error::from)
283    } else {
284        let local_var_entity: Option<CreateIncomingPhoneNumberLocalError> = serde_json::from_str(&local_var_content).ok();
285        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
286        Err(Error::ResponseError(local_var_error))
287    }
288}
289
290/// 
291pub async fn list_available_phone_number_local(configuration: &configuration::Configuration, params: ListAvailablePhoneNumberLocalParams) -> Result<models::ListAvailablePhoneNumberLocalResponse, Error<ListAvailablePhoneNumberLocalError>> {
292    let local_var_configuration = configuration;
293
294    // unbox the parameters
295    let account_sid = params.account_sid;
296    let country_code = params.country_code;
297    let area_code = params.area_code;
298    let contains = params.contains;
299    let sms_enabled = params.sms_enabled;
300    let mms_enabled = params.mms_enabled;
301    let voice_enabled = params.voice_enabled;
302    let exclude_all_address_required = params.exclude_all_address_required;
303    let exclude_local_address_required = params.exclude_local_address_required;
304    let exclude_foreign_address_required = params.exclude_foreign_address_required;
305    let beta = params.beta;
306    let near_number = params.near_number;
307    let near_lat_long = params.near_lat_long;
308    let distance = params.distance;
309    let in_postal_code = params.in_postal_code;
310    let in_region = params.in_region;
311    let in_rate_center = params.in_rate_center;
312    let in_lata = params.in_lata;
313    let in_locality = params.in_locality;
314    let fax_enabled = params.fax_enabled;
315    let page_size = params.page_size;
316    let page = params.page;
317    let page_token = params.page_token;
318
319
320    let local_var_client = &local_var_configuration.client;
321
322    let local_var_uri_str = format!("{}/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/Local.json", local_var_configuration.base_path, AccountSid=crate::apis::urlencode(account_sid), CountryCode=crate::apis::urlencode(country_code));
323    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
324
325    if let Some(ref local_var_str) = area_code {
326        local_var_req_builder = local_var_req_builder.query(&[("AreaCode", &local_var_str.to_string())]);
327    }
328    if let Some(ref local_var_str) = contains {
329        local_var_req_builder = local_var_req_builder.query(&[("Contains", &local_var_str.to_string())]);
330    }
331    if let Some(ref local_var_str) = sms_enabled {
332        local_var_req_builder = local_var_req_builder.query(&[("SmsEnabled", &local_var_str.to_string())]);
333    }
334    if let Some(ref local_var_str) = mms_enabled {
335        local_var_req_builder = local_var_req_builder.query(&[("MmsEnabled", &local_var_str.to_string())]);
336    }
337    if let Some(ref local_var_str) = voice_enabled {
338        local_var_req_builder = local_var_req_builder.query(&[("VoiceEnabled", &local_var_str.to_string())]);
339    }
340    if let Some(ref local_var_str) = exclude_all_address_required {
341        local_var_req_builder = local_var_req_builder.query(&[("ExcludeAllAddressRequired", &local_var_str.to_string())]);
342    }
343    if let Some(ref local_var_str) = exclude_local_address_required {
344        local_var_req_builder = local_var_req_builder.query(&[("ExcludeLocalAddressRequired", &local_var_str.to_string())]);
345    }
346    if let Some(ref local_var_str) = exclude_foreign_address_required {
347        local_var_req_builder = local_var_req_builder.query(&[("ExcludeForeignAddressRequired", &local_var_str.to_string())]);
348    }
349    if let Some(ref local_var_str) = beta {
350        local_var_req_builder = local_var_req_builder.query(&[("Beta", &local_var_str.to_string())]);
351    }
352    if let Some(ref local_var_str) = near_number {
353        local_var_req_builder = local_var_req_builder.query(&[("NearNumber", &local_var_str.to_string())]);
354    }
355    if let Some(ref local_var_str) = near_lat_long {
356        local_var_req_builder = local_var_req_builder.query(&[("NearLatLong", &local_var_str.to_string())]);
357    }
358    if let Some(ref local_var_str) = distance {
359        local_var_req_builder = local_var_req_builder.query(&[("Distance", &local_var_str.to_string())]);
360    }
361    if let Some(ref local_var_str) = in_postal_code {
362        local_var_req_builder = local_var_req_builder.query(&[("InPostalCode", &local_var_str.to_string())]);
363    }
364    if let Some(ref local_var_str) = in_region {
365        local_var_req_builder = local_var_req_builder.query(&[("InRegion", &local_var_str.to_string())]);
366    }
367    if let Some(ref local_var_str) = in_rate_center {
368        local_var_req_builder = local_var_req_builder.query(&[("InRateCenter", &local_var_str.to_string())]);
369    }
370    if let Some(ref local_var_str) = in_lata {
371        local_var_req_builder = local_var_req_builder.query(&[("InLata", &local_var_str.to_string())]);
372    }
373    if let Some(ref local_var_str) = in_locality {
374        local_var_req_builder = local_var_req_builder.query(&[("InLocality", &local_var_str.to_string())]);
375    }
376    if let Some(ref local_var_str) = fax_enabled {
377        local_var_req_builder = local_var_req_builder.query(&[("FaxEnabled", &local_var_str.to_string())]);
378    }
379    if let Some(ref local_var_str) = page_size {
380        local_var_req_builder = local_var_req_builder.query(&[("PageSize", &local_var_str.to_string())]);
381    }
382    if let Some(ref local_var_str) = page {
383        local_var_req_builder = local_var_req_builder.query(&[("Page", &local_var_str.to_string())]);
384    }
385    if let Some(ref local_var_str) = page_token {
386        local_var_req_builder = local_var_req_builder.query(&[("PageToken", &local_var_str.to_string())]);
387    }
388    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
389        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
390    }
391    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
392        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
393    };
394
395    let local_var_req = local_var_req_builder.build()?;
396    let local_var_resp = local_var_client.execute(local_var_req).await?;
397
398    let local_var_status = local_var_resp.status();
399    let local_var_content = local_var_resp.text().await?;
400
401    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
402        serde_json::from_str(&local_var_content).map_err(Error::from)
403    } else {
404        let local_var_entity: Option<ListAvailablePhoneNumberLocalError> = serde_json::from_str(&local_var_content).ok();
405        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
406        Err(Error::ResponseError(local_var_error))
407    }
408}
409
410/// 
411pub async fn list_incoming_phone_number_local(configuration: &configuration::Configuration, params: ListIncomingPhoneNumberLocalParams) -> Result<models::ListIncomingPhoneNumberLocalResponse, Error<ListIncomingPhoneNumberLocalError>> {
412    let local_var_configuration = configuration;
413
414    // unbox the parameters
415    let account_sid = params.account_sid;
416    let beta = params.beta;
417    let friendly_name = params.friendly_name;
418    let phone_number = params.phone_number;
419    let origin = params.origin;
420    let page_size = params.page_size;
421    let page = params.page;
422    let page_token = params.page_token;
423
424
425    let local_var_client = &local_var_configuration.client;
426
427    let local_var_uri_str = format!("{}/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/Local.json", local_var_configuration.base_path, AccountSid=crate::apis::urlencode(account_sid));
428    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
429
430    if let Some(ref local_var_str) = beta {
431        local_var_req_builder = local_var_req_builder.query(&[("Beta", &local_var_str.to_string())]);
432    }
433    if let Some(ref local_var_str) = friendly_name {
434        local_var_req_builder = local_var_req_builder.query(&[("FriendlyName", &local_var_str.to_string())]);
435    }
436    if let Some(ref local_var_str) = phone_number {
437        local_var_req_builder = local_var_req_builder.query(&[("PhoneNumber", &local_var_str.to_string())]);
438    }
439    if let Some(ref local_var_str) = origin {
440        local_var_req_builder = local_var_req_builder.query(&[("Origin", &local_var_str.to_string())]);
441    }
442    if let Some(ref local_var_str) = page_size {
443        local_var_req_builder = local_var_req_builder.query(&[("PageSize", &local_var_str.to_string())]);
444    }
445    if let Some(ref local_var_str) = page {
446        local_var_req_builder = local_var_req_builder.query(&[("Page", &local_var_str.to_string())]);
447    }
448    if let Some(ref local_var_str) = page_token {
449        local_var_req_builder = local_var_req_builder.query(&[("PageToken", &local_var_str.to_string())]);
450    }
451    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
452        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
453    }
454    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
455        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
456    };
457
458    let local_var_req = local_var_req_builder.build()?;
459    let local_var_resp = local_var_client.execute(local_var_req).await?;
460
461    let local_var_status = local_var_resp.status();
462    let local_var_content = local_var_resp.text().await?;
463
464    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
465        serde_json::from_str(&local_var_content).map_err(Error::from)
466    } else {
467        let local_var_entity: Option<ListIncomingPhoneNumberLocalError> = serde_json::from_str(&local_var_content).ok();
468        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
469        Err(Error::ResponseError(local_var_error))
470    }
471}
472