/* * * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: * * Generated by: https://openapi-generator.tech */ use super::{ContentType, Error, configuration}; use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize, de::Error as _}; /// struct for typed errors of method [`add_image_layer`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum AddImageLayerError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`apply_command`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ApplyCommandError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`cancel_operation`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum CancelOperationError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`clear_provider_secret`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ClearProviderSecretError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`create_pages`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum CreatePagesError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`create_project`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum CreateProjectError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`delete_current_llm`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum DeleteCurrentLlmError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`delete_current_project`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum DeleteCurrentProjectError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`events`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum EventsError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`export_current_project`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ExportCurrentProjectError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`fetch_google_font`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum FetchGoogleFontError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_blob`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetBlobError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_catalog`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetCatalogError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_config`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetConfigError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_current_llm`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetCurrentLlmError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_engine_catalog`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetEngineCatalogError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_google_font_file`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetGoogleFontFileError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_google_fonts_catalog`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetGoogleFontsCatalogError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_meta`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetMetaError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_page_thumbnail`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetPageThumbnailError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_scene_bin`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetSceneBinError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_scene_json`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetSceneJsonError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`import_project`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ImportProjectError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`list_fonts`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ListFontsError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`list_projects`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ListProjectsError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`patch_config`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum PatchConfigError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`put_current_llm`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum PutCurrentLlmError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`put_current_project`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum PutCurrentProjectError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`put_mask`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum PutMaskError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`redo`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum RedoError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`set_provider_secret`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum SetProviderSecretError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`start_download`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum StartDownloadError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`start_pipeline`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum StartPipelineError { UnknownValue(serde_json::Value), } /// struct for typed errors of method [`undo`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UndoError { UnknownValue(serde_json::Value), } pub async fn add_image_layer( configuration: &configuration::Configuration, id: &str, ) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_id = id; let uri_str = format!( "{}/pages/{id}/image-layers", configuration.base_path, id = crate::apis::urlencode(p_path_id) ); let mut req_builder = configuration .client .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::AddImageLayerResponse`", ))); } 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::AddImageLayerResponse`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn apply_command( configuration: &configuration::Configuration, op: models::Op, ) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_body_op = op; let uri_str = format!("{}/history/apply", configuration.base_path); let mut req_builder = configuration .client .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } req_builder = req_builder.json(&p_body_op); let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::HistoryResult`", ))); } 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::HistoryResult`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn cancel_operation( configuration: &configuration::Configuration, id: &str, ) -> Result<(), Error> { // add a prefix to parameters to efficiently prevent name collisions let p_path_id = id; let uri_str = format!( "{}/operations/{id}", configuration.base_path, id = crate::apis::urlencode(p_path_id) ); let mut req_builder = configuration .client .request(reqwest::Method::DELETE, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn clear_provider_secret( configuration: &configuration::Configuration, id: &str, ) -> Result<(), Error> { // add a prefix to parameters to efficiently prevent name collisions let p_path_id = id; let uri_str = format!( "{}/config/providers/{id}/secret", configuration.base_path, id = crate::apis::urlencode(p_path_id) ); let mut req_builder = configuration .client .request(reqwest::Method::DELETE, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn create_pages( configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/pages", configuration.base_path); let mut req_builder = configuration .client .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::CreatePagesResponse`", ))); } 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::CreatePagesResponse`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn create_project( configuration: &configuration::Configuration, create_project_request: models::CreateProjectRequest, ) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_body_create_project_request = create_project_request; let uri_str = format!("{}/projects", configuration.base_path); let mut req_builder = configuration .client .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } req_builder = req_builder.json(&p_body_create_project_request); let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::ProjectSummary`", ))); } 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::ProjectSummary`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn delete_current_llm( configuration: &configuration::Configuration, ) -> Result<(), Error> { let uri_str = format!("{}/llm/current", configuration.base_path); let mut req_builder = configuration .client .request(reqwest::Method::DELETE, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn delete_current_project( configuration: &configuration::Configuration, ) -> Result<(), Error> { let uri_str = format!("{}/projects/current", configuration.base_path); let mut req_builder = configuration .client .request(reqwest::Method::DELETE, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn events( configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/events", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::AppEvent`", ))); } 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::AppEvent`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn export_current_project( configuration: &configuration::Configuration, export_project_request: models::ExportProjectRequest, ) -> Result<(), Error> { // add a prefix to parameters to efficiently prevent name collisions let p_body_export_project_request = export_project_request; let uri_str = format!("{}/projects/current/export", configuration.base_path); let mut req_builder = configuration .client .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } req_builder = req_builder.json(&p_body_export_project_request); let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn fetch_google_font( configuration: &configuration::Configuration, family: &str, ) -> Result<(), Error> { // add a prefix to parameters to efficiently prevent name collisions let p_path_family = family; let uri_str = format!( "{}/google-fonts/{family}/fetch", configuration.base_path, family = crate::apis::urlencode(p_path_family) ); let mut req_builder = configuration .client .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn get_blob( configuration: &configuration::Configuration, hash: &str, ) -> Result<(), Error> { // add a prefix to parameters to efficiently prevent name collisions let p_path_hash = hash; let uri_str = format!( "{}/blobs/{hash}", configuration.base_path, hash = crate::apis::urlencode(p_path_hash) ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn get_catalog( configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/llm/catalog", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::LlmCatalog`", ))); } 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::LlmCatalog`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn get_config( configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/config", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::AppConfig`", ))); } 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::AppConfig`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn get_current_llm( configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/llm/current", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::LlmState`", ))); } 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::LlmState`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn get_engine_catalog( configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/engines", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::EngineCatalog`", ))); } 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::EngineCatalog`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn get_google_font_file( configuration: &configuration::Configuration, family: &str, file: &str, ) -> Result<(), Error> { // add a prefix to parameters to efficiently prevent name collisions let p_path_family = family; let p_path_file = file; let uri_str = format!( "{}/google-fonts/{family}/{file}", configuration.base_path, family = crate::apis::urlencode(p_path_family), file = crate::apis::urlencode(p_path_file) ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn get_google_fonts_catalog( configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/google-fonts", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::GoogleFontCatalog`", ))); } 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::GoogleFontCatalog`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn get_meta( configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/meta", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::MetaInfo`", ))); } 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::MetaInfo`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn get_page_thumbnail( configuration: &configuration::Configuration, id: &str, ) -> Result<(), Error> { // add a prefix to parameters to efficiently prevent name collisions let p_path_id = id; let uri_str = format!( "{}/pages/{id}/thumbnail", configuration.base_path, id = crate::apis::urlencode(p_path_id) ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn get_scene_bin( configuration: &configuration::Configuration, ) -> Result<(), Error> { let uri_str = format!("{}/scene.bin", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn get_scene_json( configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/scene.json", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::SceneSnapshot`", ))); } 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::SceneSnapshot`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn import_project( configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/projects/import", configuration.base_path); let mut req_builder = configuration .client .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::ProjectSummary`", ))); } 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::ProjectSummary`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn list_fonts( configuration: &configuration::Configuration, ) -> Result, Error> { let uri_str = format!("{}/fonts", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `Vec<models::FontFaceInfo>`", ))); } 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<models::FontFaceInfo>`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn list_projects( configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/projects", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::ListProjectsResponse`", ))); } 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::ListProjectsResponse`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn patch_config( configuration: &configuration::Configuration, config_patch: models::ConfigPatch, ) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_body_config_patch = config_patch; let uri_str = format!("{}/config", configuration.base_path); let mut req_builder = configuration .client .request(reqwest::Method::PATCH, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } req_builder = req_builder.json(&p_body_config_patch); let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::AppConfig`", ))); } 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::AppConfig`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn put_current_llm( configuration: &configuration::Configuration, llm_load_request: models::LlmLoadRequest, ) -> Result<(), Error> { // add a prefix to parameters to efficiently prevent name collisions let p_body_llm_load_request = llm_load_request; let uri_str = format!("{}/llm/current", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } req_builder = req_builder.json(&p_body_llm_load_request); let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn put_current_project( configuration: &configuration::Configuration, open_project_request: models::OpenProjectRequest, ) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_body_open_project_request = open_project_request; let uri_str = format!("{}/projects/current", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } req_builder = req_builder.json(&p_body_open_project_request); let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::ProjectSummary`", ))); } 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::ProjectSummary`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn put_mask( configuration: &configuration::Configuration, id: &str, role: models::MaskRole, ) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_path_id = id; let p_path_role = role; let uri_str = format!( "{}/pages/{id}/masks/{role}", configuration.base_path, id = crate::apis::urlencode(p_path_id), role = p_path_role.to_string() ); let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::PutMaskResponse`", ))); } 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::PutMaskResponse`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn redo( configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/history/redo", configuration.base_path); let mut req_builder = configuration .client .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::HistoryResult`", ))); } 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::HistoryResult`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn set_provider_secret( configuration: &configuration::Configuration, id: &str, provider_secret_request: models::ProviderSecretRequest, ) -> Result<(), Error> { // add a prefix to parameters to efficiently prevent name collisions let p_path_id = id; let p_body_provider_secret_request = provider_secret_request; let uri_str = format!( "{}/config/providers/{id}/secret", configuration.base_path, id = crate::apis::urlencode(p_path_id) ); let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } req_builder = req_builder.json(&p_body_provider_secret_request); let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn start_download( configuration: &configuration::Configuration, start_download_request: models::StartDownloadRequest, ) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_body_start_download_request = start_download_request; let uri_str = format!("{}/downloads", configuration.base_path); let mut req_builder = configuration .client .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } req_builder = req_builder.json(&p_body_start_download_request); let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::StartDownloadResponse`", ))); } 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::StartDownloadResponse`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn start_pipeline( configuration: &configuration::Configuration, start_pipeline_request: models::StartPipelineRequest, ) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_body_start_pipeline_request = start_pipeline_request; let uri_str = format!("{}/pipelines", configuration.base_path); let mut req_builder = configuration .client .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } req_builder = req_builder.json(&p_body_start_pipeline_request); let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::StartPipelineResponse`", ))); } 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::StartPipelineResponse`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } } pub async fn undo( configuration: &configuration::Configuration, ) -> Result> { let uri_str = format!("{}/history/undo", configuration.base_path); let mut req_builder = configuration .client .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } let req = req_builder.build()?; let resp = configuration.client.execute(req).await?; let status = resp.status(); let content_type = resp .headers() .get("content-type") .and_then(|v| v.to_str().ok()) .unwrap_or("application/octet-stream"); let content_type = super::ContentType::from(content_type); if !status.is_client_error() && !status.is_server_error() { let content = resp.text().await?; match content_type { ContentType::Json => serde_json::from_str(&content).map_err(Error::from), ContentType::Text => { return Err(Error::from(serde_json::Error::custom( "Received `text/plain` content type response that cannot be converted to `models::HistoryResult`", ))); } 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::HistoryResult`" )))); } } } else { let content = resp.text().await?; let entity: Option = serde_json::from_str(&content).ok(); Err(Error::ResponseError(ResponseContent { status, content, entity, })) } }