use super::types;
use crate::{
ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
ResponseValue, encode_path,
};
#[derive(Debug, Clone)]
pub struct AutoragConfigAiSearch<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::AutoragConfigAiSearchId, String>,
body: Result<types::builder::AutoragConfigAiSearchBody, String>,
}
impl<'a> AutoragConfigAiSearch<'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::AutoragConfigAiSearchId>,
{
self.id = value
.try_into()
.map_err(|_| "conversion to `AutoragConfigAiSearchId` for id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AutoragConfigAiSearchBody>,
<V as std::convert::TryInto<types::AutoragConfigAiSearchBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AutoragConfigAiSearchBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AutoragConfigAiSearchBody,
) -> types::builder::AutoragConfigAiSearchBody,
{
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::AutoragConfigAiSearchBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/autorag/rags/{}/ai-search",
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
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "autorag_config_ai_search",
};
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 AutoragConfigFiles<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::AutoragConfigFilesId, String>,
page: Result<::std::num::NonZeroU64, String>,
per_page: Result<i64, String>,
search: Result<::std::string::String, String>,
status: Result<types::AutoragConfigFilesStatus, String>,
}
impl<'a> AutoragConfigFiles<'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()),
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()),
status: Err("status 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::AutoragConfigFilesId>,
{
self.id = value
.try_into()
.map_err(|_| "conversion to `AutoragConfigFilesId` for 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<i64>,
{
self.per_page = value
.try_into()
.map_err(|_| "conversion to `i64` 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 fn status<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AutoragConfigFilesStatus>,
{
self.status = value.try_into().map_err(|_| {
"conversion to `AutoragConfigFilesStatus` for status 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,
page,
per_page,
search,
status,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = 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 status = status.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/autorag/rags/{}/files",
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"),
)
.query(&progenitor_client::QueryParam::new("page", &page))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.query(&progenitor_client::QueryParam::new("search", &search))
.query(&progenitor_client::QueryParam::new("status", &status))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "autorag_config_files",
};
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 AutoragConfigListJobs<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::AutoragConfigListJobsId, String>,
page: Result<::std::num::NonZeroU64, String>,
per_page: Result<i64, String>,
}
impl<'a> AutoragConfigListJobs<'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()),
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 id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AutoragConfigListJobsId>,
{
self.id = value
.try_into()
.map_err(|_| "conversion to `AutoragConfigListJobsId` for 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<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,
id,
page,
per_page,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = 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/{}/autorag/rags/{}/jobs",
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"),
)
.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: "autorag_config_list_jobs",
};
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 AutoragConfigGetJob<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::AutoragConfigGetJobId, String>,
job_id: Result<::std::string::String, String>,
}
impl<'a> AutoragConfigGetJob<'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()),
job_id: Err("job_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::AutoragConfigGetJobId>,
{
self.id = value
.try_into()
.map_err(|_| "conversion to `AutoragConfigGetJobId` for id failed".to_string());
self
}
pub fn job_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.job_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for job_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,
job_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let job_id = job_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/autorag/rags/{}/jobs/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&id.to_string()),
encode_path(&job_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: "autorag_config_get_job",
};
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 AutoragConfigListJobLogs<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::AutoragConfigListJobLogsId, String>,
job_id: Result<::std::string::String, String>,
page: Result<::std::num::NonZeroU64, String>,
per_page: Result<i64, String>,
}
impl<'a> AutoragConfigListJobLogs<'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()),
job_id: Err("job_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 id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AutoragConfigListJobLogsId>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `AutoragConfigListJobLogsId` for id failed".to_string()
});
self
}
pub fn job_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.job_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for job_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<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,
id,
job_id,
page,
per_page,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let job_id = job_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/{}/autorag/rags/{}/jobs/{}/logs",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&id.to_string()),
encode_path(&job_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: "autorag_config_list_job_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 AutoragConfigSearch<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::AutoragConfigSearchId, String>,
body: Result<types::builder::AutoragConfigSearchBody, String>,
}
impl<'a> AutoragConfigSearch<'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::AutoragConfigSearchId>,
{
self.id = value
.try_into()
.map_err(|_| "conversion to `AutoragConfigSearchId` for id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AutoragConfigSearchBody>,
<V as std::convert::TryInto<types::AutoragConfigSearchBody>>::Error: std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AutoragConfigSearchBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AutoragConfigSearchBody,
) -> types::builder::AutoragConfigSearchBody,
{
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::AutoragConfigSearchBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/autorag/rags/{}/search",
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
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "autorag_config_search",
};
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 AutoragConfigSync<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::AutoragConfigSyncId, String>,
}
impl<'a> AutoragConfigSync<'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::AutoragConfigSyncId>,
{
self.id = value
.try_into()
.map_err(|_| "conversion to `AutoragConfigSyncId` 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/{}/autorag/rags/{}/sync",
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
.patch(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "autorag_config_sync",
};
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)),
}
}
}