use super::types;
use crate::{
ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
ResponseValue, encode_path,
};
#[derive(Debug, Clone)]
pub struct AigConfigListEvaluators<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
order_by: Result<::std::string::String, String>,
order_by_direction: Result<types::AigConfigListEvaluatorsOrderByDirection, String>,
page: Result<::std::num::NonZeroU64, String>,
per_page: Result<i64, String>,
}
impl<'a> AigConfigListEvaluators<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
order_by: Err("order_by was not initialized".to_string()),
order_by_direction: Err("order_by_direction was not initialized".to_string()),
page: Err("page was not initialized".to_string()),
per_page: Err("per_page was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn order_by<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.order_by = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for order_by failed".to_string()
});
self
}
pub fn order_by_direction<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigListEvaluatorsOrderByDirection>,
{
self . order_by_direction = value . try_into () . map_err (| _ | "conversion to `AigConfigListEvaluatorsOrderByDirection` for order_by_direction failed" . to_string ()) ;
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.page = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for page failed".to_string()
});
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.per_page = value
.try_into()
.map_err(|_| "conversion to `i64` for per_page failed".to_string());
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
order_by,
order_by_direction,
page,
per_page,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let order_by = order_by.map_err(Error::InvalidRequest)?;
let order_by_direction = order_by_direction.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/evaluation-types",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("order_by", &order_by))
.query(&progenitor_client::QueryParam::new(
"order_by_direction",
&order_by_direction,
))
.query(&progenitor_client::QueryParam::new("page", &page))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_list_evaluators",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigListGateway<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
page: Result<::std::num::NonZeroU64, String>,
per_page: Result<::std::num::NonZeroU64, String>,
search: Result<::std::string::String, String>,
}
impl<'a> AigConfigListGateway<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
page: Err("page was not initialized".to_string()),
per_page: Err("per_page was not initialized".to_string()),
search: Err("search was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.page = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for page failed".to_string()
});
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.per_page = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for per_page failed".to_string()
});
self
}
pub fn search<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.search = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for search failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
page,
per_page,
search,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let search = search.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("page", &page))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.query(&progenitor_client::QueryParam::new("search", &search))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_list_gateway",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigCreateGateway<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
body: Result<types::builder::AigConfigCreateGatewayBody, String>,
}
impl<'a> AigConfigCreateGateway<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigCreateGatewayBody>,
<V as std::convert::TryInto<types::AigConfigCreateGatewayBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AigConfigCreateGatewayBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AigConfigCreateGatewayBody,
) -> types::builder::AigConfigCreateGatewayBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AigConfigCreateGatewayBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_create_gateway",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigListDataset<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigListDatasetGatewayId, String>,
enable: Result<bool, String>,
name: Result<::std::string::String, String>,
page: Result<::std::num::NonZeroU64, String>,
per_page: Result<::std::num::NonZeroU64, String>,
search: Result<::std::string::String, String>,
}
impl<'a> AigConfigListDataset<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
enable: Err("enable was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
page: Err("page was not initialized".to_string()),
per_page: Err("per_page was not initialized".to_string()),
search: Err("search was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigListDatasetGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigListDatasetGatewayId` for gateway_id failed".to_string()
});
self
}
pub fn enable<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<bool>,
{
self.enable = value
.try_into()
.map_err(|_| "conversion to `bool` for enable failed".to_string());
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.name = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for name failed".to_string()
});
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.page = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for page failed".to_string()
});
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.per_page = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for per_page failed".to_string()
});
self
}
pub fn search<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.search = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for search failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
enable,
name,
page,
per_page,
search,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let enable = enable.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let search = search.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/datasets",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("enable", &enable))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("page", &page))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.query(&progenitor_client::QueryParam::new("search", &search))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_list_dataset",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigCreateDataset<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigCreateDatasetGatewayId, String>,
body: Result<types::builder::AigConfigCreateDatasetBody, String>,
}
impl<'a> AigConfigCreateDataset<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigCreateDatasetGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigCreateDatasetGatewayId` for gateway_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigCreateDatasetBody>,
<V as std::convert::TryInto<types::AigConfigCreateDatasetBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AigConfigCreateDatasetBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AigConfigCreateDatasetBody,
) -> types::builder::AigConfigCreateDatasetBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AigConfigCreateDatasetBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/datasets",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_create_dataset",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigFetchDataset<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigFetchDatasetGatewayId, String>,
id: Result<::std::string::String, String>,
}
impl<'a> AigConfigFetchDataset<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigFetchDatasetGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigFetchDatasetGatewayId` for gateway_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/datasets/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_fetch_dataset",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigUpdateDataset<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigUpdateDatasetGatewayId, String>,
id: Result<::std::string::String, String>,
body: Result<types::builder::AigConfigUpdateDatasetBody, String>,
}
impl<'a> AigConfigUpdateDataset<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigUpdateDatasetGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigUpdateDatasetGatewayId` for gateway_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigUpdateDatasetBody>,
<V as std::convert::TryInto<types::AigConfigUpdateDatasetBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AigConfigUpdateDatasetBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AigConfigUpdateDatasetBody,
) -> types::builder::AigConfigUpdateDatasetBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AigConfigUpdateDatasetBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/datasets/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_update_dataset",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigDeleteDataset<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigDeleteDatasetGatewayId, String>,
id: Result<::std::string::String, String>,
}
impl<'a> AigConfigDeleteDataset<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigDeleteDatasetGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigDeleteDatasetGatewayId` for gateway_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/datasets/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_delete_dataset",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigListEvaluations<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigListEvaluationsGatewayId, String>,
name: Result<::std::string::String, String>,
page: Result<::std::num::NonZeroU64, String>,
per_page: Result<::std::num::NonZeroU64, String>,
processed: Result<bool, String>,
search: Result<::std::string::String, String>,
}
impl<'a> AigConfigListEvaluations<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
page: Err("page was not initialized".to_string()),
per_page: Err("per_page was not initialized".to_string()),
processed: Err("processed was not initialized".to_string()),
search: Err("search was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigListEvaluationsGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigListEvaluationsGatewayId` for gateway_id failed"
.to_string()
});
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.name = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for name failed".to_string()
});
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.page = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for page failed".to_string()
});
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.per_page = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for per_page failed".to_string()
});
self
}
pub fn processed<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<bool>,
{
self.processed = value
.try_into()
.map_err(|_| "conversion to `bool` for processed failed".to_string());
self
}
pub fn search<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.search = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for search failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
name,
page,
per_page,
processed,
search,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let processed = processed.map_err(Error::InvalidRequest)?;
let search = search.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/evaluations",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("page", &page))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.query(&progenitor_client::QueryParam::new("processed", &processed))
.query(&progenitor_client::QueryParam::new("search", &search))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_list_evaluations",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigCreateEvaluations<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigCreateEvaluationsGatewayId, String>,
body: Result<types::builder::AigConfigCreateEvaluationsBody, String>,
}
impl<'a> AigConfigCreateEvaluations<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigCreateEvaluationsGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigCreateEvaluationsGatewayId` for gateway_id failed"
.to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigCreateEvaluationsBody>,
<V as std::convert::TryInto<types::AigConfigCreateEvaluationsBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AigConfigCreateEvaluationsBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AigConfigCreateEvaluationsBody,
) -> types::builder::AigConfigCreateEvaluationsBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AigConfigCreateEvaluationsBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/evaluations",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_create_evaluations",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigFetchEvaluations<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigFetchEvaluationsGatewayId, String>,
id: Result<::std::string::String, String>,
}
impl<'a> AigConfigFetchEvaluations<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigFetchEvaluationsGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigFetchEvaluationsGatewayId` for gateway_id failed"
.to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/evaluations/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_fetch_evaluations",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigDeleteEvaluations<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigDeleteEvaluationsGatewayId, String>,
id: Result<::std::string::String, String>,
}
impl<'a> AigConfigDeleteEvaluations<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigDeleteEvaluationsGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigDeleteEvaluationsGatewayId` for gateway_id failed"
.to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/evaluations/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_delete_evaluations",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigListGatewayLogs<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigListGatewayLogsGatewayId, String>,
cached: Result<bool, String>,
direction: Result<types::AigConfigListGatewayLogsDirection, String>,
end_date: Result<::chrono::DateTime<::chrono::offset::Utc>, String>,
feedback: Result<types::AigConfigListGatewayLogsFeedback, String>,
filters: Result<::std::vec::Vec<types::AigConfigListGatewayLogsFiltersItem>, String>,
max_cost: Result<f64, String>,
max_duration: Result<f64, String>,
max_tokens_in: Result<f64, String>,
max_tokens_out: Result<f64, String>,
max_total_tokens: Result<f64, String>,
meta_info: Result<bool, String>,
min_cost: Result<f64, String>,
min_duration: Result<f64, String>,
min_tokens_in: Result<f64, String>,
min_tokens_out: Result<f64, String>,
min_total_tokens: Result<f64, String>,
model: Result<::std::string::String, String>,
model_type: Result<::std::string::String, String>,
order_by: Result<types::AigConfigListGatewayLogsOrderBy, String>,
order_by_direction: Result<types::AigConfigListGatewayLogsOrderByDirection, String>,
page: Result<::std::num::NonZeroU64, String>,
per_page: Result<::std::num::NonZeroU64, String>,
provider: Result<::std::string::String, String>,
request_content_type: Result<::std::string::String, String>,
response_content_type: Result<::std::string::String, String>,
search: Result<::std::string::String, String>,
start_date: Result<::chrono::DateTime<::chrono::offset::Utc>, String>,
success: Result<bool, String>,
}
impl<'a> AigConfigListGatewayLogs<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
cached: Err("cached was not initialized".to_string()),
direction: Err("direction was not initialized".to_string()),
end_date: Err("end_date was not initialized".to_string()),
feedback: Err("feedback was not initialized".to_string()),
filters: Err("filters was not initialized".to_string()),
max_cost: Err("max_cost was not initialized".to_string()),
max_duration: Err("max_duration was not initialized".to_string()),
max_tokens_in: Err("max_tokens_in was not initialized".to_string()),
max_tokens_out: Err("max_tokens_out was not initialized".to_string()),
max_total_tokens: Err("max_total_tokens was not initialized".to_string()),
meta_info: Err("meta_info was not initialized".to_string()),
min_cost: Err("min_cost was not initialized".to_string()),
min_duration: Err("min_duration was not initialized".to_string()),
min_tokens_in: Err("min_tokens_in was not initialized".to_string()),
min_tokens_out: Err("min_tokens_out was not initialized".to_string()),
min_total_tokens: Err("min_total_tokens was not initialized".to_string()),
model: Err("model was not initialized".to_string()),
model_type: Err("model_type was not initialized".to_string()),
order_by: Err("order_by was not initialized".to_string()),
order_by_direction: Err("order_by_direction was not initialized".to_string()),
page: Err("page was not initialized".to_string()),
per_page: Err("per_page was not initialized".to_string()),
provider: Err("provider was not initialized".to_string()),
request_content_type: Err("request_content_type was not initialized".to_string()),
response_content_type: Err("response_content_type was not initialized".to_string()),
search: Err("search was not initialized".to_string()),
start_date: Err("start_date was not initialized".to_string()),
success: Err("success was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigListGatewayLogsGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigListGatewayLogsGatewayId` for gateway_id failed"
.to_string()
});
self
}
pub fn cached<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<bool>,
{
self.cached = value
.try_into()
.map_err(|_| "conversion to `bool` for cached failed".to_string());
self
}
pub fn direction<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigListGatewayLogsDirection>,
{
self.direction = value.try_into().map_err(|_| {
"conversion to `AigConfigListGatewayLogsDirection` for direction failed".to_string()
});
self
}
pub fn end_date<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
{
self . end_date = value . try_into () . map_err (| _ | "conversion to `:: chrono :: DateTime < :: chrono :: offset :: Utc >` for end_date failed" . to_string ()) ;
self
}
pub fn feedback<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigListGatewayLogsFeedback>,
{
self.feedback = value.try_into().map_err(|_| {
"conversion to `AigConfigListGatewayLogsFeedback` for feedback failed".to_string()
});
self
}
pub fn filters<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<types::AigConfigListGatewayLogsFiltersItem>>,
{
self . filters = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < AigConfigListGatewayLogsFiltersItem >` for filters failed" . to_string ()) ;
self
}
pub fn max_cost<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.max_cost = value
.try_into()
.map_err(|_| "conversion to `f64` for max_cost failed".to_string());
self
}
pub fn max_duration<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.max_duration = value
.try_into()
.map_err(|_| "conversion to `f64` for max_duration failed".to_string());
self
}
pub fn max_tokens_in<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.max_tokens_in = value
.try_into()
.map_err(|_| "conversion to `f64` for max_tokens_in failed".to_string());
self
}
pub fn max_tokens_out<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.max_tokens_out = value
.try_into()
.map_err(|_| "conversion to `f64` for max_tokens_out failed".to_string());
self
}
pub fn max_total_tokens<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.max_total_tokens = value
.try_into()
.map_err(|_| "conversion to `f64` for max_total_tokens failed".to_string());
self
}
pub fn meta_info<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<bool>,
{
self.meta_info = value
.try_into()
.map_err(|_| "conversion to `bool` for meta_info failed".to_string());
self
}
pub fn min_cost<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.min_cost = value
.try_into()
.map_err(|_| "conversion to `f64` for min_cost failed".to_string());
self
}
pub fn min_duration<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.min_duration = value
.try_into()
.map_err(|_| "conversion to `f64` for min_duration failed".to_string());
self
}
pub fn min_tokens_in<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.min_tokens_in = value
.try_into()
.map_err(|_| "conversion to `f64` for min_tokens_in failed".to_string());
self
}
pub fn min_tokens_out<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.min_tokens_out = value
.try_into()
.map_err(|_| "conversion to `f64` for min_tokens_out failed".to_string());
self
}
pub fn min_total_tokens<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.min_total_tokens = value
.try_into()
.map_err(|_| "conversion to `f64` for min_total_tokens failed".to_string());
self
}
pub fn model<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.model = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for model failed".to_string()
});
self
}
pub fn model_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.model_type = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for model_type failed".to_string()
});
self
}
pub fn order_by<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigListGatewayLogsOrderBy>,
{
self.order_by = value.try_into().map_err(|_| {
"conversion to `AigConfigListGatewayLogsOrderBy` for order_by failed".to_string()
});
self
}
pub fn order_by_direction<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigListGatewayLogsOrderByDirection>,
{
self . order_by_direction = value . try_into () . map_err (| _ | "conversion to `AigConfigListGatewayLogsOrderByDirection` for order_by_direction failed" . to_string ()) ;
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.page = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for page failed".to_string()
});
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.per_page = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for per_page failed".to_string()
});
self
}
pub fn provider<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.provider = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for provider failed".to_string()
});
self
}
pub fn request_content_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.request_content_type = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for request_content_type failed"
.to_string()
});
self
}
pub fn response_content_type<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.response_content_type = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for response_content_type failed"
.to_string()
});
self
}
pub fn search<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.search = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for search failed".to_string()
});
self
}
pub fn start_date<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
{
self . start_date = value . try_into () . map_err (| _ | "conversion to `:: chrono :: DateTime < :: chrono :: offset :: Utc >` for start_date failed" . to_string ()) ;
self
}
pub fn success<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<bool>,
{
self.success = value
.try_into()
.map_err(|_| "conversion to `bool` for success failed".to_string());
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
cached,
direction,
end_date,
feedback,
filters,
max_cost,
max_duration,
max_tokens_in,
max_tokens_out,
max_total_tokens,
meta_info,
min_cost,
min_duration,
min_tokens_in,
min_tokens_out,
min_total_tokens,
model,
model_type,
order_by,
order_by_direction,
page,
per_page,
provider,
request_content_type,
response_content_type,
search,
start_date,
success,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let cached = cached.map_err(Error::InvalidRequest)?;
let direction = direction.map_err(Error::InvalidRequest)?;
let end_date = end_date.map_err(Error::InvalidRequest)?;
let feedback = feedback.map_err(Error::InvalidRequest)?;
let filters = filters.map_err(Error::InvalidRequest)?;
let max_cost = max_cost.map_err(Error::InvalidRequest)?;
let max_duration = max_duration.map_err(Error::InvalidRequest)?;
let max_tokens_in = max_tokens_in.map_err(Error::InvalidRequest)?;
let max_tokens_out = max_tokens_out.map_err(Error::InvalidRequest)?;
let max_total_tokens = max_total_tokens.map_err(Error::InvalidRequest)?;
let meta_info = meta_info.map_err(Error::InvalidRequest)?;
let min_cost = min_cost.map_err(Error::InvalidRequest)?;
let min_duration = min_duration.map_err(Error::InvalidRequest)?;
let min_tokens_in = min_tokens_in.map_err(Error::InvalidRequest)?;
let min_tokens_out = min_tokens_out.map_err(Error::InvalidRequest)?;
let min_total_tokens = min_total_tokens.map_err(Error::InvalidRequest)?;
let model = model.map_err(Error::InvalidRequest)?;
let model_type = model_type.map_err(Error::InvalidRequest)?;
let order_by = order_by.map_err(Error::InvalidRequest)?;
let order_by_direction = order_by_direction.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let provider = provider.map_err(Error::InvalidRequest)?;
let request_content_type = request_content_type.map_err(Error::InvalidRequest)?;
let response_content_type = response_content_type.map_err(Error::InvalidRequest)?;
let search = search.map_err(Error::InvalidRequest)?;
let start_date = start_date.map_err(Error::InvalidRequest)?;
let success = success.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/logs",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("cached", &cached))
.query(&progenitor_client::QueryParam::new("direction", &direction))
.query(&progenitor_client::QueryParam::new("end_date", &end_date))
.query(&progenitor_client::QueryParam::new("feedback", &feedback))
.query(&progenitor_client::QueryParam::new("filters", &filters))
.query(&progenitor_client::QueryParam::new("max_cost", &max_cost))
.query(&progenitor_client::QueryParam::new(
"max_duration",
&max_duration,
))
.query(&progenitor_client::QueryParam::new(
"max_tokens_in",
&max_tokens_in,
))
.query(&progenitor_client::QueryParam::new(
"max_tokens_out",
&max_tokens_out,
))
.query(&progenitor_client::QueryParam::new(
"max_total_tokens",
&max_total_tokens,
))
.query(&progenitor_client::QueryParam::new("meta_info", &meta_info))
.query(&progenitor_client::QueryParam::new("min_cost", &min_cost))
.query(&progenitor_client::QueryParam::new(
"min_duration",
&min_duration,
))
.query(&progenitor_client::QueryParam::new(
"min_tokens_in",
&min_tokens_in,
))
.query(&progenitor_client::QueryParam::new(
"min_tokens_out",
&min_tokens_out,
))
.query(&progenitor_client::QueryParam::new(
"min_total_tokens",
&min_total_tokens,
))
.query(&progenitor_client::QueryParam::new("model", &model))
.query(&progenitor_client::QueryParam::new(
"model_type",
&model_type,
))
.query(&progenitor_client::QueryParam::new("order_by", &order_by))
.query(&progenitor_client::QueryParam::new(
"order_by_direction",
&order_by_direction,
))
.query(&progenitor_client::QueryParam::new("page", &page))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.query(&progenitor_client::QueryParam::new("provider", &provider))
.query(&progenitor_client::QueryParam::new(
"request_content_type",
&request_content_type,
))
.query(&progenitor_client::QueryParam::new(
"response_content_type",
&response_content_type,
))
.query(&progenitor_client::QueryParam::new("search", &search))
.query(&progenitor_client::QueryParam::new(
"start_date",
&start_date,
))
.query(&progenitor_client::QueryParam::new("success", &success))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_list_gateway_logs",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigDeleteGatewayLogs<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigDeleteGatewayLogsGatewayId, String>,
filters: Result<::std::vec::Vec<types::AigConfigDeleteGatewayLogsFiltersItem>, String>,
limit: Result<::std::num::NonZeroU64, String>,
order_by: Result<types::AigConfigDeleteGatewayLogsOrderBy, String>,
order_by_direction: Result<types::AigConfigDeleteGatewayLogsOrderByDirection, String>,
}
impl<'a> AigConfigDeleteGatewayLogs<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
filters: Err("filters was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
order_by: Err("order_by was not initialized".to_string()),
order_by_direction: Err("order_by_direction was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigDeleteGatewayLogsGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigDeleteGatewayLogsGatewayId` for gateway_id failed"
.to_string()
});
self
}
pub fn filters<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<types::AigConfigDeleteGatewayLogsFiltersItem>>,
{
self . filters = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < AigConfigDeleteGatewayLogsFiltersItem >` for filters failed" . to_string ()) ;
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.limit = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for limit failed".to_string()
});
self
}
pub fn order_by<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigDeleteGatewayLogsOrderBy>,
{
self.order_by = value.try_into().map_err(|_| {
"conversion to `AigConfigDeleteGatewayLogsOrderBy` for order_by failed".to_string()
});
self
}
pub fn order_by_direction<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigDeleteGatewayLogsOrderByDirection>,
{
self . order_by_direction = value . try_into () . map_err (| _ | "conversion to `AigConfigDeleteGatewayLogsOrderByDirection` for order_by_direction failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
filters,
limit,
order_by,
order_by_direction,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let filters = filters.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let order_by = order_by.map_err(Error::InvalidRequest)?;
let order_by_direction = order_by_direction.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/logs",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("filters", &filters))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("order_by", &order_by))
.query(&progenitor_client::QueryParam::new(
"order_by_direction",
&order_by_direction,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_delete_gateway_logs",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigGetGatewayLogDetail<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigGetGatewayLogDetailGatewayId, String>,
id: Result<::std::string::String, String>,
}
impl<'a> AigConfigGetGatewayLogDetail<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigGetGatewayLogDetailGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigGetGatewayLogDetailGatewayId` for gateway_id failed"
.to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/logs/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_get_gateway_log_detail",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigPatchGatewayLog<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigPatchGatewayLogGatewayId, String>,
id: Result<::std::string::String, String>,
body: Result<types::builder::AigConfigPatchGatewayLogBody, String>,
}
impl<'a> AigConfigPatchGatewayLog<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigPatchGatewayLogGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigPatchGatewayLogGatewayId` for gateway_id failed"
.to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigPatchGatewayLogBody>,
<V as std::convert::TryInto<types::AigConfigPatchGatewayLogBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AigConfigPatchGatewayLogBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AigConfigPatchGatewayLogBody,
) -> types::builder::AigConfigPatchGatewayLogBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AigConfigPatchGatewayLogBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/logs/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.patch(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_patch_gateway_log",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigGetGatewayLogRequest<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigGetGatewayLogRequestGatewayId, String>,
id: Result<::std::string::String, String>,
}
impl<'a> AigConfigGetGatewayLogRequest<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigGetGatewayLogRequestGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigGetGatewayLogRequestGatewayId` for gateway_id failed"
.to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/logs/{}/request",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_get_gateway_log_request",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigGetGatewayLogResponse<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigGetGatewayLogResponseGatewayId, String>,
id: Result<::std::string::String, String>,
}
impl<'a> AigConfigGetGatewayLogResponse<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigGetGatewayLogResponseGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigGetGatewayLogResponseGatewayId` for gateway_id failed"
.to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/logs/{}/response",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_get_gateway_log_response",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigListProviders<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigListProvidersGatewayId, String>,
page: Result<::std::num::NonZeroU64, String>,
per_page: Result<::std::num::NonZeroU64, String>,
}
impl<'a> AigConfigListProviders<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
page: Err("page was not initialized".to_string()),
per_page: Err("per_page was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigListProvidersGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigListProvidersGatewayId` for gateway_id failed".to_string()
});
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.page = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for page failed".to_string()
});
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.per_page = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for per_page failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
page,
per_page,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/provider_configs",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("page", &page))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_list_providers",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigCreateProviders<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigCreateProvidersGatewayId, String>,
body: Result<types::builder::AigConfigCreateProvidersBody, String>,
}
impl<'a> AigConfigCreateProviders<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigCreateProvidersGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigCreateProvidersGatewayId` for gateway_id failed"
.to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigCreateProvidersBody>,
<V as std::convert::TryInto<types::AigConfigCreateProvidersBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AigConfigCreateProvidersBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AigConfigCreateProvidersBody,
) -> types::builder::AigConfigCreateProvidersBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AigConfigCreateProvidersBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/provider_configs",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_create_providers",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigUpdateProviders<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigUpdateProvidersGatewayId, String>,
id: Result<::std::string::String, String>,
body: Result<types::builder::AigConfigUpdateProvidersBody, String>,
}
impl<'a> AigConfigUpdateProviders<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigUpdateProvidersGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigUpdateProvidersGatewayId` for gateway_id failed"
.to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigUpdateProvidersBody>,
<V as std::convert::TryInto<types::AigConfigUpdateProvidersBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AigConfigUpdateProvidersBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AigConfigUpdateProvidersBody,
) -> types::builder::AigConfigUpdateProvidersBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AigConfigUpdateProvidersBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/provider_configs/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_update_providers",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigDeleteProviders<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigDeleteProvidersGatewayId, String>,
id: Result<::std::string::String, String>,
}
impl<'a> AigConfigDeleteProviders<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigDeleteProvidersGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigDeleteProvidersGatewayId` for gateway_id failed"
.to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/provider_configs/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_delete_providers",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigListGatewayDynamicRoutes<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<::std::string::String, String>,
}
impl<'a> AigConfigListGatewayDynamicRoutes<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for gateway_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/routes",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_list_gateway_dynamic_routes",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigPostGatewayDynamicRoute<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<::std::string::String, String>,
body: Result<types::builder::AigConfigPostGatewayDynamicRouteBody, String>,
}
impl<'a> AigConfigPostGatewayDynamicRoute<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for gateway_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigPostGatewayDynamicRouteBody>,
<V as std::convert::TryInto<types::AigConfigPostGatewayDynamicRouteBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AigConfigPostGatewayDynamicRouteBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AigConfigPostGatewayDynamicRouteBody,
)
-> types::builder::AigConfigPostGatewayDynamicRouteBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AigConfigPostGatewayDynamicRouteBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/routes",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_post_gateway_dynamic_route",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigGetGatewayDynamicRoute<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<::std::string::String, String>,
id: Result<::std::string::String, String>,
}
impl<'a> AigConfigGetGatewayDynamicRoute<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for gateway_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/routes/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_get_gateway_dynamic_route",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigDeleteGatewayDynamicRoute<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<::std::string::String, String>,
id: Result<::std::string::String, String>,
}
impl<'a> AigConfigDeleteGatewayDynamicRoute<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for gateway_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/routes/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_delete_gateway_dynamic_route",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigUpdateGatewayDynamicRoute<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<::std::string::String, String>,
id: Result<::std::string::String, String>,
body: Result<types::builder::AigConfigUpdateGatewayDynamicRouteBody, String>,
}
impl<'a> AigConfigUpdateGatewayDynamicRoute<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for gateway_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigUpdateGatewayDynamicRouteBody>,
<V as std::convert::TryInto<types::AigConfigUpdateGatewayDynamicRouteBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AigConfigUpdateGatewayDynamicRouteBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AigConfigUpdateGatewayDynamicRouteBody,
)
-> types::builder::AigConfigUpdateGatewayDynamicRouteBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AigConfigUpdateGatewayDynamicRouteBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/routes/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.patch(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_update_gateway_dynamic_route",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigPostGatewayDynamicRouteDeployment<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<::std::string::String, String>,
id: Result<::std::string::String, String>,
body: Result<types::builder::AigConfigPostGatewayDynamicRouteDeploymentBody, String>,
}
impl<'a> AigConfigPostGatewayDynamicRouteDeployment<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for gateway_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
} pub fn body < V > (mut self , value : V) -> Self where V : std :: convert :: TryInto < types :: AigConfigPostGatewayDynamicRouteDeploymentBody > , < V as std :: convert :: TryInto < types :: AigConfigPostGatewayDynamicRouteDeploymentBody >> :: Error : std :: fmt :: Display ,{
self . body = value . try_into () . map (From :: from) . map_err (| s | format ! ("conversion to `AigConfigPostGatewayDynamicRouteDeploymentBody` for body failed: {}" , s)) ;
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AigConfigPostGatewayDynamicRouteDeploymentBody,
)
-> types::builder::AigConfigPostGatewayDynamicRouteDeploymentBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AigConfigPostGatewayDynamicRouteDeploymentBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/routes/{}/deployments",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_post_gateway_dynamic_route_deployment",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigListGatewayDynamicRouteVersions<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<::std::string::String, String>,
id: Result<::std::string::String, String>,
}
impl<'a> AigConfigListGatewayDynamicRouteVersions<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for gateway_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/routes/{}/versions",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_list_gateway_dynamic_route_versions",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigPostGatewayDynamicRouteVersion<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<::std::string::String, String>,
id: Result<::std::string::String, String>,
body: Result<types::builder::AigConfigPostGatewayDynamicRouteVersionBody, String>,
}
impl<'a> AigConfigPostGatewayDynamicRouteVersion<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for gateway_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigPostGatewayDynamicRouteVersionBody>,
<V as std::convert::TryInto<types::AigConfigPostGatewayDynamicRouteVersionBody>>::Error:
std::fmt::Display,
{
self . body = value . try_into () . map (From :: from) . map_err (| s | format ! ("conversion to `AigConfigPostGatewayDynamicRouteVersionBody` for body failed: {}" , s)) ;
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AigConfigPostGatewayDynamicRouteVersionBody,
)
-> types::builder::AigConfigPostGatewayDynamicRouteVersionBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AigConfigPostGatewayDynamicRouteVersionBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/routes/{}/versions",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_post_gateway_dynamic_route_version",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigGetGatewayDynamicRouteVersion<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<::std::string::String, String>,
id: Result<::std::string::String, String>,
version_id: Result<::std::string::String, String>,
}
impl<'a> AigConfigGetGatewayDynamicRouteVersion<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
version_id: Err("version_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for gateway_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for id failed".to_string()
});
self
}
pub fn version_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.version_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for version_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
id,
version_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let version_id = version_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/routes/{}/versions/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&id.to_string()),
encode_path(&version_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_get_gateway_dynamic_route_version",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigGetGatewayUrl<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
gateway_id: Result<types::AigConfigGetGatewayUrlGatewayId, String>,
provider: Result<::std::string::String, String>,
}
impl<'a> AigConfigGetGatewayUrl<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
gateway_id: Err("gateway_id was not initialized".to_string()),
provider: Err("provider was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn gateway_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigGetGatewayUrlGatewayId>,
{
self.gateway_id = value.try_into().map_err(|_| {
"conversion to `AigConfigGetGatewayUrlGatewayId` for gateway_id failed".to_string()
});
self
}
pub fn provider<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.provider = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for provider failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
gateway_id,
provider,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let gateway_id = gateway_id.map_err(Error::InvalidRequest)?;
let provider = provider.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}/url/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&gateway_id.to_string()),
encode_path(&provider.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_get_gateway_url",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigFetchGateway<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::AigConfigFetchGatewayId, String>,
}
impl<'a> AigConfigFetchGateway<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigFetchGatewayId>,
{
self.id = value
.try_into()
.map_err(|_| "conversion to `AigConfigFetchGatewayId` for id failed".to_string());
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_fetch_gateway",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigUpdateGateway<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::AigConfigUpdateGatewayId, String>,
body: Result<types::builder::AigConfigUpdateGatewayBody, String>,
}
impl<'a> AigConfigUpdateGateway<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigUpdateGatewayId>,
{
self.id = value
.try_into()
.map_err(|_| "conversion to `AigConfigUpdateGatewayId` for id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigUpdateGatewayBody>,
<V as std::convert::TryInto<types::AigConfigUpdateGatewayBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AigConfigUpdateGatewayBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AigConfigUpdateGatewayBody,
) -> types::builder::AigConfigUpdateGatewayBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AigConfigUpdateGatewayBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_update_gateway",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AigConfigDeleteGateway<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::AigConfigDeleteGatewayId, String>,
}
impl<'a> AigConfigDeleteGateway<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AigConfigDeleteGatewayId>,
{
self.id = value
.try_into()
.map_err(|_| "conversion to `AigConfigDeleteGatewayId` for id failed".to_string());
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/ai-gateway/gateways/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "aig_config_delete_gateway",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}