use reqwest;
use serde::{Deserialize, Serialize, de::Error as _};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingGroupError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingGroupDeleteError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingGroupPostError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingGroupPutError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingGroupsError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingItemError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingItemDeleteError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingItemPostError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingItemPutError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingItemsError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingProviderError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingProviderDeleteError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingProviderPostError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingProviderPutError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppServiceSettingProvidersError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppSettingError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppSettingDeleteError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppSettingPostError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppSettingPutError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppSettingsError {
UnknownValue(serde_json::Value),
}
pub async fn app_service_setting_group(configuration: &configuration::Configuration, id: i64, app_key: &str) -> Result<models::ServiceGroupApiResponse, Error<AppServiceSettingGroupError>> {
let p_id = id;
let p_app_key = app_key;
let uri_str = format!("{}/AppSetting/{appKey}/Groups/{id}", configuration.base_path, id=p_id, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::ServiceGroupApiResponse`"))),
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::ServiceGroupApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingGroupError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_service_setting_group_delete(configuration: &configuration::Configuration, id: i64, app_key: &str) -> Result<models::BooleanApiResponse, Error<AppServiceSettingGroupDeleteError>> {
let p_id = id;
let p_app_key = app_key;
let uri_str = format!("{}/AppSetting/{appKey}/Groups/{id}", configuration.base_path, id=p_id, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::BooleanApiResponse`"))),
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::BooleanApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingGroupDeleteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_service_setting_group_post(configuration: &configuration::Configuration, app_key: &str, service_group: Option<models::ServiceGroup>) -> Result<models::AppSettingGroupPostResultApiResponse, Error<AppServiceSettingGroupPostError>> {
let p_app_key = app_key;
let p_service_group = service_group;
let uri_str = format!("{}/AppSetting/{appKey}/Groups", configuration.base_path, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_service_group);
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::AppSettingGroupPostResultApiResponse`"))),
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::AppSettingGroupPostResultApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingGroupPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_service_setting_group_put(configuration: &configuration::Configuration, id: i64, app_key: &str, service_group: Option<models::ServiceGroup>) -> Result<models::BooleanApiResponse, Error<AppServiceSettingGroupPutError>> {
let p_id = id;
let p_app_key = app_key;
let p_service_group = service_group;
let uri_str = format!("{}/AppSetting/{appKey}/Groups/{id}", configuration.base_path, id=p_id, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_service_group);
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::BooleanApiResponse`"))),
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::BooleanApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingGroupPutError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_service_setting_groups(configuration: &configuration::Configuration, app_key: &str, provider_id: Option<i64>, show_flag: Option<bool>) -> Result<models::ServiceGroupListApiResponse, Error<AppServiceSettingGroupsError>> {
let p_app_key = app_key;
let p_provider_id = provider_id;
let p_show_flag = show_flag;
let uri_str = format!("{}/AppSetting/{appKey}/Groups", configuration.base_path, appKey=crate::apis::urlencode(p_app_key));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_provider_id {
req_builder = req_builder.query(&[("providerId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_show_flag {
req_builder = req_builder.query(&[("showFlag", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::ServiceGroupListApiResponse`"))),
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::ServiceGroupListApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingGroupsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_service_setting_item(configuration: &configuration::Configuration, id: i64, app_key: &str) -> Result<models::ServiceItemApiResponse, Error<AppServiceSettingItemError>> {
let p_id = id;
let p_app_key = app_key;
let uri_str = format!("{}/AppSetting/{appKey}/Items/{id}", configuration.base_path, id=p_id, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::ServiceItemApiResponse`"))),
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::ServiceItemApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingItemError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_service_setting_item_delete(configuration: &configuration::Configuration, id: i64, app_key: &str) -> Result<models::BooleanApiResponse, Error<AppServiceSettingItemDeleteError>> {
let p_id = id;
let p_app_key = app_key;
let uri_str = format!("{}/AppSetting/{appKey}/Items/{id}", configuration.base_path, id=p_id, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::BooleanApiResponse`"))),
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::BooleanApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingItemDeleteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_service_setting_item_post(configuration: &configuration::Configuration, app_key: &str, service_item: Option<models::ServiceItem>) -> Result<models::AppSettingItemPostResultApiResponse, Error<AppServiceSettingItemPostError>> {
let p_app_key = app_key;
let p_service_item = service_item;
let uri_str = format!("{}/AppSetting/{appKey}/Items", configuration.base_path, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_service_item);
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::AppSettingItemPostResultApiResponse`"))),
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::AppSettingItemPostResultApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingItemPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_service_setting_item_put(configuration: &configuration::Configuration, id: i64, app_key: &str, service_item: Option<models::ServiceItem>) -> Result<models::BooleanApiResponse, Error<AppServiceSettingItemPutError>> {
let p_id = id;
let p_app_key = app_key;
let p_service_item = service_item;
let uri_str = format!("{}/AppSetting/{appKey}/Items/{id}", configuration.base_path, id=p_id, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_service_item);
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::BooleanApiResponse`"))),
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::BooleanApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingItemPutError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_service_setting_items(configuration: &configuration::Configuration, app_key: &str, biz_code: Option<&str>, provider_code: Option<&str>, group_code: Option<&str>, show_flag: Option<bool>) -> Result<models::ServiceItemListApiResponse, Error<AppServiceSettingItemsError>> {
let p_app_key = app_key;
let p_biz_code = biz_code;
let p_provider_code = provider_code;
let p_group_code = group_code;
let p_show_flag = show_flag;
let uri_str = format!("{}/AppSetting/{appKey}/Items", configuration.base_path, appKey=crate::apis::urlencode(p_app_key));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_biz_code {
req_builder = req_builder.query(&[("bizCode", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_provider_code {
req_builder = req_builder.query(&[("providerCode", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_group_code {
req_builder = req_builder.query(&[("groupCode", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_show_flag {
req_builder = req_builder.query(&[("showFlag", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::ServiceItemListApiResponse`"))),
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::ServiceItemListApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingItemsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_service_setting_provider(configuration: &configuration::Configuration, id: i64, app_key: &str) -> Result<models::ServiceProviderApiResponse, Error<AppServiceSettingProviderError>> {
let p_id = id;
let p_app_key = app_key;
let uri_str = format!("{}/AppSetting/{appKey}/Providers/{id}", configuration.base_path, id=p_id, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::ServiceProviderApiResponse`"))),
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::ServiceProviderApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingProviderError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_service_setting_provider_delete(configuration: &configuration::Configuration, id: i64, app_key: &str) -> Result<models::BooleanApiResponse, Error<AppServiceSettingProviderDeleteError>> {
let p_id = id;
let p_app_key = app_key;
let uri_str = format!("{}/AppSetting/{appKey}/Providers/{id}", configuration.base_path, id=p_id, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::BooleanApiResponse`"))),
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::BooleanApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingProviderDeleteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_service_setting_provider_post(configuration: &configuration::Configuration, app_key: &str, service_provider: Option<models::ServiceProvider>) -> Result<models::AppSettingProviderPostResultApiResponse, Error<AppServiceSettingProviderPostError>> {
let p_app_key = app_key;
let p_service_provider = service_provider;
let uri_str = format!("{}/AppSetting/{appKey}/Providers", configuration.base_path, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_service_provider);
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::AppSettingProviderPostResultApiResponse`"))),
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::AppSettingProviderPostResultApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingProviderPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_service_setting_provider_put(configuration: &configuration::Configuration, id: i64, app_key: &str, service_provider: Option<models::ServiceProvider>) -> Result<models::BooleanApiResponse, Error<AppServiceSettingProviderPutError>> {
let p_id = id;
let p_app_key = app_key;
let p_service_provider = service_provider;
let uri_str = format!("{}/AppSetting/{appKey}/Providers/{id}", configuration.base_path, id=p_id, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_service_provider);
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::BooleanApiResponse`"))),
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::BooleanApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingProviderPutError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_service_setting_providers(configuration: &configuration::Configuration, app_key: &str, biz_code: Option<&str>, show_flag: Option<bool>) -> Result<models::ServiceProviderListApiResponse, Error<AppServiceSettingProvidersError>> {
let p_app_key = app_key;
let p_biz_code = biz_code;
let p_show_flag = show_flag;
let uri_str = format!("{}/AppSetting/{appKey}/Providers", configuration.base_path, appKey=crate::apis::urlencode(p_app_key));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_biz_code {
req_builder = req_builder.query(&[("bizCode", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_show_flag {
req_builder = req_builder.query(&[("showFlag", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::ServiceProviderListApiResponse`"))),
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::ServiceProviderListApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppServiceSettingProvidersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_setting(configuration: &configuration::Configuration, id: i64, app_key: &str) -> Result<models::AppSettingApiResponse, Error<AppSettingError>> {
let p_id = id;
let p_app_key = app_key;
let uri_str = format!("{}/AppSetting/{appKey}/{id}", configuration.base_path, id=p_id, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::AppSettingApiResponse`"))),
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::AppSettingApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppSettingError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_setting_delete(configuration: &configuration::Configuration, id: i64, app_key: &str) -> Result<models::BooleanApiResponse, Error<AppSettingDeleteError>> {
let p_id = id;
let p_app_key = app_key;
let uri_str = format!("{}/AppSetting/{appKey}/{id}", configuration.base_path, id=p_id, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::BooleanApiResponse`"))),
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::BooleanApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppSettingDeleteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_setting_post(configuration: &configuration::Configuration, app_key: &str, app_setting: Option<models::AppSetting>) -> Result<models::AppSettingSettingPostResultApiResponse, Error<AppSettingPostError>> {
let p_app_key = app_key;
let p_app_setting = app_setting;
let uri_str = format!("{}/AppSetting/{appKey}", configuration.base_path, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_app_setting);
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::AppSettingSettingPostResultApiResponse`"))),
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::AppSettingSettingPostResultApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppSettingPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_setting_put(configuration: &configuration::Configuration, id: i64, app_key: &str, app_setting: Option<models::AppSetting>) -> Result<models::BooleanApiResponse, Error<AppSettingPutError>> {
let p_id = id;
let p_app_key = app_key;
let p_app_setting = app_setting;
let uri_str = format!("{}/AppSetting/{appKey}/{id}", configuration.base_path, id=p_id, appKey=crate::apis::urlencode(p_app_key));
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());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_app_setting);
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::BooleanApiResponse`"))),
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::BooleanApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppSettingPutError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn app_settings(configuration: &configuration::Configuration, app_key: &str, provider_code: Option<&str>, group_code: Option<&str>, tag: Option<&str>, code: Option<&str>) -> Result<models::AppSettingListApiResponse, Error<AppSettingsError>> {
let p_app_key = app_key;
let p_provider_code = provider_code;
let p_group_code = group_code;
let p_tag = tag;
let p_code = code;
let uri_str = format!("{}/AppSetting/{appKey}", configuration.base_path, appKey=crate::apis::urlencode(p_app_key));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_provider_code {
req_builder = req_builder.query(&[("providerCode", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_group_code {
req_builder = req_builder.query(&[("groupCode", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_tag {
req_builder = req_builder.query(&[("tag", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_code {
req_builder = req_builder.query(&[("code", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::AppSettingListApiResponse`"))),
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::AppSettingListApiResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AppSettingsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}