Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

A typed client of one printobserver supervisor.

One method per public operation that supervisor serves, each generated from the same checked-in description the server’s own routes are folded out of.

Implementations§

Source§

impl Client

Source

pub fn new(address: impl AsRef<str>, actor: Actor) -> Self

A client of the supervisor at one address, acting as one actor.

The address is taken as the supervisor’s own configuration writes it — http://127.0.0.1:8420 — and a bare host:port is taken as well.

Source

pub fn with_credential(self, credential: impl Into<String>) -> Self

The same client, authenticating with one credential.

The supervisor serves no versioned operation to a caller that does not present a credential it admits — the operator’s, whose verifier it is configured with and which printobserver credential issue issues, or the one a supervision turn is handed — and a call it refuses for that arrives as ClientError::Refused under status 401. A call whose actor is not the identity that credential is arrives under status 403.

Source

pub fn address(&self) -> &str

Where this client is pointed.

Source

pub fn actor(&self) -> Actor

Who this client acts as, which every mutating call carries.

Source

pub fn call<T: DeserializeOwned>( &self, method: &str, path: &str, query: &[(String, String)], body: Option<&Value>, ) -> Result<T, ClientError>

Make one call and read what came back.

§Errors

Returns ClientError for each of the five ways a call ends other than with its answer; a refused action arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source§

impl Client

Source

pub fn prints(&self) -> Result<PrintsAnswer, ClientError>

Call prints on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read.

Source

pub fn status(&self, print_id: &str) -> Result<StatusAnswer, ClientError>

Call status on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read.

Source

pub fn context(&self, print_id: &str) -> Result<ContextAnswer, ClientError>

Call context on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read.

Source

pub fn image(&self, image_id: &str) -> Result<ImageAnswer, ClientError>

Call image on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read.

Source

pub fn history( &self, print_id: &str, limit: Option<i64>, ) -> Result<HistoryAnswer, ClientError>

Call history on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read.

Source

pub fn events( &self, after: Option<String>, print_id: Option<String>, kinds: Option<Vec<String>>, exclude_kinds: Option<Vec<String>>, wait_s: Option<i64>, limit: Option<i64>, ) -> Result<EventsAnswer, ClientError>

Call events on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read.

Source

pub fn manifest_get( &self, print_id: &str, ) -> Result<ManifestAnswer, ClientError>

Call manifest_get on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read.

Source

pub fn look( &self, print_id: &str, wait_s: Option<i64>, ) -> Result<Look, ClientError>

Call look on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read.

Source

pub fn manifest_set( &self, print_id: &str, reason: &str, manifest: &JobManifest, ) -> Result<ManifestAnswer, ClientError>

Call manifest_set on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn spools( &self, include_retired: Option<bool>, ) -> Result<SpoolsAnswer, ClientError>

Call spools on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read.

Source

pub fn spool(&self, spool_id: &str) -> Result<SpoolAnswer, ClientError>

Call spool on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read.

Source

pub fn printer_history( &self, kinds: Option<Vec<String>>, since: Option<String>, until: Option<String>, spool_id: Option<String>, before: Option<String>, limit: Option<i64>, ) -> Result<TimelineAnswer, ClientError>

Call printer_history on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read.

Source

pub fn preflight(&self, file_name: &str) -> Result<PreflightAnswer, ClientError>

Call preflight on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read.

Source

pub fn pause( &self, print_id: &str, reason: &str, ) -> Result<ActionAnswer, ClientError>

Call pause on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn resume( &self, print_id: &str, reason: &str, ) -> Result<ActionAnswer, ClientError>

Call resume on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn cancel( &self, print_id: &str, reason: &str, ) -> Result<ActionAnswer, ClientError>

Call cancel on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn start_print( &self, print_id: &str, file_name: &FileName, manifest: &JobManifest, reason: &str, override_filament_check: Option<bool>, ) -> Result<ActionAnswer, ClientError>

Call start_print on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn set_feedrate_factor( &self, print_id: &str, factor: f64, reason: &str, duration_s: Option<i64>, ) -> Result<ActionAnswer, ClientError>

Call set_feedrate_factor on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn set_flowrate_factor( &self, print_id: &str, factor: f64, reason: &str, duration_s: Option<i64>, ) -> Result<ActionAnswer, ClientError>

Call set_flowrate_factor on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn set_tool_target_c( &self, print_id: &str, reason: &str, target_c: f64, tool: i64, duration_s: Option<i64>, ) -> Result<ActionAnswer, ClientError>

Call set_tool_target_c on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn set_bed_target_c( &self, print_id: &str, reason: &str, target_c: f64, duration_s: Option<i64>, ) -> Result<ActionAnswer, ClientError>

Call set_bed_target_c on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn set_fan_percent( &self, print_id: &str, percent: f64, reason: &str, duration_s: Option<i64>, ) -> Result<ActionAnswer, ClientError>

Call set_fan_percent on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn acknowledge_failure( &self, print_id: &str, disposition: &AcknowledgementDisposition, event_id: &EventId, reason: &str, ) -> Result<ActionAnswer, ClientError>

Call acknowledge_failure on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn close_print( &self, print_id: &str, outcome: &PrintOutcome, reason: &str, ) -> Result<ActionAnswer, ClientError>

Call close_print on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn register_spool( &self, initial_g: f64, material: &str, name: &str, reason: &str, color: Option<String>, density_g_cm3: Option<f64>, diameter_mm: Option<f64>, remaining_g: Option<f64>, tare_g: Option<f64>, ) -> Result<SpoolCommandAnswer, ClientError>

Call register_spool on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn load_spool( &self, spool_id: &str, reason: &str, tool: i64, ) -> Result<SpoolCommandAnswer, ClientError>

Call load_spool on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn unload_spool( &self, spool_id: &str, reason: &str, ) -> Result<SpoolCommandAnswer, ClientError>

Call unload_spool on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn adjust_spool( &self, spool_id: &str, reason: &str, gross_g: Option<f64>, remaining_g: Option<f64>, ) -> Result<SpoolCommandAnswer, ClientError>

Call adjust_spool on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn retire_spool( &self, spool_id: &str, reason: &str, ) -> Result<SpoolCommandAnswer, ClientError>

Call retire_spool on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn recover_status(&self) -> Result<RecoveryStatus, ClientError>

Call recover_status on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read.

Source

pub fn recover_lift( &self, mm: f64, reason: &str, ) -> Result<RecoveryAnswer, ClientError>

Call recover_lift on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn recover_cool(&self, reason: &str) -> Result<RecoveryAnswer, ClientError>

Call recover_cool on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn recover_fan( &self, percent: f64, reason: &str, ) -> Result<RecoveryAnswer, ClientError>

Call recover_fan on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn recover_heat( &self, reason: &str, target_c: f64, tool: i64, clearance_asserted: Option<bool>, ) -> Result<RecoveryAnswer, ClientError>

Call recover_heat on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn recover_park( &self, reason: &str, clearance_asserted: Option<bool>, ) -> Result<RecoveryAnswer, ClientError>

Call recover_park on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn recover_home_xy( &self, reason: &str, clearance_asserted: Option<bool>, ) -> Result<RecoveryAnswer, ClientError>

Call recover_home_xy on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Source

pub fn recover_home_z( &self, reason: &str, bed_clear_asserted: Option<bool>, ) -> Result<RecoveryAnswer, ClientError>

Call recover_home_z on the configured supervisor.

§Errors

Returns ClientError when the supervisor could not be reached, when it answered something this client cannot read, when this client refuses the call before making it because the reason is empty, and when the policy refused the action — which arrives as ClientError::Rejected, carrying the reason, the value asked for and the range allowed.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Client

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Client

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.