Skip to main content

Factory

Struct Factory 

Source
pub struct Factory {
    pub client: Client,
}
Available on crate feature requests only.

Fields§

§client: Client

Implementations§

Source§

impl Factory

Source

pub async fn list_org_jobs<'a>( &'a self, limit: Option<u32>, page_token: Option<String>, sort_by: Option<CreatedAtSortMode>, ) -> Result<FactoryCustomerJobSummaryResultsPage, Error>

List Factory jobs owned by your organization.

Any current organization member can list its jobs, including archived jobs. Ownership uses the job’s stored organization, so a submitter leaving or deleting their account does not move the job. Former members lose access. Results are paginated, newest first by default, with the job id breaking ties. Internal communication, financial details, and file storage locations are omitted.

Parameters:

  • limit: Option<u32>: Maximum number of items returned by a single call
  • page_token: Option<String>: Token returned by previous call to retrieve the subsequent page
  • sort_by: Option<crate::types::CreatedAtSortMode>
use futures_util::TryStreamExt;
async fn example_factory_list_org_jobs_stream() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let mut factory = client.factory();
    let mut stream = factory.list_org_jobs_stream(
        Some(4 as u32),
        Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),
    );
    loop {
        match stream.try_next().await {
            Ok(Some(item)) => {
                println!("{:?}", item);
            }
            Ok(None) => {
                break;
            }
            Err(err) => {
                return Err(err.into());
            }
        }
    }

    Ok(())
}
Source

pub async fn get_org_job<'a>( &'a self, job_id: Uuid, ) -> Result<FactoryCustomerJobDetail, Error>

Get an organization-owned Factory job for any current member.

Parameters:

  • job_id: uuid::Uuid: The requested job’s identifier. (required)
use std::str::FromStr;
async fn example_factory_get_org_job() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::FactoryCustomerJobDetail = client
        .factory()
        .get_org_job(uuid::Uuid::from_str(
            "d9797f8d-9ad6-4e08-90d7-2ec17e13471c",
        )?)
        .await?;
    println!("{:?}", result);
    Ok(())
}
Source

pub async fn get_user_finishes<'a>( &'a self, ) -> Result<Vec<FactoryCustomerCatalogOption>, Error>

List finishes currently available for customer Factory submissions.

Internal-only entries are omitted. Clients should refetch this endpoint after a catalog validation error before asking the customer to choose again.

async fn example_factory_get_user_finishes() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: Vec<kittycad::types::FactoryCustomerCatalogOption> =
        client.factory().get_user_finishes().await?;
    println!("{:?}", result);
    Ok(())
}
Source

pub async fn list_user_jobs<'a>( &'a self, limit: Option<u32>, page_token: Option<String>, sort_by: Option<CreatedAtSortMode>, ) -> Result<FactoryCustomerJobSummaryResultsPage, Error>

List your personal Factory jobs.

Returns jobs owned by your account, including archived jobs. Jobs with an organization owner belong to that organization, even when your account is also associated with them; use GET /org/factory/jobs to list those jobs. Results are paginated, newest first by default, with the job id breaking ties. Internal communication, financial details, and file storage locations are omitted.

Parameters:

  • limit: Option<u32>: Maximum number of items returned by a single call
  • page_token: Option<String>: Token returned by previous call to retrieve the subsequent page
  • sort_by: Option<crate::types::CreatedAtSortMode>
use futures_util::TryStreamExt;
async fn example_factory_list_user_jobs_stream() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let mut factory = client.factory();
    let mut stream = factory.list_user_jobs_stream(
        Some(4 as u32),
        Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),
    );
    loop {
        match stream.try_next().await {
            Ok(Some(item)) => {
                println!("{:?}", item);
            }
            Ok(None) => {
                break;
            }
            Err(err) => {
                return Err(err.into());
            }
        }
    }

    Ok(())
}
Source

pub async fn create_user_job<'a>( &'a self, attachments: Vec<Attachment>, ) -> Result<FactoryJobResponse, Error>

Submit a part for manufacturing. Requires a signed-in Zoo account.

The request is multipart/form-data: - one JSON part named body (FactoryIntakeForm) whose fields object holds intake data (material, finish, quantity, notes, …). Material and finish are required customer-visible catalog names; all other fields are stored verbatim so they can be added or renamed without an API change. - one or more file parts (any part name). At least one file is required.

The submitter’s identity (email, name, user id) comes from the authenticated account, not the form.

Fetch GET /user/factory/materials and GET /user/factory/finishes, then send the returned exact material and finish names. The server rejects missing, non-string, unknown, deleted, and internal-only choices with these stable field-specific error_code values: - factory_material_input_missing - factory_material_input_invalid_type - factory_material_not_found - factory_material_not_customer_visible - factory_finish_input_missing - factory_finish_input_invalid_type - factory_finish_not_found - factory_finish_not_customer_visible - quantity: a positive integer.

Example body part: ignorejson { "fields": { "material": "6061 Aluminum", "finish": "Anodized", "quantity": 10, "notes": "deburr all edges" } } ignore

Example request (curl): ignore curl -X POST https://api.zoo.dev/user/factory/jobs \ -H "Authorization: Bearer $ZOO_API_TOKEN" \ -F 'body={"fields":{"material":"6061 Aluminum","finish":"Anodized","quantity":10}};type=application/json' \ -F 'file=@bracket.step' ignore

Returns 201 with the created job (FactoryJobResponse).

async fn example_factory_create_user_job() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::FactoryJobResponse = client
        .factory()
        .create_user_job(vec![kittycad::types::multipart::Attachment {
            name: "thing".to_string(),
            filepath: Some("myfile.json".into()),
            content_type: Some("application/json".to_string()),
            data: std::fs::read("myfile.json").unwrap(),
        }])
        .await?;
    println!("{:?}", result);
    Ok(())
}
Source

pub async fn get_user_job<'a>( &'a self, job_id: Uuid, ) -> Result<FactoryCustomerJobDetail, Error>

Get a personal Factory job and its current customer-visible specifications.

Parameters:

  • job_id: uuid::Uuid: The requested job’s identifier. (required)
use std::str::FromStr;
async fn example_factory_get_user_job() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::FactoryCustomerJobDetail = client
        .factory()
        .get_user_job(uuid::Uuid::from_str(
            "d9797f8d-9ad6-4e08-90d7-2ec17e13471c",
        )?)
        .await?;
    println!("{:?}", result);
    Ok(())
}
Source

pub async fn get_user_materials<'a>( &'a self, ) -> Result<Vec<FactoryCustomerCatalogOption>, Error>

List materials currently available for customer Factory submissions.

Internal-only entries are omitted. Clients should refetch this endpoint after a catalog validation error before asking the customer to choose again.

async fn example_factory_get_user_materials() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: Vec<kittycad::types::FactoryCustomerCatalogOption> =
        client.factory().get_user_materials().await?;
    println!("{:?}", result);
    Ok(())
}

Trait Implementations§

Source§

impl Clone for Factory

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 Factory

Source§

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

Formats the value using the given formatter. Read more

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoResult<T> for T

Source§

type Err = !

Source§

fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more