pub struct Factory {
pub client: Client,
}requests only.Fields§
§client: ClientImplementations§
Source§impl Factory
impl Factory
Sourcepub async fn list_org_jobs<'a>(
&'a self,
limit: Option<u32>,
page_token: Option<String>,
sort_by: Option<CreatedAtSortMode>,
) -> Result<FactoryCustomerJobSummaryResultsPage, Error>
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 callpage_token: Option<String>: Token returned by previous call to retrieve the subsequent pagesort_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(())
}Sourcepub async fn get_org_job<'a>(
&'a self,
job_id: Uuid,
) -> Result<FactoryCustomerJobDetail, Error>
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(())
}Sourcepub async fn get_user_finishes<'a>(
&'a self,
) -> Result<Vec<FactoryCustomerCatalogOption>, Error>
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(())
}Sourcepub async fn list_user_jobs<'a>(
&'a self,
limit: Option<u32>,
page_token: Option<String>,
sort_by: Option<CreatedAtSortMode>,
) -> Result<FactoryCustomerJobSummaryResultsPage, Error>
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 callpage_token: Option<String>: Token returned by previous call to retrieve the subsequent pagesort_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(())
}Sourcepub async fn create_user_job<'a>(
&'a self,
attachments: Vec<Attachment>,
) -> Result<FactoryJobResponse, Error>
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(())
}Sourcepub async fn get_user_job<'a>(
&'a self,
job_id: Uuid,
) -> Result<FactoryCustomerJobDetail, Error>
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(())
}Sourcepub async fn get_user_materials<'a>(
&'a self,
) -> Result<Vec<FactoryCustomerCatalogOption>, Error>
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§
Auto Trait Implementations§
impl !RefUnwindSafe for Factory
impl !UnwindSafe for Factory
impl Freeze for Factory
impl Send for Factory
impl Sync for Factory
impl Unpin for Factory
impl UnsafeUnpin for Factory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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