Generate unique internal var names and add tests for name collisions. (#601)
* Generate unique identifiers for internal variable names instead of using a static prefix. * Add tests for previous name collision issues. * only prefix when needed. Co-authored-by: Adam Leventhal <ahl@oxide.computer> * add missing test invocation. * update test fixtures per aaa40855485ca3c2ccf338c07d595ffc907975a1. --------- Co-authored-by: Adam Leventhal <ahl@oxide.computer>
This commit is contained in:
parent
08428bea99
commit
6dc2a0ff2d
|
@ -13,7 +13,7 @@ use typify::{TypeId, TypeSpace};
|
|||
|
||||
use crate::{
|
||||
template::PathTemplate,
|
||||
util::{items, parameter_map, sanitize, Case},
|
||||
util::{items, parameter_map, sanitize, unique_ident_from, Case},
|
||||
Error, Generator, Result, TagStyle,
|
||||
};
|
||||
use crate::{to_schema::ToSchema, util::ReferenceOrExt};
|
||||
|
@ -792,15 +792,18 @@ impl Generator {
|
|||
method: &OperationMethod,
|
||||
client: TokenStream,
|
||||
) -> Result<MethodSigBody> {
|
||||
// We prefix internal variable names to mitigate possible name
|
||||
// collisions with the input spec. See:
|
||||
// https://github.com/oxidecomputer/progenitor/issues/288
|
||||
let internal_prefix = "__progenitor";
|
||||
let url_ident = format_ident!("{internal_prefix}_url");
|
||||
let query_ident = format_ident!("{internal_prefix}_query");
|
||||
let request_ident = format_ident!("{internal_prefix}_request");
|
||||
let response_ident = format_ident!("{internal_prefix}_response");
|
||||
let result_ident = format_ident!("{internal_prefix}_result");
|
||||
let param_names = method
|
||||
.params
|
||||
.iter()
|
||||
.map(|param| format_ident!("{}", param.name))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
// Generate a unique Ident for internal variables
|
||||
let url_ident = unique_ident_from("url", ¶m_names);
|
||||
let query_ident = unique_ident_from("query", ¶m_names);
|
||||
let request_ident = unique_ident_from("request", ¶m_names);
|
||||
let response_ident = unique_ident_from("response", ¶m_names);
|
||||
let result_ident = unique_ident_from("result", ¶m_names);
|
||||
|
||||
// Generate code for query parameters.
|
||||
let query_items = method
|
||||
|
@ -1429,7 +1432,6 @@ impl Generator {
|
|||
) -> Result<TokenStream> {
|
||||
let struct_name = sanitize(&method.operation_id, Case::Pascal);
|
||||
let struct_ident = format_ident!("{}", struct_name);
|
||||
let client_ident = format_ident!("__progenitor_client");
|
||||
|
||||
// Generate an ident for each parameter.
|
||||
let param_names = method
|
||||
|
@ -1438,6 +1440,8 @@ impl Generator {
|
|||
.map(|param| format_ident!("{}", param.name))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let client_ident = unique_ident_from("client", ¶m_names);
|
||||
|
||||
let mut cloneable = true;
|
||||
|
||||
// Generate the type for each parameter.
|
||||
|
|
|
@ -123,3 +123,22 @@ pub(crate) fn sanitize(input: &str, case: Case) -> String {
|
|||
format!("{}_", out)
|
||||
}
|
||||
}
|
||||
|
||||
/// Given a desired name and a slice of proc_macro2::Ident, generate a new
|
||||
/// Ident that is unique from the slice.
|
||||
pub(crate) fn unique_ident_from(
|
||||
name: &str,
|
||||
identities: &[proc_macro2::Ident],
|
||||
) -> proc_macro2::Ident {
|
||||
let mut name = name.to_string();
|
||||
|
||||
loop {
|
||||
let ident = quote::format_ident!("{}", name);
|
||||
|
||||
if !identities.contains(&ident) {
|
||||
return ident;
|
||||
}
|
||||
|
||||
name.insert_str(0, "_");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1863,38 +1863,31 @@ pub mod builder {
|
|||
///[`Client::control_hold`]: super::Client::control_hold
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ControlHold<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> ControlHold<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `POST` request to `/v1/control/hold`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/v1/control/hold", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/v1/control/hold", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1904,31 +1897,24 @@ pub mod builder {
|
|||
///[`Client::control_resume`]: super::Client::control_resume
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ControlResume<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> ControlResume<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `POST` request to `/v1/control/resume`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/v1/control/resume", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client.client.post(__progenitor_url).build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/v1/control/resume", client.baseurl,);
|
||||
let request = client.client.post(url).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1938,14 +1924,14 @@ pub mod builder {
|
|||
///[`Client::task_get`]: super::Client::task_get
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TaskGet<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
}
|
||||
|
||||
impl<'a> TaskGet<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
}
|
||||
}
|
||||
|
@ -1962,32 +1948,26 @@ pub mod builder {
|
|||
|
||||
///Sends a `GET` request to `/v1/task/{task}`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::Task>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
task,
|
||||
} = self;
|
||||
let Self { client, task } = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/task/{}",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1997,38 +1977,31 @@ pub mod builder {
|
|||
///[`Client::tasks_get`]: super::Client::tasks_get
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TasksGet<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> TasksGet<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/v1/tasks`
|
||||
pub async fn send(self) -> Result<ResponseValue<Vec<types::Task>>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/v1/tasks", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/v1/tasks", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2038,14 +2011,14 @@ pub mod builder {
|
|||
///[`Client::task_submit`]: super::Client::task_submit
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TaskSubmit<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::builder::TaskSubmit, String>,
|
||||
}
|
||||
|
||||
impl<'a> TaskSubmit<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Ok(types::builder::TaskSubmit::default()),
|
||||
}
|
||||
}
|
||||
|
@ -2071,31 +2044,25 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/v1/tasks`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::TaskSubmitResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::TaskSubmit>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/v1/tasks", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let url = format!("{}/v1/tasks", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2105,7 +2072,7 @@ pub mod builder {
|
|||
///[`Client::task_events_get`]: super::Client::task_events_get
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TaskEventsGet<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
minseq: Result<Option<u32>, String>,
|
||||
}
|
||||
|
@ -2113,7 +2080,7 @@ pub mod builder {
|
|||
impl<'a> TaskEventsGet<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
minseq: Ok(None),
|
||||
}
|
||||
|
@ -2143,38 +2110,35 @@ pub mod builder {
|
|||
///Sends a `GET` request to `/v1/tasks/{task}/events`
|
||||
pub async fn send(self) -> Result<ResponseValue<Vec<types::TaskEvent>>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
task,
|
||||
minseq,
|
||||
} = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let minseq = minseq.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/tasks/{}/events",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let mut __progenitor_query = Vec::with_capacity(1usize);
|
||||
let mut query = Vec::with_capacity(1usize);
|
||||
if let Some(v) = &minseq {
|
||||
__progenitor_query.push(("minseq", v.to_string()));
|
||||
query.push(("minseq", v.to_string()));
|
||||
}
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.query(&__progenitor_query)
|
||||
.query(&query)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2184,14 +2148,14 @@ pub mod builder {
|
|||
///[`Client::task_outputs_get`]: super::Client::task_outputs_get
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TaskOutputsGet<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
}
|
||||
|
||||
impl<'a> TaskOutputsGet<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
}
|
||||
}
|
||||
|
@ -2208,32 +2172,26 @@ pub mod builder {
|
|||
|
||||
///Sends a `GET` request to `/v1/tasks/{task}/outputs`
|
||||
pub async fn send(self) -> Result<ResponseValue<Vec<types::TaskOutput>>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
task,
|
||||
} = self;
|
||||
let Self { client, task } = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/tasks/{}/outputs",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2243,7 +2201,7 @@ pub mod builder {
|
|||
///[`Client::task_output_download`]: super::Client::task_output_download
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TaskOutputDownload<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
output: Result<String, String>,
|
||||
}
|
||||
|
@ -2251,7 +2209,7 @@ pub mod builder {
|
|||
impl<'a> TaskOutputDownload<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
output: Err("output was not initialized".to_string()),
|
||||
}
|
||||
|
@ -2280,27 +2238,24 @@ pub mod builder {
|
|||
///Sends a `GET` request to `/v1/tasks/{task}/outputs/{output}`
|
||||
pub async fn send(self) -> Result<ResponseValue<ByteStream>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
task,
|
||||
output,
|
||||
} = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let output = output.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/tasks/{}/outputs/{}",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
encode_path(&output.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client.client.get(__progenitor_url).build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200..=299 => Ok(ResponseValue::stream(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = client.client.get(url).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200..=299 => Ok(ResponseValue::stream(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2310,14 +2265,14 @@ pub mod builder {
|
|||
///[`Client::user_create`]: super::Client::user_create
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct UserCreate<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::builder::UserCreate, String>,
|
||||
}
|
||||
|
||||
impl<'a> UserCreate<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Ok(types::builder::UserCreate::default()),
|
||||
}
|
||||
}
|
||||
|
@ -2343,31 +2298,25 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/v1/users`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::UserCreateResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::UserCreate>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/v1/users", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let url = format!("{}/v1/users", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2377,38 +2326,31 @@ pub mod builder {
|
|||
///[`Client::whoami`]: super::Client::whoami
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Whoami<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> Whoami<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/v1/whoami`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::WhoamiResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/v1/whoami", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/v1/whoami", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2418,14 +2360,14 @@ pub mod builder {
|
|||
///[`Client::worker_bootstrap`]: super::Client::worker_bootstrap
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkerBootstrap<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::builder::WorkerBootstrap, String>,
|
||||
}
|
||||
|
||||
impl<'a> WorkerBootstrap<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Ok(types::builder::WorkerBootstrap::default()),
|
||||
}
|
||||
}
|
||||
|
@ -2451,31 +2393,25 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/v1/worker/bootstrap`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::WorkerBootstrapResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::WorkerBootstrap>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/v1/worker/bootstrap", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let url = format!("{}/v1/worker/bootstrap", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2485,38 +2421,31 @@ pub mod builder {
|
|||
///[`Client::worker_ping`]: super::Client::worker_ping
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkerPing<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> WorkerPing<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/v1/worker/ping`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::WorkerPingResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/v1/worker/ping", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/v1/worker/ping", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2526,7 +2455,7 @@ pub mod builder {
|
|||
///[`Client::worker_task_append`]: super::Client::worker_task_append
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkerTaskAppend<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
body: Result<types::builder::WorkerAppendTask, String>,
|
||||
}
|
||||
|
@ -2534,7 +2463,7 @@ pub mod builder {
|
|||
impl<'a> WorkerTaskAppend<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
body: Ok(types::builder::WorkerAppendTask::default()),
|
||||
}
|
||||
|
@ -2573,33 +2502,22 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/v1/worker/task/{task}/append`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
task,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, task, body } = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::WorkerAppendTask>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/worker/task/{}/append",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = client.client.post(url).json(&body).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2609,7 +2527,7 @@ pub mod builder {
|
|||
///[`Client::worker_task_upload_chunk`]: super::Client::worker_task_upload_chunk
|
||||
#[derive(Debug)]
|
||||
pub struct WorkerTaskUploadChunk<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
body: Result<reqwest::Body, String>,
|
||||
}
|
||||
|
@ -2617,7 +2535,7 @@ pub mod builder {
|
|||
impl<'a> WorkerTaskUploadChunk<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
body: Err("body was not initialized".to_string()),
|
||||
}
|
||||
|
@ -2645,21 +2563,17 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/v1/worker/task/{task}/chunk`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::UploadedChunk>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
task,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, task, body } = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let body = body.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/worker/task/{}/chunk",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
|
@ -2670,14 +2584,11 @@ pub mod builder {
|
|||
)
|
||||
.body(body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2687,7 +2598,7 @@ pub mod builder {
|
|||
///[`Client::worker_task_complete`]: super::Client::worker_task_complete
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkerTaskComplete<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
body: Result<types::builder::WorkerCompleteTask, String>,
|
||||
}
|
||||
|
@ -2695,7 +2606,7 @@ pub mod builder {
|
|||
impl<'a> WorkerTaskComplete<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
body: Ok(types::builder::WorkerCompleteTask::default()),
|
||||
}
|
||||
|
@ -2734,33 +2645,22 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/v1/worker/task/{task}/complete`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
task,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, task, body } = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::WorkerCompleteTask>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/worker/task/{}/complete",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = client.client.post(url).json(&body).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2770,7 +2670,7 @@ pub mod builder {
|
|||
///[`Client::worker_task_add_output`]: super::Client::worker_task_add_output
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkerTaskAddOutput<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
body: Result<types::builder::WorkerAddOutput, String>,
|
||||
}
|
||||
|
@ -2778,7 +2678,7 @@ pub mod builder {
|
|||
impl<'a> WorkerTaskAddOutput<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
body: Ok(types::builder::WorkerAddOutput::default()),
|
||||
}
|
||||
|
@ -2815,33 +2715,22 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/v1/worker/task/{task}/output`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
task,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, task, body } = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::WorkerAddOutput>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/worker/task/{}/output",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = client.client.post(url).json(&body).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2851,38 +2740,31 @@ pub mod builder {
|
|||
///[`Client::workers_list`]: super::Client::workers_list
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkersList<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> WorkersList<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/v1/workers`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::WorkersResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/v1/workers", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/v1/workers", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2892,31 +2774,24 @@ pub mod builder {
|
|||
///[`Client::workers_recycle`]: super::Client::workers_recycle
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkersRecycle<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> WorkersRecycle<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `POST` request to `/v1/workers/recycle`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/v1/workers/recycle", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client.client.post(__progenitor_url).build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/v1/workers/recycle", client.baseurl,);
|
||||
let request = client.client.post(url).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1863,38 +1863,31 @@ pub mod builder {
|
|||
///[`Client::control_hold`]: super::Client::control_hold
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ControlHold<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> ControlHold<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `POST` request to `/v1/control/hold`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/v1/control/hold", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/v1/control/hold", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1904,31 +1897,24 @@ pub mod builder {
|
|||
///[`Client::control_resume`]: super::Client::control_resume
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ControlResume<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> ControlResume<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `POST` request to `/v1/control/resume`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/v1/control/resume", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client.client.post(__progenitor_url).build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/v1/control/resume", client.baseurl,);
|
||||
let request = client.client.post(url).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1938,14 +1924,14 @@ pub mod builder {
|
|||
///[`Client::task_get`]: super::Client::task_get
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TaskGet<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
}
|
||||
|
||||
impl<'a> TaskGet<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
}
|
||||
}
|
||||
|
@ -1962,32 +1948,26 @@ pub mod builder {
|
|||
|
||||
///Sends a `GET` request to `/v1/task/{task}`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::Task>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
task,
|
||||
} = self;
|
||||
let Self { client, task } = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/task/{}",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1997,38 +1977,31 @@ pub mod builder {
|
|||
///[`Client::tasks_get`]: super::Client::tasks_get
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TasksGet<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> TasksGet<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/v1/tasks`
|
||||
pub async fn send(self) -> Result<ResponseValue<Vec<types::Task>>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/v1/tasks", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/v1/tasks", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2038,14 +2011,14 @@ pub mod builder {
|
|||
///[`Client::task_submit`]: super::Client::task_submit
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TaskSubmit<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::builder::TaskSubmit, String>,
|
||||
}
|
||||
|
||||
impl<'a> TaskSubmit<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Ok(types::builder::TaskSubmit::default()),
|
||||
}
|
||||
}
|
||||
|
@ -2071,31 +2044,25 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/v1/tasks`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::TaskSubmitResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::TaskSubmit>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/v1/tasks", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let url = format!("{}/v1/tasks", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2105,7 +2072,7 @@ pub mod builder {
|
|||
///[`Client::task_events_get`]: super::Client::task_events_get
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TaskEventsGet<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
minseq: Result<Option<u32>, String>,
|
||||
}
|
||||
|
@ -2113,7 +2080,7 @@ pub mod builder {
|
|||
impl<'a> TaskEventsGet<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
minseq: Ok(None),
|
||||
}
|
||||
|
@ -2143,38 +2110,35 @@ pub mod builder {
|
|||
///Sends a `GET` request to `/v1/tasks/{task}/events`
|
||||
pub async fn send(self) -> Result<ResponseValue<Vec<types::TaskEvent>>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
task,
|
||||
minseq,
|
||||
} = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let minseq = minseq.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/tasks/{}/events",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let mut __progenitor_query = Vec::with_capacity(1usize);
|
||||
let mut query = Vec::with_capacity(1usize);
|
||||
if let Some(v) = &minseq {
|
||||
__progenitor_query.push(("minseq", v.to_string()));
|
||||
query.push(("minseq", v.to_string()));
|
||||
}
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.query(&__progenitor_query)
|
||||
.query(&query)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2184,14 +2148,14 @@ pub mod builder {
|
|||
///[`Client::task_outputs_get`]: super::Client::task_outputs_get
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TaskOutputsGet<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
}
|
||||
|
||||
impl<'a> TaskOutputsGet<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
}
|
||||
}
|
||||
|
@ -2208,32 +2172,26 @@ pub mod builder {
|
|||
|
||||
///Sends a `GET` request to `/v1/tasks/{task}/outputs`
|
||||
pub async fn send(self) -> Result<ResponseValue<Vec<types::TaskOutput>>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
task,
|
||||
} = self;
|
||||
let Self { client, task } = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/tasks/{}/outputs",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2243,7 +2201,7 @@ pub mod builder {
|
|||
///[`Client::task_output_download`]: super::Client::task_output_download
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TaskOutputDownload<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
output: Result<String, String>,
|
||||
}
|
||||
|
@ -2251,7 +2209,7 @@ pub mod builder {
|
|||
impl<'a> TaskOutputDownload<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
output: Err("output was not initialized".to_string()),
|
||||
}
|
||||
|
@ -2280,27 +2238,24 @@ pub mod builder {
|
|||
///Sends a `GET` request to `/v1/tasks/{task}/outputs/{output}`
|
||||
pub async fn send(self) -> Result<ResponseValue<ByteStream>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
task,
|
||||
output,
|
||||
} = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let output = output.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/tasks/{}/outputs/{}",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
encode_path(&output.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client.client.get(__progenitor_url).build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200..=299 => Ok(ResponseValue::stream(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = client.client.get(url).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200..=299 => Ok(ResponseValue::stream(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2310,14 +2265,14 @@ pub mod builder {
|
|||
///[`Client::user_create`]: super::Client::user_create
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct UserCreate<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::builder::UserCreate, String>,
|
||||
}
|
||||
|
||||
impl<'a> UserCreate<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Ok(types::builder::UserCreate::default()),
|
||||
}
|
||||
}
|
||||
|
@ -2343,31 +2298,25 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/v1/users`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::UserCreateResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::UserCreate>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/v1/users", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let url = format!("{}/v1/users", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2377,38 +2326,31 @@ pub mod builder {
|
|||
///[`Client::whoami`]: super::Client::whoami
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Whoami<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> Whoami<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/v1/whoami`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::WhoamiResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/v1/whoami", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/v1/whoami", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2418,14 +2360,14 @@ pub mod builder {
|
|||
///[`Client::worker_bootstrap`]: super::Client::worker_bootstrap
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkerBootstrap<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::builder::WorkerBootstrap, String>,
|
||||
}
|
||||
|
||||
impl<'a> WorkerBootstrap<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Ok(types::builder::WorkerBootstrap::default()),
|
||||
}
|
||||
}
|
||||
|
@ -2451,31 +2393,25 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/v1/worker/bootstrap`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::WorkerBootstrapResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::WorkerBootstrap>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/v1/worker/bootstrap", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let url = format!("{}/v1/worker/bootstrap", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2485,38 +2421,31 @@ pub mod builder {
|
|||
///[`Client::worker_ping`]: super::Client::worker_ping
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkerPing<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> WorkerPing<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/v1/worker/ping`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::WorkerPingResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/v1/worker/ping", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/v1/worker/ping", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2526,7 +2455,7 @@ pub mod builder {
|
|||
///[`Client::worker_task_append`]: super::Client::worker_task_append
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkerTaskAppend<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
body: Result<types::builder::WorkerAppendTask, String>,
|
||||
}
|
||||
|
@ -2534,7 +2463,7 @@ pub mod builder {
|
|||
impl<'a> WorkerTaskAppend<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
body: Ok(types::builder::WorkerAppendTask::default()),
|
||||
}
|
||||
|
@ -2573,33 +2502,22 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/v1/worker/task/{task}/append`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
task,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, task, body } = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::WorkerAppendTask>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/worker/task/{}/append",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = client.client.post(url).json(&body).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2609,7 +2527,7 @@ pub mod builder {
|
|||
///[`Client::worker_task_upload_chunk`]: super::Client::worker_task_upload_chunk
|
||||
#[derive(Debug)]
|
||||
pub struct WorkerTaskUploadChunk<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
body: Result<reqwest::Body, String>,
|
||||
}
|
||||
|
@ -2617,7 +2535,7 @@ pub mod builder {
|
|||
impl<'a> WorkerTaskUploadChunk<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
body: Err("body was not initialized".to_string()),
|
||||
}
|
||||
|
@ -2645,21 +2563,17 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/v1/worker/task/{task}/chunk`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::UploadedChunk>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
task,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, task, body } = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let body = body.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/worker/task/{}/chunk",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
|
@ -2670,14 +2584,11 @@ pub mod builder {
|
|||
)
|
||||
.body(body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2687,7 +2598,7 @@ pub mod builder {
|
|||
///[`Client::worker_task_complete`]: super::Client::worker_task_complete
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkerTaskComplete<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
body: Result<types::builder::WorkerCompleteTask, String>,
|
||||
}
|
||||
|
@ -2695,7 +2606,7 @@ pub mod builder {
|
|||
impl<'a> WorkerTaskComplete<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
body: Ok(types::builder::WorkerCompleteTask::default()),
|
||||
}
|
||||
|
@ -2734,33 +2645,22 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/v1/worker/task/{task}/complete`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
task,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, task, body } = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::WorkerCompleteTask>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/worker/task/{}/complete",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = client.client.post(url).json(&body).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2770,7 +2670,7 @@ pub mod builder {
|
|||
///[`Client::worker_task_add_output`]: super::Client::worker_task_add_output
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkerTaskAddOutput<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
task: Result<String, String>,
|
||||
body: Result<types::builder::WorkerAddOutput, String>,
|
||||
}
|
||||
|
@ -2778,7 +2678,7 @@ pub mod builder {
|
|||
impl<'a> WorkerTaskAddOutput<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
task: Err("task was not initialized".to_string()),
|
||||
body: Ok(types::builder::WorkerAddOutput::default()),
|
||||
}
|
||||
|
@ -2815,33 +2715,22 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/v1/worker/task/{task}/output`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
task,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, task, body } = self;
|
||||
let task = task.map_err(Error::InvalidRequest)?;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::WorkerAddOutput>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/worker/task/{}/output",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = client.client.post(url).json(&body).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2851,38 +2740,31 @@ pub mod builder {
|
|||
///[`Client::workers_list`]: super::Client::workers_list
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkersList<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> WorkersList<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/v1/workers`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::WorkersResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/v1/workers", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/v1/workers", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2892,31 +2774,24 @@ pub mod builder {
|
|||
///[`Client::workers_recycle`]: super::Client::workers_recycle
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkersRecycle<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> WorkersRecycle<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `POST` request to `/v1/workers/recycle`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/v1/workers/recycle", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client.client.post(__progenitor_url).build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/v1/workers/recycle", client.baseurl,);
|
||||
let request = client.client.post(url).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -313,32 +313,32 @@ impl Client {
|
|||
impl Client {
|
||||
///Sends a `POST` request to `/v1/control/hold`
|
||||
pub async fn control_hold<'a>(&'a self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/v1/control/hold", self.baseurl,);
|
||||
let __progenitor_request = self
|
||||
let url = format!("{}/v1/control/hold", self.baseurl,);
|
||||
let request = self
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
///Sends a `POST` request to `/v1/control/resume`
|
||||
pub async fn control_resume<'a>(&'a self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/v1/control/resume", self.baseurl,);
|
||||
let __progenitor_request = self.client.post(__progenitor_url).build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let url = format!("{}/v1/control/resume", self.baseurl,);
|
||||
let request = self.client.post(url).build()?;
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -347,43 +347,43 @@ impl Client {
|
|||
&'a self,
|
||||
task: &'a str,
|
||||
) -> Result<ResponseValue<types::Task>, Error<()>> {
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/task/{}",
|
||||
self.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = self
|
||||
let request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/v1/tasks`
|
||||
pub async fn tasks_get<'a>(&'a self) -> Result<ResponseValue<Vec<types::Task>>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/v1/tasks", self.baseurl,);
|
||||
let __progenitor_request = self
|
||||
let url = format!("{}/v1/tasks", self.baseurl,);
|
||||
let request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,21 +392,21 @@ impl Client {
|
|||
&'a self,
|
||||
body: &'a types::TaskSubmit,
|
||||
) -> Result<ResponseValue<types::TaskSubmitResult>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/v1/tasks", self.baseurl,);
|
||||
let __progenitor_request = self
|
||||
let url = format!("{}/v1/tasks", self.baseurl,);
|
||||
let request = self
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -416,30 +416,30 @@ impl Client {
|
|||
task: &'a str,
|
||||
minseq: Option<u32>,
|
||||
) -> Result<ResponseValue<Vec<types::TaskEvent>>, Error<()>> {
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/tasks/{}/events",
|
||||
self.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let mut __progenitor_query = Vec::with_capacity(1usize);
|
||||
let mut query = Vec::with_capacity(1usize);
|
||||
if let Some(v) = &minseq {
|
||||
__progenitor_query.push(("minseq", v.to_string()));
|
||||
query.push(("minseq", v.to_string()));
|
||||
}
|
||||
|
||||
let __progenitor_request = self
|
||||
let request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.query(&__progenitor_query)
|
||||
.query(&query)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -448,24 +448,24 @@ impl Client {
|
|||
&'a self,
|
||||
task: &'a str,
|
||||
) -> Result<ResponseValue<Vec<types::TaskOutput>>, Error<()>> {
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/tasks/{}/outputs",
|
||||
self.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = self
|
||||
let request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -475,18 +475,18 @@ impl Client {
|
|||
task: &'a str,
|
||||
output: &'a str,
|
||||
) -> Result<ResponseValue<ByteStream>, Error<()>> {
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/tasks/{}/outputs/{}",
|
||||
self.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
encode_path(&output.to_string()),
|
||||
);
|
||||
let __progenitor_request = self.client.get(__progenitor_url).build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200..=299 => Ok(ResponseValue::stream(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = self.client.get(url).build()?;
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200..=299 => Ok(ResponseValue::stream(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -495,40 +495,40 @@ impl Client {
|
|||
&'a self,
|
||||
body: &'a types::UserCreate,
|
||||
) -> Result<ResponseValue<types::UserCreateResult>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/v1/users", self.baseurl,);
|
||||
let __progenitor_request = self
|
||||
let url = format!("{}/v1/users", self.baseurl,);
|
||||
let request = self
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/v1/whoami`
|
||||
pub async fn whoami<'a>(&'a self) -> Result<ResponseValue<types::WhoamiResult>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/v1/whoami", self.baseurl,);
|
||||
let __progenitor_request = self
|
||||
let url = format!("{}/v1/whoami", self.baseurl,);
|
||||
let request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,21 +537,21 @@ impl Client {
|
|||
&'a self,
|
||||
body: &'a types::WorkerBootstrap,
|
||||
) -> Result<ResponseValue<types::WorkerBootstrapResult>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/v1/worker/bootstrap", self.baseurl,);
|
||||
let __progenitor_request = self
|
||||
let url = format!("{}/v1/worker/bootstrap", self.baseurl,);
|
||||
let request = self
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -559,20 +559,20 @@ impl Client {
|
|||
pub async fn worker_ping<'a>(
|
||||
&'a self,
|
||||
) -> Result<ResponseValue<types::WorkerPingResult>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/v1/worker/ping", self.baseurl,);
|
||||
let __progenitor_request = self
|
||||
let url = format!("{}/v1/worker/ping", self.baseurl,);
|
||||
let request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -582,17 +582,17 @@ impl Client {
|
|||
task: &'a str,
|
||||
body: &'a types::WorkerAppendTask,
|
||||
) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/worker/task/{}/append",
|
||||
self.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = self.client.post(__progenitor_url).json(&body).build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = self.client.post(url).json(&body).build()?;
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -602,14 +602,14 @@ impl Client {
|
|||
task: &'a str,
|
||||
body: B,
|
||||
) -> Result<ResponseValue<types::UploadedChunk>, Error<()>> {
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/worker/task/{}/chunk",
|
||||
self.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = self
|
||||
let request = self
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
|
@ -620,11 +620,11 @@ impl Client {
|
|||
)
|
||||
.body(body)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -634,17 +634,17 @@ impl Client {
|
|||
task: &'a str,
|
||||
body: &'a types::WorkerCompleteTask,
|
||||
) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/worker/task/{}/complete",
|
||||
self.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = self.client.post(__progenitor_url).json(&body).build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = self.client.post(url).json(&body).build()?;
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -654,17 +654,17 @@ impl Client {
|
|||
task: &'a str,
|
||||
body: &'a types::WorkerAddOutput,
|
||||
) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/v1/worker/task/{}/output",
|
||||
self.baseurl,
|
||||
encode_path(&task.to_string()),
|
||||
);
|
||||
let __progenitor_request = self.client.post(__progenitor_url).json(&body).build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = self.client.post(url).json(&body).build()?;
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -672,32 +672,32 @@ impl Client {
|
|||
pub async fn workers_list<'a>(
|
||||
&'a self,
|
||||
) -> Result<ResponseValue<types::WorkersResult>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/v1/workers", self.baseurl,);
|
||||
let __progenitor_request = self
|
||||
let url = format!("{}/v1/workers", self.baseurl,);
|
||||
let request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
///Sends a `POST` request to `/v1/workers/recycle`
|
||||
pub async fn workers_recycle<'a>(&'a self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/v1/workers/recycle", self.baseurl,);
|
||||
let __progenitor_request = self.client.post(__progenitor_url).build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let url = format!("{}/v1/workers/recycle", self.baseurl,);
|
||||
let request = self.client.post(url).build()?;
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1065,7 +1065,7 @@ pub mod builder {
|
|||
///[`Client::enrol`]: super::Client::enrol
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Enrol<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
authorization: Result<String, String>,
|
||||
body: Result<types::builder::EnrolBody, String>,
|
||||
}
|
||||
|
@ -1073,7 +1073,7 @@ pub mod builder {
|
|||
impl<'a> Enrol<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
authorization: Err("authorization was not initialized".to_string()),
|
||||
body: Ok(types::builder::EnrolBody::default()),
|
||||
}
|
||||
|
@ -1111,7 +1111,7 @@ pub mod builder {
|
|||
///Sends a `POST` request to `/enrol`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
authorization,
|
||||
body,
|
||||
} = self;
|
||||
|
@ -1119,23 +1119,20 @@ pub mod builder {
|
|||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::EnrolBody>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/enrol", __progenitor_client.baseurl,);
|
||||
let url = format!("{}/enrol", client.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.json(&body)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1145,14 +1142,14 @@ pub mod builder {
|
|||
///[`Client::global_jobs`]: super::Client::global_jobs
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct GlobalJobs<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
authorization: Result<String, String>,
|
||||
}
|
||||
|
||||
impl<'a> GlobalJobs<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
authorization: Err("authorization was not initialized".to_string()),
|
||||
}
|
||||
}
|
||||
|
@ -1170,30 +1167,27 @@ pub mod builder {
|
|||
///Sends a `GET` request to `/global/jobs`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::GlobalJobsResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
authorization,
|
||||
} = self;
|
||||
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/global/jobs", __progenitor_client.baseurl,);
|
||||
let url = format!("{}/global/jobs", client.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1203,14 +1197,14 @@ pub mod builder {
|
|||
///[`Client::ping`]: super::Client::ping
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Ping<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
authorization: Result<String, String>,
|
||||
}
|
||||
|
||||
impl<'a> Ping<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
authorization: Err("authorization was not initialized".to_string()),
|
||||
}
|
||||
}
|
||||
|
@ -1228,30 +1222,27 @@ pub mod builder {
|
|||
///Sends a `GET` request to `/ping`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::PingResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
authorization,
|
||||
} = self;
|
||||
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/ping", __progenitor_client.baseurl,);
|
||||
let url = format!("{}/ping", client.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1261,7 +1252,7 @@ pub mod builder {
|
|||
///[`Client::report_finish`]: super::Client::report_finish
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ReportFinish<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
authorization: Result<String, String>,
|
||||
body: Result<types::builder::ReportFinishBody, String>,
|
||||
}
|
||||
|
@ -1269,7 +1260,7 @@ pub mod builder {
|
|||
impl<'a> ReportFinish<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
authorization: Err("authorization was not initialized".to_string()),
|
||||
body: Ok(types::builder::ReportFinishBody::default()),
|
||||
}
|
||||
|
@ -1309,7 +1300,7 @@ pub mod builder {
|
|||
///Sends a `POST` request to `/report/finish`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
authorization,
|
||||
body,
|
||||
} = self;
|
||||
|
@ -1317,12 +1308,12 @@ pub mod builder {
|
|||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::ReportFinishBody>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/report/finish", __progenitor_client.baseurl,);
|
||||
let url = format!("{}/report/finish", client.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
|
@ -1330,14 +1321,11 @@ pub mod builder {
|
|||
.json(&body)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1347,7 +1335,7 @@ pub mod builder {
|
|||
///[`Client::report_output`]: super::Client::report_output
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ReportOutput<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
authorization: Result<String, String>,
|
||||
body: Result<types::builder::ReportOutputBody, String>,
|
||||
}
|
||||
|
@ -1355,7 +1343,7 @@ pub mod builder {
|
|||
impl<'a> ReportOutput<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
authorization: Err("authorization was not initialized".to_string()),
|
||||
body: Ok(types::builder::ReportOutputBody::default()),
|
||||
}
|
||||
|
@ -1395,7 +1383,7 @@ pub mod builder {
|
|||
///Sends a `POST` request to `/report/output`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
authorization,
|
||||
body,
|
||||
} = self;
|
||||
|
@ -1403,12 +1391,12 @@ pub mod builder {
|
|||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::ReportOutputBody>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/report/output", __progenitor_client.baseurl,);
|
||||
let url = format!("{}/report/output", client.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
|
@ -1416,14 +1404,11 @@ pub mod builder {
|
|||
.json(&body)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1433,7 +1418,7 @@ pub mod builder {
|
|||
///[`Client::report_start`]: super::Client::report_start
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ReportStart<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
authorization: Result<String, String>,
|
||||
body: Result<types::builder::ReportStartBody, String>,
|
||||
}
|
||||
|
@ -1441,7 +1426,7 @@ pub mod builder {
|
|||
impl<'a> ReportStart<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
authorization: Err("authorization was not initialized".to_string()),
|
||||
body: Ok(types::builder::ReportStartBody::default()),
|
||||
}
|
||||
|
@ -1479,7 +1464,7 @@ pub mod builder {
|
|||
///Sends a `POST` request to `/report/start`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
authorization,
|
||||
body,
|
||||
} = self;
|
||||
|
@ -1487,12 +1472,12 @@ pub mod builder {
|
|||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::ReportStartBody>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/report/start", __progenitor_client.baseurl,);
|
||||
let url = format!("{}/report/start", client.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
|
@ -1500,14 +1485,11 @@ pub mod builder {
|
|||
.json(&body)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1065,7 +1065,7 @@ pub mod builder {
|
|||
///[`Client::enrol`]: super::Client::enrol
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Enrol<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
authorization: Result<String, String>,
|
||||
body: Result<types::builder::EnrolBody, String>,
|
||||
}
|
||||
|
@ -1073,7 +1073,7 @@ pub mod builder {
|
|||
impl<'a> Enrol<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
authorization: Err("authorization was not initialized".to_string()),
|
||||
body: Ok(types::builder::EnrolBody::default()),
|
||||
}
|
||||
|
@ -1111,7 +1111,7 @@ pub mod builder {
|
|||
///Sends a `POST` request to `/enrol`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
authorization,
|
||||
body,
|
||||
} = self;
|
||||
|
@ -1119,23 +1119,20 @@ pub mod builder {
|
|||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::EnrolBody>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/enrol", __progenitor_client.baseurl,);
|
||||
let url = format!("{}/enrol", client.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.json(&body)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1145,14 +1142,14 @@ pub mod builder {
|
|||
///[`Client::global_jobs`]: super::Client::global_jobs
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct GlobalJobs<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
authorization: Result<String, String>,
|
||||
}
|
||||
|
||||
impl<'a> GlobalJobs<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
authorization: Err("authorization was not initialized".to_string()),
|
||||
}
|
||||
}
|
||||
|
@ -1170,30 +1167,27 @@ pub mod builder {
|
|||
///Sends a `GET` request to `/global/jobs`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::GlobalJobsResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
authorization,
|
||||
} = self;
|
||||
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/global/jobs", __progenitor_client.baseurl,);
|
||||
let url = format!("{}/global/jobs", client.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1203,14 +1197,14 @@ pub mod builder {
|
|||
///[`Client::ping`]: super::Client::ping
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Ping<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
authorization: Result<String, String>,
|
||||
}
|
||||
|
||||
impl<'a> Ping<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
authorization: Err("authorization was not initialized".to_string()),
|
||||
}
|
||||
}
|
||||
|
@ -1228,30 +1222,27 @@ pub mod builder {
|
|||
///Sends a `GET` request to `/ping`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::PingResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
authorization,
|
||||
} = self;
|
||||
let authorization = authorization.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/ping", __progenitor_client.baseurl,);
|
||||
let url = format!("{}/ping", client.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1261,7 +1252,7 @@ pub mod builder {
|
|||
///[`Client::report_finish`]: super::Client::report_finish
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ReportFinish<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
authorization: Result<String, String>,
|
||||
body: Result<types::builder::ReportFinishBody, String>,
|
||||
}
|
||||
|
@ -1269,7 +1260,7 @@ pub mod builder {
|
|||
impl<'a> ReportFinish<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
authorization: Err("authorization was not initialized".to_string()),
|
||||
body: Ok(types::builder::ReportFinishBody::default()),
|
||||
}
|
||||
|
@ -1309,7 +1300,7 @@ pub mod builder {
|
|||
///Sends a `POST` request to `/report/finish`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
authorization,
|
||||
body,
|
||||
} = self;
|
||||
|
@ -1317,12 +1308,12 @@ pub mod builder {
|
|||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::ReportFinishBody>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/report/finish", __progenitor_client.baseurl,);
|
||||
let url = format!("{}/report/finish", client.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
|
@ -1330,14 +1321,11 @@ pub mod builder {
|
|||
.json(&body)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1347,7 +1335,7 @@ pub mod builder {
|
|||
///[`Client::report_output`]: super::Client::report_output
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ReportOutput<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
authorization: Result<String, String>,
|
||||
body: Result<types::builder::ReportOutputBody, String>,
|
||||
}
|
||||
|
@ -1355,7 +1343,7 @@ pub mod builder {
|
|||
impl<'a> ReportOutput<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
authorization: Err("authorization was not initialized".to_string()),
|
||||
body: Ok(types::builder::ReportOutputBody::default()),
|
||||
}
|
||||
|
@ -1395,7 +1383,7 @@ pub mod builder {
|
|||
///Sends a `POST` request to `/report/output`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
authorization,
|
||||
body,
|
||||
} = self;
|
||||
|
@ -1403,12 +1391,12 @@ pub mod builder {
|
|||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::ReportOutputBody>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/report/output", __progenitor_client.baseurl,);
|
||||
let url = format!("{}/report/output", client.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
|
@ -1416,14 +1404,11 @@ pub mod builder {
|
|||
.json(&body)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1433,7 +1418,7 @@ pub mod builder {
|
|||
///[`Client::report_start`]: super::Client::report_start
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ReportStart<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
authorization: Result<String, String>,
|
||||
body: Result<types::builder::ReportStartBody, String>,
|
||||
}
|
||||
|
@ -1441,7 +1426,7 @@ pub mod builder {
|
|||
impl<'a> ReportStart<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
authorization: Err("authorization was not initialized".to_string()),
|
||||
body: Ok(types::builder::ReportStartBody::default()),
|
||||
}
|
||||
|
@ -1479,7 +1464,7 @@ pub mod builder {
|
|||
///Sends a `POST` request to `/report/start`
|
||||
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
authorization,
|
||||
body,
|
||||
} = self;
|
||||
|
@ -1487,12 +1472,12 @@ pub mod builder {
|
|||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::ReportStartBody>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/report/start", __progenitor_client.baseurl,);
|
||||
let url = format!("{}/report/start", client.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
|
@ -1500,14 +1485,11 @@ pub mod builder {
|
|||
.json(&body)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,20 +210,20 @@ impl Client {
|
|||
authorization: &'a str,
|
||||
body: &'a types::EnrolBody,
|
||||
) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/enrol", self.baseurl,);
|
||||
let url = format!("{}/enrol", self.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = self
|
||||
let request = self
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.json(&body)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,23 +235,23 @@ impl Client {
|
|||
&'a self,
|
||||
authorization: &'a str,
|
||||
) -> Result<ResponseValue<types::GlobalJobsResult>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/global/jobs", self.baseurl,);
|
||||
let url = format!("{}/global/jobs", self.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = self
|
||||
let request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,23 +263,23 @@ impl Client {
|
|||
&'a self,
|
||||
authorization: &'a str,
|
||||
) -> Result<ResponseValue<types::PingResult>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/ping", self.baseurl,);
|
||||
let url = format!("{}/ping", self.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = self
|
||||
let request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,12 +293,12 @@ impl Client {
|
|||
authorization: &'a str,
|
||||
body: &'a types::ReportFinishBody,
|
||||
) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/report/finish", self.baseurl,);
|
||||
let url = format!("{}/report/finish", self.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = self
|
||||
let request = self
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
|
@ -306,11 +306,11 @@ impl Client {
|
|||
.json(&body)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,12 +324,12 @@ impl Client {
|
|||
authorization: &'a str,
|
||||
body: &'a types::ReportOutputBody,
|
||||
) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/report/output", self.baseurl,);
|
||||
let url = format!("{}/report/output", self.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = self
|
||||
let request = self
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
|
@ -337,11 +337,11 @@ impl Client {
|
|||
.json(&body)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,12 +355,12 @@ impl Client {
|
|||
authorization: &'a str,
|
||||
body: &'a types::ReportStartBody,
|
||||
) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/report/start", self.baseurl,);
|
||||
let url = format!("{}/report/start", self.baseurl,);
|
||||
let mut header_map = HeaderMap::with_capacity(1usize);
|
||||
header_map.append("Authorization", HeaderValue::try_from(authorization)?);
|
||||
let __progenitor_request = self
|
||||
let request = self
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
|
@ -368,11 +368,11 @@ impl Client {
|
|||
.json(&body)
|
||||
.headers(header_map)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,236 @@
|
|||
#[allow(unused_imports)]
|
||||
use progenitor_client::{encode_path, RequestBuilderExt};
|
||||
pub use progenitor_client::{ByteStream, Error, ResponseValue};
|
||||
#[allow(unused_imports)]
|
||||
use reqwest::header::{HeaderMap, HeaderValue};
|
||||
pub mod types {
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[allow(unused_imports)]
|
||||
use std::convert::TryFrom;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
///Client for Parameter name collision test
|
||||
///
|
||||
///Minimal API for testing collision between parameter names and generated code
|
||||
///
|
||||
///Version: v1
|
||||
pub struct Client {
|
||||
pub(crate) baseurl: String,
|
||||
pub(crate) client: reqwest::Client,
|
||||
}
|
||||
|
||||
impl Client {
|
||||
/// Create a new client.
|
||||
///
|
||||
/// `baseurl` is the base URL provided to the internal
|
||||
/// `reqwest::Client`, and should include a scheme and hostname,
|
||||
/// as well as port and a path stem if applicable.
|
||||
pub fn new(baseurl: &str) -> Self {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let client = {
|
||||
let dur = std::time::Duration::from_secs(15);
|
||||
reqwest::ClientBuilder::new()
|
||||
.connect_timeout(dur)
|
||||
.timeout(dur)
|
||||
};
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let client = reqwest::ClientBuilder::new();
|
||||
Self::new_with_client(baseurl, client.build().unwrap())
|
||||
}
|
||||
|
||||
/// Construct a new client with an existing `reqwest::Client`,
|
||||
/// allowing more control over its configuration.
|
||||
///
|
||||
/// `baseurl` is the base URL provided to the internal
|
||||
/// `reqwest::Client`, and should include a scheme and hostname,
|
||||
/// as well as port and a path stem if applicable.
|
||||
pub fn new_with_client(baseurl: &str, client: reqwest::Client) -> Self {
|
||||
Self {
|
||||
baseurl: baseurl.to_string(),
|
||||
client,
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the base URL to which requests are made.
|
||||
pub fn baseurl(&self) -> &String {
|
||||
&self.baseurl
|
||||
}
|
||||
|
||||
/// Get the internal `reqwest::Client` used to make requests.
|
||||
pub fn client(&self) -> &reqwest::Client {
|
||||
&self.client
|
||||
}
|
||||
|
||||
/// Get the version of this API.
|
||||
///
|
||||
/// This string is pulled directly from the source OpenAPI
|
||||
/// document and may be in any format the API selects.
|
||||
pub fn api_version(&self) -> &'static str {
|
||||
"v1"
|
||||
}
|
||||
}
|
||||
|
||||
impl Client {
|
||||
///Gets a key
|
||||
///
|
||||
///Sends a `GET` request to `/key/{query}`
|
||||
///
|
||||
///Arguments:
|
||||
/// - `query`: Parameter name that was previously colliding
|
||||
/// - `client`: Parameter name that was previously colliding
|
||||
/// - `request`: Parameter name that was previously colliding
|
||||
/// - `response`: Parameter name that was previously colliding
|
||||
/// - `result`: Parameter name that was previously colliding
|
||||
/// - `url`: Parameter name that was previously colliding
|
||||
///```ignore
|
||||
/// let response = client.key_get()
|
||||
/// .query(query)
|
||||
/// .client(client)
|
||||
/// .request(request)
|
||||
/// .response(response)
|
||||
/// .result(result)
|
||||
/// .url(url)
|
||||
/// .send()
|
||||
/// .await;
|
||||
/// ```
|
||||
pub fn key_get(&self) -> builder::KeyGet {
|
||||
builder::KeyGet::new(self)
|
||||
}
|
||||
}
|
||||
|
||||
pub mod builder {
|
||||
use super::types;
|
||||
#[allow(unused_imports)]
|
||||
use super::{
|
||||
encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue,
|
||||
};
|
||||
///Builder for [`Client::key_get`]
|
||||
///
|
||||
///[`Client::key_get`]: super::Client::key_get
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct KeyGet<'a> {
|
||||
_client: &'a super::Client,
|
||||
query: Result<bool, String>,
|
||||
client: Result<bool, String>,
|
||||
request: Result<bool, String>,
|
||||
response: Result<bool, String>,
|
||||
result: Result<bool, String>,
|
||||
url: Result<bool, String>,
|
||||
}
|
||||
|
||||
impl<'a> KeyGet<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
_client: client,
|
||||
query: Err("query was not initialized".to_string()),
|
||||
client: Err("client was not initialized".to_string()),
|
||||
request: Err("request was not initialized".to_string()),
|
||||
response: Err("response was not initialized".to_string()),
|
||||
result: Err("result was not initialized".to_string()),
|
||||
url: Err("url was not initialized".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn query<V>(mut self, value: V) -> Self
|
||||
where
|
||||
V: std::convert::TryInto<bool>,
|
||||
{
|
||||
self.query = value
|
||||
.try_into()
|
||||
.map_err(|_| "conversion to `bool` for query failed".to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn client<V>(mut self, value: V) -> Self
|
||||
where
|
||||
V: std::convert::TryInto<bool>,
|
||||
{
|
||||
self.client = value
|
||||
.try_into()
|
||||
.map_err(|_| "conversion to `bool` for client failed".to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn request<V>(mut self, value: V) -> Self
|
||||
where
|
||||
V: std::convert::TryInto<bool>,
|
||||
{
|
||||
self.request = value
|
||||
.try_into()
|
||||
.map_err(|_| "conversion to `bool` for request failed".to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn response<V>(mut self, value: V) -> Self
|
||||
where
|
||||
V: std::convert::TryInto<bool>,
|
||||
{
|
||||
self.response = value
|
||||
.try_into()
|
||||
.map_err(|_| "conversion to `bool` for response failed".to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn result<V>(mut self, value: V) -> Self
|
||||
where
|
||||
V: std::convert::TryInto<bool>,
|
||||
{
|
||||
self.result = value
|
||||
.try_into()
|
||||
.map_err(|_| "conversion to `bool` for result failed".to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn url<V>(mut self, value: V) -> Self
|
||||
where
|
||||
V: std::convert::TryInto<bool>,
|
||||
{
|
||||
self.url = value
|
||||
.try_into()
|
||||
.map_err(|_| "conversion to `bool` for url failed".to_string());
|
||||
self
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/key/{query}`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
_client,
|
||||
query,
|
||||
client,
|
||||
request,
|
||||
response,
|
||||
result,
|
||||
url,
|
||||
} = self;
|
||||
let query = query.map_err(Error::InvalidRequest)?;
|
||||
let client = client.map_err(Error::InvalidRequest)?;
|
||||
let request = request.map_err(Error::InvalidRequest)?;
|
||||
let response = response.map_err(Error::InvalidRequest)?;
|
||||
let result = result.map_err(Error::InvalidRequest)?;
|
||||
let url = url.map_err(Error::InvalidRequest)?;
|
||||
let _url = format!(
|
||||
"{}/key/{}",
|
||||
_client.baseurl,
|
||||
encode_path(&query.to_string()),
|
||||
);
|
||||
let mut _query = Vec::with_capacity(5usize);
|
||||
_query.push(("client", client.to_string()));
|
||||
_query.push(("request", request.to_string()));
|
||||
_query.push(("response", response.to_string()));
|
||||
_query.push(("result", result.to_string()));
|
||||
_query.push(("url", url.to_string()));
|
||||
let _request = _client.client.get(_url).query(&_query).build()?;
|
||||
let _result = _client.client.execute(_request).await;
|
||||
let _response = _result?;
|
||||
match _response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(_response)),
|
||||
_ => Err(Error::UnexpectedResponse(_response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod prelude {
|
||||
pub use super::Client;
|
||||
}
|
|
@ -0,0 +1,236 @@
|
|||
#[allow(unused_imports)]
|
||||
use progenitor_client::{encode_path, RequestBuilderExt};
|
||||
pub use progenitor_client::{ByteStream, Error, ResponseValue};
|
||||
#[allow(unused_imports)]
|
||||
use reqwest::header::{HeaderMap, HeaderValue};
|
||||
pub mod types {
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[allow(unused_imports)]
|
||||
use std::convert::TryFrom;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
///Client for Parameter name collision test
|
||||
///
|
||||
///Minimal API for testing collision between parameter names and generated code
|
||||
///
|
||||
///Version: v1
|
||||
pub struct Client {
|
||||
pub(crate) baseurl: String,
|
||||
pub(crate) client: reqwest::Client,
|
||||
}
|
||||
|
||||
impl Client {
|
||||
/// Create a new client.
|
||||
///
|
||||
/// `baseurl` is the base URL provided to the internal
|
||||
/// `reqwest::Client`, and should include a scheme and hostname,
|
||||
/// as well as port and a path stem if applicable.
|
||||
pub fn new(baseurl: &str) -> Self {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let client = {
|
||||
let dur = std::time::Duration::from_secs(15);
|
||||
reqwest::ClientBuilder::new()
|
||||
.connect_timeout(dur)
|
||||
.timeout(dur)
|
||||
};
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let client = reqwest::ClientBuilder::new();
|
||||
Self::new_with_client(baseurl, client.build().unwrap())
|
||||
}
|
||||
|
||||
/// Construct a new client with an existing `reqwest::Client`,
|
||||
/// allowing more control over its configuration.
|
||||
///
|
||||
/// `baseurl` is the base URL provided to the internal
|
||||
/// `reqwest::Client`, and should include a scheme and hostname,
|
||||
/// as well as port and a path stem if applicable.
|
||||
pub fn new_with_client(baseurl: &str, client: reqwest::Client) -> Self {
|
||||
Self {
|
||||
baseurl: baseurl.to_string(),
|
||||
client,
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the base URL to which requests are made.
|
||||
pub fn baseurl(&self) -> &String {
|
||||
&self.baseurl
|
||||
}
|
||||
|
||||
/// Get the internal `reqwest::Client` used to make requests.
|
||||
pub fn client(&self) -> &reqwest::Client {
|
||||
&self.client
|
||||
}
|
||||
|
||||
/// Get the version of this API.
|
||||
///
|
||||
/// This string is pulled directly from the source OpenAPI
|
||||
/// document and may be in any format the API selects.
|
||||
pub fn api_version(&self) -> &'static str {
|
||||
"v1"
|
||||
}
|
||||
}
|
||||
|
||||
impl Client {
|
||||
///Gets a key
|
||||
///
|
||||
///Sends a `GET` request to `/key/{query}`
|
||||
///
|
||||
///Arguments:
|
||||
/// - `query`: Parameter name that was previously colliding
|
||||
/// - `client`: Parameter name that was previously colliding
|
||||
/// - `request`: Parameter name that was previously colliding
|
||||
/// - `response`: Parameter name that was previously colliding
|
||||
/// - `result`: Parameter name that was previously colliding
|
||||
/// - `url`: Parameter name that was previously colliding
|
||||
///```ignore
|
||||
/// let response = client.key_get()
|
||||
/// .query(query)
|
||||
/// .client(client)
|
||||
/// .request(request)
|
||||
/// .response(response)
|
||||
/// .result(result)
|
||||
/// .url(url)
|
||||
/// .send()
|
||||
/// .await;
|
||||
/// ```
|
||||
pub fn key_get(&self) -> builder::KeyGet {
|
||||
builder::KeyGet::new(self)
|
||||
}
|
||||
}
|
||||
|
||||
pub mod builder {
|
||||
use super::types;
|
||||
#[allow(unused_imports)]
|
||||
use super::{
|
||||
encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue,
|
||||
};
|
||||
///Builder for [`Client::key_get`]
|
||||
///
|
||||
///[`Client::key_get`]: super::Client::key_get
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct KeyGet<'a> {
|
||||
_client: &'a super::Client,
|
||||
query: Result<bool, String>,
|
||||
client: Result<bool, String>,
|
||||
request: Result<bool, String>,
|
||||
response: Result<bool, String>,
|
||||
result: Result<bool, String>,
|
||||
url: Result<bool, String>,
|
||||
}
|
||||
|
||||
impl<'a> KeyGet<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
_client: client,
|
||||
query: Err("query was not initialized".to_string()),
|
||||
client: Err("client was not initialized".to_string()),
|
||||
request: Err("request was not initialized".to_string()),
|
||||
response: Err("response was not initialized".to_string()),
|
||||
result: Err("result was not initialized".to_string()),
|
||||
url: Err("url was not initialized".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn query<V>(mut self, value: V) -> Self
|
||||
where
|
||||
V: std::convert::TryInto<bool>,
|
||||
{
|
||||
self.query = value
|
||||
.try_into()
|
||||
.map_err(|_| "conversion to `bool` for query failed".to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn client<V>(mut self, value: V) -> Self
|
||||
where
|
||||
V: std::convert::TryInto<bool>,
|
||||
{
|
||||
self.client = value
|
||||
.try_into()
|
||||
.map_err(|_| "conversion to `bool` for client failed".to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn request<V>(mut self, value: V) -> Self
|
||||
where
|
||||
V: std::convert::TryInto<bool>,
|
||||
{
|
||||
self.request = value
|
||||
.try_into()
|
||||
.map_err(|_| "conversion to `bool` for request failed".to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn response<V>(mut self, value: V) -> Self
|
||||
where
|
||||
V: std::convert::TryInto<bool>,
|
||||
{
|
||||
self.response = value
|
||||
.try_into()
|
||||
.map_err(|_| "conversion to `bool` for response failed".to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn result<V>(mut self, value: V) -> Self
|
||||
where
|
||||
V: std::convert::TryInto<bool>,
|
||||
{
|
||||
self.result = value
|
||||
.try_into()
|
||||
.map_err(|_| "conversion to `bool` for result failed".to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn url<V>(mut self, value: V) -> Self
|
||||
where
|
||||
V: std::convert::TryInto<bool>,
|
||||
{
|
||||
self.url = value
|
||||
.try_into()
|
||||
.map_err(|_| "conversion to `bool` for url failed".to_string());
|
||||
self
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/key/{query}`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
_client,
|
||||
query,
|
||||
client,
|
||||
request,
|
||||
response,
|
||||
result,
|
||||
url,
|
||||
} = self;
|
||||
let query = query.map_err(Error::InvalidRequest)?;
|
||||
let client = client.map_err(Error::InvalidRequest)?;
|
||||
let request = request.map_err(Error::InvalidRequest)?;
|
||||
let response = response.map_err(Error::InvalidRequest)?;
|
||||
let result = result.map_err(Error::InvalidRequest)?;
|
||||
let url = url.map_err(Error::InvalidRequest)?;
|
||||
let _url = format!(
|
||||
"{}/key/{}",
|
||||
_client.baseurl,
|
||||
encode_path(&query.to_string()),
|
||||
);
|
||||
let mut _query = Vec::with_capacity(5usize);
|
||||
_query.push(("client", client.to_string()));
|
||||
_query.push(("request", request.to_string()));
|
||||
_query.push(("response", response.to_string()));
|
||||
_query.push(("result", result.to_string()));
|
||||
_query.push(("url", url.to_string()));
|
||||
let _request = _client.client.get(_url).query(&_query).build()?;
|
||||
let _result = _client.client.execute(_request).await;
|
||||
let _response = _result?;
|
||||
match _response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(_response)),
|
||||
_ => Err(Error::UnexpectedResponse(_response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod prelude {
|
||||
pub use self::super::Client;
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
pub struct Cli<T: CliOverride = ()> {
|
||||
client: sdk::Client,
|
||||
over: T,
|
||||
}
|
||||
|
||||
impl Cli {
|
||||
pub fn new(client: sdk::Client) -> Self {
|
||||
Self { client, over: () }
|
||||
}
|
||||
|
||||
pub fn get_command(cmd: CliCommand) -> clap::Command {
|
||||
match cmd {
|
||||
CliCommand::KeyGet => Self::cli_key_get(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cli_key_get() -> clap::Command {
|
||||
clap::Command::new("")
|
||||
.arg(
|
||||
clap::Arg::new("client")
|
||||
.long("client")
|
||||
.value_parser(clap::value_parser!(bool))
|
||||
.required(true)
|
||||
.help("Parameter name that was previously colliding"),
|
||||
)
|
||||
.arg(
|
||||
clap::Arg::new("query")
|
||||
.long("query")
|
||||
.value_parser(clap::value_parser!(bool))
|
||||
.required(true)
|
||||
.help("Parameter name that was previously colliding"),
|
||||
)
|
||||
.arg(
|
||||
clap::Arg::new("request")
|
||||
.long("request")
|
||||
.value_parser(clap::value_parser!(bool))
|
||||
.required(true)
|
||||
.help("Parameter name that was previously colliding"),
|
||||
)
|
||||
.arg(
|
||||
clap::Arg::new("response")
|
||||
.long("response")
|
||||
.value_parser(clap::value_parser!(bool))
|
||||
.required(true)
|
||||
.help("Parameter name that was previously colliding"),
|
||||
)
|
||||
.arg(
|
||||
clap::Arg::new("result")
|
||||
.long("result")
|
||||
.value_parser(clap::value_parser!(bool))
|
||||
.required(true)
|
||||
.help("Parameter name that was previously colliding"),
|
||||
)
|
||||
.arg(
|
||||
clap::Arg::new("url")
|
||||
.long("url")
|
||||
.value_parser(clap::value_parser!(bool))
|
||||
.required(true)
|
||||
.help("Parameter name that was previously colliding"),
|
||||
)
|
||||
.long_about("Gets a key")
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: CliOverride> Cli<T> {
|
||||
pub fn new_with_override(client: sdk::Client, over: T) -> Self {
|
||||
Self { client, over }
|
||||
}
|
||||
|
||||
pub async fn execute(&self, cmd: CliCommand, matches: &clap::ArgMatches) {
|
||||
match cmd {
|
||||
CliCommand::KeyGet => {
|
||||
self.execute_key_get(matches).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn execute_key_get(&self, matches: &clap::ArgMatches) {
|
||||
let mut request = self.client.key_get();
|
||||
if let Some(value) = matches.get_one::<bool>("client") {
|
||||
request = request.client(value.clone());
|
||||
}
|
||||
|
||||
if let Some(value) = matches.get_one::<bool>("query") {
|
||||
request = request.query(value.clone());
|
||||
}
|
||||
|
||||
if let Some(value) = matches.get_one::<bool>("request") {
|
||||
request = request.request(value.clone());
|
||||
}
|
||||
|
||||
if let Some(value) = matches.get_one::<bool>("response") {
|
||||
request = request.response(value.clone());
|
||||
}
|
||||
|
||||
if let Some(value) = matches.get_one::<bool>("result") {
|
||||
request = request.result(value.clone());
|
||||
}
|
||||
|
||||
if let Some(value) = matches.get_one::<bool>("url") {
|
||||
request = request.url(value.clone());
|
||||
}
|
||||
|
||||
self.over.execute_key_get(matches, &mut request).unwrap();
|
||||
let result = request.send().await;
|
||||
match result {
|
||||
Ok(r) => {
|
||||
println!("success\n{:#?}", r)
|
||||
}
|
||||
Err(r) => {
|
||||
println!("success\n{:#?}", r)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait CliOverride {
|
||||
fn execute_key_get(
|
||||
&self,
|
||||
matches: &clap::ArgMatches,
|
||||
request: &mut builder::KeyGet,
|
||||
) -> Result<(), String> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl CliOverride for () {}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum CliCommand {
|
||||
KeyGet,
|
||||
}
|
||||
|
||||
impl CliCommand {
|
||||
pub fn iter() -> impl Iterator<Item = CliCommand> {
|
||||
vec![CliCommand::KeyGet].into_iter()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
pub mod operations {
|
||||
# and [`Then`](httpmock::Then)"]
|
||||
#![doc = r" wrappers for each operation. Each can be converted to"]
|
||||
#![doc = r" its inner type with a call to `into_inner()`. This can"]
|
||||
#![doc = r" be used to explicitly deviate from permitted values."]
|
||||
use sdk::*;
|
||||
pub struct KeyGetWhen(httpmock::When);
|
||||
impl KeyGetWhen {
|
||||
pub fn new(inner: httpmock::When) -> Self {
|
||||
Self(
|
||||
inner
|
||||
.method(httpmock::Method::GET)
|
||||
.path_matches(regex::Regex::new("^/key/[^/]*$").unwrap()),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn into_inner(self) -> httpmock::When {
|
||||
self.0
|
||||
}
|
||||
|
||||
pub fn query(self, value: bool) -> Self {
|
||||
let re = regex::Regex::new(&format!("^/key/{}$", value.to_string())).unwrap();
|
||||
Self(self.0.path_matches(re))
|
||||
}
|
||||
|
||||
pub fn client(self, value: bool) -> Self {
|
||||
Self(self.0.query_param("client", value.to_string()))
|
||||
}
|
||||
|
||||
pub fn request(self, value: bool) -> Self {
|
||||
Self(self.0.query_param("request", value.to_string()))
|
||||
}
|
||||
|
||||
pub fn response(self, value: bool) -> Self {
|
||||
Self(self.0.query_param("response", value.to_string()))
|
||||
}
|
||||
|
||||
pub fn result(self, value: bool) -> Self {
|
||||
Self(self.0.query_param("result", value.to_string()))
|
||||
}
|
||||
|
||||
pub fn url(self, value: bool) -> Self {
|
||||
Self(self.0.query_param("url", value.to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
pub struct KeyGetThen(httpmock::Then);
|
||||
impl KeyGetThen {
|
||||
pub fn new(inner: httpmock::Then) -> Self {
|
||||
Self(inner)
|
||||
}
|
||||
|
||||
pub fn into_inner(self) -> httpmock::Then {
|
||||
self.0
|
||||
}
|
||||
|
||||
pub fn ok(self) -> Self {
|
||||
Self(self.0.status(200u16))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc = r" An extension trait for [`MockServer`](httpmock::MockServer) that"]
|
||||
#[doc = r" adds a method for each operation. These are the equivalent of"]
|
||||
#[doc = r" type-checked [`mock()`](httpmock::MockServer::mock) calls."]
|
||||
pub trait MockServerExt {
|
||||
fn key_get<F>(&self, config_fn: F) -> httpmock::Mock
|
||||
where
|
||||
F: FnOnce(operations::KeyGetWhen, operations::KeyGetThen);
|
||||
}
|
||||
|
||||
impl MockServerExt for httpmock::MockServer {
|
||||
fn key_get<F>(&self, config_fn: F) -> httpmock::Mock
|
||||
where
|
||||
F: FnOnce(operations::KeyGetWhen, operations::KeyGetThen),
|
||||
{
|
||||
self.mock(|when, then| {
|
||||
config_fn(
|
||||
operations::KeyGetWhen::new(when),
|
||||
operations::KeyGetThen::new(then),
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
#[allow(unused_imports)]
|
||||
use progenitor_client::{encode_path, RequestBuilderExt};
|
||||
pub use progenitor_client::{ByteStream, Error, ResponseValue};
|
||||
#[allow(unused_imports)]
|
||||
use reqwest::header::{HeaderMap, HeaderValue};
|
||||
pub mod types {
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[allow(unused_imports)]
|
||||
use std::convert::TryFrom;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
///Client for Parameter name collision test
|
||||
///
|
||||
///Minimal API for testing collision between parameter names and generated code
|
||||
///
|
||||
///Version: v1
|
||||
pub struct Client {
|
||||
pub(crate) baseurl: String,
|
||||
pub(crate) client: reqwest::Client,
|
||||
}
|
||||
|
||||
impl Client {
|
||||
/// Create a new client.
|
||||
///
|
||||
/// `baseurl` is the base URL provided to the internal
|
||||
/// `reqwest::Client`, and should include a scheme and hostname,
|
||||
/// as well as port and a path stem if applicable.
|
||||
pub fn new(baseurl: &str) -> Self {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let client = {
|
||||
let dur = std::time::Duration::from_secs(15);
|
||||
reqwest::ClientBuilder::new()
|
||||
.connect_timeout(dur)
|
||||
.timeout(dur)
|
||||
};
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let client = reqwest::ClientBuilder::new();
|
||||
Self::new_with_client(baseurl, client.build().unwrap())
|
||||
}
|
||||
|
||||
/// Construct a new client with an existing `reqwest::Client`,
|
||||
/// allowing more control over its configuration.
|
||||
///
|
||||
/// `baseurl` is the base URL provided to the internal
|
||||
/// `reqwest::Client`, and should include a scheme and hostname,
|
||||
/// as well as port and a path stem if applicable.
|
||||
pub fn new_with_client(baseurl: &str, client: reqwest::Client) -> Self {
|
||||
Self {
|
||||
baseurl: baseurl.to_string(),
|
||||
client,
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the base URL to which requests are made.
|
||||
pub fn baseurl(&self) -> &String {
|
||||
&self.baseurl
|
||||
}
|
||||
|
||||
/// Get the internal `reqwest::Client` used to make requests.
|
||||
pub fn client(&self) -> &reqwest::Client {
|
||||
&self.client
|
||||
}
|
||||
|
||||
/// Get the version of this API.
|
||||
///
|
||||
/// This string is pulled directly from the source OpenAPI
|
||||
/// document and may be in any format the API selects.
|
||||
pub fn api_version(&self) -> &'static str {
|
||||
"v1"
|
||||
}
|
||||
}
|
||||
|
||||
impl Client {
|
||||
///Gets a key
|
||||
///
|
||||
///Sends a `GET` request to `/key/{query}`
|
||||
///
|
||||
///Arguments:
|
||||
/// - `query`: Parameter name that was previously colliding
|
||||
/// - `client`: Parameter name that was previously colliding
|
||||
/// - `request`: Parameter name that was previously colliding
|
||||
/// - `response`: Parameter name that was previously colliding
|
||||
/// - `result`: Parameter name that was previously colliding
|
||||
/// - `url`: Parameter name that was previously colliding
|
||||
pub async fn key_get<'a>(
|
||||
&'a self,
|
||||
query: bool,
|
||||
client: bool,
|
||||
request: bool,
|
||||
response: bool,
|
||||
result: bool,
|
||||
url: bool,
|
||||
) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let _url = format!("{}/key/{}", self.baseurl, encode_path(&query.to_string()),);
|
||||
let mut _query = Vec::with_capacity(5usize);
|
||||
_query.push(("client", client.to_string()));
|
||||
_query.push(("request", request.to_string()));
|
||||
_query.push(("response", response.to_string()));
|
||||
_query.push(("result", result.to_string()));
|
||||
_query.push(("url", url.to_string()));
|
||||
let _request = self.client.get(_url).query(&_query).build()?;
|
||||
let _result = self.client.execute(_request).await;
|
||||
let _response = _result?;
|
||||
match _response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(_response)),
|
||||
_ => Err(Error::UnexpectedResponse(_response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod prelude {
|
||||
pub use super::Client;
|
||||
}
|
|
@ -104,7 +104,7 @@ pub mod builder {
|
|||
///[`Client::key_get`]: super::Client::key_get
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct KeyGet<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
key: Result<Option<bool>, String>,
|
||||
unique_key: Result<Option<String>, String>,
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ pub mod builder {
|
|||
impl<'a> KeyGet<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
key: Ok(None),
|
||||
unique_key: Ok(None),
|
||||
}
|
||||
|
@ -143,33 +143,26 @@ pub mod builder {
|
|||
///Sends a `GET` request to `/key`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
key,
|
||||
unique_key,
|
||||
} = self;
|
||||
let key = key.map_err(Error::InvalidRequest)?;
|
||||
let unique_key = unique_key.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/key", __progenitor_client.baseurl,);
|
||||
let mut __progenitor_query = Vec::with_capacity(2usize);
|
||||
let url = format!("{}/key", client.baseurl,);
|
||||
let mut query = Vec::with_capacity(2usize);
|
||||
if let Some(v) = &key {
|
||||
__progenitor_query.push(("key", v.to_string()));
|
||||
query.push(("key", v.to_string()));
|
||||
}
|
||||
if let Some(v) = &unique_key {
|
||||
__progenitor_query.push(("uniqueKey", v.to_string()));
|
||||
query.push(("uniqueKey", v.to_string()));
|
||||
}
|
||||
let __progenitor_request = __progenitor_client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.query(&__progenitor_query)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = client.client.get(url).query(&query).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ pub mod builder {
|
|||
///[`Client::key_get`]: super::Client::key_get
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct KeyGet<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
key: Result<Option<bool>, String>,
|
||||
unique_key: Result<Option<String>, String>,
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ pub mod builder {
|
|||
impl<'a> KeyGet<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
key: Ok(None),
|
||||
unique_key: Ok(None),
|
||||
}
|
||||
|
@ -143,33 +143,26 @@ pub mod builder {
|
|||
///Sends a `GET` request to `/key`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
key,
|
||||
unique_key,
|
||||
} = self;
|
||||
let key = key.map_err(Error::InvalidRequest)?;
|
||||
let unique_key = unique_key.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/key", __progenitor_client.baseurl,);
|
||||
let mut __progenitor_query = Vec::with_capacity(2usize);
|
||||
let url = format!("{}/key", client.baseurl,);
|
||||
let mut query = Vec::with_capacity(2usize);
|
||||
if let Some(v) = &key {
|
||||
__progenitor_query.push(("key", v.to_string()));
|
||||
query.push(("key", v.to_string()));
|
||||
}
|
||||
if let Some(v) = &unique_key {
|
||||
__progenitor_query.push(("uniqueKey", v.to_string()));
|
||||
query.push(("uniqueKey", v.to_string()));
|
||||
}
|
||||
let __progenitor_request = __progenitor_client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.query(&__progenitor_query)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = client.client.get(url).query(&query).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,26 +86,22 @@ impl Client {
|
|||
key: Option<bool>,
|
||||
unique_key: Option<&'a str>,
|
||||
) -> Result<ResponseValue<()>, Error<()>> {
|
||||
let __progenitor_url = format!("{}/key", self.baseurl,);
|
||||
let mut __progenitor_query = Vec::with_capacity(2usize);
|
||||
let url = format!("{}/key", self.baseurl,);
|
||||
let mut query = Vec::with_capacity(2usize);
|
||||
if let Some(v) = &key {
|
||||
__progenitor_query.push(("key", v.to_string()));
|
||||
query.push(("key", v.to_string()));
|
||||
}
|
||||
|
||||
if let Some(v) = &unique_key {
|
||||
__progenitor_query.push(("uniqueKey", v.to_string()));
|
||||
query.push(("uniqueKey", v.to_string()));
|
||||
}
|
||||
|
||||
let __progenitor_request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.query(&__progenitor_query)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let request = self.client.get(url).query(&query).build()?;
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => Ok(ResponseValue::empty(response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2113,46 +2113,39 @@ pub mod builder {
|
|||
///[`Client::instance_get`]: super::Client::instance_get
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InstanceGet<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> InstanceGet<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/instance`
|
||||
pub async fn send(
|
||||
self,
|
||||
) -> Result<ResponseValue<types::InstanceGetResponse>, Error<types::Error>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/instance", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/instance", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2162,14 +2155,14 @@ pub mod builder {
|
|||
///[`Client::instance_ensure`]: super::Client::instance_ensure
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InstanceEnsure<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::builder::InstanceEnsureRequest, String>,
|
||||
}
|
||||
|
||||
impl<'a> InstanceEnsure<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Ok(types::builder::InstanceEnsureRequest::default()),
|
||||
}
|
||||
}
|
||||
|
@ -2199,37 +2192,31 @@ pub mod builder {
|
|||
pub async fn send(
|
||||
self,
|
||||
) -> Result<ResponseValue<types::InstanceEnsureResponse>, Error<types::Error>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::InstanceEnsureRequest>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/instance", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let url = format!("{}/instance", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.put(__progenitor_url)
|
||||
.put(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2239,7 +2226,7 @@ pub mod builder {
|
|||
///[`Client::instance_issue_crucible_snapshot_request`]: super::Client::instance_issue_crucible_snapshot_request
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InstanceIssueCrucibleSnapshotRequest<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
id: Result<uuid::Uuid, String>,
|
||||
snapshot_id: Result<uuid::Uuid, String>,
|
||||
}
|
||||
|
@ -2247,7 +2234,7 @@ pub mod builder {
|
|||
impl<'a> InstanceIssueCrucibleSnapshotRequest<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
id: Err("id was not initialized".to_string()),
|
||||
snapshot_id: Err("snapshot_id was not initialized".to_string()),
|
||||
}
|
||||
|
@ -2277,40 +2264,37 @@ pub mod builder {
|
|||
/// `/instance/disk/{id}/snapshot/{snapshot_id}`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<types::Error>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
id,
|
||||
snapshot_id,
|
||||
} = self;
|
||||
let id = id.map_err(Error::InvalidRequest)?;
|
||||
let snapshot_id = snapshot_id.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/instance/disk/{}/snapshot/{}",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&id.to_string()),
|
||||
encode_path(&snapshot_id.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2320,14 +2304,14 @@ pub mod builder {
|
|||
///[`Client::instance_migrate_status`]: super::Client::instance_migrate_status
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InstanceMigrateStatus<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::builder::InstanceMigrateStatusRequest, String>,
|
||||
}
|
||||
|
||||
impl<'a> InstanceMigrateStatus<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Ok(types::builder::InstanceMigrateStatusRequest::default()),
|
||||
}
|
||||
}
|
||||
|
@ -2357,38 +2341,31 @@ pub mod builder {
|
|||
self,
|
||||
) -> Result<ResponseValue<types::InstanceMigrateStatusResponse>, Error<types::Error>>
|
||||
{
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::InstanceMigrateStatusRequest>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url =
|
||||
format!("{}/instance/migrate/status", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let url = format!("{}/instance/migrate/status", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2398,27 +2375,23 @@ pub mod builder {
|
|||
///[`Client::instance_serial`]: super::Client::instance_serial
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InstanceSerial<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> InstanceSerial<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/instance/serial`
|
||||
pub async fn send(
|
||||
self,
|
||||
) -> Result<ResponseValue<reqwest::Upgraded>, Error<reqwest::Upgraded>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/instance/serial", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/instance/serial", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(reqwest::header::CONNECTION, "Upgrade")
|
||||
.header(reqwest::header::UPGRADE, "websocket")
|
||||
.header(reqwest::header::SEC_WEBSOCKET_VERSION, "13")
|
||||
|
@ -2430,15 +2403,12 @@ pub mod builder {
|
|||
),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
101u16 => ResponseValue::upgrade(__progenitor_response).await,
|
||||
200..=299 => ResponseValue::upgrade(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
101u16 => ResponseValue::upgrade(response).await,
|
||||
200..=299 => ResponseValue::upgrade(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2448,14 +2418,14 @@ pub mod builder {
|
|||
///[`Client::instance_state_put`]: super::Client::instance_state_put
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InstanceStatePut<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::InstanceStateRequested, String>,
|
||||
}
|
||||
|
||||
impl<'a> InstanceStatePut<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Err("body was not initialized".to_string()),
|
||||
}
|
||||
}
|
||||
|
@ -2472,35 +2442,29 @@ pub mod builder {
|
|||
|
||||
///Sends a `PUT` request to `/instance/state`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<types::Error>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/instance/state", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let url = format!("{}/instance/state", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.put(__progenitor_url)
|
||||
.put(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
204u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
204u16 => Ok(ResponseValue::empty(response)),
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2510,14 +2474,14 @@ pub mod builder {
|
|||
///[`Client::instance_state_monitor`]: super::Client::instance_state_monitor
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InstanceStateMonitor<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::builder::InstanceStateMonitorRequest, String>,
|
||||
}
|
||||
|
||||
impl<'a> InstanceStateMonitor<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Ok(types::builder::InstanceStateMonitorRequest::default()),
|
||||
}
|
||||
}
|
||||
|
@ -2547,38 +2511,31 @@ pub mod builder {
|
|||
self,
|
||||
) -> Result<ResponseValue<types::InstanceStateMonitorResponse>, Error<types::Error>>
|
||||
{
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::InstanceStateMonitorRequest>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url =
|
||||
format!("{}/instance/state-monitor", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let url = format!("{}/instance/state-monitor", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2119,46 +2119,39 @@ pub mod builder {
|
|||
///[`Client::instance_get`]: super::Client::instance_get
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InstanceGet<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> InstanceGet<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/instance`
|
||||
pub async fn send(
|
||||
self,
|
||||
) -> Result<ResponseValue<types::InstanceGetResponse>, Error<types::Error>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/instance", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/instance", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2168,14 +2161,14 @@ pub mod builder {
|
|||
///[`Client::instance_ensure`]: super::Client::instance_ensure
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InstanceEnsure<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::builder::InstanceEnsureRequest, String>,
|
||||
}
|
||||
|
||||
impl<'a> InstanceEnsure<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Ok(types::builder::InstanceEnsureRequest::default()),
|
||||
}
|
||||
}
|
||||
|
@ -2205,37 +2198,31 @@ pub mod builder {
|
|||
pub async fn send(
|
||||
self,
|
||||
) -> Result<ResponseValue<types::InstanceEnsureResponse>, Error<types::Error>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::InstanceEnsureRequest>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/instance", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let url = format!("{}/instance", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.put(__progenitor_url)
|
||||
.put(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2245,7 +2232,7 @@ pub mod builder {
|
|||
///[`Client::instance_issue_crucible_snapshot_request`]: super::Client::instance_issue_crucible_snapshot_request
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InstanceIssueCrucibleSnapshotRequest<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
id: Result<uuid::Uuid, String>,
|
||||
snapshot_id: Result<uuid::Uuid, String>,
|
||||
}
|
||||
|
@ -2253,7 +2240,7 @@ pub mod builder {
|
|||
impl<'a> InstanceIssueCrucibleSnapshotRequest<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
id: Err("id was not initialized".to_string()),
|
||||
snapshot_id: Err("snapshot_id was not initialized".to_string()),
|
||||
}
|
||||
|
@ -2283,40 +2270,37 @@ pub mod builder {
|
|||
/// `/instance/disk/{id}/snapshot/{snapshot_id}`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<types::Error>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
client,
|
||||
id,
|
||||
snapshot_id,
|
||||
} = self;
|
||||
let id = id.map_err(Error::InvalidRequest)?;
|
||||
let snapshot_id = snapshot_id.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/instance/disk/{}/snapshot/{}",
|
||||
__progenitor_client.baseurl,
|
||||
client.baseurl,
|
||||
encode_path(&id.to_string()),
|
||||
encode_path(&snapshot_id.to_string()),
|
||||
);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let request = client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2326,14 +2310,14 @@ pub mod builder {
|
|||
///[`Client::instance_migrate_status`]: super::Client::instance_migrate_status
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InstanceMigrateStatus<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::builder::InstanceMigrateStatusRequest, String>,
|
||||
}
|
||||
|
||||
impl<'a> InstanceMigrateStatus<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Ok(types::builder::InstanceMigrateStatusRequest::default()),
|
||||
}
|
||||
}
|
||||
|
@ -2363,38 +2347,31 @@ pub mod builder {
|
|||
self,
|
||||
) -> Result<ResponseValue<types::InstanceMigrateStatusResponse>, Error<types::Error>>
|
||||
{
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::InstanceMigrateStatusRequest>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url =
|
||||
format!("{}/instance/migrate/status", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let url = format!("{}/instance/migrate/status", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2404,27 +2381,23 @@ pub mod builder {
|
|||
///[`Client::instance_serial`]: super::Client::instance_serial
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InstanceSerial<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
}
|
||||
|
||||
impl<'a> InstanceSerial<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
}
|
||||
Self { client: client }
|
||||
}
|
||||
|
||||
///Sends a `GET` request to `/instance/serial`
|
||||
pub async fn send(
|
||||
self,
|
||||
) -> Result<ResponseValue<reqwest::Upgraded>, Error<reqwest::Upgraded>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
} = self;
|
||||
let __progenitor_url = format!("{}/instance/serial", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let Self { client } = self;
|
||||
let url = format!("{}/instance/serial", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(reqwest::header::CONNECTION, "Upgrade")
|
||||
.header(reqwest::header::UPGRADE, "websocket")
|
||||
.header(reqwest::header::SEC_WEBSOCKET_VERSION, "13")
|
||||
|
@ -2436,15 +2409,12 @@ pub mod builder {
|
|||
),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
101u16 => ResponseValue::upgrade(__progenitor_response).await,
|
||||
200..=299 => ResponseValue::upgrade(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
101u16 => ResponseValue::upgrade(response).await,
|
||||
200..=299 => ResponseValue::upgrade(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2454,14 +2424,14 @@ pub mod builder {
|
|||
///[`Client::instance_state_put`]: super::Client::instance_state_put
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InstanceStatePut<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::InstanceStateRequested, String>,
|
||||
}
|
||||
|
||||
impl<'a> InstanceStatePut<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Err("body was not initialized".to_string()),
|
||||
}
|
||||
}
|
||||
|
@ -2478,35 +2448,29 @@ pub mod builder {
|
|||
|
||||
///Sends a `PUT` request to `/instance/state`
|
||||
pub async fn send(self) -> Result<ResponseValue<()>, Error<types::Error>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/instance/state", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let url = format!("{}/instance/state", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.put(__progenitor_url)
|
||||
.put(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
204u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
204u16 => Ok(ResponseValue::empty(response)),
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2516,14 +2480,14 @@ pub mod builder {
|
|||
///[`Client::instance_state_monitor`]: super::Client::instance_state_monitor
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InstanceStateMonitor<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::builder::InstanceStateMonitorRequest, String>,
|
||||
}
|
||||
|
||||
impl<'a> InstanceStateMonitor<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Ok(types::builder::InstanceStateMonitorRequest::default()),
|
||||
}
|
||||
}
|
||||
|
@ -2553,38 +2517,31 @@ pub mod builder {
|
|||
self,
|
||||
) -> Result<ResponseValue<types::InstanceStateMonitorResponse>, Error<types::Error>>
|
||||
{
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::InstanceStateMonitorRequest>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url =
|
||||
format!("{}/instance/state-monitor", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
let url = format!("{}/instance/state-monitor", client.baseurl,);
|
||||
let request = client
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -671,26 +671,26 @@ impl Client {
|
|||
pub async fn instance_get<'a>(
|
||||
&'a self,
|
||||
) -> Result<ResponseValue<types::InstanceGetResponse>, Error<types::Error>> {
|
||||
let __progenitor_url = format!("{}/instance", self.baseurl,);
|
||||
let __progenitor_request = self
|
||||
let url = format!("{}/instance", self.baseurl,);
|
||||
let request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -699,27 +699,27 @@ impl Client {
|
|||
&'a self,
|
||||
body: &'a types::InstanceEnsureRequest,
|
||||
) -> Result<ResponseValue<types::InstanceEnsureResponse>, Error<types::Error>> {
|
||||
let __progenitor_url = format!("{}/instance", self.baseurl,);
|
||||
let __progenitor_request = self
|
||||
let url = format!("{}/instance", self.baseurl,);
|
||||
let request = self
|
||||
.client
|
||||
.put(__progenitor_url)
|
||||
.put(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
201u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -731,31 +731,31 @@ impl Client {
|
|||
id: &'a uuid::Uuid,
|
||||
snapshot_id: &'a uuid::Uuid,
|
||||
) -> Result<ResponseValue<()>, Error<types::Error>> {
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/instance/disk/{}/snapshot/{}",
|
||||
self.baseurl,
|
||||
encode_path(&id.to_string()),
|
||||
encode_path(&snapshot_id.to_string()),
|
||||
);
|
||||
let __progenitor_request = self
|
||||
let request = self
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.post(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -764,27 +764,27 @@ impl Client {
|
|||
&'a self,
|
||||
body: &'a types::InstanceMigrateStatusRequest,
|
||||
) -> Result<ResponseValue<types::InstanceMigrateStatusResponse>, Error<types::Error>> {
|
||||
let __progenitor_url = format!("{}/instance/migrate/status", self.baseurl,);
|
||||
let __progenitor_request = self
|
||||
let url = format!("{}/instance/migrate/status", self.baseurl,);
|
||||
let request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -792,10 +792,10 @@ impl Client {
|
|||
pub async fn instance_serial<'a>(
|
||||
&'a self,
|
||||
) -> Result<ResponseValue<reqwest::Upgraded>, Error<reqwest::Upgraded>> {
|
||||
let __progenitor_url = format!("{}/instance/serial", self.baseurl,);
|
||||
let __progenitor_request = self
|
||||
let url = format!("{}/instance/serial", self.baseurl,);
|
||||
let request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(reqwest::header::CONNECTION, "Upgrade")
|
||||
.header(reqwest::header::UPGRADE, "websocket")
|
||||
.header(reqwest::header::SEC_WEBSOCKET_VERSION, "13")
|
||||
|
@ -807,12 +807,12 @@ impl Client {
|
|||
),
|
||||
)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
101u16 => ResponseValue::upgrade(__progenitor_response).await,
|
||||
200..=299 => ResponseValue::upgrade(__progenitor_response).await,
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
101u16 => ResponseValue::upgrade(response).await,
|
||||
200..=299 => ResponseValue::upgrade(response).await,
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -821,27 +821,27 @@ impl Client {
|
|||
&'a self,
|
||||
body: types::InstanceStateRequested,
|
||||
) -> Result<ResponseValue<()>, Error<types::Error>> {
|
||||
let __progenitor_url = format!("{}/instance/state", self.baseurl,);
|
||||
let __progenitor_request = self
|
||||
let url = format!("{}/instance/state", self.baseurl,);
|
||||
let request = self
|
||||
.client
|
||||
.put(__progenitor_url)
|
||||
.put(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
204u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
204u16 => Ok(ResponseValue::empty(response)),
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -850,27 +850,27 @@ impl Client {
|
|||
&'a self,
|
||||
body: &'a types::InstanceStateMonitorRequest,
|
||||
) -> Result<ResponseValue<types::InstanceStateMonitorResponse>, Error<types::Error>> {
|
||||
let __progenitor_url = format!("{}/instance/state-monitor", self.baseurl,);
|
||||
let __progenitor_request = self
|
||||
let url = format!("{}/instance/state-monitor", self.baseurl,);
|
||||
let request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(__progenitor_response).await,
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200u16 => ResponseValue::from_response(response).await,
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -309,14 +309,14 @@ pub mod builder {
|
|||
///[`Client::default_params`]: super::Client::default_params
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DefaultParams<'a> {
|
||||
__progenitor_client: &'a super::Client,
|
||||
client: &'a super::Client,
|
||||
body: Result<types::builder::BodyWithDefaults, String>,
|
||||
}
|
||||
|
||||
impl<'a> DefaultParams<'a> {
|
||||
pub fn new(client: &'a super::Client) -> Self {
|
||||
Self {
|
||||
__progenitor_client: client,
|
||||
client: client,
|
||||
body: Ok(types::builder::BodyWithDefaults::default()),
|
||||
}
|
||||
}
|
||||
|
@ -344,29 +344,17 @@ pub mod builder {
|
|||
|
||||
///Sends a `POST` request to `/`
|
||||
pub async fn send(self) -> Result<ResponseValue<ByteStream>, Error<ByteStream>> {
|
||||
let Self {
|
||||
__progenitor_client,
|
||||
body,
|
||||
} = self;
|
||||
let Self { client, body } = self;
|
||||
let body = body
|
||||
.and_then(std::convert::TryInto::<types::BodyWithDefaults>::try_into)
|
||||
.map_err(Error::InvalidRequest)?;
|
||||
let __progenitor_url = format!("{}/", __progenitor_client.baseurl,);
|
||||
let __progenitor_request = __progenitor_client
|
||||
.client
|
||||
.post(__progenitor_url)
|
||||
.json(&body)
|
||||
.build()?;
|
||||
let __progenitor_result = __progenitor_client
|
||||
.client
|
||||
.execute(__progenitor_request)
|
||||
.await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200..=299 => Ok(ResponseValue::stream(__progenitor_response)),
|
||||
_ => Err(Error::ErrorResponse(ResponseValue::stream(
|
||||
__progenitor_response,
|
||||
))),
|
||||
let url = format!("{}/", client.baseurl,);
|
||||
let request = client.client.post(url).json(&body).build()?;
|
||||
let result = client.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200..=299 => Ok(ResponseValue::stream(response)),
|
||||
_ => Err(Error::ErrorResponse(ResponseValue::stream(response))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,15 +120,13 @@ impl Client {
|
|||
&'a self,
|
||||
body: &'a types::BodyWithDefaults,
|
||||
) -> Result<ResponseValue<ByteStream>, Error<ByteStream>> {
|
||||
let __progenitor_url = format!("{}/", self.baseurl,);
|
||||
let __progenitor_request = self.client.post(__progenitor_url).json(&body).build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200..=299 => Ok(ResponseValue::stream(__progenitor_response)),
|
||||
_ => Err(Error::ErrorResponse(ResponseValue::stream(
|
||||
__progenitor_response,
|
||||
))),
|
||||
let url = format!("{}/", self.baseurl,);
|
||||
let request = self.client.post(url).json(&body).build()?;
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200..=299 => Ok(ResponseValue::stream(response)),
|
||||
_ => Err(Error::ErrorResponse(ResponseValue::stream(response))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,15 +88,13 @@ impl Client {
|
|||
pub async fn freeform_response<'a>(
|
||||
&'a self,
|
||||
) -> Result<ResponseValue<ByteStream>, Error<ByteStream>> {
|
||||
let __progenitor_url = format!("{}/", self.baseurl,);
|
||||
let __progenitor_request = self.client.get(__progenitor_url).build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
200..=299 => Ok(ResponseValue::stream(__progenitor_response)),
|
||||
_ => Err(Error::ErrorResponse(ResponseValue::stream(
|
||||
__progenitor_response,
|
||||
))),
|
||||
let url = format!("{}/", self.baseurl,);
|
||||
let request = self.client.get(url).build()?;
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
200..=299 => Ok(ResponseValue::stream(response)),
|
||||
_ => Err(Error::ErrorResponse(ResponseValue::stream(response))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,37 +94,37 @@ impl Client {
|
|||
in_: &'a str,
|
||||
use_: &'a str,
|
||||
) -> Result<ResponseValue<()>, Error<types::Error>> {
|
||||
let __progenitor_url = format!(
|
||||
let url = format!(
|
||||
"{}/{}/{}/{}",
|
||||
self.baseurl,
|
||||
encode_path(&ref_.to_string()),
|
||||
encode_path(&type_.to_string()),
|
||||
encode_path(&trait_.to_string()),
|
||||
);
|
||||
let mut __progenitor_query = Vec::with_capacity(3usize);
|
||||
__progenitor_query.push(("if", if_.to_string()));
|
||||
__progenitor_query.push(("in", in_.to_string()));
|
||||
__progenitor_query.push(("use", use_.to_string()));
|
||||
let __progenitor_request = self
|
||||
let mut query = Vec::with_capacity(3usize);
|
||||
query.push(("if", if_.to_string()));
|
||||
query.push(("in", in_.to_string()));
|
||||
query.push(("use", use_.to_string()));
|
||||
let request = self
|
||||
.client
|
||||
.get(__progenitor_url)
|
||||
.get(url)
|
||||
.header(
|
||||
reqwest::header::ACCEPT,
|
||||
reqwest::header::HeaderValue::from_static("application/json"),
|
||||
)
|
||||
.query(&__progenitor_query)
|
||||
.query(&query)
|
||||
.build()?;
|
||||
let __progenitor_result = self.client.execute(__progenitor_request).await;
|
||||
let __progenitor_response = __progenitor_result?;
|
||||
match __progenitor_response.status().as_u16() {
|
||||
204u16 => Ok(ResponseValue::empty(__progenitor_response)),
|
||||
let result = self.client.execute(request).await;
|
||||
let response = result?;
|
||||
match response.status().as_u16() {
|
||||
204u16 => Ok(ResponseValue::empty(response)),
|
||||
400u16..=499u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
500u16..=599u16 => Err(Error::ErrorResponse(
|
||||
ResponseValue::from_response(__progenitor_response).await?,
|
||||
ResponseValue::from_response(response).await?,
|
||||
)),
|
||||
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
|
||||
_ => Err(Error::UnexpectedResponse(response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,6 +157,11 @@ fn test_yaml() {
|
|||
verify_apis("param-overrides.yaml");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_param_collision() {
|
||||
verify_apis("param-collision.json");
|
||||
}
|
||||
|
||||
// TODO this file is full of inconsistencies and incorrectly specified types.
|
||||
// It's an interesting test to consider whether we try to do our best to
|
||||
// interpret the intent or just fail.
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
{
|
||||
"openapi": "3.0.0",
|
||||
"info": {
|
||||
"description": "Minimal API for testing collision between parameter names and generated code",
|
||||
"title": "Parameter name collision test",
|
||||
"version": "v1"
|
||||
},
|
||||
"paths": {
|
||||
"/key/{query}": {
|
||||
"get": {
|
||||
"description": "Gets a key",
|
||||
"operationId": "key.get",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Parameter name that was previously colliding",
|
||||
"in": "path",
|
||||
"name": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Parameter name that was previously colliding",
|
||||
"in": "query",
|
||||
"name": "url",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Parameter name that was previously colliding",
|
||||
"in": "query",
|
||||
"name": "request",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Parameter name that was previously colliding",
|
||||
"in": "query",
|
||||
"name": "response",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Parameter name that was previously colliding",
|
||||
"in": "query",
|
||||
"name": "result",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Parameter name that was previously colliding",
|
||||
"in": "query",
|
||||
"name": "client",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"type": "string",
|
||||
"description": "Successful response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue