vrchatapi/apis/
files_api.rs

1/*
2 * VRChat API Documentation
3 *
4 *
5 * Contact: vrchatapi.lpv0t@aries.fyi
6 * Generated by: https://openapi-generator.tech
7 */
8
9use super::{configuration, ContentType, Error};
10use crate::{apis::ResponseContent, models};
11use reqwest;
12use serde::{de::Error as _, Deserialize, Serialize};
13
14/// struct for typed errors of method [`create_file`]
15#[derive(Debug, Clone, Serialize, Deserialize)]
16#[serde(untagged)]
17pub enum CreateFileError {
18    UnknownValue(serde_json::Value),
19}
20
21/// struct for typed errors of method [`create_file_version`]
22#[derive(Debug, Clone, Serialize, Deserialize)]
23#[serde(untagged)]
24pub enum CreateFileVersionError {
25    UnknownValue(serde_json::Value),
26}
27
28/// struct for typed errors of method [`delete_file`]
29#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum DeleteFileError {
32    Status404(models::Error),
33    UnknownValue(serde_json::Value),
34}
35
36/// struct for typed errors of method [`delete_file_version`]
37#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(untagged)]
39pub enum DeleteFileVersionError {
40    Status400(models::Error),
41    Status500(models::Error),
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`download_file_version`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum DownloadFileVersionError {
49    Status404(models::Error),
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`finish_file_data_upload`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum FinishFileDataUploadError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`get_admin_asset_bundle`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetAdminAssetBundleError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`get_content_agreement_status`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetContentAgreementStatusError {
71    Status401(models::Error),
72    UnknownValue(serde_json::Value),
73}
74
75/// struct for typed errors of method [`get_file`]
76#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum GetFileError {
79    Status404(models::Error),
80    UnknownValue(serde_json::Value),
81}
82
83/// struct for typed errors of method [`get_file_analysis`]
84#[derive(Debug, Clone, Serialize, Deserialize)]
85#[serde(untagged)]
86pub enum GetFileAnalysisError {
87    Status404(models::Error),
88    UnknownValue(serde_json::Value),
89}
90
91/// struct for typed errors of method [`get_file_analysis_security`]
92#[derive(Debug, Clone, Serialize, Deserialize)]
93#[serde(untagged)]
94pub enum GetFileAnalysisSecurityError {
95    Status404(models::Error),
96    UnknownValue(serde_json::Value),
97}
98
99/// struct for typed errors of method [`get_file_analysis_standard`]
100#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum GetFileAnalysisStandardError {
103    Status404(models::Error),
104    UnknownValue(serde_json::Value),
105}
106
107/// struct for typed errors of method [`get_file_data_upload_status`]
108#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum GetFileDataUploadStatusError {
111    UnknownValue(serde_json::Value),
112}
113
114/// struct for typed errors of method [`get_files`]
115#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum GetFilesError {
118    UnknownValue(serde_json::Value),
119}
120
121/// struct for typed errors of method [`set_group_gallery_file_order`]
122#[derive(Debug, Clone, Serialize, Deserialize)]
123#[serde(untagged)]
124pub enum SetGroupGalleryFileOrderError {
125    Status404(models::Error),
126    UnknownValue(serde_json::Value),
127}
128
129/// struct for typed errors of method [`start_file_data_upload`]
130#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum StartFileDataUploadError {
133    Status400(models::Error),
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`submit_content_agreement`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum SubmitContentAgreementError {
141    Status401(models::Error),
142    UnknownValue(serde_json::Value),
143}
144
145/// struct for typed errors of method [`update_asset_review_notes`]
146#[derive(Debug, Clone, Serialize, Deserialize)]
147#[serde(untagged)]
148pub enum UpdateAssetReviewNotesError {
149    Status401(models::Error),
150    UnknownValue(serde_json::Value),
151}
152
153/// struct for typed errors of method [`upload_gallery_image`]
154#[derive(Debug, Clone, Serialize, Deserialize)]
155#[serde(untagged)]
156pub enum UploadGalleryImageError {
157    UnknownValue(serde_json::Value),
158}
159
160/// struct for typed errors of method [`upload_icon`]
161#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum UploadIconError {
164    UnknownValue(serde_json::Value),
165}
166
167/// struct for typed errors of method [`upload_image`]
168#[derive(Debug, Clone, Serialize, Deserialize)]
169#[serde(untagged)]
170pub enum UploadImageError {
171    UnknownValue(serde_json::Value),
172}
173
174/// Creates a new File object
175pub async fn create_file(
176    configuration: &configuration::Configuration,
177    create_file_request: Option<models::CreateFileRequest>,
178) -> Result<models::File, Error<CreateFileError>> {
179    // add a prefix to parameters to efficiently prevent name collisions
180    let p_body_create_file_request = create_file_request;
181
182    let uri_str = format!("{}/file", configuration.base_path);
183    let mut req_builder = configuration
184        .client
185        .request(reqwest::Method::POST, &uri_str);
186
187    if let Some(ref user_agent) = configuration.user_agent {
188        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
189    }
190    req_builder = req_builder.json(&p_body_create_file_request);
191
192    let req = req_builder.build()?;
193    let resp = configuration.client.execute(req).await?;
194
195    let status = resp.status();
196    let content_type = resp
197        .headers()
198        .get("content-type")
199        .and_then(|v| v.to_str().ok())
200        .unwrap_or("application/octet-stream");
201    let content_type = super::ContentType::from(content_type);
202
203    if !status.is_client_error() && !status.is_server_error() {
204        let content = resp.text().await?;
205        match content_type {
206            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
207            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::File`"))),
208            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::File`")))),
209        }
210    } else {
211        let content = resp.text().await?;
212        let entity: Option<CreateFileError> = serde_json::from_str(&content).ok();
213        Err(Error::ResponseError(ResponseContent {
214            status,
215            content,
216            entity,
217        }))
218    }
219}
220
221/// Creates a new FileVersion. Once a Version has been created, proceed to the `/file/{fileId}/{versionId}/file/start` endpoint to start a file upload.
222pub async fn create_file_version(
223    configuration: &configuration::Configuration,
224    file_id: &str,
225    create_file_version_request: Option<models::CreateFileVersionRequest>,
226) -> Result<models::File, Error<CreateFileVersionError>> {
227    // add a prefix to parameters to efficiently prevent name collisions
228    let p_path_file_id = file_id;
229    let p_body_create_file_version_request = create_file_version_request;
230
231    let uri_str = format!(
232        "{}/file/{fileId}",
233        configuration.base_path,
234        fileId = crate::apis::urlencode(p_path_file_id)
235    );
236    let mut req_builder = configuration
237        .client
238        .request(reqwest::Method::POST, &uri_str);
239
240    if let Some(ref user_agent) = configuration.user_agent {
241        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
242    }
243    req_builder = req_builder.json(&p_body_create_file_version_request);
244
245    let req = req_builder.build()?;
246    let resp = configuration.client.execute(req).await?;
247
248    let status = resp.status();
249    let content_type = resp
250        .headers()
251        .get("content-type")
252        .and_then(|v| v.to_str().ok())
253        .unwrap_or("application/octet-stream");
254    let content_type = super::ContentType::from(content_type);
255
256    if !status.is_client_error() && !status.is_server_error() {
257        let content = resp.text().await?;
258        match content_type {
259            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
260            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::File`"))),
261            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::File`")))),
262        }
263    } else {
264        let content = resp.text().await?;
265        let entity: Option<CreateFileVersionError> = serde_json::from_str(&content).ok();
266        Err(Error::ResponseError(ResponseContent {
267            status,
268            content,
269            entity,
270        }))
271    }
272}
273
274/// Deletes a File object.
275pub async fn delete_file(
276    configuration: &configuration::Configuration,
277    file_id: &str,
278) -> Result<models::File, Error<DeleteFileError>> {
279    // add a prefix to parameters to efficiently prevent name collisions
280    let p_path_file_id = file_id;
281
282    let uri_str = format!(
283        "{}/file/{fileId}",
284        configuration.base_path,
285        fileId = crate::apis::urlencode(p_path_file_id)
286    );
287    let mut req_builder = configuration
288        .client
289        .request(reqwest::Method::DELETE, &uri_str);
290
291    if let Some(ref user_agent) = configuration.user_agent {
292        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
293    }
294
295    let req = req_builder.build()?;
296    let resp = configuration.client.execute(req).await?;
297
298    let status = resp.status();
299    let content_type = resp
300        .headers()
301        .get("content-type")
302        .and_then(|v| v.to_str().ok())
303        .unwrap_or("application/octet-stream");
304    let content_type = super::ContentType::from(content_type);
305
306    if !status.is_client_error() && !status.is_server_error() {
307        let content = resp.text().await?;
308        match content_type {
309            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
310            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::File`"))),
311            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::File`")))),
312        }
313    } else {
314        let content = resp.text().await?;
315        let entity: Option<DeleteFileError> = serde_json::from_str(&content).ok();
316        Err(Error::ResponseError(ResponseContent {
317            status,
318            content,
319            entity,
320        }))
321    }
322}
323
324/// Delete a specific version of a file. You can only delete the latest version.
325pub async fn delete_file_version(
326    configuration: &configuration::Configuration,
327    file_id: &str,
328    version_id: i32,
329) -> Result<models::File, Error<DeleteFileVersionError>> {
330    // add a prefix to parameters to efficiently prevent name collisions
331    let p_path_file_id = file_id;
332    let p_path_version_id = version_id;
333
334    let uri_str = format!(
335        "{}/file/{fileId}/{versionId}",
336        configuration.base_path,
337        fileId = crate::apis::urlencode(p_path_file_id),
338        versionId = p_path_version_id
339    );
340    let mut req_builder = configuration
341        .client
342        .request(reqwest::Method::DELETE, &uri_str);
343
344    if let Some(ref user_agent) = configuration.user_agent {
345        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
346    }
347
348    let req = req_builder.build()?;
349    let resp = configuration.client.execute(req).await?;
350
351    let status = resp.status();
352    let content_type = resp
353        .headers()
354        .get("content-type")
355        .and_then(|v| v.to_str().ok())
356        .unwrap_or("application/octet-stream");
357    let content_type = super::ContentType::from(content_type);
358
359    if !status.is_client_error() && !status.is_server_error() {
360        let content = resp.text().await?;
361        match content_type {
362            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
363            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::File`"))),
364            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::File`")))),
365        }
366    } else {
367        let content = resp.text().await?;
368        let entity: Option<DeleteFileVersionError> = serde_json::from_str(&content).ok();
369        Err(Error::ResponseError(ResponseContent {
370            status,
371            content,
372            entity,
373        }))
374    }
375}
376
377/// Downloads the file with the provided version number.  **Version Note:** Version 0 is always when the file was created. The real data is usually always located in version 1 and up.  **Extension Note:** Files are not guaranteed to have a file extensions. UnityPackage files tends to have it, images through this endpoint do not. You are responsible for appending file extension from the `extension` field when neccesary.
378pub async fn download_file_version(
379    configuration: &configuration::Configuration,
380    file_id: &str,
381    version_id: i32,
382) -> Result<reqwest::Response, Error<DownloadFileVersionError>> {
383    // add a prefix to parameters to efficiently prevent name collisions
384    let p_path_file_id = file_id;
385    let p_path_version_id = version_id;
386
387    let uri_str = format!(
388        "{}/file/{fileId}/{versionId}",
389        configuration.base_path,
390        fileId = crate::apis::urlencode(p_path_file_id),
391        versionId = p_path_version_id
392    );
393    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
394
395    if let Some(ref user_agent) = configuration.user_agent {
396        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
397    }
398
399    let req = req_builder.build()?;
400    let resp = configuration.client.execute(req).await?;
401
402    let status = resp.status();
403
404    if !status.is_client_error() && !status.is_server_error() {
405        Ok(resp)
406    } else {
407        let content = resp.text().await?;
408        let entity: Option<DownloadFileVersionError> = serde_json::from_str(&content).ok();
409        Err(Error::ResponseError(ResponseContent {
410            status,
411            content,
412            entity,
413        }))
414    }
415}
416
417/// Finish an upload of a FileData. This will mark it as \"complete\". After uploading the `file` for Avatars and Worlds you then have to upload a `signature` file.
418pub async fn finish_file_data_upload(
419    configuration: &configuration::Configuration,
420    file_id: &str,
421    version_id: i32,
422    file_type: &str,
423    finish_file_data_upload_request: Option<models::FinishFileDataUploadRequest>,
424) -> Result<models::File, Error<FinishFileDataUploadError>> {
425    // add a prefix to parameters to efficiently prevent name collisions
426    let p_path_file_id = file_id;
427    let p_path_version_id = version_id;
428    let p_path_file_type = file_type;
429    let p_body_finish_file_data_upload_request = finish_file_data_upload_request;
430
431    let uri_str = format!(
432        "{}/file/{fileId}/{versionId}/{fileType}/finish",
433        configuration.base_path,
434        fileId = crate::apis::urlencode(p_path_file_id),
435        versionId = p_path_version_id,
436        fileType = crate::apis::urlencode(p_path_file_type)
437    );
438    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
439
440    if let Some(ref user_agent) = configuration.user_agent {
441        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
442    }
443    req_builder = req_builder.json(&p_body_finish_file_data_upload_request);
444
445    let req = req_builder.build()?;
446    let resp = configuration.client.execute(req).await?;
447
448    let status = resp.status();
449    let content_type = resp
450        .headers()
451        .get("content-type")
452        .and_then(|v| v.to_str().ok())
453        .unwrap_or("application/octet-stream");
454    let content_type = super::ContentType::from(content_type);
455
456    if !status.is_client_error() && !status.is_server_error() {
457        let content = resp.text().await?;
458        match content_type {
459            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
460            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::File`"))),
461            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::File`")))),
462        }
463    } else {
464        let content = resp.text().await?;
465        let entity: Option<FinishFileDataUploadError> = serde_json::from_str(&content).ok();
466        Err(Error::ResponseError(ResponseContent {
467            status,
468            content,
469            entity,
470        }))
471    }
472}
473
474/// Returns an AdminAssetBundle
475pub async fn get_admin_asset_bundle(
476    configuration: &configuration::Configuration,
477    admin_asset_bundle_id: &str,
478) -> Result<models::AdminAssetBundle, Error<GetAdminAssetBundleError>> {
479    // add a prefix to parameters to efficiently prevent name collisions
480    let p_path_admin_asset_bundle_id = admin_asset_bundle_id;
481
482    let uri_str = format!(
483        "{}/adminassetbundles/{adminAssetBundleId}",
484        configuration.base_path,
485        adminAssetBundleId = crate::apis::urlencode(p_path_admin_asset_bundle_id)
486    );
487    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
488
489    if let Some(ref user_agent) = configuration.user_agent {
490        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
491    }
492
493    let req = req_builder.build()?;
494    let resp = configuration.client.execute(req).await?;
495
496    let status = resp.status();
497    let content_type = resp
498        .headers()
499        .get("content-type")
500        .and_then(|v| v.to_str().ok())
501        .unwrap_or("application/octet-stream");
502    let content_type = super::ContentType::from(content_type);
503
504    if !status.is_client_error() && !status.is_server_error() {
505        let content = resp.text().await?;
506        match content_type {
507            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
508            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AdminAssetBundle`"))),
509            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AdminAssetBundle`")))),
510        }
511    } else {
512        let content = resp.text().await?;
513        let entity: Option<GetAdminAssetBundleError> = serde_json::from_str(&content).ok();
514        Err(Error::ResponseError(ResponseContent {
515            status,
516            content,
517            entity,
518        }))
519    }
520}
521
522/// Returns the agreement status of the currently authenticated user for the given agreementCode, contentId, and version.
523pub async fn get_content_agreement_status(
524    configuration: &configuration::Configuration,
525    agreement_code: models::AgreementCode,
526    content_id: &str,
527    version: i32,
528) -> Result<models::AgreementStatus, Error<GetContentAgreementStatusError>> {
529    // add a prefix to parameters to efficiently prevent name collisions
530    let p_query_agreement_code = agreement_code;
531    let p_query_content_id = content_id;
532    let p_query_version = version;
533
534    let uri_str = format!("{}/agreement", configuration.base_path);
535    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
536
537    req_builder = req_builder.query(&[("agreementCode", &p_query_agreement_code.to_string())]);
538    req_builder = req_builder.query(&[("contentId", &p_query_content_id.to_string())]);
539    req_builder = req_builder.query(&[("version", &p_query_version.to_string())]);
540    if let Some(ref user_agent) = configuration.user_agent {
541        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
542    }
543
544    let req = req_builder.build()?;
545    let resp = configuration.client.execute(req).await?;
546
547    let status = resp.status();
548    let content_type = resp
549        .headers()
550        .get("content-type")
551        .and_then(|v| v.to_str().ok())
552        .unwrap_or("application/octet-stream");
553    let content_type = super::ContentType::from(content_type);
554
555    if !status.is_client_error() && !status.is_server_error() {
556        let content = resp.text().await?;
557        match content_type {
558            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
559            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AgreementStatus`"))),
560            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AgreementStatus`")))),
561        }
562    } else {
563        let content = resp.text().await?;
564        let entity: Option<GetContentAgreementStatusError> = serde_json::from_str(&content).ok();
565        Err(Error::ResponseError(ResponseContent {
566            status,
567            content,
568            entity,
569        }))
570    }
571}
572
573/// Shows general information about the \"File\" object. Each File can have several \"Version\"'s, and each Version can have multiple real files or \"Data\" blobs.
574pub async fn get_file(
575    configuration: &configuration::Configuration,
576    file_id: &str,
577) -> Result<models::File, Error<GetFileError>> {
578    // add a prefix to parameters to efficiently prevent name collisions
579    let p_path_file_id = file_id;
580
581    let uri_str = format!(
582        "{}/file/{fileId}",
583        configuration.base_path,
584        fileId = crate::apis::urlencode(p_path_file_id)
585    );
586    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
587
588    if let Some(ref user_agent) = configuration.user_agent {
589        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
590    }
591
592    let req = req_builder.build()?;
593    let resp = configuration.client.execute(req).await?;
594
595    let status = resp.status();
596    let content_type = resp
597        .headers()
598        .get("content-type")
599        .and_then(|v| v.to_str().ok())
600        .unwrap_or("application/octet-stream");
601    let content_type = super::ContentType::from(content_type);
602
603    if !status.is_client_error() && !status.is_server_error() {
604        let content = resp.text().await?;
605        match content_type {
606            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
607            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::File`"))),
608            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::File`")))),
609        }
610    } else {
611        let content = resp.text().await?;
612        let entity: Option<GetFileError> = serde_json::from_str(&content).ok();
613        Err(Error::ResponseError(ResponseContent {
614            status,
615            content,
616            entity,
617        }))
618    }
619}
620
621/// Get the performance analysis for the uploaded assets of an avatar
622pub async fn get_file_analysis(
623    configuration: &configuration::Configuration,
624    file_id: &str,
625    version_id: i32,
626) -> Result<models::FileAnalysis, Error<GetFileAnalysisError>> {
627    // add a prefix to parameters to efficiently prevent name collisions
628    let p_path_file_id = file_id;
629    let p_path_version_id = version_id;
630
631    let uri_str = format!(
632        "{}/analysis/{fileId}/{versionId}",
633        configuration.base_path,
634        fileId = crate::apis::urlencode(p_path_file_id),
635        versionId = p_path_version_id
636    );
637    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
638
639    if let Some(ref user_agent) = configuration.user_agent {
640        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
641    }
642
643    let req = req_builder.build()?;
644    let resp = configuration.client.execute(req).await?;
645
646    let status = resp.status();
647    let content_type = resp
648        .headers()
649        .get("content-type")
650        .and_then(|v| v.to_str().ok())
651        .unwrap_or("application/octet-stream");
652    let content_type = super::ContentType::from(content_type);
653
654    if !status.is_client_error() && !status.is_server_error() {
655        let content = resp.text().await?;
656        match content_type {
657            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
658            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FileAnalysis`"))),
659            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FileAnalysis`")))),
660        }
661    } else {
662        let content = resp.text().await?;
663        let entity: Option<GetFileAnalysisError> = serde_json::from_str(&content).ok();
664        Err(Error::ResponseError(ResponseContent {
665            status,
666            content,
667            entity,
668        }))
669    }
670}
671
672/// Get the security performance analysis for the uploaded assets of an avatar
673pub async fn get_file_analysis_security(
674    configuration: &configuration::Configuration,
675    file_id: &str,
676    version_id: i32,
677) -> Result<models::FileAnalysis, Error<GetFileAnalysisSecurityError>> {
678    // add a prefix to parameters to efficiently prevent name collisions
679    let p_path_file_id = file_id;
680    let p_path_version_id = version_id;
681
682    let uri_str = format!(
683        "{}/analysis/{fileId}/{versionId}/security",
684        configuration.base_path,
685        fileId = crate::apis::urlencode(p_path_file_id),
686        versionId = p_path_version_id
687    );
688    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
689
690    if let Some(ref user_agent) = configuration.user_agent {
691        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
692    }
693
694    let req = req_builder.build()?;
695    let resp = configuration.client.execute(req).await?;
696
697    let status = resp.status();
698    let content_type = resp
699        .headers()
700        .get("content-type")
701        .and_then(|v| v.to_str().ok())
702        .unwrap_or("application/octet-stream");
703    let content_type = super::ContentType::from(content_type);
704
705    if !status.is_client_error() && !status.is_server_error() {
706        let content = resp.text().await?;
707        match content_type {
708            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
709            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FileAnalysis`"))),
710            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FileAnalysis`")))),
711        }
712    } else {
713        let content = resp.text().await?;
714        let entity: Option<GetFileAnalysisSecurityError> = serde_json::from_str(&content).ok();
715        Err(Error::ResponseError(ResponseContent {
716            status,
717            content,
718            entity,
719        }))
720    }
721}
722
723/// Get the standard performance analysis for the uploaded assets of an avatar
724pub async fn get_file_analysis_standard(
725    configuration: &configuration::Configuration,
726    file_id: &str,
727    version_id: i32,
728) -> Result<models::FileAnalysis, Error<GetFileAnalysisStandardError>> {
729    // add a prefix to parameters to efficiently prevent name collisions
730    let p_path_file_id = file_id;
731    let p_path_version_id = version_id;
732
733    let uri_str = format!(
734        "{}/analysis/{fileId}/{versionId}/standard",
735        configuration.base_path,
736        fileId = crate::apis::urlencode(p_path_file_id),
737        versionId = p_path_version_id
738    );
739    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
740
741    if let Some(ref user_agent) = configuration.user_agent {
742        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
743    }
744
745    let req = req_builder.build()?;
746    let resp = configuration.client.execute(req).await?;
747
748    let status = resp.status();
749    let content_type = resp
750        .headers()
751        .get("content-type")
752        .and_then(|v| v.to_str().ok())
753        .unwrap_or("application/octet-stream");
754    let content_type = super::ContentType::from(content_type);
755
756    if !status.is_client_error() && !status.is_server_error() {
757        let content = resp.text().await?;
758        match content_type {
759            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
760            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FileAnalysis`"))),
761            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FileAnalysis`")))),
762        }
763    } else {
764        let content = resp.text().await?;
765        let entity: Option<GetFileAnalysisStandardError> = serde_json::from_str(&content).ok();
766        Err(Error::ResponseError(ResponseContent {
767            status,
768            content,
769            entity,
770        }))
771    }
772}
773
774/// Retrieves the upload status for file upload. Can currently only be accessed when `status` is `waiting`. Trying to access it on a file version already uploaded currently times out.
775pub async fn get_file_data_upload_status(
776    configuration: &configuration::Configuration,
777    file_id: &str,
778    version_id: i32,
779    file_type: &str,
780) -> Result<models::FileVersionUploadStatus, Error<GetFileDataUploadStatusError>> {
781    // add a prefix to parameters to efficiently prevent name collisions
782    let p_path_file_id = file_id;
783    let p_path_version_id = version_id;
784    let p_path_file_type = file_type;
785
786    let uri_str = format!(
787        "{}/file/{fileId}/{versionId}/{fileType}/status",
788        configuration.base_path,
789        fileId = crate::apis::urlencode(p_path_file_id),
790        versionId = p_path_version_id,
791        fileType = crate::apis::urlencode(p_path_file_type)
792    );
793    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
794
795    if let Some(ref user_agent) = configuration.user_agent {
796        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
797    }
798
799    let req = req_builder.build()?;
800    let resp = configuration.client.execute(req).await?;
801
802    let status = resp.status();
803    let content_type = resp
804        .headers()
805        .get("content-type")
806        .and_then(|v| v.to_str().ok())
807        .unwrap_or("application/octet-stream");
808    let content_type = super::ContentType::from(content_type);
809
810    if !status.is_client_error() && !status.is_server_error() {
811        let content = resp.text().await?;
812        match content_type {
813            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
814            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FileVersionUploadStatus`"))),
815            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FileVersionUploadStatus`")))),
816        }
817    } else {
818        let content = resp.text().await?;
819        let entity: Option<GetFileDataUploadStatusError> = serde_json::from_str(&content).ok();
820        Err(Error::ResponseError(ResponseContent {
821            status,
822            content,
823            entity,
824        }))
825    }
826}
827
828/// Returns a list of files
829pub async fn get_files(
830    configuration: &configuration::Configuration,
831    tag: Option<&str>,
832    user_id: Option<&str>,
833    n: Option<i32>,
834    offset: Option<i32>,
835) -> Result<Vec<models::File>, Error<GetFilesError>> {
836    // add a prefix to parameters to efficiently prevent name collisions
837    let p_query_tag = tag;
838    let p_query_user_id = user_id;
839    let p_query_n = n;
840    let p_query_offset = offset;
841
842    let uri_str = format!("{}/files", configuration.base_path);
843    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
844
845    if let Some(ref param_value) = p_query_tag {
846        req_builder = req_builder.query(&[("tag", &param_value.to_string())]);
847    }
848    if let Some(ref param_value) = p_query_user_id {
849        req_builder = req_builder.query(&[("userId", &param_value.to_string())]);
850    }
851    if let Some(ref param_value) = p_query_n {
852        req_builder = req_builder.query(&[("n", &param_value.to_string())]);
853    }
854    if let Some(ref param_value) = p_query_offset {
855        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
856    }
857    if let Some(ref user_agent) = configuration.user_agent {
858        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
859    }
860
861    let req = req_builder.build()?;
862    let resp = configuration.client.execute(req).await?;
863
864    let status = resp.status();
865    let content_type = resp
866        .headers()
867        .get("content-type")
868        .and_then(|v| v.to_str().ok())
869        .unwrap_or("application/octet-stream");
870    let content_type = super::ContentType::from(content_type);
871
872    if !status.is_client_error() && !status.is_server_error() {
873        let content = resp.text().await?;
874        match content_type {
875            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
876            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::File&gt;`"))),
877            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::File&gt;`")))),
878        }
879    } else {
880        let content = resp.text().await?;
881        let entity: Option<GetFilesError> = serde_json::from_str(&content).ok();
882        Err(Error::ResponseError(ResponseContent {
883            status,
884            content,
885            entity,
886        }))
887    }
888}
889
890/// Set the order of the files in a group gallery
891pub async fn set_group_gallery_file_order(
892    configuration: &configuration::Configuration,
893    group_gallery_file_order_request: Option<models::GroupGalleryFileOrderRequest>,
894) -> Result<models::GroupGalleryFileOrder, Error<SetGroupGalleryFileOrderError>> {
895    // add a prefix to parameters to efficiently prevent name collisions
896    let p_body_group_gallery_file_order_request = group_gallery_file_order_request;
897
898    let uri_str = format!("{}/files/order", configuration.base_path);
899    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
900
901    if let Some(ref user_agent) = configuration.user_agent {
902        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
903    }
904    req_builder = req_builder.json(&p_body_group_gallery_file_order_request);
905
906    let req = req_builder.build()?;
907    let resp = configuration.client.execute(req).await?;
908
909    let status = resp.status();
910    let content_type = resp
911        .headers()
912        .get("content-type")
913        .and_then(|v| v.to_str().ok())
914        .unwrap_or("application/octet-stream");
915    let content_type = super::ContentType::from(content_type);
916
917    if !status.is_client_error() && !status.is_server_error() {
918        let content = resp.text().await?;
919        match content_type {
920            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
921            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GroupGalleryFileOrder`"))),
922            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GroupGalleryFileOrder`")))),
923        }
924    } else {
925        let content = resp.text().await?;
926        let entity: Option<SetGroupGalleryFileOrderError> = serde_json::from_str(&content).ok();
927        Err(Error::ResponseError(ResponseContent {
928            status,
929            content,
930            entity,
931        }))
932    }
933}
934
935/// Starts an upload of a specific FilePart. This endpoint will return an AWS URL which you can PUT data to. You need to call this and receive a new AWS API URL for each `partNumber`. Please see AWS's REST documentation on \"PUT Object to S3\" on how to upload. Once all parts has been uploaded, proceed to `/finish` endpoint.  **Note:** `nextPartNumber` seems like it is always ignored. Despite it returning 0, first partNumber is always 1.
936pub async fn start_file_data_upload(
937    configuration: &configuration::Configuration,
938    file_id: &str,
939    version_id: i32,
940    file_type: &str,
941    part_number: Option<i32>,
942) -> Result<models::FileUploadUrl, Error<StartFileDataUploadError>> {
943    // add a prefix to parameters to efficiently prevent name collisions
944    let p_path_file_id = file_id;
945    let p_path_version_id = version_id;
946    let p_path_file_type = file_type;
947    let p_query_part_number = part_number;
948
949    let uri_str = format!(
950        "{}/file/{fileId}/{versionId}/{fileType}/start",
951        configuration.base_path,
952        fileId = crate::apis::urlencode(p_path_file_id),
953        versionId = p_path_version_id,
954        fileType = crate::apis::urlencode(p_path_file_type)
955    );
956    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
957
958    if let Some(ref param_value) = p_query_part_number {
959        req_builder = req_builder.query(&[("partNumber", &param_value.to_string())]);
960    }
961    if let Some(ref user_agent) = configuration.user_agent {
962        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
963    }
964
965    let req = req_builder.build()?;
966    let resp = configuration.client.execute(req).await?;
967
968    let status = resp.status();
969    let content_type = resp
970        .headers()
971        .get("content-type")
972        .and_then(|v| v.to_str().ok())
973        .unwrap_or("application/octet-stream");
974    let content_type = super::ContentType::from(content_type);
975
976    if !status.is_client_error() && !status.is_server_error() {
977        let content = resp.text().await?;
978        match content_type {
979            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
980            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FileUploadUrl`"))),
981            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FileUploadUrl`")))),
982        }
983    } else {
984        let content = resp.text().await?;
985        let entity: Option<StartFileDataUploadError> = serde_json::from_str(&content).ok();
986        Err(Error::ResponseError(ResponseContent {
987            status,
988            content,
989            entity,
990        }))
991    }
992}
993
994/// Returns the agreement of the currently authenticated user for the given agreementCode, contentId, and version.
995pub async fn submit_content_agreement(
996    configuration: &configuration::Configuration,
997    agreement_request: Option<models::AgreementRequest>,
998) -> Result<models::Agreement, Error<SubmitContentAgreementError>> {
999    // add a prefix to parameters to efficiently prevent name collisions
1000    let p_body_agreement_request = agreement_request;
1001
1002    let uri_str = format!("{}/agreement", configuration.base_path);
1003    let mut req_builder = configuration
1004        .client
1005        .request(reqwest::Method::POST, &uri_str);
1006
1007    if let Some(ref user_agent) = configuration.user_agent {
1008        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1009    }
1010    req_builder = req_builder.json(&p_body_agreement_request);
1011
1012    let req = req_builder.build()?;
1013    let resp = configuration.client.execute(req).await?;
1014
1015    let status = resp.status();
1016    let content_type = resp
1017        .headers()
1018        .get("content-type")
1019        .and_then(|v| v.to_str().ok())
1020        .unwrap_or("application/octet-stream");
1021    let content_type = super::ContentType::from(content_type);
1022
1023    if !status.is_client_error() && !status.is_server_error() {
1024        let content = resp.text().await?;
1025        match content_type {
1026            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1027            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Agreement`"))),
1028            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Agreement`")))),
1029        }
1030    } else {
1031        let content = resp.text().await?;
1032        let entity: Option<SubmitContentAgreementError> = serde_json::from_str(&content).ok();
1033        Err(Error::ResponseError(ResponseContent {
1034            status,
1035            content,
1036            entity,
1037        }))
1038    }
1039}
1040
1041/// Update notes regarding an asset review.
1042pub async fn update_asset_review_notes(
1043    configuration: &configuration::Configuration,
1044    asset_review_id: &str,
1045    update_asset_review_notes_request: Option<models::UpdateAssetReviewNotesRequest>,
1046) -> Result<(), Error<UpdateAssetReviewNotesError>> {
1047    // add a prefix to parameters to efficiently prevent name collisions
1048    let p_path_asset_review_id = asset_review_id;
1049    let p_body_update_asset_review_notes_request = update_asset_review_notes_request;
1050
1051    let uri_str = format!(
1052        "{}/assetReview/{assetReviewId}/notes",
1053        configuration.base_path,
1054        assetReviewId = crate::apis::urlencode(p_path_asset_review_id)
1055    );
1056    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1057
1058    if let Some(ref user_agent) = configuration.user_agent {
1059        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1060    }
1061    req_builder = req_builder.json(&p_body_update_asset_review_notes_request);
1062
1063    let req = req_builder.build()?;
1064    let resp = configuration.client.execute(req).await?;
1065
1066    let status = resp.status();
1067
1068    if !status.is_client_error() && !status.is_server_error() {
1069        Ok(())
1070    } else {
1071        let content = resp.text().await?;
1072        let entity: Option<UpdateAssetReviewNotesError> = serde_json::from_str(&content).ok();
1073        Err(Error::ResponseError(ResponseContent {
1074            status,
1075            content,
1076            entity,
1077        }))
1078    }
1079}
1080
1081/// Upload a gallery image
1082pub async fn upload_gallery_image(
1083    configuration: &configuration::Configuration,
1084    file: impl Into<::std::borrow::Cow<'static, [u8]>>,
1085    filename: impl Into<::std::borrow::Cow<'static, str>>,
1086    mime_type: &str,
1087) -> Result<models::File, Error<UploadGalleryImageError>> {
1088    // add a prefix to parameters to efficiently prevent name collisions
1089    let p_form_file = file;
1090
1091    let uri_str = format!("{}/gallery", configuration.base_path);
1092    let mut req_builder = configuration
1093        .client
1094        .request(reqwest::Method::POST, &uri_str);
1095
1096    if let Some(ref user_agent) = configuration.user_agent {
1097        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1098    }
1099    let mut multipart_form = reqwest::multipart::Form::new();
1100    let part = reqwest::multipart::Part::bytes(p_form_file)
1101        .file_name(filename)
1102        .mime_str(mime_type)?;
1103    multipart_form = multipart_form.part("file", part);
1104    req_builder = req_builder.multipart(multipart_form);
1105
1106    let req = req_builder.build()?;
1107    let resp = configuration.client.execute(req).await?;
1108
1109    let status = resp.status();
1110    let content_type = resp
1111        .headers()
1112        .get("content-type")
1113        .and_then(|v| v.to_str().ok())
1114        .unwrap_or("application/octet-stream");
1115    let content_type = super::ContentType::from(content_type);
1116
1117    if !status.is_client_error() && !status.is_server_error() {
1118        let content = resp.text().await?;
1119        match content_type {
1120            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1121            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::File`"))),
1122            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::File`")))),
1123        }
1124    } else {
1125        let content = resp.text().await?;
1126        let entity: Option<UploadGalleryImageError> = serde_json::from_str(&content).ok();
1127        Err(Error::ResponseError(ResponseContent {
1128            status,
1129            content,
1130            entity,
1131        }))
1132    }
1133}
1134
1135/// Upload an icon
1136pub async fn upload_icon(
1137    configuration: &configuration::Configuration,
1138    file: impl Into<::std::borrow::Cow<'static, [u8]>>,
1139    filename: impl Into<::std::borrow::Cow<'static, str>>,
1140    mime_type: &str,
1141) -> Result<models::File, Error<UploadIconError>> {
1142    // add a prefix to parameters to efficiently prevent name collisions
1143    let p_form_file = file;
1144
1145    let uri_str = format!("{}/icon", configuration.base_path);
1146    let mut req_builder = configuration
1147        .client
1148        .request(reqwest::Method::POST, &uri_str);
1149
1150    if let Some(ref user_agent) = configuration.user_agent {
1151        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1152    }
1153    let mut multipart_form = reqwest::multipart::Form::new();
1154    let part = reqwest::multipart::Part::bytes(p_form_file)
1155        .file_name(filename)
1156        .mime_str(mime_type)?;
1157    multipart_form = multipart_form.part("file", part);
1158    req_builder = req_builder.multipart(multipart_form);
1159
1160    let req = req_builder.build()?;
1161    let resp = configuration.client.execute(req).await?;
1162
1163    let status = resp.status();
1164    let content_type = resp
1165        .headers()
1166        .get("content-type")
1167        .and_then(|v| v.to_str().ok())
1168        .unwrap_or("application/octet-stream");
1169    let content_type = super::ContentType::from(content_type);
1170
1171    if !status.is_client_error() && !status.is_server_error() {
1172        let content = resp.text().await?;
1173        match content_type {
1174            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1175            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::File`"))),
1176            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::File`")))),
1177        }
1178    } else {
1179        let content = resp.text().await?;
1180        let entity: Option<UploadIconError> = serde_json::from_str(&content).ok();
1181        Err(Error::ResponseError(ResponseContent {
1182            status,
1183            content,
1184            entity,
1185        }))
1186    }
1187}
1188
1189/// Upload an image, which can be an icon, gallery image, sticker or emoji
1190pub async fn upload_image(
1191    configuration: &configuration::Configuration,
1192    file: impl Into<::std::borrow::Cow<'static, [u8]>>,
1193    filename: impl Into<::std::borrow::Cow<'static, str>>,
1194    mime_type: &str,
1195    tag: models::ImagePurpose,
1196    animation_style: Option<models::ImageAnimationStyle>,
1197    frames: Option<i32>,
1198    frames_over_time: Option<i32>,
1199    loop_style: Option<models::ImageLoopStyle>,
1200    mask_tag: Option<models::ImageMask>,
1201) -> Result<models::File, Error<UploadImageError>> {
1202    // add a prefix to parameters to efficiently prevent name collisions
1203    let p_form_file = file;
1204    let p_form_tag = tag;
1205    let p_form_animation_style = animation_style;
1206    let p_form_frames = frames;
1207    let p_form_frames_over_time = frames_over_time;
1208    let p_form_loop_style = loop_style;
1209    let p_form_mask_tag = mask_tag;
1210
1211    let uri_str = format!("{}/file/image", configuration.base_path);
1212    let mut req_builder = configuration
1213        .client
1214        .request(reqwest::Method::POST, &uri_str);
1215
1216    if let Some(ref user_agent) = configuration.user_agent {
1217        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1218    }
1219    let mut multipart_form = reqwest::multipart::Form::new();
1220    if let Some(param_value) = p_form_animation_style {
1221        multipart_form = multipart_form.text("animationStyle", param_value.to_string());
1222    }
1223    let part = reqwest::multipart::Part::bytes(p_form_file)
1224        .file_name(filename)
1225        .mime_str(mime_type)?;
1226    multipart_form = multipart_form.part("file", part);
1227    if let Some(param_value) = p_form_frames {
1228        multipart_form = multipart_form.text("frames", param_value.to_string());
1229    }
1230    if let Some(param_value) = p_form_frames_over_time {
1231        multipart_form = multipart_form.text("framesOverTime", param_value.to_string());
1232    }
1233    if let Some(param_value) = p_form_loop_style {
1234        multipart_form = multipart_form.text("loopStyle", param_value.to_string());
1235    }
1236    if let Some(param_value) = p_form_mask_tag {
1237        multipart_form = multipart_form.text("maskTag", param_value.to_string());
1238    }
1239    multipart_form = multipart_form.text("tag", p_form_tag.to_string());
1240    req_builder = req_builder.multipart(multipart_form);
1241
1242    let req = req_builder.build()?;
1243    let resp = configuration.client.execute(req).await?;
1244
1245    let status = resp.status();
1246    let content_type = resp
1247        .headers()
1248        .get("content-type")
1249        .and_then(|v| v.to_str().ok())
1250        .unwrap_or("application/octet-stream");
1251    let content_type = super::ContentType::from(content_type);
1252
1253    if !status.is_client_error() && !status.is_server_error() {
1254        let content = resp.text().await?;
1255        match content_type {
1256            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1257            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::File`"))),
1258            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::File`")))),
1259        }
1260    } else {
1261        let content = resp.text().await?;
1262        let entity: Option<UploadImageError> = serde_json::from_str(&content).ok();
1263        Err(Error::ResponseError(ResponseContent {
1264            status,
1265            content,
1266            entity,
1267        }))
1268    }
1269}