twilio_rust_openapi/apis/
api20100401_transcription_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_realtime_transcription`]
18#[derive(Clone, Debug)]
19pub struct CreateRealtimeTranscriptionParams {
20    /// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Transcription resource.
21    pub account_sid: String,
22    /// The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Transcription resource is associated with.
23    pub call_sid: String,
24    /// The user-specified name of this Transcription, if one was given when the Transcription was created. This may be used to stop the Transcription.
25    pub name: Option<String>,
26    pub track: Option<String>,
27    /// Absolute URL of the status callback.
28    pub status_callback_url: Option<String>,
29    /// The http method for the status_callback (one of GET, POST).
30    pub status_callback_method: Option<String>,
31    /// Friendly name given to the Inbound Track
32    pub inbound_track_label: Option<String>,
33    /// Friendly name given to the Outbound Track
34    pub outbound_track_label: Option<String>,
35    /// Indicates if partial results are going to be sent to the customer
36    pub partial_results: Option<bool>,
37    /// Language code used by the transcription engine, specified in [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) format
38    pub language_code: Option<String>,
39    /// Definition of the transcription engine to be used, among those supported by Twilio
40    pub transcription_engine: Option<String>,
41    /// indicates if the server will attempt to filter out profanities, replacing all but the initial character in each filtered word with asterisks
42    pub profanity_filter: Option<bool>,
43    /// Recognition model used by the transcription engine, among those supported by the provider
44    pub speech_model: Option<String>,
45    /// A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them.
46    pub hints: Option<String>,
47    /// The provider will add punctuation to recognition result
48    pub enable_automatic_punctuation: Option<bool>
49}
50
51/// struct for passing parameters to the method [`delete_recording_transcription`]
52#[derive(Clone, Debug)]
53pub struct DeleteRecordingTranscriptionParams {
54    /// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resources to delete.
55    pub account_sid: String,
56    /// The SID of the [Recording](https://www.twilio.com/docs/voice/api/recording) that created the transcription to delete.
57    pub recording_sid: String,
58    /// The Twilio-provided string that uniquely identifies the Transcription resource to delete.
59    pub sid: String
60}
61
62/// struct for passing parameters to the method [`delete_transcription`]
63#[derive(Clone, Debug)]
64pub struct DeleteTranscriptionParams {
65    /// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resources to delete.
66    pub account_sid: String,
67    /// The Twilio-provided string that uniquely identifies the Transcription resource to delete.
68    pub sid: String
69}
70
71/// struct for passing parameters to the method [`fetch_recording_transcription`]
72#[derive(Clone, Debug)]
73pub struct FetchRecordingTranscriptionParams {
74    /// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource to fetch.
75    pub account_sid: String,
76    /// The SID of the [Recording](https://www.twilio.com/docs/voice/api/recording) that created the transcription to fetch.
77    pub recording_sid: String,
78    /// The Twilio-provided string that uniquely identifies the Transcription resource to fetch.
79    pub sid: String
80}
81
82/// struct for passing parameters to the method [`fetch_transcription`]
83#[derive(Clone, Debug)]
84pub struct FetchTranscriptionParams {
85    /// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource to fetch.
86    pub account_sid: String,
87    /// The Twilio-provided string that uniquely identifies the Transcription resource to fetch.
88    pub sid: String
89}
90
91/// struct for passing parameters to the method [`list_recording_transcription`]
92#[derive(Clone, Debug)]
93pub struct ListRecordingTranscriptionParams {
94    /// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resources to read.
95    pub account_sid: String,
96    /// The SID of the [Recording](https://www.twilio.com/docs/voice/api/recording) that created the transcriptions to read.
97    pub recording_sid: String,
98    /// How many resources to return in each list page. The default is 50, and the maximum is 1000.
99    pub page_size: Option<i32>,
100    /// The page index. This value is simply for client state.
101    pub page: Option<i32>,
102    /// The page token. This is provided by the API.
103    pub page_token: Option<String>
104}
105
106/// struct for passing parameters to the method [`list_transcription`]
107#[derive(Clone, Debug)]
108pub struct ListTranscriptionParams {
109    /// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resources to read.
110    pub account_sid: String,
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 [`update_realtime_transcription`]
120#[derive(Clone, Debug)]
121pub struct UpdateRealtimeTranscriptionParams {
122    /// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Transcription resource.
123    pub account_sid: String,
124    /// The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Transcription resource is associated with.
125    pub call_sid: String,
126    /// The SID of the Transcription resource, or the `name` used when creating the resource
127    pub sid: String,
128    pub status: String
129}
130
131
132/// struct for typed errors of method [`create_realtime_transcription`]
133#[derive(Debug, Clone, Serialize, Deserialize)]
134#[serde(untagged)]
135pub enum CreateRealtimeTranscriptionError {
136    UnknownValue(serde_json::Value),
137}
138
139/// struct for typed errors of method [`delete_recording_transcription`]
140#[derive(Debug, Clone, Serialize, Deserialize)]
141#[serde(untagged)]
142pub enum DeleteRecordingTranscriptionError {
143    UnknownValue(serde_json::Value),
144}
145
146/// struct for typed errors of method [`delete_transcription`]
147#[derive(Debug, Clone, Serialize, Deserialize)]
148#[serde(untagged)]
149pub enum DeleteTranscriptionError {
150    UnknownValue(serde_json::Value),
151}
152
153/// struct for typed errors of method [`fetch_recording_transcription`]
154#[derive(Debug, Clone, Serialize, Deserialize)]
155#[serde(untagged)]
156pub enum FetchRecordingTranscriptionError {
157    UnknownValue(serde_json::Value),
158}
159
160/// struct for typed errors of method [`fetch_transcription`]
161#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum FetchTranscriptionError {
164    UnknownValue(serde_json::Value),
165}
166
167/// struct for typed errors of method [`list_recording_transcription`]
168#[derive(Debug, Clone, Serialize, Deserialize)]
169#[serde(untagged)]
170pub enum ListRecordingTranscriptionError {
171    UnknownValue(serde_json::Value),
172}
173
174/// struct for typed errors of method [`list_transcription`]
175#[derive(Debug, Clone, Serialize, Deserialize)]
176#[serde(untagged)]
177pub enum ListTranscriptionError {
178    UnknownValue(serde_json::Value),
179}
180
181/// struct for typed errors of method [`update_realtime_transcription`]
182#[derive(Debug, Clone, Serialize, Deserialize)]
183#[serde(untagged)]
184pub enum UpdateRealtimeTranscriptionError {
185    UnknownValue(serde_json::Value),
186}
187
188
189/// Create a Transcription
190pub async fn create_realtime_transcription(configuration: &configuration::Configuration, params: CreateRealtimeTranscriptionParams) -> Result<models::ApiPeriodV2010PeriodAccountPeriodCallPeriodRealtimeTranscription, Error<CreateRealtimeTranscriptionError>> {
191    let local_var_configuration = configuration;
192
193    // unbox the parameters
194    let account_sid = params.account_sid;
195    let call_sid = params.call_sid;
196    let name = params.name;
197    let track = params.track;
198    let status_callback_url = params.status_callback_url;
199    let status_callback_method = params.status_callback_method;
200    let inbound_track_label = params.inbound_track_label;
201    let outbound_track_label = params.outbound_track_label;
202    let partial_results = params.partial_results;
203    let language_code = params.language_code;
204    let transcription_engine = params.transcription_engine;
205    let profanity_filter = params.profanity_filter;
206    let speech_model = params.speech_model;
207    let hints = params.hints;
208    let enable_automatic_punctuation = params.enable_automatic_punctuation;
209
210
211    let local_var_client = &local_var_configuration.client;
212
213    let local_var_uri_str = format!("{}/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Transcriptions.json", local_var_configuration.base_path, AccountSid=crate::apis::urlencode(account_sid), CallSid=crate::apis::urlencode(call_sid));
214    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
215
216    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
217        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
218    }
219    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
220        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
221    };
222    let mut local_var_form_params = std::collections::HashMap::new();
223    if let Some(local_var_param_value) = name {
224        local_var_form_params.insert("Name", local_var_param_value.to_string());
225    }
226    if let Some(local_var_param_value) = track {
227        local_var_form_params.insert("Track", local_var_param_value.to_string());
228    }
229    if let Some(local_var_param_value) = status_callback_url {
230        local_var_form_params.insert("StatusCallbackUrl", local_var_param_value.to_string());
231    }
232    if let Some(local_var_param_value) = status_callback_method {
233        local_var_form_params.insert("StatusCallbackMethod", local_var_param_value.to_string());
234    }
235    if let Some(local_var_param_value) = inbound_track_label {
236        local_var_form_params.insert("InboundTrackLabel", local_var_param_value.to_string());
237    }
238    if let Some(local_var_param_value) = outbound_track_label {
239        local_var_form_params.insert("OutboundTrackLabel", local_var_param_value.to_string());
240    }
241    if let Some(local_var_param_value) = partial_results {
242        local_var_form_params.insert("PartialResults", local_var_param_value.to_string());
243    }
244    if let Some(local_var_param_value) = language_code {
245        local_var_form_params.insert("LanguageCode", local_var_param_value.to_string());
246    }
247    if let Some(local_var_param_value) = transcription_engine {
248        local_var_form_params.insert("TranscriptionEngine", local_var_param_value.to_string());
249    }
250    if let Some(local_var_param_value) = profanity_filter {
251        local_var_form_params.insert("ProfanityFilter", local_var_param_value.to_string());
252    }
253    if let Some(local_var_param_value) = speech_model {
254        local_var_form_params.insert("SpeechModel", local_var_param_value.to_string());
255    }
256    if let Some(local_var_param_value) = hints {
257        local_var_form_params.insert("Hints", local_var_param_value.to_string());
258    }
259    if let Some(local_var_param_value) = enable_automatic_punctuation {
260        local_var_form_params.insert("EnableAutomaticPunctuation", local_var_param_value.to_string());
261    }
262    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
263
264    let local_var_req = local_var_req_builder.build()?;
265    let local_var_resp = local_var_client.execute(local_var_req).await?;
266
267    let local_var_status = local_var_resp.status();
268    let local_var_content = local_var_resp.text().await?;
269
270    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
271        serde_json::from_str(&local_var_content).map_err(Error::from)
272    } else {
273        let local_var_entity: Option<CreateRealtimeTranscriptionError> = serde_json::from_str(&local_var_content).ok();
274        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
275        Err(Error::ResponseError(local_var_error))
276    }
277}
278
279/// 
280pub async fn delete_recording_transcription(configuration: &configuration::Configuration, params: DeleteRecordingTranscriptionParams) -> Result<(), Error<DeleteRecordingTranscriptionError>> {
281    let local_var_configuration = configuration;
282
283    // unbox the parameters
284    let account_sid = params.account_sid;
285    let recording_sid = params.recording_sid;
286    let sid = params.sid;
287
288
289    let local_var_client = &local_var_configuration.client;
290
291    let local_var_uri_str = format!("{}/2010-04-01/Accounts/{AccountSid}/Recordings/{RecordingSid}/Transcriptions/{Sid}.json", local_var_configuration.base_path, AccountSid=crate::apis::urlencode(account_sid), RecordingSid=crate::apis::urlencode(recording_sid), Sid=crate::apis::urlencode(sid));
292    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
293
294    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
295        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
296    }
297    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
298        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
299    };
300
301    let local_var_req = local_var_req_builder.build()?;
302    let local_var_resp = local_var_client.execute(local_var_req).await?;
303
304    let local_var_status = local_var_resp.status();
305    let local_var_content = local_var_resp.text().await?;
306
307    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
308        Ok(())
309    } else {
310        let local_var_entity: Option<DeleteRecordingTranscriptionError> = serde_json::from_str(&local_var_content).ok();
311        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
312        Err(Error::ResponseError(local_var_error))
313    }
314}
315
316/// Delete a transcription from the account used to make the request
317pub async fn delete_transcription(configuration: &configuration::Configuration, params: DeleteTranscriptionParams) -> Result<(), Error<DeleteTranscriptionError>> {
318    let local_var_configuration = configuration;
319
320    // unbox the parameters
321    let account_sid = params.account_sid;
322    let sid = params.sid;
323
324
325    let local_var_client = &local_var_configuration.client;
326
327    let local_var_uri_str = format!("{}/2010-04-01/Accounts/{AccountSid}/Transcriptions/{Sid}.json", local_var_configuration.base_path, AccountSid=crate::apis::urlencode(account_sid), Sid=crate::apis::urlencode(sid));
328    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
329
330    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
331        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
332    }
333    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
334        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
335    };
336
337    let local_var_req = local_var_req_builder.build()?;
338    let local_var_resp = local_var_client.execute(local_var_req).await?;
339
340    let local_var_status = local_var_resp.status();
341    let local_var_content = local_var_resp.text().await?;
342
343    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
344        Ok(())
345    } else {
346        let local_var_entity: Option<DeleteTranscriptionError> = serde_json::from_str(&local_var_content).ok();
347        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
348        Err(Error::ResponseError(local_var_error))
349    }
350}
351
352/// 
353pub async fn fetch_recording_transcription(configuration: &configuration::Configuration, params: FetchRecordingTranscriptionParams) -> Result<models::ApiPeriodV2010PeriodAccountPeriodRecordingPeriodRecordingTranscription, Error<FetchRecordingTranscriptionError>> {
354    let local_var_configuration = configuration;
355
356    // unbox the parameters
357    let account_sid = params.account_sid;
358    let recording_sid = params.recording_sid;
359    let sid = params.sid;
360
361
362    let local_var_client = &local_var_configuration.client;
363
364    let local_var_uri_str = format!("{}/2010-04-01/Accounts/{AccountSid}/Recordings/{RecordingSid}/Transcriptions/{Sid}.json", local_var_configuration.base_path, AccountSid=crate::apis::urlencode(account_sid), RecordingSid=crate::apis::urlencode(recording_sid), Sid=crate::apis::urlencode(sid));
365    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
366
367    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
368        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
369    }
370    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
371        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
372    };
373
374    let local_var_req = local_var_req_builder.build()?;
375    let local_var_resp = local_var_client.execute(local_var_req).await?;
376
377    let local_var_status = local_var_resp.status();
378    let local_var_content = local_var_resp.text().await?;
379
380    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
381        serde_json::from_str(&local_var_content).map_err(Error::from)
382    } else {
383        let local_var_entity: Option<FetchRecordingTranscriptionError> = serde_json::from_str(&local_var_content).ok();
384        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
385        Err(Error::ResponseError(local_var_error))
386    }
387}
388
389/// Fetch an instance of a Transcription
390pub async fn fetch_transcription(configuration: &configuration::Configuration, params: FetchTranscriptionParams) -> Result<models::ApiPeriodV2010PeriodAccountPeriodTranscription, Error<FetchTranscriptionError>> {
391    let local_var_configuration = configuration;
392
393    // unbox the parameters
394    let account_sid = params.account_sid;
395    let sid = params.sid;
396
397
398    let local_var_client = &local_var_configuration.client;
399
400    let local_var_uri_str = format!("{}/2010-04-01/Accounts/{AccountSid}/Transcriptions/{Sid}.json", local_var_configuration.base_path, AccountSid=crate::apis::urlencode(account_sid), Sid=crate::apis::urlencode(sid));
401    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
402
403    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
404        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
405    }
406    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
407        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
408    };
409
410    let local_var_req = local_var_req_builder.build()?;
411    let local_var_resp = local_var_client.execute(local_var_req).await?;
412
413    let local_var_status = local_var_resp.status();
414    let local_var_content = local_var_resp.text().await?;
415
416    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
417        serde_json::from_str(&local_var_content).map_err(Error::from)
418    } else {
419        let local_var_entity: Option<FetchTranscriptionError> = serde_json::from_str(&local_var_content).ok();
420        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
421        Err(Error::ResponseError(local_var_error))
422    }
423}
424
425/// 
426pub async fn list_recording_transcription(configuration: &configuration::Configuration, params: ListRecordingTranscriptionParams) -> Result<models::ListRecordingTranscriptionResponse, Error<ListRecordingTranscriptionError>> {
427    let local_var_configuration = configuration;
428
429    // unbox the parameters
430    let account_sid = params.account_sid;
431    let recording_sid = params.recording_sid;
432    let page_size = params.page_size;
433    let page = params.page;
434    let page_token = params.page_token;
435
436
437    let local_var_client = &local_var_configuration.client;
438
439    let local_var_uri_str = format!("{}/2010-04-01/Accounts/{AccountSid}/Recordings/{RecordingSid}/Transcriptions.json", local_var_configuration.base_path, AccountSid=crate::apis::urlencode(account_sid), RecordingSid=crate::apis::urlencode(recording_sid));
440    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
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<ListRecordingTranscriptionError> = 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
473/// Retrieve a list of transcriptions belonging to the account used to make the request
474pub async fn list_transcription(configuration: &configuration::Configuration, params: ListTranscriptionParams) -> Result<models::ListTranscriptionResponse, Error<ListTranscriptionError>> {
475    let local_var_configuration = configuration;
476
477    // unbox the parameters
478    let account_sid = params.account_sid;
479    let page_size = params.page_size;
480    let page = params.page;
481    let page_token = params.page_token;
482
483
484    let local_var_client = &local_var_configuration.client;
485
486    let local_var_uri_str = format!("{}/2010-04-01/Accounts/{AccountSid}/Transcriptions.json", local_var_configuration.base_path, AccountSid=crate::apis::urlencode(account_sid));
487    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
488
489    if let Some(ref local_var_str) = page_size {
490        local_var_req_builder = local_var_req_builder.query(&[("PageSize", &local_var_str.to_string())]);
491    }
492    if let Some(ref local_var_str) = page {
493        local_var_req_builder = local_var_req_builder.query(&[("Page", &local_var_str.to_string())]);
494    }
495    if let Some(ref local_var_str) = page_token {
496        local_var_req_builder = local_var_req_builder.query(&[("PageToken", &local_var_str.to_string())]);
497    }
498    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
499        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
500    }
501    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
502        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
503    };
504
505    let local_var_req = local_var_req_builder.build()?;
506    let local_var_resp = local_var_client.execute(local_var_req).await?;
507
508    let local_var_status = local_var_resp.status();
509    let local_var_content = local_var_resp.text().await?;
510
511    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
512        serde_json::from_str(&local_var_content).map_err(Error::from)
513    } else {
514        let local_var_entity: Option<ListTranscriptionError> = serde_json::from_str(&local_var_content).ok();
515        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
516        Err(Error::ResponseError(local_var_error))
517    }
518}
519
520/// Stop a Transcription using either the SID of the Transcription resource or the `name` used when creating the resource
521pub async fn update_realtime_transcription(configuration: &configuration::Configuration, params: UpdateRealtimeTranscriptionParams) -> Result<models::ApiPeriodV2010PeriodAccountPeriodCallPeriodRealtimeTranscription, Error<UpdateRealtimeTranscriptionError>> {
522    let local_var_configuration = configuration;
523
524    // unbox the parameters
525    let account_sid = params.account_sid;
526    let call_sid = params.call_sid;
527    let sid = params.sid;
528    let status = params.status;
529
530
531    let local_var_client = &local_var_configuration.client;
532
533    let local_var_uri_str = format!("{}/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Transcriptions/{Sid}.json", local_var_configuration.base_path, AccountSid=crate::apis::urlencode(account_sid), CallSid=crate::apis::urlencode(call_sid), Sid=crate::apis::urlencode(sid));
534    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
535
536    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
537        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
538    }
539    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
540        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
541    };
542    let mut local_var_form_params = std::collections::HashMap::new();
543    local_var_form_params.insert("Status", status.to_string());
544    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
545
546    let local_var_req = local_var_req_builder.build()?;
547    let local_var_resp = local_var_client.execute(local_var_req).await?;
548
549    let local_var_status = local_var_resp.status();
550    let local_var_content = local_var_resp.text().await?;
551
552    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
553        serde_json::from_str(&local_var_content).map_err(Error::from)
554    } else {
555        let local_var_entity: Option<UpdateRealtimeTranscriptionError> = serde_json::from_str(&local_var_content).ok();
556        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
557        Err(Error::ResponseError(local_var_error))
558    }
559}
560