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:
Ian Nickles 2023-10-16 11:44:24 -07:00 committed by GitHub
parent 08428bea99
commit 6dc2a0ff2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 10051 additions and 11121 deletions

View File

@ -13,7 +13,7 @@ use typify::{TypeId, TypeSpace};
use crate::{ use crate::{
template::PathTemplate, template::PathTemplate,
util::{items, parameter_map, sanitize, Case}, util::{items, parameter_map, sanitize, unique_ident_from, Case},
Error, Generator, Result, TagStyle, Error, Generator, Result, TagStyle,
}; };
use crate::{to_schema::ToSchema, util::ReferenceOrExt}; use crate::{to_schema::ToSchema, util::ReferenceOrExt};
@ -792,15 +792,18 @@ impl Generator {
method: &OperationMethod, method: &OperationMethod,
client: TokenStream, client: TokenStream,
) -> Result<MethodSigBody> { ) -> Result<MethodSigBody> {
// We prefix internal variable names to mitigate possible name let param_names = method
// collisions with the input spec. See: .params
// https://github.com/oxidecomputer/progenitor/issues/288 .iter()
let internal_prefix = "__progenitor"; .map(|param| format_ident!("{}", param.name))
let url_ident = format_ident!("{internal_prefix}_url"); .collect::<Vec<_>>();
let query_ident = format_ident!("{internal_prefix}_query");
let request_ident = format_ident!("{internal_prefix}_request"); // Generate a unique Ident for internal variables
let response_ident = format_ident!("{internal_prefix}_response"); let url_ident = unique_ident_from("url", &param_names);
let result_ident = format_ident!("{internal_prefix}_result"); let query_ident = unique_ident_from("query", &param_names);
let request_ident = unique_ident_from("request", &param_names);
let response_ident = unique_ident_from("response", &param_names);
let result_ident = unique_ident_from("result", &param_names);
// Generate code for query parameters. // Generate code for query parameters.
let query_items = method let query_items = method
@ -1429,7 +1432,6 @@ impl Generator {
) -> Result<TokenStream> { ) -> Result<TokenStream> {
let struct_name = sanitize(&method.operation_id, Case::Pascal); let struct_name = sanitize(&method.operation_id, Case::Pascal);
let struct_ident = format_ident!("{}", struct_name); let struct_ident = format_ident!("{}", struct_name);
let client_ident = format_ident!("__progenitor_client");
// Generate an ident for each parameter. // Generate an ident for each parameter.
let param_names = method let param_names = method
@ -1438,6 +1440,8 @@ impl Generator {
.map(|param| format_ident!("{}", param.name)) .map(|param| format_ident!("{}", param.name))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let client_ident = unique_ident_from("client", &param_names);
let mut cloneable = true; let mut cloneable = true;
// Generate the type for each parameter. // Generate the type for each parameter.

View File

@ -123,3 +123,22 @@ pub(crate) fn sanitize(input: &str, case: Case) -> String {
format!("{}_", out) 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, "_");
}
}

View File

@ -1863,38 +1863,31 @@ pub mod builder {
///[`Client::control_hold`]: super::Client::control_hold ///[`Client::control_hold`]: super::Client::control_hold
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ControlHold<'a> { pub struct ControlHold<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> ControlHold<'a> { impl<'a> ControlHold<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `POST` request to `/v1/control/hold` ///Sends a `POST` request to `/v1/control/hold`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/v1/control/hold", client.baseurl,);
} = self; let request = client
let __progenitor_url = format!("{}/v1/control/hold", __progenitor_client.baseurl,);
let __progenitor_request = __progenitor_client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1904,31 +1897,24 @@ pub mod builder {
///[`Client::control_resume`]: super::Client::control_resume ///[`Client::control_resume`]: super::Client::control_resume
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ControlResume<'a> { pub struct ControlResume<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> ControlResume<'a> { impl<'a> ControlResume<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `POST` request to `/v1/control/resume` ///Sends a `POST` request to `/v1/control/resume`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/v1/control/resume", client.baseurl,);
} = self; let request = client.client.post(url).build()?;
let __progenitor_url = format!("{}/v1/control/resume", __progenitor_client.baseurl,); let result = client.client.execute(request).await;
let __progenitor_request = __progenitor_client.client.post(__progenitor_url).build()?; let response = result?;
let __progenitor_result = __progenitor_client match response.status().as_u16() {
.client 200u16 => Ok(ResponseValue::empty(response)),
.execute(__progenitor_request) _ => Err(Error::UnexpectedResponse(response)),
.await;
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1938,14 +1924,14 @@ pub mod builder {
///[`Client::task_get`]: super::Client::task_get ///[`Client::task_get`]: super::Client::task_get
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct TaskGet<'a> { pub struct TaskGet<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
} }
impl<'a> TaskGet<'a> { impl<'a> TaskGet<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
} }
} }
@ -1962,32 +1948,26 @@ pub mod builder {
///Sends a `GET` request to `/v1/task/{task}` ///Sends a `GET` request to `/v1/task/{task}`
pub async fn send(self) -> Result<ResponseValue<types::Task>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::Task>, Error<()>> {
let Self { let Self { client, task } = self;
__progenitor_client,
task,
} = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/task/{}", "{}/v1/task/{}",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = __progenitor_client let request = client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1997,38 +1977,31 @@ pub mod builder {
///[`Client::tasks_get`]: super::Client::tasks_get ///[`Client::tasks_get`]: super::Client::tasks_get
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct TasksGet<'a> { pub struct TasksGet<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> TasksGet<'a> { impl<'a> TasksGet<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `GET` request to `/v1/tasks` ///Sends a `GET` request to `/v1/tasks`
pub async fn send(self) -> Result<ResponseValue<Vec<types::Task>>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<Vec<types::Task>>, Error<()>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/v1/tasks", client.baseurl,);
} = self; let request = client
let __progenitor_url = format!("{}/v1/tasks", __progenitor_client.baseurl,);
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2038,14 +2011,14 @@ pub mod builder {
///[`Client::task_submit`]: super::Client::task_submit ///[`Client::task_submit`]: super::Client::task_submit
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct TaskSubmit<'a> { pub struct TaskSubmit<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::builder::TaskSubmit, String>, body: Result<types::builder::TaskSubmit, String>,
} }
impl<'a> TaskSubmit<'a> { impl<'a> TaskSubmit<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Ok(types::builder::TaskSubmit::default()), body: Ok(types::builder::TaskSubmit::default()),
} }
} }
@ -2071,31 +2044,25 @@ pub mod builder {
///Sends a `POST` request to `/v1/tasks` ///Sends a `POST` request to `/v1/tasks`
pub async fn send(self) -> Result<ResponseValue<types::TaskSubmitResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::TaskSubmitResult>, Error<()>> {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body let body = body
.and_then(std::convert::TryInto::<types::TaskSubmit>::try_into) .and_then(std::convert::TryInto::<types::TaskSubmit>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!("{}/v1/tasks", __progenitor_client.baseurl,); let url = format!("{}/v1/tasks", client.baseurl,);
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2105,7 +2072,7 @@ pub mod builder {
///[`Client::task_events_get`]: super::Client::task_events_get ///[`Client::task_events_get`]: super::Client::task_events_get
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct TaskEventsGet<'a> { pub struct TaskEventsGet<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
minseq: Result<Option<u32>, String>, minseq: Result<Option<u32>, String>,
} }
@ -2113,7 +2080,7 @@ pub mod builder {
impl<'a> TaskEventsGet<'a> { impl<'a> TaskEventsGet<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
minseq: Ok(None), minseq: Ok(None),
} }
@ -2143,38 +2110,35 @@ pub mod builder {
///Sends a `GET` request to `/v1/tasks/{task}/events` ///Sends a `GET` request to `/v1/tasks/{task}/events`
pub async fn send(self) -> Result<ResponseValue<Vec<types::TaskEvent>>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<Vec<types::TaskEvent>>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
task, task,
minseq, minseq,
} = self; } = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let minseq = minseq.map_err(Error::InvalidRequest)?; let minseq = minseq.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/tasks/{}/events", "{}/v1/tasks/{}/events",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), 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 { 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 .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.query(&__progenitor_query) .query(&query)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2184,14 +2148,14 @@ pub mod builder {
///[`Client::task_outputs_get`]: super::Client::task_outputs_get ///[`Client::task_outputs_get`]: super::Client::task_outputs_get
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct TaskOutputsGet<'a> { pub struct TaskOutputsGet<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
} }
impl<'a> TaskOutputsGet<'a> { impl<'a> TaskOutputsGet<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
} }
} }
@ -2208,32 +2172,26 @@ pub mod builder {
///Sends a `GET` request to `/v1/tasks/{task}/outputs` ///Sends a `GET` request to `/v1/tasks/{task}/outputs`
pub async fn send(self) -> Result<ResponseValue<Vec<types::TaskOutput>>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<Vec<types::TaskOutput>>, Error<()>> {
let Self { let Self { client, task } = self;
__progenitor_client,
task,
} = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/tasks/{}/outputs", "{}/v1/tasks/{}/outputs",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = __progenitor_client let request = client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2243,7 +2201,7 @@ pub mod builder {
///[`Client::task_output_download`]: super::Client::task_output_download ///[`Client::task_output_download`]: super::Client::task_output_download
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct TaskOutputDownload<'a> { pub struct TaskOutputDownload<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
output: Result<String, String>, output: Result<String, String>,
} }
@ -2251,7 +2209,7 @@ pub mod builder {
impl<'a> TaskOutputDownload<'a> { impl<'a> TaskOutputDownload<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
output: Err("output 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}` ///Sends a `GET` request to `/v1/tasks/{task}/outputs/{output}`
pub async fn send(self) -> Result<ResponseValue<ByteStream>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<ByteStream>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
task, task,
output, output,
} = self; } = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let output = output.map_err(Error::InvalidRequest)?; let output = output.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/tasks/{}/outputs/{}", "{}/v1/tasks/{}/outputs/{}",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
encode_path(&output.to_string()), encode_path(&output.to_string()),
); );
let __progenitor_request = __progenitor_client.client.get(__progenitor_url).build()?; let request = client.client.get(url).build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200..=299 => Ok(ResponseValue::stream(response)),
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200..=299 => Ok(ResponseValue::stream(__progenitor_response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2310,14 +2265,14 @@ pub mod builder {
///[`Client::user_create`]: super::Client::user_create ///[`Client::user_create`]: super::Client::user_create
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct UserCreate<'a> { pub struct UserCreate<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::builder::UserCreate, String>, body: Result<types::builder::UserCreate, String>,
} }
impl<'a> UserCreate<'a> { impl<'a> UserCreate<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Ok(types::builder::UserCreate::default()), body: Ok(types::builder::UserCreate::default()),
} }
} }
@ -2343,31 +2298,25 @@ pub mod builder {
///Sends a `POST` request to `/v1/users` ///Sends a `POST` request to `/v1/users`
pub async fn send(self) -> Result<ResponseValue<types::UserCreateResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::UserCreateResult>, Error<()>> {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body let body = body
.and_then(std::convert::TryInto::<types::UserCreate>::try_into) .and_then(std::convert::TryInto::<types::UserCreate>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!("{}/v1/users", __progenitor_client.baseurl,); let url = format!("{}/v1/users", client.baseurl,);
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2377,38 +2326,31 @@ pub mod builder {
///[`Client::whoami`]: super::Client::whoami ///[`Client::whoami`]: super::Client::whoami
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Whoami<'a> { pub struct Whoami<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> Whoami<'a> { impl<'a> Whoami<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `GET` request to `/v1/whoami` ///Sends a `GET` request to `/v1/whoami`
pub async fn send(self) -> Result<ResponseValue<types::WhoamiResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::WhoamiResult>, Error<()>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/v1/whoami", client.baseurl,);
} = self; let request = client
let __progenitor_url = format!("{}/v1/whoami", __progenitor_client.baseurl,);
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2418,14 +2360,14 @@ pub mod builder {
///[`Client::worker_bootstrap`]: super::Client::worker_bootstrap ///[`Client::worker_bootstrap`]: super::Client::worker_bootstrap
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WorkerBootstrap<'a> { pub struct WorkerBootstrap<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::builder::WorkerBootstrap, String>, body: Result<types::builder::WorkerBootstrap, String>,
} }
impl<'a> WorkerBootstrap<'a> { impl<'a> WorkerBootstrap<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Ok(types::builder::WorkerBootstrap::default()), body: Ok(types::builder::WorkerBootstrap::default()),
} }
} }
@ -2451,31 +2393,25 @@ pub mod builder {
///Sends a `POST` request to `/v1/worker/bootstrap` ///Sends a `POST` request to `/v1/worker/bootstrap`
pub async fn send(self) -> Result<ResponseValue<types::WorkerBootstrapResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::WorkerBootstrapResult>, Error<()>> {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body let body = body
.and_then(std::convert::TryInto::<types::WorkerBootstrap>::try_into) .and_then(std::convert::TryInto::<types::WorkerBootstrap>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!("{}/v1/worker/bootstrap", __progenitor_client.baseurl,); let url = format!("{}/v1/worker/bootstrap", client.baseurl,);
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2485,38 +2421,31 @@ pub mod builder {
///[`Client::worker_ping`]: super::Client::worker_ping ///[`Client::worker_ping`]: super::Client::worker_ping
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WorkerPing<'a> { pub struct WorkerPing<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> WorkerPing<'a> { impl<'a> WorkerPing<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `GET` request to `/v1/worker/ping` ///Sends a `GET` request to `/v1/worker/ping`
pub async fn send(self) -> Result<ResponseValue<types::WorkerPingResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::WorkerPingResult>, Error<()>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/v1/worker/ping", client.baseurl,);
} = self; let request = client
let __progenitor_url = format!("{}/v1/worker/ping", __progenitor_client.baseurl,);
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2526,7 +2455,7 @@ pub mod builder {
///[`Client::worker_task_append`]: super::Client::worker_task_append ///[`Client::worker_task_append`]: super::Client::worker_task_append
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WorkerTaskAppend<'a> { pub struct WorkerTaskAppend<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
body: Result<types::builder::WorkerAppendTask, String>, body: Result<types::builder::WorkerAppendTask, String>,
} }
@ -2534,7 +2463,7 @@ pub mod builder {
impl<'a> WorkerTaskAppend<'a> { impl<'a> WorkerTaskAppend<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
body: Ok(types::builder::WorkerAppendTask::default()), body: Ok(types::builder::WorkerAppendTask::default()),
} }
@ -2573,33 +2502,22 @@ pub mod builder {
///Sends a `POST` request to `/v1/worker/task/{task}/append` ///Sends a `POST` request to `/v1/worker/task/{task}/append`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self { client, task, body } = self;
__progenitor_client,
task,
body,
} = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let body = body let body = body
.and_then(std::convert::TryInto::<types::WorkerAppendTask>::try_into) .and_then(std::convert::TryInto::<types::WorkerAppendTask>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/worker/task/{}/append", "{}/v1/worker/task/{}/append",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = __progenitor_client let request = client.client.post(url).json(&body).build()?;
.client let result = client.client.execute(request).await;
.post(__progenitor_url) let response = result?;
.json(&body) match response.status().as_u16() {
.build()?; 201u16 => Ok(ResponseValue::empty(response)),
let __progenitor_result = __progenitor_client _ => Err(Error::UnexpectedResponse(response)),
.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)),
} }
} }
} }
@ -2609,7 +2527,7 @@ pub mod builder {
///[`Client::worker_task_upload_chunk`]: super::Client::worker_task_upload_chunk ///[`Client::worker_task_upload_chunk`]: super::Client::worker_task_upload_chunk
#[derive(Debug)] #[derive(Debug)]
pub struct WorkerTaskUploadChunk<'a> { pub struct WorkerTaskUploadChunk<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
body: Result<reqwest::Body, String>, body: Result<reqwest::Body, String>,
} }
@ -2617,7 +2535,7 @@ pub mod builder {
impl<'a> WorkerTaskUploadChunk<'a> { impl<'a> WorkerTaskUploadChunk<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
body: Err("body 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` ///Sends a `POST` request to `/v1/worker/task/{task}/chunk`
pub async fn send(self) -> Result<ResponseValue<types::UploadedChunk>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::UploadedChunk>, Error<()>> {
let Self { let Self { client, task, body } = self;
__progenitor_client,
task,
body,
} = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/worker/task/{}/chunk", "{}/v1/worker/task/{}/chunk",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
@ -2670,14 +2584,11 @@ pub mod builder {
) )
.body(body) .body(body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2687,7 +2598,7 @@ pub mod builder {
///[`Client::worker_task_complete`]: super::Client::worker_task_complete ///[`Client::worker_task_complete`]: super::Client::worker_task_complete
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WorkerTaskComplete<'a> { pub struct WorkerTaskComplete<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
body: Result<types::builder::WorkerCompleteTask, String>, body: Result<types::builder::WorkerCompleteTask, String>,
} }
@ -2695,7 +2606,7 @@ pub mod builder {
impl<'a> WorkerTaskComplete<'a> { impl<'a> WorkerTaskComplete<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
body: Ok(types::builder::WorkerCompleteTask::default()), body: Ok(types::builder::WorkerCompleteTask::default()),
} }
@ -2734,33 +2645,22 @@ pub mod builder {
///Sends a `POST` request to `/v1/worker/task/{task}/complete` ///Sends a `POST` request to `/v1/worker/task/{task}/complete`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self { client, task, body } = self;
__progenitor_client,
task,
body,
} = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let body = body let body = body
.and_then(std::convert::TryInto::<types::WorkerCompleteTask>::try_into) .and_then(std::convert::TryInto::<types::WorkerCompleteTask>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/worker/task/{}/complete", "{}/v1/worker/task/{}/complete",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = __progenitor_client let request = client.client.post(url).json(&body).build()?;
.client let result = client.client.execute(request).await;
.post(__progenitor_url) let response = result?;
.json(&body) match response.status().as_u16() {
.build()?; 200u16 => Ok(ResponseValue::empty(response)),
let __progenitor_result = __progenitor_client _ => Err(Error::UnexpectedResponse(response)),
.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)),
} }
} }
} }
@ -2770,7 +2670,7 @@ pub mod builder {
///[`Client::worker_task_add_output`]: super::Client::worker_task_add_output ///[`Client::worker_task_add_output`]: super::Client::worker_task_add_output
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WorkerTaskAddOutput<'a> { pub struct WorkerTaskAddOutput<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
body: Result<types::builder::WorkerAddOutput, String>, body: Result<types::builder::WorkerAddOutput, String>,
} }
@ -2778,7 +2678,7 @@ pub mod builder {
impl<'a> WorkerTaskAddOutput<'a> { impl<'a> WorkerTaskAddOutput<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
body: Ok(types::builder::WorkerAddOutput::default()), body: Ok(types::builder::WorkerAddOutput::default()),
} }
@ -2815,33 +2715,22 @@ pub mod builder {
///Sends a `POST` request to `/v1/worker/task/{task}/output` ///Sends a `POST` request to `/v1/worker/task/{task}/output`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self { client, task, body } = self;
__progenitor_client,
task,
body,
} = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let body = body let body = body
.and_then(std::convert::TryInto::<types::WorkerAddOutput>::try_into) .and_then(std::convert::TryInto::<types::WorkerAddOutput>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/worker/task/{}/output", "{}/v1/worker/task/{}/output",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = __progenitor_client let request = client.client.post(url).json(&body).build()?;
.client let result = client.client.execute(request).await;
.post(__progenitor_url) let response = result?;
.json(&body) match response.status().as_u16() {
.build()?; 201u16 => Ok(ResponseValue::empty(response)),
let __progenitor_result = __progenitor_client _ => Err(Error::UnexpectedResponse(response)),
.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)),
} }
} }
} }
@ -2851,38 +2740,31 @@ pub mod builder {
///[`Client::workers_list`]: super::Client::workers_list ///[`Client::workers_list`]: super::Client::workers_list
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WorkersList<'a> { pub struct WorkersList<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> WorkersList<'a> { impl<'a> WorkersList<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `GET` request to `/v1/workers` ///Sends a `GET` request to `/v1/workers`
pub async fn send(self) -> Result<ResponseValue<types::WorkersResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::WorkersResult>, Error<()>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/v1/workers", client.baseurl,);
} = self; let request = client
let __progenitor_url = format!("{}/v1/workers", __progenitor_client.baseurl,);
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2892,31 +2774,24 @@ pub mod builder {
///[`Client::workers_recycle`]: super::Client::workers_recycle ///[`Client::workers_recycle`]: super::Client::workers_recycle
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WorkersRecycle<'a> { pub struct WorkersRecycle<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> WorkersRecycle<'a> { impl<'a> WorkersRecycle<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `POST` request to `/v1/workers/recycle` ///Sends a `POST` request to `/v1/workers/recycle`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/v1/workers/recycle", client.baseurl,);
} = self; let request = client.client.post(url).build()?;
let __progenitor_url = format!("{}/v1/workers/recycle", __progenitor_client.baseurl,); let result = client.client.execute(request).await;
let __progenitor_request = __progenitor_client.client.post(__progenitor_url).build()?; let response = result?;
let __progenitor_result = __progenitor_client match response.status().as_u16() {
.client 200u16 => Ok(ResponseValue::empty(response)),
.execute(__progenitor_request) _ => Err(Error::UnexpectedResponse(response)),
.await;
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }

View File

@ -1863,38 +1863,31 @@ pub mod builder {
///[`Client::control_hold`]: super::Client::control_hold ///[`Client::control_hold`]: super::Client::control_hold
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ControlHold<'a> { pub struct ControlHold<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> ControlHold<'a> { impl<'a> ControlHold<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `POST` request to `/v1/control/hold` ///Sends a `POST` request to `/v1/control/hold`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/v1/control/hold", client.baseurl,);
} = self; let request = client
let __progenitor_url = format!("{}/v1/control/hold", __progenitor_client.baseurl,);
let __progenitor_request = __progenitor_client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1904,31 +1897,24 @@ pub mod builder {
///[`Client::control_resume`]: super::Client::control_resume ///[`Client::control_resume`]: super::Client::control_resume
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ControlResume<'a> { pub struct ControlResume<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> ControlResume<'a> { impl<'a> ControlResume<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `POST` request to `/v1/control/resume` ///Sends a `POST` request to `/v1/control/resume`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/v1/control/resume", client.baseurl,);
} = self; let request = client.client.post(url).build()?;
let __progenitor_url = format!("{}/v1/control/resume", __progenitor_client.baseurl,); let result = client.client.execute(request).await;
let __progenitor_request = __progenitor_client.client.post(__progenitor_url).build()?; let response = result?;
let __progenitor_result = __progenitor_client match response.status().as_u16() {
.client 200u16 => Ok(ResponseValue::empty(response)),
.execute(__progenitor_request) _ => Err(Error::UnexpectedResponse(response)),
.await;
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1938,14 +1924,14 @@ pub mod builder {
///[`Client::task_get`]: super::Client::task_get ///[`Client::task_get`]: super::Client::task_get
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct TaskGet<'a> { pub struct TaskGet<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
} }
impl<'a> TaskGet<'a> { impl<'a> TaskGet<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
} }
} }
@ -1962,32 +1948,26 @@ pub mod builder {
///Sends a `GET` request to `/v1/task/{task}` ///Sends a `GET` request to `/v1/task/{task}`
pub async fn send(self) -> Result<ResponseValue<types::Task>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::Task>, Error<()>> {
let Self { let Self { client, task } = self;
__progenitor_client,
task,
} = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/task/{}", "{}/v1/task/{}",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = __progenitor_client let request = client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1997,38 +1977,31 @@ pub mod builder {
///[`Client::tasks_get`]: super::Client::tasks_get ///[`Client::tasks_get`]: super::Client::tasks_get
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct TasksGet<'a> { pub struct TasksGet<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> TasksGet<'a> { impl<'a> TasksGet<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `GET` request to `/v1/tasks` ///Sends a `GET` request to `/v1/tasks`
pub async fn send(self) -> Result<ResponseValue<Vec<types::Task>>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<Vec<types::Task>>, Error<()>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/v1/tasks", client.baseurl,);
} = self; let request = client
let __progenitor_url = format!("{}/v1/tasks", __progenitor_client.baseurl,);
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2038,14 +2011,14 @@ pub mod builder {
///[`Client::task_submit`]: super::Client::task_submit ///[`Client::task_submit`]: super::Client::task_submit
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct TaskSubmit<'a> { pub struct TaskSubmit<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::builder::TaskSubmit, String>, body: Result<types::builder::TaskSubmit, String>,
} }
impl<'a> TaskSubmit<'a> { impl<'a> TaskSubmit<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Ok(types::builder::TaskSubmit::default()), body: Ok(types::builder::TaskSubmit::default()),
} }
} }
@ -2071,31 +2044,25 @@ pub mod builder {
///Sends a `POST` request to `/v1/tasks` ///Sends a `POST` request to `/v1/tasks`
pub async fn send(self) -> Result<ResponseValue<types::TaskSubmitResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::TaskSubmitResult>, Error<()>> {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body let body = body
.and_then(std::convert::TryInto::<types::TaskSubmit>::try_into) .and_then(std::convert::TryInto::<types::TaskSubmit>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!("{}/v1/tasks", __progenitor_client.baseurl,); let url = format!("{}/v1/tasks", client.baseurl,);
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2105,7 +2072,7 @@ pub mod builder {
///[`Client::task_events_get`]: super::Client::task_events_get ///[`Client::task_events_get`]: super::Client::task_events_get
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct TaskEventsGet<'a> { pub struct TaskEventsGet<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
minseq: Result<Option<u32>, String>, minseq: Result<Option<u32>, String>,
} }
@ -2113,7 +2080,7 @@ pub mod builder {
impl<'a> TaskEventsGet<'a> { impl<'a> TaskEventsGet<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
minseq: Ok(None), minseq: Ok(None),
} }
@ -2143,38 +2110,35 @@ pub mod builder {
///Sends a `GET` request to `/v1/tasks/{task}/events` ///Sends a `GET` request to `/v1/tasks/{task}/events`
pub async fn send(self) -> Result<ResponseValue<Vec<types::TaskEvent>>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<Vec<types::TaskEvent>>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
task, task,
minseq, minseq,
} = self; } = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let minseq = minseq.map_err(Error::InvalidRequest)?; let minseq = minseq.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/tasks/{}/events", "{}/v1/tasks/{}/events",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), 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 { 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 .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.query(&__progenitor_query) .query(&query)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2184,14 +2148,14 @@ pub mod builder {
///[`Client::task_outputs_get`]: super::Client::task_outputs_get ///[`Client::task_outputs_get`]: super::Client::task_outputs_get
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct TaskOutputsGet<'a> { pub struct TaskOutputsGet<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
} }
impl<'a> TaskOutputsGet<'a> { impl<'a> TaskOutputsGet<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
} }
} }
@ -2208,32 +2172,26 @@ pub mod builder {
///Sends a `GET` request to `/v1/tasks/{task}/outputs` ///Sends a `GET` request to `/v1/tasks/{task}/outputs`
pub async fn send(self) -> Result<ResponseValue<Vec<types::TaskOutput>>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<Vec<types::TaskOutput>>, Error<()>> {
let Self { let Self { client, task } = self;
__progenitor_client,
task,
} = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/tasks/{}/outputs", "{}/v1/tasks/{}/outputs",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = __progenitor_client let request = client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2243,7 +2201,7 @@ pub mod builder {
///[`Client::task_output_download`]: super::Client::task_output_download ///[`Client::task_output_download`]: super::Client::task_output_download
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct TaskOutputDownload<'a> { pub struct TaskOutputDownload<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
output: Result<String, String>, output: Result<String, String>,
} }
@ -2251,7 +2209,7 @@ pub mod builder {
impl<'a> TaskOutputDownload<'a> { impl<'a> TaskOutputDownload<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
output: Err("output 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}` ///Sends a `GET` request to `/v1/tasks/{task}/outputs/{output}`
pub async fn send(self) -> Result<ResponseValue<ByteStream>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<ByteStream>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
task, task,
output, output,
} = self; } = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let output = output.map_err(Error::InvalidRequest)?; let output = output.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/tasks/{}/outputs/{}", "{}/v1/tasks/{}/outputs/{}",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
encode_path(&output.to_string()), encode_path(&output.to_string()),
); );
let __progenitor_request = __progenitor_client.client.get(__progenitor_url).build()?; let request = client.client.get(url).build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200..=299 => Ok(ResponseValue::stream(response)),
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200..=299 => Ok(ResponseValue::stream(__progenitor_response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2310,14 +2265,14 @@ pub mod builder {
///[`Client::user_create`]: super::Client::user_create ///[`Client::user_create`]: super::Client::user_create
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct UserCreate<'a> { pub struct UserCreate<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::builder::UserCreate, String>, body: Result<types::builder::UserCreate, String>,
} }
impl<'a> UserCreate<'a> { impl<'a> UserCreate<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Ok(types::builder::UserCreate::default()), body: Ok(types::builder::UserCreate::default()),
} }
} }
@ -2343,31 +2298,25 @@ pub mod builder {
///Sends a `POST` request to `/v1/users` ///Sends a `POST` request to `/v1/users`
pub async fn send(self) -> Result<ResponseValue<types::UserCreateResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::UserCreateResult>, Error<()>> {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body let body = body
.and_then(std::convert::TryInto::<types::UserCreate>::try_into) .and_then(std::convert::TryInto::<types::UserCreate>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!("{}/v1/users", __progenitor_client.baseurl,); let url = format!("{}/v1/users", client.baseurl,);
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2377,38 +2326,31 @@ pub mod builder {
///[`Client::whoami`]: super::Client::whoami ///[`Client::whoami`]: super::Client::whoami
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Whoami<'a> { pub struct Whoami<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> Whoami<'a> { impl<'a> Whoami<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `GET` request to `/v1/whoami` ///Sends a `GET` request to `/v1/whoami`
pub async fn send(self) -> Result<ResponseValue<types::WhoamiResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::WhoamiResult>, Error<()>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/v1/whoami", client.baseurl,);
} = self; let request = client
let __progenitor_url = format!("{}/v1/whoami", __progenitor_client.baseurl,);
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2418,14 +2360,14 @@ pub mod builder {
///[`Client::worker_bootstrap`]: super::Client::worker_bootstrap ///[`Client::worker_bootstrap`]: super::Client::worker_bootstrap
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WorkerBootstrap<'a> { pub struct WorkerBootstrap<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::builder::WorkerBootstrap, String>, body: Result<types::builder::WorkerBootstrap, String>,
} }
impl<'a> WorkerBootstrap<'a> { impl<'a> WorkerBootstrap<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Ok(types::builder::WorkerBootstrap::default()), body: Ok(types::builder::WorkerBootstrap::default()),
} }
} }
@ -2451,31 +2393,25 @@ pub mod builder {
///Sends a `POST` request to `/v1/worker/bootstrap` ///Sends a `POST` request to `/v1/worker/bootstrap`
pub async fn send(self) -> Result<ResponseValue<types::WorkerBootstrapResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::WorkerBootstrapResult>, Error<()>> {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body let body = body
.and_then(std::convert::TryInto::<types::WorkerBootstrap>::try_into) .and_then(std::convert::TryInto::<types::WorkerBootstrap>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!("{}/v1/worker/bootstrap", __progenitor_client.baseurl,); let url = format!("{}/v1/worker/bootstrap", client.baseurl,);
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2485,38 +2421,31 @@ pub mod builder {
///[`Client::worker_ping`]: super::Client::worker_ping ///[`Client::worker_ping`]: super::Client::worker_ping
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WorkerPing<'a> { pub struct WorkerPing<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> WorkerPing<'a> { impl<'a> WorkerPing<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `GET` request to `/v1/worker/ping` ///Sends a `GET` request to `/v1/worker/ping`
pub async fn send(self) -> Result<ResponseValue<types::WorkerPingResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::WorkerPingResult>, Error<()>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/v1/worker/ping", client.baseurl,);
} = self; let request = client
let __progenitor_url = format!("{}/v1/worker/ping", __progenitor_client.baseurl,);
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2526,7 +2455,7 @@ pub mod builder {
///[`Client::worker_task_append`]: super::Client::worker_task_append ///[`Client::worker_task_append`]: super::Client::worker_task_append
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WorkerTaskAppend<'a> { pub struct WorkerTaskAppend<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
body: Result<types::builder::WorkerAppendTask, String>, body: Result<types::builder::WorkerAppendTask, String>,
} }
@ -2534,7 +2463,7 @@ pub mod builder {
impl<'a> WorkerTaskAppend<'a> { impl<'a> WorkerTaskAppend<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
body: Ok(types::builder::WorkerAppendTask::default()), body: Ok(types::builder::WorkerAppendTask::default()),
} }
@ -2573,33 +2502,22 @@ pub mod builder {
///Sends a `POST` request to `/v1/worker/task/{task}/append` ///Sends a `POST` request to `/v1/worker/task/{task}/append`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self { client, task, body } = self;
__progenitor_client,
task,
body,
} = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let body = body let body = body
.and_then(std::convert::TryInto::<types::WorkerAppendTask>::try_into) .and_then(std::convert::TryInto::<types::WorkerAppendTask>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/worker/task/{}/append", "{}/v1/worker/task/{}/append",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = __progenitor_client let request = client.client.post(url).json(&body).build()?;
.client let result = client.client.execute(request).await;
.post(__progenitor_url) let response = result?;
.json(&body) match response.status().as_u16() {
.build()?; 201u16 => Ok(ResponseValue::empty(response)),
let __progenitor_result = __progenitor_client _ => Err(Error::UnexpectedResponse(response)),
.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)),
} }
} }
} }
@ -2609,7 +2527,7 @@ pub mod builder {
///[`Client::worker_task_upload_chunk`]: super::Client::worker_task_upload_chunk ///[`Client::worker_task_upload_chunk`]: super::Client::worker_task_upload_chunk
#[derive(Debug)] #[derive(Debug)]
pub struct WorkerTaskUploadChunk<'a> { pub struct WorkerTaskUploadChunk<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
body: Result<reqwest::Body, String>, body: Result<reqwest::Body, String>,
} }
@ -2617,7 +2535,7 @@ pub mod builder {
impl<'a> WorkerTaskUploadChunk<'a> { impl<'a> WorkerTaskUploadChunk<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
body: Err("body 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` ///Sends a `POST` request to `/v1/worker/task/{task}/chunk`
pub async fn send(self) -> Result<ResponseValue<types::UploadedChunk>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::UploadedChunk>, Error<()>> {
let Self { let Self { client, task, body } = self;
__progenitor_client,
task,
body,
} = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/worker/task/{}/chunk", "{}/v1/worker/task/{}/chunk",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
@ -2670,14 +2584,11 @@ pub mod builder {
) )
.body(body) .body(body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2687,7 +2598,7 @@ pub mod builder {
///[`Client::worker_task_complete`]: super::Client::worker_task_complete ///[`Client::worker_task_complete`]: super::Client::worker_task_complete
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WorkerTaskComplete<'a> { pub struct WorkerTaskComplete<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
body: Result<types::builder::WorkerCompleteTask, String>, body: Result<types::builder::WorkerCompleteTask, String>,
} }
@ -2695,7 +2606,7 @@ pub mod builder {
impl<'a> WorkerTaskComplete<'a> { impl<'a> WorkerTaskComplete<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
body: Ok(types::builder::WorkerCompleteTask::default()), body: Ok(types::builder::WorkerCompleteTask::default()),
} }
@ -2734,33 +2645,22 @@ pub mod builder {
///Sends a `POST` request to `/v1/worker/task/{task}/complete` ///Sends a `POST` request to `/v1/worker/task/{task}/complete`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self { client, task, body } = self;
__progenitor_client,
task,
body,
} = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let body = body let body = body
.and_then(std::convert::TryInto::<types::WorkerCompleteTask>::try_into) .and_then(std::convert::TryInto::<types::WorkerCompleteTask>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/worker/task/{}/complete", "{}/v1/worker/task/{}/complete",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = __progenitor_client let request = client.client.post(url).json(&body).build()?;
.client let result = client.client.execute(request).await;
.post(__progenitor_url) let response = result?;
.json(&body) match response.status().as_u16() {
.build()?; 200u16 => Ok(ResponseValue::empty(response)),
let __progenitor_result = __progenitor_client _ => Err(Error::UnexpectedResponse(response)),
.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)),
} }
} }
} }
@ -2770,7 +2670,7 @@ pub mod builder {
///[`Client::worker_task_add_output`]: super::Client::worker_task_add_output ///[`Client::worker_task_add_output`]: super::Client::worker_task_add_output
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WorkerTaskAddOutput<'a> { pub struct WorkerTaskAddOutput<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
task: Result<String, String>, task: Result<String, String>,
body: Result<types::builder::WorkerAddOutput, String>, body: Result<types::builder::WorkerAddOutput, String>,
} }
@ -2778,7 +2678,7 @@ pub mod builder {
impl<'a> WorkerTaskAddOutput<'a> { impl<'a> WorkerTaskAddOutput<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
task: Err("task was not initialized".to_string()), task: Err("task was not initialized".to_string()),
body: Ok(types::builder::WorkerAddOutput::default()), body: Ok(types::builder::WorkerAddOutput::default()),
} }
@ -2815,33 +2715,22 @@ pub mod builder {
///Sends a `POST` request to `/v1/worker/task/{task}/output` ///Sends a `POST` request to `/v1/worker/task/{task}/output`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self { client, task, body } = self;
__progenitor_client,
task,
body,
} = self;
let task = task.map_err(Error::InvalidRequest)?; let task = task.map_err(Error::InvalidRequest)?;
let body = body let body = body
.and_then(std::convert::TryInto::<types::WorkerAddOutput>::try_into) .and_then(std::convert::TryInto::<types::WorkerAddOutput>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/v1/worker/task/{}/output", "{}/v1/worker/task/{}/output",
__progenitor_client.baseurl, client.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = __progenitor_client let request = client.client.post(url).json(&body).build()?;
.client let result = client.client.execute(request).await;
.post(__progenitor_url) let response = result?;
.json(&body) match response.status().as_u16() {
.build()?; 201u16 => Ok(ResponseValue::empty(response)),
let __progenitor_result = __progenitor_client _ => Err(Error::UnexpectedResponse(response)),
.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)),
} }
} }
} }
@ -2851,38 +2740,31 @@ pub mod builder {
///[`Client::workers_list`]: super::Client::workers_list ///[`Client::workers_list`]: super::Client::workers_list
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WorkersList<'a> { pub struct WorkersList<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> WorkersList<'a> { impl<'a> WorkersList<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `GET` request to `/v1/workers` ///Sends a `GET` request to `/v1/workers`
pub async fn send(self) -> Result<ResponseValue<types::WorkersResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::WorkersResult>, Error<()>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/v1/workers", client.baseurl,);
} = self; let request = client
let __progenitor_url = format!("{}/v1/workers", __progenitor_client.baseurl,);
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2892,31 +2774,24 @@ pub mod builder {
///[`Client::workers_recycle`]: super::Client::workers_recycle ///[`Client::workers_recycle`]: super::Client::workers_recycle
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct WorkersRecycle<'a> { pub struct WorkersRecycle<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> WorkersRecycle<'a> { impl<'a> WorkersRecycle<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `POST` request to `/v1/workers/recycle` ///Sends a `POST` request to `/v1/workers/recycle`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/v1/workers/recycle", client.baseurl,);
} = self; let request = client.client.post(url).build()?;
let __progenitor_url = format!("{}/v1/workers/recycle", __progenitor_client.baseurl,); let result = client.client.execute(request).await;
let __progenitor_request = __progenitor_client.client.post(__progenitor_url).build()?; let response = result?;
let __progenitor_result = __progenitor_client match response.status().as_u16() {
.client 200u16 => Ok(ResponseValue::empty(response)),
.execute(__progenitor_request) _ => Err(Error::UnexpectedResponse(response)),
.await;
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }

View File

@ -313,32 +313,32 @@ impl Client {
impl Client { impl Client {
///Sends a `POST` request to `/v1/control/hold` ///Sends a `POST` request to `/v1/control/hold`
pub async fn control_hold<'a>(&'a self) -> Result<ResponseValue<()>, Error<()>> { pub async fn control_hold<'a>(&'a self) -> Result<ResponseValue<()>, Error<()>> {
let __progenitor_url = format!("{}/v1/control/hold", self.baseurl,); let url = format!("{}/v1/control/hold", self.baseurl,);
let __progenitor_request = self let request = self
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await, 200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
///Sends a `POST` request to `/v1/control/resume` ///Sends a `POST` request to `/v1/control/resume`
pub async fn control_resume<'a>(&'a self) -> Result<ResponseValue<()>, Error<()>> { pub async fn control_resume<'a>(&'a self) -> Result<ResponseValue<()>, Error<()>> {
let __progenitor_url = format!("{}/v1/control/resume", self.baseurl,); let url = format!("{}/v1/control/resume", self.baseurl,);
let __progenitor_request = self.client.post(__progenitor_url).build()?; let request = self.client.post(url).build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => Ok(ResponseValue::empty(__progenitor_response)), 200u16 => Ok(ResponseValue::empty(response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -347,43 +347,43 @@ impl Client {
&'a self, &'a self,
task: &'a str, task: &'a str,
) -> Result<ResponseValue<types::Task>, Error<()>> { ) -> Result<ResponseValue<types::Task>, Error<()>> {
let __progenitor_url = format!( let url = format!(
"{}/v1/task/{}", "{}/v1/task/{}",
self.baseurl, self.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = self let request = self
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await, 200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
///Sends a `GET` request to `/v1/tasks` ///Sends a `GET` request to `/v1/tasks`
pub async fn tasks_get<'a>(&'a self) -> Result<ResponseValue<Vec<types::Task>>, Error<()>> { pub async fn tasks_get<'a>(&'a self) -> Result<ResponseValue<Vec<types::Task>>, Error<()>> {
let __progenitor_url = format!("{}/v1/tasks", self.baseurl,); let url = format!("{}/v1/tasks", self.baseurl,);
let __progenitor_request = self let request = self
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await, 200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -392,21 +392,21 @@ impl Client {
&'a self, &'a self,
body: &'a types::TaskSubmit, body: &'a types::TaskSubmit,
) -> Result<ResponseValue<types::TaskSubmitResult>, Error<()>> { ) -> Result<ResponseValue<types::TaskSubmitResult>, Error<()>> {
let __progenitor_url = format!("{}/v1/tasks", self.baseurl,); let url = format!("{}/v1/tasks", self.baseurl,);
let __progenitor_request = self let request = self
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await, 201u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -416,30 +416,30 @@ impl Client {
task: &'a str, task: &'a str,
minseq: Option<u32>, minseq: Option<u32>,
) -> Result<ResponseValue<Vec<types::TaskEvent>>, Error<()>> { ) -> Result<ResponseValue<Vec<types::TaskEvent>>, Error<()>> {
let __progenitor_url = format!( let url = format!(
"{}/v1/tasks/{}/events", "{}/v1/tasks/{}/events",
self.baseurl, self.baseurl,
encode_path(&task.to_string()), 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 { 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 .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.query(&__progenitor_query) .query(&query)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await, 200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -448,24 +448,24 @@ impl Client {
&'a self, &'a self,
task: &'a str, task: &'a str,
) -> Result<ResponseValue<Vec<types::TaskOutput>>, Error<()>> { ) -> Result<ResponseValue<Vec<types::TaskOutput>>, Error<()>> {
let __progenitor_url = format!( let url = format!(
"{}/v1/tasks/{}/outputs", "{}/v1/tasks/{}/outputs",
self.baseurl, self.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = self let request = self
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await, 200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -475,18 +475,18 @@ impl Client {
task: &'a str, task: &'a str,
output: &'a str, output: &'a str,
) -> Result<ResponseValue<ByteStream>, Error<()>> { ) -> Result<ResponseValue<ByteStream>, Error<()>> {
let __progenitor_url = format!( let url = format!(
"{}/v1/tasks/{}/outputs/{}", "{}/v1/tasks/{}/outputs/{}",
self.baseurl, self.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
encode_path(&output.to_string()), encode_path(&output.to_string()),
); );
let __progenitor_request = self.client.get(__progenitor_url).build()?; let request = self.client.get(url).build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200..=299 => Ok(ResponseValue::stream(__progenitor_response)), 200..=299 => Ok(ResponseValue::stream(response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -495,40 +495,40 @@ impl Client {
&'a self, &'a self,
body: &'a types::UserCreate, body: &'a types::UserCreate,
) -> Result<ResponseValue<types::UserCreateResult>, Error<()>> { ) -> Result<ResponseValue<types::UserCreateResult>, Error<()>> {
let __progenitor_url = format!("{}/v1/users", self.baseurl,); let url = format!("{}/v1/users", self.baseurl,);
let __progenitor_request = self let request = self
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await, 201u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
///Sends a `GET` request to `/v1/whoami` ///Sends a `GET` request to `/v1/whoami`
pub async fn whoami<'a>(&'a self) -> Result<ResponseValue<types::WhoamiResult>, Error<()>> { pub async fn whoami<'a>(&'a self) -> Result<ResponseValue<types::WhoamiResult>, Error<()>> {
let __progenitor_url = format!("{}/v1/whoami", self.baseurl,); let url = format!("{}/v1/whoami", self.baseurl,);
let __progenitor_request = self let request = self
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await, 200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -537,21 +537,21 @@ impl Client {
&'a self, &'a self,
body: &'a types::WorkerBootstrap, body: &'a types::WorkerBootstrap,
) -> Result<ResponseValue<types::WorkerBootstrapResult>, Error<()>> { ) -> Result<ResponseValue<types::WorkerBootstrapResult>, Error<()>> {
let __progenitor_url = format!("{}/v1/worker/bootstrap", self.baseurl,); let url = format!("{}/v1/worker/bootstrap", self.baseurl,);
let __progenitor_request = self let request = self
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await, 201u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -559,20 +559,20 @@ impl Client {
pub async fn worker_ping<'a>( pub async fn worker_ping<'a>(
&'a self, &'a self,
) -> Result<ResponseValue<types::WorkerPingResult>, Error<()>> { ) -> Result<ResponseValue<types::WorkerPingResult>, Error<()>> {
let __progenitor_url = format!("{}/v1/worker/ping", self.baseurl,); let url = format!("{}/v1/worker/ping", self.baseurl,);
let __progenitor_request = self let request = self
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await, 200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -582,17 +582,17 @@ impl Client {
task: &'a str, task: &'a str,
body: &'a types::WorkerAppendTask, body: &'a types::WorkerAppendTask,
) -> Result<ResponseValue<()>, Error<()>> { ) -> Result<ResponseValue<()>, Error<()>> {
let __progenitor_url = format!( let url = format!(
"{}/v1/worker/task/{}/append", "{}/v1/worker/task/{}/append",
self.baseurl, self.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = self.client.post(__progenitor_url).json(&body).build()?; let request = self.client.post(url).json(&body).build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
201u16 => Ok(ResponseValue::empty(__progenitor_response)), 201u16 => Ok(ResponseValue::empty(response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -602,14 +602,14 @@ impl Client {
task: &'a str, task: &'a str,
body: B, body: B,
) -> Result<ResponseValue<types::UploadedChunk>, Error<()>> { ) -> Result<ResponseValue<types::UploadedChunk>, Error<()>> {
let __progenitor_url = format!( let url = format!(
"{}/v1/worker/task/{}/chunk", "{}/v1/worker/task/{}/chunk",
self.baseurl, self.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = self let request = self
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
@ -620,11 +620,11 @@ impl Client {
) )
.body(body) .body(body)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await, 201u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -634,17 +634,17 @@ impl Client {
task: &'a str, task: &'a str,
body: &'a types::WorkerCompleteTask, body: &'a types::WorkerCompleteTask,
) -> Result<ResponseValue<()>, Error<()>> { ) -> Result<ResponseValue<()>, Error<()>> {
let __progenitor_url = format!( let url = format!(
"{}/v1/worker/task/{}/complete", "{}/v1/worker/task/{}/complete",
self.baseurl, self.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = self.client.post(__progenitor_url).json(&body).build()?; let request = self.client.post(url).json(&body).build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => Ok(ResponseValue::empty(__progenitor_response)), 200u16 => Ok(ResponseValue::empty(response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -654,17 +654,17 @@ impl Client {
task: &'a str, task: &'a str,
body: &'a types::WorkerAddOutput, body: &'a types::WorkerAddOutput,
) -> Result<ResponseValue<()>, Error<()>> { ) -> Result<ResponseValue<()>, Error<()>> {
let __progenitor_url = format!( let url = format!(
"{}/v1/worker/task/{}/output", "{}/v1/worker/task/{}/output",
self.baseurl, self.baseurl,
encode_path(&task.to_string()), encode_path(&task.to_string()),
); );
let __progenitor_request = self.client.post(__progenitor_url).json(&body).build()?; let request = self.client.post(url).json(&body).build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
201u16 => Ok(ResponseValue::empty(__progenitor_response)), 201u16 => Ok(ResponseValue::empty(response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -672,32 +672,32 @@ impl Client {
pub async fn workers_list<'a>( pub async fn workers_list<'a>(
&'a self, &'a self,
) -> Result<ResponseValue<types::WorkersResult>, Error<()>> { ) -> Result<ResponseValue<types::WorkersResult>, Error<()>> {
let __progenitor_url = format!("{}/v1/workers", self.baseurl,); let url = format!("{}/v1/workers", self.baseurl,);
let __progenitor_request = self let request = self
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await, 200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
///Sends a `POST` request to `/v1/workers/recycle` ///Sends a `POST` request to `/v1/workers/recycle`
pub async fn workers_recycle<'a>(&'a self) -> Result<ResponseValue<()>, Error<()>> { pub async fn workers_recycle<'a>(&'a self) -> Result<ResponseValue<()>, Error<()>> {
let __progenitor_url = format!("{}/v1/workers/recycle", self.baseurl,); let url = format!("{}/v1/workers/recycle", self.baseurl,);
let __progenitor_request = self.client.post(__progenitor_url).build()?; let request = self.client.post(url).build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => Ok(ResponseValue::empty(__progenitor_response)), 200u16 => Ok(ResponseValue::empty(response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
} }

View File

@ -1065,7 +1065,7 @@ pub mod builder {
///[`Client::enrol`]: super::Client::enrol ///[`Client::enrol`]: super::Client::enrol
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Enrol<'a> { pub struct Enrol<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
authorization: Result<String, String>, authorization: Result<String, String>,
body: Result<types::builder::EnrolBody, String>, body: Result<types::builder::EnrolBody, String>,
} }
@ -1073,7 +1073,7 @@ pub mod builder {
impl<'a> Enrol<'a> { impl<'a> Enrol<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
authorization: Err("authorization was not initialized".to_string()), authorization: Err("authorization was not initialized".to_string()),
body: Ok(types::builder::EnrolBody::default()), body: Ok(types::builder::EnrolBody::default()),
} }
@ -1111,7 +1111,7 @@ pub mod builder {
///Sends a `POST` request to `/enrol` ///Sends a `POST` request to `/enrol`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
authorization, authorization,
body, body,
} = self; } = self;
@ -1119,23 +1119,20 @@ pub mod builder {
let body = body let body = body
.and_then(std::convert::TryInto::<types::EnrolBody>::try_into) .and_then(std::convert::TryInto::<types::EnrolBody>::try_into)
.map_err(Error::InvalidRequest)?; .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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.json(&body) .json(&body)
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => Ok(ResponseValue::empty(response)),
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => Ok(ResponseValue::empty(__progenitor_response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1145,14 +1142,14 @@ pub mod builder {
///[`Client::global_jobs`]: super::Client::global_jobs ///[`Client::global_jobs`]: super::Client::global_jobs
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct GlobalJobs<'a> { pub struct GlobalJobs<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
authorization: Result<String, String>, authorization: Result<String, String>,
} }
impl<'a> GlobalJobs<'a> { impl<'a> GlobalJobs<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
authorization: Err("authorization was not initialized".to_string()), authorization: Err("authorization was not initialized".to_string()),
} }
} }
@ -1170,30 +1167,27 @@ pub mod builder {
///Sends a `GET` request to `/global/jobs` ///Sends a `GET` request to `/global/jobs`
pub async fn send(self) -> Result<ResponseValue<types::GlobalJobsResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::GlobalJobsResult>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
authorization, authorization,
} = self; } = self;
let authorization = authorization.map_err(Error::InvalidRequest)?; 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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = __progenitor_client let request = client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1203,14 +1197,14 @@ pub mod builder {
///[`Client::ping`]: super::Client::ping ///[`Client::ping`]: super::Client::ping
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Ping<'a> { pub struct Ping<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
authorization: Result<String, String>, authorization: Result<String, String>,
} }
impl<'a> Ping<'a> { impl<'a> Ping<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
authorization: Err("authorization was not initialized".to_string()), authorization: Err("authorization was not initialized".to_string()),
} }
} }
@ -1228,30 +1222,27 @@ pub mod builder {
///Sends a `GET` request to `/ping` ///Sends a `GET` request to `/ping`
pub async fn send(self) -> Result<ResponseValue<types::PingResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::PingResult>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
authorization, authorization,
} = self; } = self;
let authorization = authorization.map_err(Error::InvalidRequest)?; 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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = __progenitor_client let request = client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1261,7 +1252,7 @@ pub mod builder {
///[`Client::report_finish`]: super::Client::report_finish ///[`Client::report_finish`]: super::Client::report_finish
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ReportFinish<'a> { pub struct ReportFinish<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
authorization: Result<String, String>, authorization: Result<String, String>,
body: Result<types::builder::ReportFinishBody, String>, body: Result<types::builder::ReportFinishBody, String>,
} }
@ -1269,7 +1260,7 @@ pub mod builder {
impl<'a> ReportFinish<'a> { impl<'a> ReportFinish<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
authorization: Err("authorization was not initialized".to_string()), authorization: Err("authorization was not initialized".to_string()),
body: Ok(types::builder::ReportFinishBody::default()), body: Ok(types::builder::ReportFinishBody::default()),
} }
@ -1309,7 +1300,7 @@ pub mod builder {
///Sends a `POST` request to `/report/finish` ///Sends a `POST` request to `/report/finish`
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
authorization, authorization,
body, body,
} = self; } = self;
@ -1317,12 +1308,12 @@ pub mod builder {
let body = body let body = body
.and_then(std::convert::TryInto::<types::ReportFinishBody>::try_into) .and_then(std::convert::TryInto::<types::ReportFinishBody>::try_into)
.map_err(Error::InvalidRequest)?; .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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
@ -1330,14 +1321,11 @@ pub mod builder {
.json(&body) .json(&body)
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1347,7 +1335,7 @@ pub mod builder {
///[`Client::report_output`]: super::Client::report_output ///[`Client::report_output`]: super::Client::report_output
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ReportOutput<'a> { pub struct ReportOutput<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
authorization: Result<String, String>, authorization: Result<String, String>,
body: Result<types::builder::ReportOutputBody, String>, body: Result<types::builder::ReportOutputBody, String>,
} }
@ -1355,7 +1343,7 @@ pub mod builder {
impl<'a> ReportOutput<'a> { impl<'a> ReportOutput<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
authorization: Err("authorization was not initialized".to_string()), authorization: Err("authorization was not initialized".to_string()),
body: Ok(types::builder::ReportOutputBody::default()), body: Ok(types::builder::ReportOutputBody::default()),
} }
@ -1395,7 +1383,7 @@ pub mod builder {
///Sends a `POST` request to `/report/output` ///Sends a `POST` request to `/report/output`
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
authorization, authorization,
body, body,
} = self; } = self;
@ -1403,12 +1391,12 @@ pub mod builder {
let body = body let body = body
.and_then(std::convert::TryInto::<types::ReportOutputBody>::try_into) .and_then(std::convert::TryInto::<types::ReportOutputBody>::try_into)
.map_err(Error::InvalidRequest)?; .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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
@ -1416,14 +1404,11 @@ pub mod builder {
.json(&body) .json(&body)
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1433,7 +1418,7 @@ pub mod builder {
///[`Client::report_start`]: super::Client::report_start ///[`Client::report_start`]: super::Client::report_start
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ReportStart<'a> { pub struct ReportStart<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
authorization: Result<String, String>, authorization: Result<String, String>,
body: Result<types::builder::ReportStartBody, String>, body: Result<types::builder::ReportStartBody, String>,
} }
@ -1441,7 +1426,7 @@ pub mod builder {
impl<'a> ReportStart<'a> { impl<'a> ReportStart<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
authorization: Err("authorization was not initialized".to_string()), authorization: Err("authorization was not initialized".to_string()),
body: Ok(types::builder::ReportStartBody::default()), body: Ok(types::builder::ReportStartBody::default()),
} }
@ -1479,7 +1464,7 @@ pub mod builder {
///Sends a `POST` request to `/report/start` ///Sends a `POST` request to `/report/start`
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
authorization, authorization,
body, body,
} = self; } = self;
@ -1487,12 +1472,12 @@ pub mod builder {
let body = body let body = body
.and_then(std::convert::TryInto::<types::ReportStartBody>::try_into) .and_then(std::convert::TryInto::<types::ReportStartBody>::try_into)
.map_err(Error::InvalidRequest)?; .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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
@ -1500,14 +1485,11 @@ pub mod builder {
.json(&body) .json(&body)
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }

View File

@ -1065,7 +1065,7 @@ pub mod builder {
///[`Client::enrol`]: super::Client::enrol ///[`Client::enrol`]: super::Client::enrol
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Enrol<'a> { pub struct Enrol<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
authorization: Result<String, String>, authorization: Result<String, String>,
body: Result<types::builder::EnrolBody, String>, body: Result<types::builder::EnrolBody, String>,
} }
@ -1073,7 +1073,7 @@ pub mod builder {
impl<'a> Enrol<'a> { impl<'a> Enrol<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
authorization: Err("authorization was not initialized".to_string()), authorization: Err("authorization was not initialized".to_string()),
body: Ok(types::builder::EnrolBody::default()), body: Ok(types::builder::EnrolBody::default()),
} }
@ -1111,7 +1111,7 @@ pub mod builder {
///Sends a `POST` request to `/enrol` ///Sends a `POST` request to `/enrol`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
authorization, authorization,
body, body,
} = self; } = self;
@ -1119,23 +1119,20 @@ pub mod builder {
let body = body let body = body
.and_then(std::convert::TryInto::<types::EnrolBody>::try_into) .and_then(std::convert::TryInto::<types::EnrolBody>::try_into)
.map_err(Error::InvalidRequest)?; .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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.json(&body) .json(&body)
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => Ok(ResponseValue::empty(response)),
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => Ok(ResponseValue::empty(__progenitor_response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1145,14 +1142,14 @@ pub mod builder {
///[`Client::global_jobs`]: super::Client::global_jobs ///[`Client::global_jobs`]: super::Client::global_jobs
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct GlobalJobs<'a> { pub struct GlobalJobs<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
authorization: Result<String, String>, authorization: Result<String, String>,
} }
impl<'a> GlobalJobs<'a> { impl<'a> GlobalJobs<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
authorization: Err("authorization was not initialized".to_string()), authorization: Err("authorization was not initialized".to_string()),
} }
} }
@ -1170,30 +1167,27 @@ pub mod builder {
///Sends a `GET` request to `/global/jobs` ///Sends a `GET` request to `/global/jobs`
pub async fn send(self) -> Result<ResponseValue<types::GlobalJobsResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::GlobalJobsResult>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
authorization, authorization,
} = self; } = self;
let authorization = authorization.map_err(Error::InvalidRequest)?; 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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = __progenitor_client let request = client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1203,14 +1197,14 @@ pub mod builder {
///[`Client::ping`]: super::Client::ping ///[`Client::ping`]: super::Client::ping
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Ping<'a> { pub struct Ping<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
authorization: Result<String, String>, authorization: Result<String, String>,
} }
impl<'a> Ping<'a> { impl<'a> Ping<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
authorization: Err("authorization was not initialized".to_string()), authorization: Err("authorization was not initialized".to_string()),
} }
} }
@ -1228,30 +1222,27 @@ pub mod builder {
///Sends a `GET` request to `/ping` ///Sends a `GET` request to `/ping`
pub async fn send(self) -> Result<ResponseValue<types::PingResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::PingResult>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
authorization, authorization,
} = self; } = self;
let authorization = authorization.map_err(Error::InvalidRequest)?; 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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = __progenitor_client let request = client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1261,7 +1252,7 @@ pub mod builder {
///[`Client::report_finish`]: super::Client::report_finish ///[`Client::report_finish`]: super::Client::report_finish
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ReportFinish<'a> { pub struct ReportFinish<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
authorization: Result<String, String>, authorization: Result<String, String>,
body: Result<types::builder::ReportFinishBody, String>, body: Result<types::builder::ReportFinishBody, String>,
} }
@ -1269,7 +1260,7 @@ pub mod builder {
impl<'a> ReportFinish<'a> { impl<'a> ReportFinish<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
authorization: Err("authorization was not initialized".to_string()), authorization: Err("authorization was not initialized".to_string()),
body: Ok(types::builder::ReportFinishBody::default()), body: Ok(types::builder::ReportFinishBody::default()),
} }
@ -1309,7 +1300,7 @@ pub mod builder {
///Sends a `POST` request to `/report/finish` ///Sends a `POST` request to `/report/finish`
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
authorization, authorization,
body, body,
} = self; } = self;
@ -1317,12 +1308,12 @@ pub mod builder {
let body = body let body = body
.and_then(std::convert::TryInto::<types::ReportFinishBody>::try_into) .and_then(std::convert::TryInto::<types::ReportFinishBody>::try_into)
.map_err(Error::InvalidRequest)?; .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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
@ -1330,14 +1321,11 @@ pub mod builder {
.json(&body) .json(&body)
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1347,7 +1335,7 @@ pub mod builder {
///[`Client::report_output`]: super::Client::report_output ///[`Client::report_output`]: super::Client::report_output
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ReportOutput<'a> { pub struct ReportOutput<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
authorization: Result<String, String>, authorization: Result<String, String>,
body: Result<types::builder::ReportOutputBody, String>, body: Result<types::builder::ReportOutputBody, String>,
} }
@ -1355,7 +1343,7 @@ pub mod builder {
impl<'a> ReportOutput<'a> { impl<'a> ReportOutput<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
authorization: Err("authorization was not initialized".to_string()), authorization: Err("authorization was not initialized".to_string()),
body: Ok(types::builder::ReportOutputBody::default()), body: Ok(types::builder::ReportOutputBody::default()),
} }
@ -1395,7 +1383,7 @@ pub mod builder {
///Sends a `POST` request to `/report/output` ///Sends a `POST` request to `/report/output`
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
authorization, authorization,
body, body,
} = self; } = self;
@ -1403,12 +1391,12 @@ pub mod builder {
let body = body let body = body
.and_then(std::convert::TryInto::<types::ReportOutputBody>::try_into) .and_then(std::convert::TryInto::<types::ReportOutputBody>::try_into)
.map_err(Error::InvalidRequest)?; .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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
@ -1416,14 +1404,11 @@ pub mod builder {
.json(&body) .json(&body)
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -1433,7 +1418,7 @@ pub mod builder {
///[`Client::report_start`]: super::Client::report_start ///[`Client::report_start`]: super::Client::report_start
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ReportStart<'a> { pub struct ReportStart<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
authorization: Result<String, String>, authorization: Result<String, String>,
body: Result<types::builder::ReportStartBody, String>, body: Result<types::builder::ReportStartBody, String>,
} }
@ -1441,7 +1426,7 @@ pub mod builder {
impl<'a> ReportStart<'a> { impl<'a> ReportStart<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
authorization: Err("authorization was not initialized".to_string()), authorization: Err("authorization was not initialized".to_string()),
body: Ok(types::builder::ReportStartBody::default()), body: Ok(types::builder::ReportStartBody::default()),
} }
@ -1479,7 +1464,7 @@ pub mod builder {
///Sends a `POST` request to `/report/start` ///Sends a `POST` request to `/report/start`
pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<types::ReportResult>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
authorization, authorization,
body, body,
} = self; } = self;
@ -1487,12 +1472,12 @@ pub mod builder {
let body = body let body = body
.and_then(std::convert::TryInto::<types::ReportStartBody>::try_into) .and_then(std::convert::TryInto::<types::ReportStartBody>::try_into)
.map_err(Error::InvalidRequest)?; .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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
@ -1500,14 +1485,11 @@ pub mod builder {
.json(&body) .json(&body)
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?; _ => Err(Error::UnexpectedResponse(response)),
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }

View File

@ -210,20 +210,20 @@ impl Client {
authorization: &'a str, authorization: &'a str,
body: &'a types::EnrolBody, body: &'a types::EnrolBody,
) -> Result<ResponseValue<()>, Error<()>> { ) -> Result<ResponseValue<()>, Error<()>> {
let __progenitor_url = format!("{}/enrol", self.baseurl,); let url = format!("{}/enrol", self.baseurl,);
let mut header_map = HeaderMap::with_capacity(1usize); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = self let request = self
.client .client
.post(__progenitor_url) .post(url)
.json(&body) .json(&body)
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
201u16 => Ok(ResponseValue::empty(__progenitor_response)), 201u16 => Ok(ResponseValue::empty(response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -235,23 +235,23 @@ impl Client {
&'a self, &'a self,
authorization: &'a str, authorization: &'a str,
) -> Result<ResponseValue<types::GlobalJobsResult>, Error<()>> { ) -> 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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = self let request = self
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await, 201u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -263,23 +263,23 @@ impl Client {
&'a self, &'a self,
authorization: &'a str, authorization: &'a str,
) -> Result<ResponseValue<types::PingResult>, Error<()>> { ) -> 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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = self let request = self
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await, 201u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -293,12 +293,12 @@ impl Client {
authorization: &'a str, authorization: &'a str,
body: &'a types::ReportFinishBody, body: &'a types::ReportFinishBody,
) -> Result<ResponseValue<types::ReportResult>, Error<()>> { ) -> 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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = self let request = self
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
@ -306,11 +306,11 @@ impl Client {
.json(&body) .json(&body)
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await, 201u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -324,12 +324,12 @@ impl Client {
authorization: &'a str, authorization: &'a str,
body: &'a types::ReportOutputBody, body: &'a types::ReportOutputBody,
) -> Result<ResponseValue<types::ReportResult>, Error<()>> { ) -> 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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = self let request = self
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
@ -337,11 +337,11 @@ impl Client {
.json(&body) .json(&body)
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await, 201u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -355,12 +355,12 @@ impl Client {
authorization: &'a str, authorization: &'a str,
body: &'a types::ReportStartBody, body: &'a types::ReportStartBody,
) -> Result<ResponseValue<types::ReportResult>, Error<()>> { ) -> 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); let mut header_map = HeaderMap::with_capacity(1usize);
header_map.append("Authorization", HeaderValue::try_from(authorization)?); header_map.append("Authorization", HeaderValue::try_from(authorization)?);
let __progenitor_request = self let request = self
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
@ -368,11 +368,11 @@ impl Client {
.json(&body) .json(&body)
.headers(header_map) .headers(header_map)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await, 201u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => 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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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()
}
}

View File

@ -0,0 +1,84 @@
pub mod operations {
#![doc = r" [`When`](httpmock::When) 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),
)
})
}
}

View File

@ -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;
}

View File

@ -104,7 +104,7 @@ pub mod builder {
///[`Client::key_get`]: super::Client::key_get ///[`Client::key_get`]: super::Client::key_get
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct KeyGet<'a> { pub struct KeyGet<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
key: Result<Option<bool>, String>, key: Result<Option<bool>, String>,
unique_key: Result<Option<String>, String>, unique_key: Result<Option<String>, String>,
} }
@ -112,7 +112,7 @@ pub mod builder {
impl<'a> KeyGet<'a> { impl<'a> KeyGet<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
key: Ok(None), key: Ok(None),
unique_key: Ok(None), unique_key: Ok(None),
} }
@ -143,33 +143,26 @@ pub mod builder {
///Sends a `GET` request to `/key` ///Sends a `GET` request to `/key`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
key, key,
unique_key, unique_key,
} = self; } = self;
let key = key.map_err(Error::InvalidRequest)?; let key = key.map_err(Error::InvalidRequest)?;
let unique_key = unique_key.map_err(Error::InvalidRequest)?; let unique_key = unique_key.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!("{}/key", __progenitor_client.baseurl,); let url = format!("{}/key", client.baseurl,);
let mut __progenitor_query = Vec::with_capacity(2usize); let mut query = Vec::with_capacity(2usize);
if let Some(v) = &key { if let Some(v) = &key {
__progenitor_query.push(("key", v.to_string())); query.push(("key", v.to_string()));
} }
if let Some(v) = &unique_key { if let Some(v) = &unique_key {
__progenitor_query.push(("uniqueKey", v.to_string())); query.push(("uniqueKey", v.to_string()));
} }
let __progenitor_request = __progenitor_client let request = client.client.get(url).query(&query).build()?;
.client let result = client.client.execute(request).await;
.get(__progenitor_url) let response = result?;
.query(&__progenitor_query) match response.status().as_u16() {
.build()?; 200u16 => Ok(ResponseValue::empty(response)),
let __progenitor_result = __progenitor_client _ => Err(Error::UnexpectedResponse(response)),
.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)),
} }
} }
} }

View File

@ -104,7 +104,7 @@ pub mod builder {
///[`Client::key_get`]: super::Client::key_get ///[`Client::key_get`]: super::Client::key_get
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct KeyGet<'a> { pub struct KeyGet<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
key: Result<Option<bool>, String>, key: Result<Option<bool>, String>,
unique_key: Result<Option<String>, String>, unique_key: Result<Option<String>, String>,
} }
@ -112,7 +112,7 @@ pub mod builder {
impl<'a> KeyGet<'a> { impl<'a> KeyGet<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
key: Ok(None), key: Ok(None),
unique_key: Ok(None), unique_key: Ok(None),
} }
@ -143,33 +143,26 @@ pub mod builder {
///Sends a `GET` request to `/key` ///Sends a `GET` request to `/key`
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self { let Self {
__progenitor_client, client,
key, key,
unique_key, unique_key,
} = self; } = self;
let key = key.map_err(Error::InvalidRequest)?; let key = key.map_err(Error::InvalidRequest)?;
let unique_key = unique_key.map_err(Error::InvalidRequest)?; let unique_key = unique_key.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!("{}/key", __progenitor_client.baseurl,); let url = format!("{}/key", client.baseurl,);
let mut __progenitor_query = Vec::with_capacity(2usize); let mut query = Vec::with_capacity(2usize);
if let Some(v) = &key { if let Some(v) = &key {
__progenitor_query.push(("key", v.to_string())); query.push(("key", v.to_string()));
} }
if let Some(v) = &unique_key { if let Some(v) = &unique_key {
__progenitor_query.push(("uniqueKey", v.to_string())); query.push(("uniqueKey", v.to_string()));
} }
let __progenitor_request = __progenitor_client let request = client.client.get(url).query(&query).build()?;
.client let result = client.client.execute(request).await;
.get(__progenitor_url) let response = result?;
.query(&__progenitor_query) match response.status().as_u16() {
.build()?; 200u16 => Ok(ResponseValue::empty(response)),
let __progenitor_result = __progenitor_client _ => Err(Error::UnexpectedResponse(response)),
.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)),
} }
} }
} }

View File

@ -86,26 +86,22 @@ impl Client {
key: Option<bool>, key: Option<bool>,
unique_key: Option<&'a str>, unique_key: Option<&'a str>,
) -> Result<ResponseValue<()>, Error<()>> { ) -> Result<ResponseValue<()>, Error<()>> {
let __progenitor_url = format!("{}/key", self.baseurl,); let url = format!("{}/key", self.baseurl,);
let mut __progenitor_query = Vec::with_capacity(2usize); let mut query = Vec::with_capacity(2usize);
if let Some(v) = &key { if let Some(v) = &key {
__progenitor_query.push(("key", v.to_string())); query.push(("key", v.to_string()));
} }
if let Some(v) = &unique_key { if let Some(v) = &unique_key {
__progenitor_query.push(("uniqueKey", v.to_string())); query.push(("uniqueKey", v.to_string()));
} }
let __progenitor_request = self let request = self.client.get(url).query(&query).build()?;
.client let result = self.client.execute(request).await;
.get(__progenitor_url) let response = result?;
.query(&__progenitor_query) match response.status().as_u16() {
.build()?; 200u16 => Ok(ResponseValue::empty(response)),
let __progenitor_result = self.client.execute(__progenitor_request).await; _ => Err(Error::UnexpectedResponse(response)),
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
200u16 => Ok(ResponseValue::empty(__progenitor_response)),
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }

View File

@ -2113,46 +2113,39 @@ pub mod builder {
///[`Client::instance_get`]: super::Client::instance_get ///[`Client::instance_get`]: super::Client::instance_get
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InstanceGet<'a> { pub struct InstanceGet<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> InstanceGet<'a> { impl<'a> InstanceGet<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `GET` request to `/instance` ///Sends a `GET` request to `/instance`
pub async fn send( pub async fn send(
self, self,
) -> Result<ResponseValue<types::InstanceGetResponse>, Error<types::Error>> { ) -> Result<ResponseValue<types::InstanceGetResponse>, Error<types::Error>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/instance", client.baseurl,);
} = self; let request = client
let __progenitor_url = format!("{}/instance", __progenitor_client.baseurl,);
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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 ///[`Client::instance_ensure`]: super::Client::instance_ensure
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InstanceEnsure<'a> { pub struct InstanceEnsure<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::builder::InstanceEnsureRequest, String>, body: Result<types::builder::InstanceEnsureRequest, String>,
} }
impl<'a> InstanceEnsure<'a> { impl<'a> InstanceEnsure<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Ok(types::builder::InstanceEnsureRequest::default()), body: Ok(types::builder::InstanceEnsureRequest::default()),
} }
} }
@ -2199,37 +2192,31 @@ pub mod builder {
pub async fn send( pub async fn send(
self, self,
) -> Result<ResponseValue<types::InstanceEnsureResponse>, Error<types::Error>> { ) -> Result<ResponseValue<types::InstanceEnsureResponse>, Error<types::Error>> {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body let body = body
.and_then(std::convert::TryInto::<types::InstanceEnsureRequest>::try_into) .and_then(std::convert::TryInto::<types::InstanceEnsureRequest>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!("{}/instance", __progenitor_client.baseurl,); let url = format!("{}/instance", client.baseurl,);
let __progenitor_request = __progenitor_client let request = client
.client .client
.put(__progenitor_url) .put(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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 ///[`Client::instance_issue_crucible_snapshot_request`]: super::Client::instance_issue_crucible_snapshot_request
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InstanceIssueCrucibleSnapshotRequest<'a> { pub struct InstanceIssueCrucibleSnapshotRequest<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
id: Result<uuid::Uuid, String>, id: Result<uuid::Uuid, String>,
snapshot_id: Result<uuid::Uuid, String>, snapshot_id: Result<uuid::Uuid, String>,
} }
@ -2247,7 +2234,7 @@ pub mod builder {
impl<'a> InstanceIssueCrucibleSnapshotRequest<'a> { impl<'a> InstanceIssueCrucibleSnapshotRequest<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
id: Err("id was not initialized".to_string()), id: Err("id was not initialized".to_string()),
snapshot_id: Err("snapshot_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}` /// `/instance/disk/{id}/snapshot/{snapshot_id}`
pub async fn send(self) -> Result<ResponseValue<()>, Error<types::Error>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<types::Error>> {
let Self { let Self {
__progenitor_client, client,
id, id,
snapshot_id, snapshot_id,
} = self; } = self;
let id = id.map_err(Error::InvalidRequest)?; let id = id.map_err(Error::InvalidRequest)?;
let snapshot_id = snapshot_id.map_err(Error::InvalidRequest)?; let snapshot_id = snapshot_id.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/instance/disk/{}/snapshot/{}", "{}/instance/disk/{}/snapshot/{}",
__progenitor_client.baseurl, client.baseurl,
encode_path(&id.to_string()), encode_path(&id.to_string()),
encode_path(&snapshot_id.to_string()), encode_path(&snapshot_id.to_string()),
); );
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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 ///[`Client::instance_migrate_status`]: super::Client::instance_migrate_status
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InstanceMigrateStatus<'a> { pub struct InstanceMigrateStatus<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::builder::InstanceMigrateStatusRequest, String>, body: Result<types::builder::InstanceMigrateStatusRequest, String>,
} }
impl<'a> InstanceMigrateStatus<'a> { impl<'a> InstanceMigrateStatus<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Ok(types::builder::InstanceMigrateStatusRequest::default()), body: Ok(types::builder::InstanceMigrateStatusRequest::default()),
} }
} }
@ -2357,38 +2341,31 @@ pub mod builder {
self, self,
) -> Result<ResponseValue<types::InstanceMigrateStatusResponse>, Error<types::Error>> ) -> Result<ResponseValue<types::InstanceMigrateStatusResponse>, Error<types::Error>>
{ {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body let body = body
.and_then(std::convert::TryInto::<types::InstanceMigrateStatusRequest>::try_into) .and_then(std::convert::TryInto::<types::InstanceMigrateStatusRequest>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = let url = format!("{}/instance/migrate/status", client.baseurl,);
format!("{}/instance/migrate/status", __progenitor_client.baseurl,); let request = client
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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 ///[`Client::instance_serial`]: super::Client::instance_serial
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InstanceSerial<'a> { pub struct InstanceSerial<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> InstanceSerial<'a> { impl<'a> InstanceSerial<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `GET` request to `/instance/serial` ///Sends a `GET` request to `/instance/serial`
pub async fn send( pub async fn send(
self, self,
) -> Result<ResponseValue<reqwest::Upgraded>, Error<reqwest::Upgraded>> { ) -> Result<ResponseValue<reqwest::Upgraded>, Error<reqwest::Upgraded>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/instance/serial", client.baseurl,);
} = self; let request = client
let __progenitor_url = format!("{}/instance/serial", __progenitor_client.baseurl,);
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header(reqwest::header::CONNECTION, "Upgrade") .header(reqwest::header::CONNECTION, "Upgrade")
.header(reqwest::header::UPGRADE, "websocket") .header(reqwest::header::UPGRADE, "websocket")
.header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13")
@ -2430,15 +2403,12 @@ pub mod builder {
), ),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 101u16 => ResponseValue::upgrade(response).await,
let __progenitor_response = __progenitor_result?; 200..=299 => ResponseValue::upgrade(response).await,
match __progenitor_response.status().as_u16() { _ => Err(Error::UnexpectedResponse(response)),
101u16 => ResponseValue::upgrade(__progenitor_response).await,
200..=299 => ResponseValue::upgrade(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2448,14 +2418,14 @@ pub mod builder {
///[`Client::instance_state_put`]: super::Client::instance_state_put ///[`Client::instance_state_put`]: super::Client::instance_state_put
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InstanceStatePut<'a> { pub struct InstanceStatePut<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::InstanceStateRequested, String>, body: Result<types::InstanceStateRequested, String>,
} }
impl<'a> InstanceStatePut<'a> { impl<'a> InstanceStatePut<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Err("body was not initialized".to_string()), body: Err("body was not initialized".to_string()),
} }
} }
@ -2472,35 +2442,29 @@ pub mod builder {
///Sends a `PUT` request to `/instance/state` ///Sends a `PUT` request to `/instance/state`
pub async fn send(self) -> Result<ResponseValue<()>, Error<types::Error>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<types::Error>> {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!("{}/instance/state", __progenitor_client.baseurl,); let url = format!("{}/instance/state", client.baseurl,);
let __progenitor_request = __progenitor_client let request = client
.client .client
.put(__progenitor_url) .put(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 204u16 => Ok(ResponseValue::empty(response)),
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
204u16 => Ok(ResponseValue::empty(__progenitor_response)),
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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 ///[`Client::instance_state_monitor`]: super::Client::instance_state_monitor
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InstanceStateMonitor<'a> { pub struct InstanceStateMonitor<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::builder::InstanceStateMonitorRequest, String>, body: Result<types::builder::InstanceStateMonitorRequest, String>,
} }
impl<'a> InstanceStateMonitor<'a> { impl<'a> InstanceStateMonitor<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Ok(types::builder::InstanceStateMonitorRequest::default()), body: Ok(types::builder::InstanceStateMonitorRequest::default()),
} }
} }
@ -2547,38 +2511,31 @@ pub mod builder {
self, self,
) -> Result<ResponseValue<types::InstanceStateMonitorResponse>, Error<types::Error>> ) -> Result<ResponseValue<types::InstanceStateMonitorResponse>, Error<types::Error>>
{ {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body let body = body
.and_then(std::convert::TryInto::<types::InstanceStateMonitorRequest>::try_into) .and_then(std::convert::TryInto::<types::InstanceStateMonitorRequest>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = let url = format!("{}/instance/state-monitor", client.baseurl,);
format!("{}/instance/state-monitor", __progenitor_client.baseurl,); let request = client
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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)),
} }
} }
} }

View File

@ -2119,46 +2119,39 @@ pub mod builder {
///[`Client::instance_get`]: super::Client::instance_get ///[`Client::instance_get`]: super::Client::instance_get
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InstanceGet<'a> { pub struct InstanceGet<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> InstanceGet<'a> { impl<'a> InstanceGet<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `GET` request to `/instance` ///Sends a `GET` request to `/instance`
pub async fn send( pub async fn send(
self, self,
) -> Result<ResponseValue<types::InstanceGetResponse>, Error<types::Error>> { ) -> Result<ResponseValue<types::InstanceGetResponse>, Error<types::Error>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/instance", client.baseurl,);
} = self; let request = client
let __progenitor_url = format!("{}/instance", __progenitor_client.baseurl,);
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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 ///[`Client::instance_ensure`]: super::Client::instance_ensure
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InstanceEnsure<'a> { pub struct InstanceEnsure<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::builder::InstanceEnsureRequest, String>, body: Result<types::builder::InstanceEnsureRequest, String>,
} }
impl<'a> InstanceEnsure<'a> { impl<'a> InstanceEnsure<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Ok(types::builder::InstanceEnsureRequest::default()), body: Ok(types::builder::InstanceEnsureRequest::default()),
} }
} }
@ -2205,37 +2198,31 @@ pub mod builder {
pub async fn send( pub async fn send(
self, self,
) -> Result<ResponseValue<types::InstanceEnsureResponse>, Error<types::Error>> { ) -> Result<ResponseValue<types::InstanceEnsureResponse>, Error<types::Error>> {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body let body = body
.and_then(std::convert::TryInto::<types::InstanceEnsureRequest>::try_into) .and_then(std::convert::TryInto::<types::InstanceEnsureRequest>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!("{}/instance", __progenitor_client.baseurl,); let url = format!("{}/instance", client.baseurl,);
let __progenitor_request = __progenitor_client let request = client
.client .client
.put(__progenitor_url) .put(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 201u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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 ///[`Client::instance_issue_crucible_snapshot_request`]: super::Client::instance_issue_crucible_snapshot_request
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InstanceIssueCrucibleSnapshotRequest<'a> { pub struct InstanceIssueCrucibleSnapshotRequest<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
id: Result<uuid::Uuid, String>, id: Result<uuid::Uuid, String>,
snapshot_id: Result<uuid::Uuid, String>, snapshot_id: Result<uuid::Uuid, String>,
} }
@ -2253,7 +2240,7 @@ pub mod builder {
impl<'a> InstanceIssueCrucibleSnapshotRequest<'a> { impl<'a> InstanceIssueCrucibleSnapshotRequest<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
id: Err("id was not initialized".to_string()), id: Err("id was not initialized".to_string()),
snapshot_id: Err("snapshot_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}` /// `/instance/disk/{id}/snapshot/{snapshot_id}`
pub async fn send(self) -> Result<ResponseValue<()>, Error<types::Error>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<types::Error>> {
let Self { let Self {
__progenitor_client, client,
id, id,
snapshot_id, snapshot_id,
} = self; } = self;
let id = id.map_err(Error::InvalidRequest)?; let id = id.map_err(Error::InvalidRequest)?;
let snapshot_id = snapshot_id.map_err(Error::InvalidRequest)?; let snapshot_id = snapshot_id.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!( let url = format!(
"{}/instance/disk/{}/snapshot/{}", "{}/instance/disk/{}/snapshot/{}",
__progenitor_client.baseurl, client.baseurl,
encode_path(&id.to_string()), encode_path(&id.to_string()),
encode_path(&snapshot_id.to_string()), encode_path(&snapshot_id.to_string()),
); );
let __progenitor_request = __progenitor_client let request = client
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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 ///[`Client::instance_migrate_status`]: super::Client::instance_migrate_status
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InstanceMigrateStatus<'a> { pub struct InstanceMigrateStatus<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::builder::InstanceMigrateStatusRequest, String>, body: Result<types::builder::InstanceMigrateStatusRequest, String>,
} }
impl<'a> InstanceMigrateStatus<'a> { impl<'a> InstanceMigrateStatus<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Ok(types::builder::InstanceMigrateStatusRequest::default()), body: Ok(types::builder::InstanceMigrateStatusRequest::default()),
} }
} }
@ -2363,38 +2347,31 @@ pub mod builder {
self, self,
) -> Result<ResponseValue<types::InstanceMigrateStatusResponse>, Error<types::Error>> ) -> Result<ResponseValue<types::InstanceMigrateStatusResponse>, Error<types::Error>>
{ {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body let body = body
.and_then(std::convert::TryInto::<types::InstanceMigrateStatusRequest>::try_into) .and_then(std::convert::TryInto::<types::InstanceMigrateStatusRequest>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = let url = format!("{}/instance/migrate/status", client.baseurl,);
format!("{}/instance/migrate/status", __progenitor_client.baseurl,); let request = client
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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 ///[`Client::instance_serial`]: super::Client::instance_serial
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InstanceSerial<'a> { pub struct InstanceSerial<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
} }
impl<'a> InstanceSerial<'a> { impl<'a> InstanceSerial<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self { client: client }
__progenitor_client: client,
}
} }
///Sends a `GET` request to `/instance/serial` ///Sends a `GET` request to `/instance/serial`
pub async fn send( pub async fn send(
self, self,
) -> Result<ResponseValue<reqwest::Upgraded>, Error<reqwest::Upgraded>> { ) -> Result<ResponseValue<reqwest::Upgraded>, Error<reqwest::Upgraded>> {
let Self { let Self { client } = self;
__progenitor_client, let url = format!("{}/instance/serial", client.baseurl,);
} = self; let request = client
let __progenitor_url = format!("{}/instance/serial", __progenitor_client.baseurl,);
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header(reqwest::header::CONNECTION, "Upgrade") .header(reqwest::header::CONNECTION, "Upgrade")
.header(reqwest::header::UPGRADE, "websocket") .header(reqwest::header::UPGRADE, "websocket")
.header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13")
@ -2436,15 +2409,12 @@ pub mod builder {
), ),
) )
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 101u16 => ResponseValue::upgrade(response).await,
let __progenitor_response = __progenitor_result?; 200..=299 => ResponseValue::upgrade(response).await,
match __progenitor_response.status().as_u16() { _ => Err(Error::UnexpectedResponse(response)),
101u16 => ResponseValue::upgrade(__progenitor_response).await,
200..=299 => ResponseValue::upgrade(__progenitor_response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)),
} }
} }
} }
@ -2454,14 +2424,14 @@ pub mod builder {
///[`Client::instance_state_put`]: super::Client::instance_state_put ///[`Client::instance_state_put`]: super::Client::instance_state_put
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InstanceStatePut<'a> { pub struct InstanceStatePut<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::InstanceStateRequested, String>, body: Result<types::InstanceStateRequested, String>,
} }
impl<'a> InstanceStatePut<'a> { impl<'a> InstanceStatePut<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Err("body was not initialized".to_string()), body: Err("body was not initialized".to_string()),
} }
} }
@ -2478,35 +2448,29 @@ pub mod builder {
///Sends a `PUT` request to `/instance/state` ///Sends a `PUT` request to `/instance/state`
pub async fn send(self) -> Result<ResponseValue<()>, Error<types::Error>> { pub async fn send(self) -> Result<ResponseValue<()>, Error<types::Error>> {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?;
let __progenitor_url = format!("{}/instance/state", __progenitor_client.baseurl,); let url = format!("{}/instance/state", client.baseurl,);
let __progenitor_request = __progenitor_client let request = client
.client .client
.put(__progenitor_url) .put(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 204u16 => Ok(ResponseValue::empty(response)),
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
204u16 => Ok(ResponseValue::empty(__progenitor_response)),
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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 ///[`Client::instance_state_monitor`]: super::Client::instance_state_monitor
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct InstanceStateMonitor<'a> { pub struct InstanceStateMonitor<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::builder::InstanceStateMonitorRequest, String>, body: Result<types::builder::InstanceStateMonitorRequest, String>,
} }
impl<'a> InstanceStateMonitor<'a> { impl<'a> InstanceStateMonitor<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Ok(types::builder::InstanceStateMonitorRequest::default()), body: Ok(types::builder::InstanceStateMonitorRequest::default()),
} }
} }
@ -2553,38 +2517,31 @@ pub mod builder {
self, self,
) -> Result<ResponseValue<types::InstanceStateMonitorResponse>, Error<types::Error>> ) -> Result<ResponseValue<types::InstanceStateMonitorResponse>, Error<types::Error>>
{ {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body let body = body
.and_then(std::convert::TryInto::<types::InstanceStateMonitorRequest>::try_into) .and_then(std::convert::TryInto::<types::InstanceStateMonitorRequest>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = let url = format!("{}/instance/state-monitor", client.baseurl,);
format!("{}/instance/state-monitor", __progenitor_client.baseurl,); let request = client
let __progenitor_request = __progenitor_client
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = __progenitor_client let result = client.client.execute(request).await;
.client let response = result?;
.execute(__progenitor_request) match response.status().as_u16() {
.await; 200u16 => ResponseValue::from_response(response).await,
let __progenitor_response = __progenitor_result?;
match __progenitor_response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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)),
} }
} }
} }

View File

@ -671,26 +671,26 @@ impl Client {
pub async fn instance_get<'a>( pub async fn instance_get<'a>(
&'a self, &'a self,
) -> Result<ResponseValue<types::InstanceGetResponse>, Error<types::Error>> { ) -> Result<ResponseValue<types::InstanceGetResponse>, Error<types::Error>> {
let __progenitor_url = format!("{}/instance", self.baseurl,); let url = format!("{}/instance", self.baseurl,);
let __progenitor_request = self let request = self
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await, 200u16 => ResponseValue::from_response(response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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, &'a self,
body: &'a types::InstanceEnsureRequest, body: &'a types::InstanceEnsureRequest,
) -> Result<ResponseValue<types::InstanceEnsureResponse>, Error<types::Error>> { ) -> Result<ResponseValue<types::InstanceEnsureResponse>, Error<types::Error>> {
let __progenitor_url = format!("{}/instance", self.baseurl,); let url = format!("{}/instance", self.baseurl,);
let __progenitor_request = self let request = self
.client .client
.put(__progenitor_url) .put(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
201u16 => ResponseValue::from_response(__progenitor_response).await, 201u16 => ResponseValue::from_response(response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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, id: &'a uuid::Uuid,
snapshot_id: &'a uuid::Uuid, snapshot_id: &'a uuid::Uuid,
) -> Result<ResponseValue<()>, Error<types::Error>> { ) -> Result<ResponseValue<()>, Error<types::Error>> {
let __progenitor_url = format!( let url = format!(
"{}/instance/disk/{}/snapshot/{}", "{}/instance/disk/{}/snapshot/{}",
self.baseurl, self.baseurl,
encode_path(&id.to_string()), encode_path(&id.to_string()),
encode_path(&snapshot_id.to_string()), encode_path(&snapshot_id.to_string()),
); );
let __progenitor_request = self let request = self
.client .client
.post(__progenitor_url) .post(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await, 200u16 => ResponseValue::from_response(response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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, &'a self,
body: &'a types::InstanceMigrateStatusRequest, body: &'a types::InstanceMigrateStatusRequest,
) -> Result<ResponseValue<types::InstanceMigrateStatusResponse>, Error<types::Error>> { ) -> Result<ResponseValue<types::InstanceMigrateStatusResponse>, Error<types::Error>> {
let __progenitor_url = format!("{}/instance/migrate/status", self.baseurl,); let url = format!("{}/instance/migrate/status", self.baseurl,);
let __progenitor_request = self let request = self
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await, 200u16 => ResponseValue::from_response(response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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>( pub async fn instance_serial<'a>(
&'a self, &'a self,
) -> Result<ResponseValue<reqwest::Upgraded>, Error<reqwest::Upgraded>> { ) -> Result<ResponseValue<reqwest::Upgraded>, Error<reqwest::Upgraded>> {
let __progenitor_url = format!("{}/instance/serial", self.baseurl,); let url = format!("{}/instance/serial", self.baseurl,);
let __progenitor_request = self let request = self
.client .client
.get(__progenitor_url) .get(url)
.header(reqwest::header::CONNECTION, "Upgrade") .header(reqwest::header::CONNECTION, "Upgrade")
.header(reqwest::header::UPGRADE, "websocket") .header(reqwest::header::UPGRADE, "websocket")
.header(reqwest::header::SEC_WEBSOCKET_VERSION, "13") .header(reqwest::header::SEC_WEBSOCKET_VERSION, "13")
@ -807,12 +807,12 @@ impl Client {
), ),
) )
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
101u16 => ResponseValue::upgrade(__progenitor_response).await, 101u16 => ResponseValue::upgrade(response).await,
200..=299 => ResponseValue::upgrade(__progenitor_response).await, 200..=299 => ResponseValue::upgrade(response).await,
_ => Err(Error::UnexpectedResponse(__progenitor_response)), _ => Err(Error::UnexpectedResponse(response)),
} }
} }
@ -821,27 +821,27 @@ impl Client {
&'a self, &'a self,
body: types::InstanceStateRequested, body: types::InstanceStateRequested,
) -> Result<ResponseValue<()>, Error<types::Error>> { ) -> Result<ResponseValue<()>, Error<types::Error>> {
let __progenitor_url = format!("{}/instance/state", self.baseurl,); let url = format!("{}/instance/state", self.baseurl,);
let __progenitor_request = self let request = self
.client .client
.put(__progenitor_url) .put(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
204u16 => Ok(ResponseValue::empty(__progenitor_response)), 204u16 => Ok(ResponseValue::empty(response)),
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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, &'a self,
body: &'a types::InstanceStateMonitorRequest, body: &'a types::InstanceStateMonitorRequest,
) -> Result<ResponseValue<types::InstanceStateMonitorResponse>, Error<types::Error>> { ) -> Result<ResponseValue<types::InstanceStateMonitorResponse>, Error<types::Error>> {
let __progenitor_url = format!("{}/instance/state-monitor", self.baseurl,); let url = format!("{}/instance/state-monitor", self.baseurl,);
let __progenitor_request = self let request = self
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.json(&body) .json(&body)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200u16 => ResponseValue::from_response(__progenitor_response).await, 200u16 => ResponseValue::from_response(response).await,
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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)),
} }
} }
} }

View File

@ -309,14 +309,14 @@ pub mod builder {
///[`Client::default_params`]: super::Client::default_params ///[`Client::default_params`]: super::Client::default_params
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct DefaultParams<'a> { pub struct DefaultParams<'a> {
__progenitor_client: &'a super::Client, client: &'a super::Client,
body: Result<types::builder::BodyWithDefaults, String>, body: Result<types::builder::BodyWithDefaults, String>,
} }
impl<'a> DefaultParams<'a> { impl<'a> DefaultParams<'a> {
pub fn new(client: &'a super::Client) -> Self { pub fn new(client: &'a super::Client) -> Self {
Self { Self {
__progenitor_client: client, client: client,
body: Ok(types::builder::BodyWithDefaults::default()), body: Ok(types::builder::BodyWithDefaults::default()),
} }
} }
@ -344,29 +344,17 @@ pub mod builder {
///Sends a `POST` request to `/` ///Sends a `POST` request to `/`
pub async fn send(self) -> Result<ResponseValue<ByteStream>, Error<ByteStream>> { pub async fn send(self) -> Result<ResponseValue<ByteStream>, Error<ByteStream>> {
let Self { let Self { client, body } = self;
__progenitor_client,
body,
} = self;
let body = body let body = body
.and_then(std::convert::TryInto::<types::BodyWithDefaults>::try_into) .and_then(std::convert::TryInto::<types::BodyWithDefaults>::try_into)
.map_err(Error::InvalidRequest)?; .map_err(Error::InvalidRequest)?;
let __progenitor_url = format!("{}/", __progenitor_client.baseurl,); let url = format!("{}/", client.baseurl,);
let __progenitor_request = __progenitor_client let request = client.client.post(url).json(&body).build()?;
.client let result = client.client.execute(request).await;
.post(__progenitor_url) let response = result?;
.json(&body) match response.status().as_u16() {
.build()?; 200..=299 => Ok(ResponseValue::stream(response)),
let __progenitor_result = __progenitor_client _ => Err(Error::ErrorResponse(ResponseValue::stream(response))),
.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,
))),
} }
} }
} }

View File

@ -120,15 +120,13 @@ impl Client {
&'a self, &'a self,
body: &'a types::BodyWithDefaults, body: &'a types::BodyWithDefaults,
) -> Result<ResponseValue<ByteStream>, Error<ByteStream>> { ) -> Result<ResponseValue<ByteStream>, Error<ByteStream>> {
let __progenitor_url = format!("{}/", self.baseurl,); let url = format!("{}/", self.baseurl,);
let __progenitor_request = self.client.post(__progenitor_url).json(&body).build()?; let request = self.client.post(url).json(&body).build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200..=299 => Ok(ResponseValue::stream(__progenitor_response)), 200..=299 => Ok(ResponseValue::stream(response)),
_ => Err(Error::ErrorResponse(ResponseValue::stream( _ => Err(Error::ErrorResponse(ResponseValue::stream(response))),
__progenitor_response,
))),
} }
} }
} }

View File

@ -88,15 +88,13 @@ impl Client {
pub async fn freeform_response<'a>( pub async fn freeform_response<'a>(
&'a self, &'a self,
) -> Result<ResponseValue<ByteStream>, Error<ByteStream>> { ) -> Result<ResponseValue<ByteStream>, Error<ByteStream>> {
let __progenitor_url = format!("{}/", self.baseurl,); let url = format!("{}/", self.baseurl,);
let __progenitor_request = self.client.get(__progenitor_url).build()?; let request = self.client.get(url).build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
200..=299 => Ok(ResponseValue::stream(__progenitor_response)), 200..=299 => Ok(ResponseValue::stream(response)),
_ => Err(Error::ErrorResponse(ResponseValue::stream( _ => Err(Error::ErrorResponse(ResponseValue::stream(response))),
__progenitor_response,
))),
} }
} }
} }

View File

@ -94,37 +94,37 @@ impl Client {
in_: &'a str, in_: &'a str,
use_: &'a str, use_: &'a str,
) -> Result<ResponseValue<()>, Error<types::Error>> { ) -> Result<ResponseValue<()>, Error<types::Error>> {
let __progenitor_url = format!( let url = format!(
"{}/{}/{}/{}", "{}/{}/{}/{}",
self.baseurl, self.baseurl,
encode_path(&ref_.to_string()), encode_path(&ref_.to_string()),
encode_path(&type_.to_string()), encode_path(&type_.to_string()),
encode_path(&trait_.to_string()), encode_path(&trait_.to_string()),
); );
let mut __progenitor_query = Vec::with_capacity(3usize); let mut query = Vec::with_capacity(3usize);
__progenitor_query.push(("if", if_.to_string())); query.push(("if", if_.to_string()));
__progenitor_query.push(("in", in_.to_string())); query.push(("in", in_.to_string()));
__progenitor_query.push(("use", use_.to_string())); query.push(("use", use_.to_string()));
let __progenitor_request = self let request = self
.client .client
.get(__progenitor_url) .get(url)
.header( .header(
reqwest::header::ACCEPT, reqwest::header::ACCEPT,
reqwest::header::HeaderValue::from_static("application/json"), reqwest::header::HeaderValue::from_static("application/json"),
) )
.query(&__progenitor_query) .query(&query)
.build()?; .build()?;
let __progenitor_result = self.client.execute(__progenitor_request).await; let result = self.client.execute(request).await;
let __progenitor_response = __progenitor_result?; let response = result?;
match __progenitor_response.status().as_u16() { match response.status().as_u16() {
204u16 => Ok(ResponseValue::empty(__progenitor_response)), 204u16 => Ok(ResponseValue::empty(response)),
400u16..=499u16 => Err(Error::ErrorResponse( 400u16..=499u16 => Err(Error::ErrorResponse(
ResponseValue::from_response(__progenitor_response).await?, ResponseValue::from_response(response).await?,
)), )),
500u16..=599u16 => Err(Error::ErrorResponse( 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)),
} }
} }
} }

View File

@ -157,6 +157,11 @@ fn test_yaml() {
verify_apis("param-overrides.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. // 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 // It's an interesting test to consider whether we try to do our best to
// interpret the intent or just fail. // interpret the intent or just fail.

View File

@ -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"
}
}
}
}
}
}