| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| use super::{ContentType, Error, configuration}; |
| use crate::{apis::ResponseContent, models}; |
| use reqwest; |
| use serde::{Deserialize, Serialize, de::Error as _}; |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum AddImageLayerError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum ApplyCommandError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum CancelOperationError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum ClearProviderSecretError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum CreatePagesError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum CreateProjectError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum DeleteCurrentLlmError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum DeleteCurrentProjectError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum EventsError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum ExportCurrentProjectError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum FetchGoogleFontError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum GetBlobError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum GetCatalogError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum GetConfigError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum GetCurrentLlmError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum GetEngineCatalogError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum GetGoogleFontFileError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum GetGoogleFontsCatalogError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum GetMetaError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum GetPageThumbnailError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum GetSceneBinError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum GetSceneJsonError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum ImportProjectError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum ListFontsError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum ListProjectsError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum PatchConfigError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum PutCurrentLlmError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum PutCurrentProjectError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum PutMaskError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum RedoError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum SetProviderSecretError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum StartDownloadError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[derive(Debug, Clone, Serialize, Deserialize)] |
| #[serde(untagged)] |
| pub enum StartPipelineError { |
| UnknownValue(serde_json::Value), |
| } |
|
|
| |
| #[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<models::AddImageLayerResponse, Error<AddImageLayerError>> { |
| |
| 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<AddImageLayerError> = 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<models::HistoryResult, Error<ApplyCommandError>> { |
| |
| 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<ApplyCommandError> = 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<CancelOperationError>> { |
| |
| 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<CancelOperationError> = 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<ClearProviderSecretError>> { |
| |
| 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<ClearProviderSecretError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn create_pages( |
| configuration: &configuration::Configuration, |
| ) -> Result<models::CreatePagesResponse, Error<CreatePagesError>> { |
| 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<CreatePagesError> = 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<models::ProjectSummary, Error<CreateProjectError>> { |
| |
| 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<CreateProjectError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn delete_current_llm( |
| configuration: &configuration::Configuration, |
| ) -> Result<(), Error<DeleteCurrentLlmError>> { |
| 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<DeleteCurrentLlmError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn delete_current_project( |
| configuration: &configuration::Configuration, |
| ) -> Result<(), Error<DeleteCurrentProjectError>> { |
| 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<DeleteCurrentProjectError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn events( |
| configuration: &configuration::Configuration, |
| ) -> Result<models::AppEvent, Error<EventsError>> { |
| 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<EventsError> = 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<ExportCurrentProjectError>> { |
| |
| 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<ExportCurrentProjectError> = 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<FetchGoogleFontError>> { |
| |
| 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<FetchGoogleFontError> = 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<GetBlobError>> { |
| |
| 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<GetBlobError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn get_catalog( |
| configuration: &configuration::Configuration, |
| ) -> Result<models::LlmCatalog, Error<GetCatalogError>> { |
| 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<GetCatalogError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn get_config( |
| configuration: &configuration::Configuration, |
| ) -> Result<models::AppConfig, Error<GetConfigError>> { |
| 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<GetConfigError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn get_current_llm( |
| configuration: &configuration::Configuration, |
| ) -> Result<models::LlmState, Error<GetCurrentLlmError>> { |
| 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<GetCurrentLlmError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn get_engine_catalog( |
| configuration: &configuration::Configuration, |
| ) -> Result<models::EngineCatalog, Error<GetEngineCatalogError>> { |
| 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<GetEngineCatalogError> = 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<GetGoogleFontFileError>> { |
| |
| 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<GetGoogleFontFileError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn get_google_fonts_catalog( |
| configuration: &configuration::Configuration, |
| ) -> Result<models::GoogleFontCatalog, Error<GetGoogleFontsCatalogError>> { |
| 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<GetGoogleFontsCatalogError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn get_meta( |
| configuration: &configuration::Configuration, |
| ) -> Result<models::MetaInfo, Error<GetMetaError>> { |
| 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<GetMetaError> = 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<GetPageThumbnailError>> { |
| |
| 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<GetPageThumbnailError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn get_scene_bin( |
| configuration: &configuration::Configuration, |
| ) -> Result<(), Error<GetSceneBinError>> { |
| 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<GetSceneBinError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn get_scene_json( |
| configuration: &configuration::Configuration, |
| ) -> Result<models::SceneSnapshot, Error<GetSceneJsonError>> { |
| 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<GetSceneJsonError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn import_project( |
| configuration: &configuration::Configuration, |
| ) -> Result<models::ProjectSummary, Error<ImportProjectError>> { |
| 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<ImportProjectError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn list_fonts( |
| configuration: &configuration::Configuration, |
| ) -> Result<Vec<models::FontFaceInfo>, Error<ListFontsError>> { |
| 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<ListFontsError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn list_projects( |
| configuration: &configuration::Configuration, |
| ) -> Result<models::ListProjectsResponse, Error<ListProjectsError>> { |
| 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<ListProjectsError> = 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<models::AppConfig, Error<PatchConfigError>> { |
| |
| 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<PatchConfigError> = 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<PutCurrentLlmError>> { |
| |
| 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<PutCurrentLlmError> = 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<models::ProjectSummary, Error<PutCurrentProjectError>> { |
| |
| 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<PutCurrentProjectError> = 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<models::PutMaskResponse, Error<PutMaskError>> { |
| |
| 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<PutMaskError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn redo( |
| configuration: &configuration::Configuration, |
| ) -> Result<models::HistoryResult, Error<RedoError>> { |
| 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<RedoError> = 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<SetProviderSecretError>> { |
| |
| 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<SetProviderSecretError> = 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<models::StartDownloadResponse, Error<StartDownloadError>> { |
| |
| 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<StartDownloadError> = 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<models::StartPipelineResponse, Error<StartPipelineError>> { |
| |
| 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<StartPipelineError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|
| pub async fn undo( |
| configuration: &configuration::Configuration, |
| ) -> Result<models::HistoryResult, Error<UndoError>> { |
| 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<UndoError> = serde_json::from_str(&content).ok(); |
| Err(Error::ResponseError(ResponseContent { |
| status, |
| content, |
| entity, |
| })) |
| } |
| } |
|
|