#[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, Deserialize, JsonSchema, Serialize)] pub struct Task { pub id: String, pub name: String, pub output_rules: Vec, pub script: String, pub state: String, } impl Task { pub fn builder() -> builder::Task { builder::Task::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct TaskEvent { pub payload: String, pub seq: u32, pub stream: String, pub time: chrono::DateTime, } impl TaskEvent { pub fn builder() -> builder::TaskEvent { builder::TaskEvent::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct TaskOutput { pub id: String, pub path: String, pub size: u64, } impl TaskOutput { pub fn builder() -> builder::TaskOutput { builder::TaskOutput::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct TaskSubmit { pub name: String, #[serde(default, skip_serializing_if = "Vec::is_empty")] pub output_rules: Vec, pub script: String, } impl TaskSubmit { pub fn builder() -> builder::TaskSubmit { builder::TaskSubmit::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct TaskSubmitResult { pub id: String, } impl TaskSubmitResult { pub fn builder() -> builder::TaskSubmitResult { builder::TaskSubmitResult::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct UploadedChunk { pub id: String, } impl UploadedChunk { pub fn builder() -> builder::UploadedChunk { builder::UploadedChunk::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct UserCreate { pub name: String, } impl UserCreate { pub fn builder() -> builder::UserCreate { builder::UserCreate::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct UserCreateResult { pub id: String, pub name: String, pub token: String, } impl UserCreateResult { pub fn builder() -> builder::UserCreateResult { builder::UserCreateResult::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct WhoamiResult { pub id: String, pub name: String, } impl WhoamiResult { pub fn builder() -> builder::WhoamiResult { builder::WhoamiResult::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct Worker { pub deleted: bool, pub id: String, #[serde(default, skip_serializing_if = "Option::is_none")] pub instance_id: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub lastping: Option>, pub recycle: bool, pub tasks: Vec, } impl Worker { pub fn builder() -> builder::Worker { builder::Worker::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct WorkerAddOutput { pub chunks: Vec, pub path: String, pub size: i64, } impl WorkerAddOutput { pub fn builder() -> builder::WorkerAddOutput { builder::WorkerAddOutput::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct WorkerAppendTask { pub payload: String, pub stream: String, pub time: chrono::DateTime, } impl WorkerAppendTask { pub fn builder() -> builder::WorkerAppendTask { builder::WorkerAppendTask::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct WorkerBootstrap { pub bootstrap: String, pub token: String, } impl WorkerBootstrap { pub fn builder() -> builder::WorkerBootstrap { builder::WorkerBootstrap::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct WorkerBootstrapResult { pub id: String, } impl WorkerBootstrapResult { pub fn builder() -> builder::WorkerBootstrapResult { builder::WorkerBootstrapResult::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct WorkerCompleteTask { pub failed: bool, } impl WorkerCompleteTask { pub fn builder() -> builder::WorkerCompleteTask { builder::WorkerCompleteTask::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct WorkerPingResult { pub poweroff: bool, #[serde(default, skip_serializing_if = "Option::is_none")] pub task: Option, } impl WorkerPingResult { pub fn builder() -> builder::WorkerPingResult { builder::WorkerPingResult::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct WorkerPingTask { pub id: String, pub output_rules: Vec, pub script: String, } impl WorkerPingTask { pub fn builder() -> builder::WorkerPingTask { builder::WorkerPingTask::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct WorkerTask { pub id: String, pub name: String, pub owner: String, } impl WorkerTask { pub fn builder() -> builder::WorkerTask { builder::WorkerTask::default() } } #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct WorkersResult { pub workers: Vec, } impl WorkersResult { pub fn builder() -> builder::WorkersResult { builder::WorkersResult::default() } } mod builder { pub struct Task { id: Result, name: Result, output_rules: Result, String>, script: Result, state: Result, } impl Default for Task { fn default() -> Self { Self { id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), output_rules: Err("no value supplied for output_rules".to_string()), script: Err("no value supplied for script".to_string()), state: Err("no value supplied for state".to_string()), } } } impl Task { pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn output_rules(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.output_rules = value.try_into().map_err(|e| { format!("error converting supplied value for output_rules: {}", e) }); self } pub fn script(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.script = value .try_into() .map_err(|e| format!("error converting supplied value for script: {}", e)); self } pub fn state(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.state = value .try_into() .map_err(|e| format!("error converting supplied value for state: {}", e)); self } } impl std::convert::TryFrom for super::Task { type Error = String; fn try_from(value: Task) -> Result { Ok(Self { id: value.id?, name: value.name?, output_rules: value.output_rules?, script: value.script?, state: value.state?, }) } } pub struct TaskEvent { payload: Result, seq: Result, stream: Result, time: Result, String>, } impl Default for TaskEvent { fn default() -> Self { Self { payload: Err("no value supplied for payload".to_string()), seq: Err("no value supplied for seq".to_string()), stream: Err("no value supplied for stream".to_string()), time: Err("no value supplied for time".to_string()), } } } impl TaskEvent { pub fn payload(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.payload = value .try_into() .map_err(|e| format!("error converting supplied value for payload: {}", e)); self } pub fn seq(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.seq = value .try_into() .map_err(|e| format!("error converting supplied value for seq: {}", e)); self } pub fn stream(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.stream = value .try_into() .map_err(|e| format!("error converting supplied value for stream: {}", e)); self } pub fn time(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time = value .try_into() .map_err(|e| format!("error converting supplied value for time: {}", e)); self } } impl std::convert::TryFrom for super::TaskEvent { type Error = String; fn try_from(value: TaskEvent) -> Result { Ok(Self { payload: value.payload?, seq: value.seq?, stream: value.stream?, time: value.time?, }) } } pub struct TaskOutput { id: Result, path: Result, size: Result, } impl Default for TaskOutput { fn default() -> Self { Self { id: Err("no value supplied for id".to_string()), path: Err("no value supplied for path".to_string()), size: Err("no value supplied for size".to_string()), } } } impl TaskOutput { pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn path(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.path = value .try_into() .map_err(|e| format!("error converting supplied value for path: {}", e)); self } pub fn size(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.size = value .try_into() .map_err(|e| format!("error converting supplied value for size: {}", e)); self } } impl std::convert::TryFrom for super::TaskOutput { type Error = String; fn try_from(value: TaskOutput) -> Result { Ok(Self { id: value.id?, path: value.path?, size: value.size?, }) } } pub struct TaskSubmit { name: Result, output_rules: Result, String>, script: Result, } impl Default for TaskSubmit { fn default() -> Self { Self { name: Err("no value supplied for name".to_string()), output_rules: Ok(Default::default()), script: Err("no value supplied for script".to_string()), } } } impl TaskSubmit { pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn output_rules(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.output_rules = value.try_into().map_err(|e| { format!("error converting supplied value for output_rules: {}", e) }); self } pub fn script(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.script = value .try_into() .map_err(|e| format!("error converting supplied value for script: {}", e)); self } } impl std::convert::TryFrom for super::TaskSubmit { type Error = String; fn try_from(value: TaskSubmit) -> Result { Ok(Self { name: value.name?, output_rules: value.output_rules?, script: value.script?, }) } } pub struct TaskSubmitResult { id: Result, } impl Default for TaskSubmitResult { fn default() -> Self { Self { id: Err("no value supplied for id".to_string()), } } } impl TaskSubmitResult { pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } } impl std::convert::TryFrom for super::TaskSubmitResult { type Error = String; fn try_from(value: TaskSubmitResult) -> Result { Ok(Self { id: value.id? }) } } pub struct UploadedChunk { id: Result, } impl Default for UploadedChunk { fn default() -> Self { Self { id: Err("no value supplied for id".to_string()), } } } impl UploadedChunk { pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } } impl std::convert::TryFrom for super::UploadedChunk { type Error = String; fn try_from(value: UploadedChunk) -> Result { Ok(Self { id: value.id? }) } } pub struct UserCreate { name: Result, } impl Default for UserCreate { fn default() -> Self { Self { name: Err("no value supplied for name".to_string()), } } } impl UserCreate { pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::UserCreate { type Error = String; fn try_from(value: UserCreate) -> Result { Ok(Self { name: value.name? }) } } pub struct UserCreateResult { id: Result, name: Result, token: Result, } impl Default for UserCreateResult { fn default() -> Self { Self { id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), token: Err("no value supplied for token".to_string()), } } } impl UserCreateResult { pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn token(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.token = value .try_into() .map_err(|e| format!("error converting supplied value for token: {}", e)); self } } impl std::convert::TryFrom for super::UserCreateResult { type Error = String; fn try_from(value: UserCreateResult) -> Result { Ok(Self { id: value.id?, name: value.name?, token: value.token?, }) } } pub struct WhoamiResult { id: Result, name: Result, } impl Default for WhoamiResult { fn default() -> Self { Self { id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), } } } impl WhoamiResult { pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } } impl std::convert::TryFrom for super::WhoamiResult { type Error = String; fn try_from(value: WhoamiResult) -> Result { Ok(Self { id: value.id?, name: value.name?, }) } } pub struct Worker { deleted: Result, id: Result, instance_id: Result, String>, lastping: Result>, String>, recycle: Result, tasks: Result, String>, } impl Default for Worker { fn default() -> Self { Self { deleted: Err("no value supplied for deleted".to_string()), id: Err("no value supplied for id".to_string()), instance_id: Ok(Default::default()), lastping: Ok(Default::default()), recycle: Err("no value supplied for recycle".to_string()), tasks: Err("no value supplied for tasks".to_string()), } } } impl Worker { pub fn deleted(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.deleted = value .try_into() .map_err(|e| format!("error converting supplied value for deleted: {}", e)); self } pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn instance_id(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.instance_id = value .try_into() .map_err(|e| format!("error converting supplied value for instance_id: {}", e)); self } pub fn lastping(mut self, value: T) -> Self where T: std::convert::TryInto>>, T::Error: std::fmt::Display, { self.lastping = value .try_into() .map_err(|e| format!("error converting supplied value for lastping: {}", e)); self } pub fn recycle(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.recycle = value .try_into() .map_err(|e| format!("error converting supplied value for recycle: {}", e)); self } pub fn tasks(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.tasks = value .try_into() .map_err(|e| format!("error converting supplied value for tasks: {}", e)); self } } impl std::convert::TryFrom for super::Worker { type Error = String; fn try_from(value: Worker) -> Result { Ok(Self { deleted: value.deleted?, id: value.id?, instance_id: value.instance_id?, lastping: value.lastping?, recycle: value.recycle?, tasks: value.tasks?, }) } } pub struct WorkerAddOutput { chunks: Result, String>, path: Result, size: Result, } impl Default for WorkerAddOutput { fn default() -> Self { Self { chunks: Err("no value supplied for chunks".to_string()), path: Err("no value supplied for path".to_string()), size: Err("no value supplied for size".to_string()), } } } impl WorkerAddOutput { pub fn chunks(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.chunks = value .try_into() .map_err(|e| format!("error converting supplied value for chunks: {}", e)); self } pub fn path(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.path = value .try_into() .map_err(|e| format!("error converting supplied value for path: {}", e)); self } pub fn size(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.size = value .try_into() .map_err(|e| format!("error converting supplied value for size: {}", e)); self } } impl std::convert::TryFrom for super::WorkerAddOutput { type Error = String; fn try_from(value: WorkerAddOutput) -> Result { Ok(Self { chunks: value.chunks?, path: value.path?, size: value.size?, }) } } pub struct WorkerAppendTask { payload: Result, stream: Result, time: Result, String>, } impl Default for WorkerAppendTask { fn default() -> Self { Self { payload: Err("no value supplied for payload".to_string()), stream: Err("no value supplied for stream".to_string()), time: Err("no value supplied for time".to_string()), } } } impl WorkerAppendTask { pub fn payload(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.payload = value .try_into() .map_err(|e| format!("error converting supplied value for payload: {}", e)); self } pub fn stream(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.stream = value .try_into() .map_err(|e| format!("error converting supplied value for stream: {}", e)); self } pub fn time(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.time = value .try_into() .map_err(|e| format!("error converting supplied value for time: {}", e)); self } } impl std::convert::TryFrom for super::WorkerAppendTask { type Error = String; fn try_from(value: WorkerAppendTask) -> Result { Ok(Self { payload: value.payload?, stream: value.stream?, time: value.time?, }) } } pub struct WorkerBootstrap { bootstrap: Result, token: Result, } impl Default for WorkerBootstrap { fn default() -> Self { Self { bootstrap: Err("no value supplied for bootstrap".to_string()), token: Err("no value supplied for token".to_string()), } } } impl WorkerBootstrap { pub fn bootstrap(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.bootstrap = value .try_into() .map_err(|e| format!("error converting supplied value for bootstrap: {}", e)); self } pub fn token(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.token = value .try_into() .map_err(|e| format!("error converting supplied value for token: {}", e)); self } } impl std::convert::TryFrom for super::WorkerBootstrap { type Error = String; fn try_from(value: WorkerBootstrap) -> Result { Ok(Self { bootstrap: value.bootstrap?, token: value.token?, }) } } pub struct WorkerBootstrapResult { id: Result, } impl Default for WorkerBootstrapResult { fn default() -> Self { Self { id: Err("no value supplied for id".to_string()), } } } impl WorkerBootstrapResult { pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } } impl std::convert::TryFrom for super::WorkerBootstrapResult { type Error = String; fn try_from(value: WorkerBootstrapResult) -> Result { Ok(Self { id: value.id? }) } } pub struct WorkerCompleteTask { failed: Result, } impl Default for WorkerCompleteTask { fn default() -> Self { Self { failed: Err("no value supplied for failed".to_string()), } } } impl WorkerCompleteTask { pub fn failed(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.failed = value .try_into() .map_err(|e| format!("error converting supplied value for failed: {}", e)); self } } impl std::convert::TryFrom for super::WorkerCompleteTask { type Error = String; fn try_from(value: WorkerCompleteTask) -> Result { Ok(Self { failed: value.failed?, }) } } pub struct WorkerPingResult { poweroff: Result, task: Result, String>, } impl Default for WorkerPingResult { fn default() -> Self { Self { poweroff: Err("no value supplied for poweroff".to_string()), task: Ok(Default::default()), } } } impl WorkerPingResult { pub fn poweroff(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.poweroff = value .try_into() .map_err(|e| format!("error converting supplied value for poweroff: {}", e)); self } pub fn task(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.task = value .try_into() .map_err(|e| format!("error converting supplied value for task: {}", e)); self } } impl std::convert::TryFrom for super::WorkerPingResult { type Error = String; fn try_from(value: WorkerPingResult) -> Result { Ok(Self { poweroff: value.poweroff?, task: value.task?, }) } } pub struct WorkerPingTask { id: Result, output_rules: Result, String>, script: Result, } impl Default for WorkerPingTask { fn default() -> Self { Self { id: Err("no value supplied for id".to_string()), output_rules: Err("no value supplied for output_rules".to_string()), script: Err("no value supplied for script".to_string()), } } } impl WorkerPingTask { pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn output_rules(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.output_rules = value.try_into().map_err(|e| { format!("error converting supplied value for output_rules: {}", e) }); self } pub fn script(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.script = value .try_into() .map_err(|e| format!("error converting supplied value for script: {}", e)); self } } impl std::convert::TryFrom for super::WorkerPingTask { type Error = String; fn try_from(value: WorkerPingTask) -> Result { Ok(Self { id: value.id?, output_rules: value.output_rules?, script: value.script?, }) } } pub struct WorkerTask { id: Result, name: Result, owner: Result, } impl Default for WorkerTask { fn default() -> Self { Self { id: Err("no value supplied for id".to_string()), name: Err("no value supplied for name".to_string()), owner: Err("no value supplied for owner".to_string()), } } } impl WorkerTask { pub fn id(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.id = value .try_into() .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn name(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.name = value .try_into() .map_err(|e| format!("error converting supplied value for name: {}", e)); self } pub fn owner(mut self, value: T) -> Self where T: std::convert::TryInto, T::Error: std::fmt::Display, { self.owner = value .try_into() .map_err(|e| format!("error converting supplied value for owner: {}", e)); self } } impl std::convert::TryFrom for super::WorkerTask { type Error = String; fn try_from(value: WorkerTask) -> Result { Ok(Self { id: value.id?, name: value.name?, owner: value.owner?, }) } } pub struct WorkersResult { workers: Result, String>, } impl Default for WorkersResult { fn default() -> Self { Self { workers: Err("no value supplied for workers".to_string()), } } } impl WorkersResult { pub fn workers(mut self, value: T) -> Self where T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.workers = value .try_into() .map_err(|e| format!("error converting supplied value for workers: {}", e)); self } } impl std::convert::TryFrom for super::WorkersResult { type Error = String; fn try_from(value: WorkersResult) -> Result { Ok(Self { workers: value.workers?, }) } } } } #[derive(Clone, Debug)] ///Client for Buildomat 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 { let dur = std::time::Duration::from_secs(15); let client = reqwest::ClientBuilder::new() .connect_timeout(dur) .timeout(dur) .build() .unwrap(); Self::new_with_client(baseurl, client) } /// 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, } } /// Return the base URL to which requests are made. pub fn baseurl(&self) -> &String { &self.baseurl } /// Return the internal `reqwest::Client` used to make requests. pub fn client(&self) -> &reqwest::Client { &self.client } } impl Client { ///Sends a `POST` request to `/v1/control/hold` ///```ignore /// let response = client.control_hold() /// .send() /// .await; /// ``` pub fn control_hold(&self) -> builder::ControlHold { builder::ControlHold::new(self) } ///Sends a `POST` request to `/v1/control/resume` ///```ignore /// let response = client.control_resume() /// .send() /// .await; /// ``` pub fn control_resume(&self) -> builder::ControlResume { builder::ControlResume::new(self) } ///Sends a `GET` request to `/v1/task/{task}` ///```ignore /// let response = client.task_get() /// .task(task) /// .send() /// .await; /// ``` pub fn task_get(&self) -> builder::TaskGet { builder::TaskGet::new(self) } ///Sends a `GET` request to `/v1/tasks` ///```ignore /// let response = client.tasks_get() /// .send() /// .await; /// ``` pub fn tasks_get(&self) -> builder::TasksGet { builder::TasksGet::new(self) } ///Sends a `POST` request to `/v1/tasks` ///```ignore /// let response = client.task_submit() /// .body(body) /// .send() /// .await; /// ``` pub fn task_submit(&self) -> builder::TaskSubmit { builder::TaskSubmit::new(self) } ///Sends a `GET` request to `/v1/tasks/{task}/events` ///```ignore /// let response = client.task_events_get() /// .task(task) /// .minseq(minseq) /// .send() /// .await; /// ``` pub fn task_events_get(&self) -> builder::TaskEventsGet { builder::TaskEventsGet::new(self) } ///Sends a `GET` request to `/v1/tasks/{task}/outputs` ///```ignore /// let response = client.task_outputs_get() /// .task(task) /// .send() /// .await; /// ``` pub fn task_outputs_get(&self) -> builder::TaskOutputsGet { builder::TaskOutputsGet::new(self) } ///Sends a `GET` request to `/v1/tasks/{task}/outputs/{output}` ///```ignore /// let response = client.task_output_download() /// .task(task) /// .output(output) /// .send() /// .await; /// ``` pub fn task_output_download(&self) -> builder::TaskOutputDownload { builder::TaskOutputDownload::new(self) } ///Sends a `POST` request to `/v1/users` ///```ignore /// let response = client.user_create() /// .body(body) /// .send() /// .await; /// ``` pub fn user_create(&self) -> builder::UserCreate { builder::UserCreate::new(self) } ///Sends a `GET` request to `/v1/whoami` ///```ignore /// let response = client.whoami() /// .send() /// .await; /// ``` pub fn whoami(&self) -> builder::Whoami { builder::Whoami::new(self) } ///Sends a `POST` request to `/v1/worker/bootstrap` ///```ignore /// let response = client.worker_bootstrap() /// .body(body) /// .send() /// .await; /// ``` pub fn worker_bootstrap(&self) -> builder::WorkerBootstrap { builder::WorkerBootstrap::new(self) } ///Sends a `GET` request to `/v1/worker/ping` ///```ignore /// let response = client.worker_ping() /// .send() /// .await; /// ``` pub fn worker_ping(&self) -> builder::WorkerPing { builder::WorkerPing::new(self) } ///Sends a `POST` request to `/v1/worker/task/{task}/append` ///```ignore /// let response = client.worker_task_append() /// .task(task) /// .body(body) /// .send() /// .await; /// ``` pub fn worker_task_append(&self) -> builder::WorkerTaskAppend { builder::WorkerTaskAppend::new(self) } ///Sends a `POST` request to `/v1/worker/task/{task}/chunk` ///```ignore /// let response = client.worker_task_upload_chunk() /// .task(task) /// .body(body) /// .send() /// .await; /// ``` pub fn worker_task_upload_chunk(&self) -> builder::WorkerTaskUploadChunk { builder::WorkerTaskUploadChunk::new(self) } ///Sends a `POST` request to `/v1/worker/task/{task}/complete` ///```ignore /// let response = client.worker_task_complete() /// .task(task) /// .body(body) /// .send() /// .await; /// ``` pub fn worker_task_complete(&self) -> builder::WorkerTaskComplete { builder::WorkerTaskComplete::new(self) } ///Sends a `POST` request to `/v1/worker/task/{task}/output` ///```ignore /// let response = client.worker_task_add_output() /// .task(task) /// .body(body) /// .send() /// .await; /// ``` pub fn worker_task_add_output(&self) -> builder::WorkerTaskAddOutput { builder::WorkerTaskAddOutput::new(self) } ///Sends a `GET` request to `/v1/workers` ///```ignore /// let response = client.workers_list() /// .send() /// .await; /// ``` pub fn workers_list(&self) -> builder::WorkersList { builder::WorkersList::new(self) } ///Sends a `POST` request to `/v1/workers/recycle` ///```ignore /// let response = client.workers_recycle() /// .send() /// .await; /// ``` pub fn workers_recycle(&self) -> builder::WorkersRecycle { builder::WorkersRecycle::new(self) } } pub mod builder { use super::types; #[allow(unused_imports)] use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; ///Builder for [`Client::control_hold`] /// ///[`Client::control_hold`]: super::Client::control_hold #[derive(Debug, Clone)] pub struct ControlHold<'a> { client: &'a super::Client, } impl<'a> ControlHold<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `POST` request to `/v1/control/hold` pub async fn send(self) -> Result, Error<()>> { let Self { client } = self; let url = format!("{}/v1/control/hold", client.baseurl,); let request = client.client.post(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::control_resume`] /// ///[`Client::control_resume`]: super::Client::control_resume #[derive(Debug, Clone)] pub struct ControlResume<'a> { client: &'a super::Client, } impl<'a> ControlResume<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `POST` request to `/v1/control/resume` pub async fn send(self) -> Result, Error<()>> { let Self { client } = self; let url = format!("{}/v1/control/resume", client.baseurl,); let request = client.client.post(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => Ok(ResponseValue::empty(response)), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::task_get`] /// ///[`Client::task_get`]: super::Client::task_get #[derive(Debug, Clone)] pub struct TaskGet<'a> { client: &'a super::Client, task: Result, } impl<'a> TaskGet<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, task: Err("task was not initialized".to_string()), } } pub fn task(mut self, value: V) -> Self where V: std::convert::TryInto, { self.task = value .try_into() .map_err(|_| "conversion to `String` for task failed".to_string()); self } ///Sends a `GET` request to `/v1/task/{task}` pub async fn send(self) -> Result, Error<()>> { let Self { client, task } = self; let task = task.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/task/{}", client.baseurl, encode_path(&task.to_string()), ); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::tasks_get`] /// ///[`Client::tasks_get`]: super::Client::tasks_get #[derive(Debug, Clone)] pub struct TasksGet<'a> { client: &'a super::Client, } impl<'a> TasksGet<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `GET` request to `/v1/tasks` pub async fn send(self) -> Result>, Error<()>> { let Self { client } = self; let url = format!("{}/v1/tasks", client.baseurl,); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::task_submit`] /// ///[`Client::task_submit`]: super::Client::task_submit #[derive(Debug, Clone)] pub struct TaskSubmit<'a> { client: &'a super::Client, body: Result, } impl<'a> TaskSubmit<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Err("body was not initialized".to_string()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `TaskSubmit` for body failed".to_string()); self } ///Sends a `POST` request to `/v1/tasks` pub async fn send(self) -> Result, Error<()>> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; let url = format!("{}/v1/tasks", client.baseurl,); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::task_events_get`] /// ///[`Client::task_events_get`]: super::Client::task_events_get #[derive(Debug, Clone)] pub struct TaskEventsGet<'a> { client: &'a super::Client, task: Result, minseq: Result, String>, } impl<'a> TaskEventsGet<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, task: Err("task was not initialized".to_string()), minseq: Ok(None), } } pub fn task(mut self, value: V) -> Self where V: std::convert::TryInto, { self.task = value .try_into() .map_err(|_| "conversion to `String` for task failed".to_string()); self } pub fn minseq(mut self, value: V) -> Self where V: std::convert::TryInto, { self.minseq = value .try_into() .map(Some) .map_err(|_| "conversion to `Option < u32 >` for minseq failed".to_string()); self } ///Sends a `GET` request to `/v1/tasks/{task}/events` pub async fn send(self) -> Result>, Error<()>> { let Self { client, task, minseq, } = self; let task = task.map_err(Error::InvalidRequest)?; let minseq = minseq.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/tasks/{}/events", client.baseurl, encode_path(&task.to_string()), ); let mut query = Vec::with_capacity(1usize); if let Some(v) = &minseq { query.push(("minseq", v.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 => ResponseValue::from_response(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::task_outputs_get`] /// ///[`Client::task_outputs_get`]: super::Client::task_outputs_get #[derive(Debug, Clone)] pub struct TaskOutputsGet<'a> { client: &'a super::Client, task: Result, } impl<'a> TaskOutputsGet<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, task: Err("task was not initialized".to_string()), } } pub fn task(mut self, value: V) -> Self where V: std::convert::TryInto, { self.task = value .try_into() .map_err(|_| "conversion to `String` for task failed".to_string()); self } ///Sends a `GET` request to `/v1/tasks/{task}/outputs` pub async fn send(self) -> Result>, Error<()>> { let Self { client, task } = self; let task = task.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/tasks/{}/outputs", client.baseurl, encode_path(&task.to_string()), ); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::task_output_download`] /// ///[`Client::task_output_download`]: super::Client::task_output_download #[derive(Debug, Clone)] pub struct TaskOutputDownload<'a> { client: &'a super::Client, task: Result, output: Result, } impl<'a> TaskOutputDownload<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, task: Err("task was not initialized".to_string()), output: Err("output was not initialized".to_string()), } } pub fn task(mut self, value: V) -> Self where V: std::convert::TryInto, { self.task = value .try_into() .map_err(|_| "conversion to `String` for task failed".to_string()); self } pub fn output(mut self, value: V) -> Self where V: std::convert::TryInto, { self.output = value .try_into() .map_err(|_| "conversion to `String` for output failed".to_string()); self } ///Sends a `GET` request to `/v1/tasks/{task}/outputs/{output}` pub async fn send(self) -> Result, Error<()>> { let Self { client, task, output, } = self; let task = task.map_err(Error::InvalidRequest)?; let output = output.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/tasks/{}/outputs/{}", client.baseurl, encode_path(&task.to_string()), encode_path(&output.to_string()), ); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200..=299 => Ok(ResponseValue::stream(response)), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::user_create`] /// ///[`Client::user_create`]: super::Client::user_create #[derive(Debug, Clone)] pub struct UserCreate<'a> { client: &'a super::Client, body: Result, } impl<'a> UserCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Err("body was not initialized".to_string()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `UserCreate` for body failed".to_string()); self } ///Sends a `POST` request to `/v1/users` pub async fn send(self) -> Result, Error<()>> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; let url = format!("{}/v1/users", client.baseurl,); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::whoami`] /// ///[`Client::whoami`]: super::Client::whoami #[derive(Debug, Clone)] pub struct Whoami<'a> { client: &'a super::Client, } impl<'a> Whoami<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `GET` request to `/v1/whoami` pub async fn send(self) -> Result, Error<()>> { let Self { client } = self; let url = format!("{}/v1/whoami", client.baseurl,); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::worker_bootstrap`] /// ///[`Client::worker_bootstrap`]: super::Client::worker_bootstrap #[derive(Debug, Clone)] pub struct WorkerBootstrap<'a> { client: &'a super::Client, body: Result, } impl<'a> WorkerBootstrap<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, body: Err("body was not initialized".to_string()), } } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `WorkerBootstrap` for body failed".to_string()); self } ///Sends a `POST` request to `/v1/worker/bootstrap` pub async fn send(self) -> Result, Error<()>> { let Self { client, body } = self; let body = body.map_err(Error::InvalidRequest)?; let url = format!("{}/v1/worker/bootstrap", client.baseurl,); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::worker_ping`] /// ///[`Client::worker_ping`]: super::Client::worker_ping #[derive(Debug, Clone)] pub struct WorkerPing<'a> { client: &'a super::Client, } impl<'a> WorkerPing<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `GET` request to `/v1/worker/ping` pub async fn send(self) -> Result, Error<()>> { let Self { client } = self; let url = format!("{}/v1/worker/ping", client.baseurl,); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::worker_task_append`] /// ///[`Client::worker_task_append`]: super::Client::worker_task_append #[derive(Debug, Clone)] pub struct WorkerTaskAppend<'a> { client: &'a super::Client, task: Result, body: Result, } impl<'a> WorkerTaskAppend<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, task: Err("task was not initialized".to_string()), body: Err("body was not initialized".to_string()), } } pub fn task(mut self, value: V) -> Self where V: std::convert::TryInto, { self.task = value .try_into() .map_err(|_| "conversion to `String` for task failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `WorkerAppendTask` for body failed".to_string()); self } ///Sends a `POST` request to `/v1/worker/task/{task}/append` pub async fn send(self) -> Result, Error<()>> { let Self { client, task, body } = self; let task = task.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/worker/task/{}/append", client.baseurl, encode_path(&task.to_string()), ); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => Ok(ResponseValue::empty(response)), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::worker_task_upload_chunk`] /// ///[`Client::worker_task_upload_chunk`]: super::Client::worker_task_upload_chunk #[derive(Debug)] pub struct WorkerTaskUploadChunk<'a> { client: &'a super::Client, task: Result, body: Result, } impl<'a> WorkerTaskUploadChunk<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, task: Err("task was not initialized".to_string()), body: Err("body was not initialized".to_string()), } } pub fn task(mut self, value: V) -> Self where V: std::convert::TryInto, { self.task = value .try_into() .map_err(|_| "conversion to `String` for task failed".to_string()); self } pub fn body(mut self, value: B) -> Self where B: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `reqwest::Body` for body failed".to_string()); self } ///Sends a `POST` request to `/v1/worker/task/{task}/chunk` pub async fn send(self) -> Result, Error<()>> { let Self { client, task, body } = self; let task = task.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/worker/task/{}/chunk", client.baseurl, encode_path(&task.to_string()), ); let request = client .client .post(url) .header( reqwest::header::CONTENT_TYPE, reqwest::header::HeaderValue::from_static("application/octet-stream"), ) .body(body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::worker_task_complete`] /// ///[`Client::worker_task_complete`]: super::Client::worker_task_complete #[derive(Debug, Clone)] pub struct WorkerTaskComplete<'a> { client: &'a super::Client, task: Result, body: Result, } impl<'a> WorkerTaskComplete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, task: Err("task was not initialized".to_string()), body: Err("body was not initialized".to_string()), } } pub fn task(mut self, value: V) -> Self where V: std::convert::TryInto, { self.task = value .try_into() .map_err(|_| "conversion to `String` for task failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `WorkerCompleteTask` for body failed".to_string()); self } ///Sends a `POST` request to `/v1/worker/task/{task}/complete` pub async fn send(self) -> Result, Error<()>> { let Self { client, task, body } = self; let task = task.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/worker/task/{}/complete", client.baseurl, encode_path(&task.to_string()), ); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => Ok(ResponseValue::empty(response)), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::worker_task_add_output`] /// ///[`Client::worker_task_add_output`]: super::Client::worker_task_add_output #[derive(Debug, Clone)] pub struct WorkerTaskAddOutput<'a> { client: &'a super::Client, task: Result, body: Result, } impl<'a> WorkerTaskAddOutput<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client, task: Err("task was not initialized".to_string()), body: Err("body was not initialized".to_string()), } } pub fn task(mut self, value: V) -> Self where V: std::convert::TryInto, { self.task = value .try_into() .map_err(|_| "conversion to `String` for task failed".to_string()); self } pub fn body(mut self, value: V) -> Self where V: std::convert::TryInto, { self.body = value .try_into() .map_err(|_| "conversion to `WorkerAddOutput` for body failed".to_string()); self } ///Sends a `POST` request to `/v1/worker/task/{task}/output` pub async fn send(self) -> Result, Error<()>> { let Self { client, task, body } = self; let task = task.map_err(Error::InvalidRequest)?; let body = body.map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/worker/task/{}/output", client.baseurl, encode_path(&task.to_string()), ); let request = client.client.post(url).json(&body).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 201u16 => Ok(ResponseValue::empty(response)), _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::workers_list`] /// ///[`Client::workers_list`]: super::Client::workers_list #[derive(Debug, Clone)] pub struct WorkersList<'a> { client: &'a super::Client, } impl<'a> WorkersList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `GET` request to `/v1/workers` pub async fn send(self) -> Result, Error<()>> { let Self { client } = self; let url = format!("{}/v1/workers", client.baseurl,); let request = client.client.get(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } ///Builder for [`Client::workers_recycle`] /// ///[`Client::workers_recycle`]: super::Client::workers_recycle #[derive(Debug, Clone)] pub struct WorkersRecycle<'a> { client: &'a super::Client, } impl<'a> WorkersRecycle<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client } } ///Sends a `POST` request to `/v1/workers/recycle` pub async fn send(self) -> Result, Error<()>> { let Self { client } = self; let url = format!("{}/v1/workers/recycle", client.baseurl,); let request = client.client.post(url).build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => Ok(ResponseValue::empty(response)), _ => Err(Error::UnexpectedResponse(response)), } } } } pub mod prelude { pub use self::super::Client; }