Skip to main content

Projects

Struct Projects 

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

Fields§

§client: Client

Implementations§

Source§

impl Projects

Source

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

List the active categories available for project submissions.

async fn example_projects_list_categories() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: Vec<kittycad::types::ProjectCategoryResponse> =
        client.projects().list_categories().await?;
    println!("{:?}", result);
    Ok(())
}
Source

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

List publicly visible community projects for the website/gallery.

async fn example_projects_list_public() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: Vec<kittycad::types::PublicProjectResponse> = client.projects().list_public().await?;
    println!("{:?}", result);
    Ok(())
}
Source

pub async fn get_public<'a>( &'a self, id: Uuid, ) -> Result<PublicProjectResponse, Error>

Get one publicly visible community project.

Parameters:

  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_get_public() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::PublicProjectResponse = client
        .projects()
        .get_public(uuid::Uuid::from_str(
            "d9797f8d-9ad6-4e08-90d7-2ec17e13471c",
        )?)
        .await?;
    println!("{:?}", result);
    Ok(())
}
Source

pub async fn download_public<'a>( &'a self, format: Option<ProjectArchiveFormat>, id: Uuid, ) -> Result<(), Error>

Download a published public project as a tar archive.

Parameters:

  • format: Option<crate::types::ProjectArchiveFormat>: Archive format to return. Defaults to tar.
  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_download_public() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    client
        .projects()
        .download_public(
            Some(kittycad::types::ProjectArchiveFormat::Zip),
            uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
        )
        .await?;
    Ok(())
}
Source

pub async fn get_public_thumbnail<'a>(&'a self, id: Uuid) -> Result<(), Error>

Fetch the public thumbnail for a published project.

Parameters:

  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_get_public_thumbnail() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    client
        .projects()
        .get_public_thumbnail(uuid::Uuid::from_str(
            "d9797f8d-9ad6-4e08-90d7-2ec17e13471c",
        )?)
        .await?;
    Ok(())
}
Source

pub async fn create_public_vote<'a>( &'a self, id: Uuid, ) -> Result<PublicProjectVoteResponse, Error>

Add the authenticated user’s upvote to a published community project.

Parameters:

  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_create_public_vote() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::PublicProjectVoteResponse = client
        .projects()
        .create_public_vote(uuid::Uuid::from_str(
            "d9797f8d-9ad6-4e08-90d7-2ec17e13471c",
        )?)
        .await?;
    println!("{:?}", result);
    Ok(())
}
Source

pub async fn delete_public_vote<'a>( &'a self, id: Uuid, ) -> Result<PublicProjectVoteResponse, Error>

Remove the authenticated user’s upvote from a published community project.

Parameters:

  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_delete_public_vote() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::PublicProjectVoteResponse = client
        .projects()
        .delete_public_vote(uuid::Uuid::from_str(
            "d9797f8d-9ad6-4e08-90d7-2ec17e13471c",
        )?)
        .await?;
    println!("{:?}", result);
    Ok(())
}
Source

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

List the authenticated user’s projects.

async fn example_projects_list() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: Vec<kittycad::types::ProjectSummaryResponse> = client.projects().list().await?;
    println!("{:?}", result);
    Ok(())
}
Source

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

Create a draft project for the authenticated user.

async fn example_projects_create() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::ProjectResponse = client
        .projects()
        .create(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<'a>(&'a self, id: Uuid) -> Result<ProjectResponse, Error>

Get one of the authenticated user’s projects.

Parameters:

  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_get() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::ProjectResponse = client
        .projects()
        .get(uuid::Uuid::from_str(
            "d9797f8d-9ad6-4e08-90d7-2ec17e13471c",
        )?)
        .await?;
    println!("{:?}", result);
    Ok(())
}
Source

pub async fn update<'a>( &'a self, attachments: Vec<Attachment>, id: Uuid, ) -> Result<ProjectResponse, Error>

Replace one of the authenticated user’s projects.

Parameters:

  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_update() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::ProjectResponse = client
        .projects()
        .update(
            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(),
            }],
            uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
        )
        .await?;
    println!("{:?}", result);
    Ok(())
}
Source

pub async fn delete<'a>(&'a self, id: Uuid) -> Result<(), Error>

Delete one of the authenticated user’s projects.

Parameters:

  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_delete() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    client
        .projects()
        .delete(uuid::Uuid::from_str(
            "d9797f8d-9ad6-4e08-90d7-2ec17e13471c",
        )?)
        .await?;
    Ok(())
}
Source

pub async fn download<'a>( &'a self, format: Option<ProjectArchiveFormat>, id: Uuid, ) -> Result<(), Error>

Download one of the authenticated user’s projects as a tar archive.

Parameters:

  • format: Option<crate::types::ProjectArchiveFormat>: Archive format to return. Defaults to tar.
  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_download() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    client
        .projects()
        .download(
            Some(kittycad::types::ProjectArchiveFormat::Zip),
            uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
        )
        .await?;
    Ok(())
}
Source

pub async fn update_organization<'a>( &'a self, id: Uuid, ) -> Result<ProjectResponse, Error>

Move one of the authenticated user’s projects into their active organization library.

This changes only the project’s ownership scope. The project ID, current revision, files, and version history remain unchanged so cloud bindings stay valid across the move.

Parameters:

  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_update_organization() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::ProjectResponse = client
        .projects()
        .update_organization(uuid::Uuid::from_str(
            "d9797f8d-9ad6-4e08-90d7-2ec17e13471c",
        )?)
        .await?;
    println!("{:?}", result);
    Ok(())
}
Source

pub async fn delete_organization<'a>(&'a self, id: Uuid) -> Result<(), Error>

Move an organization project back to its creator’s personal library.

Organization administrators may perform this move to revoke organization access. The project ID, current revision, files, and version history remain unchanged.

Parameters:

  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_delete_organization() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    client
        .projects()
        .delete_organization(uuid::Uuid::from_str(
            "d9797f8d-9ad6-4e08-90d7-2ec17e13471c",
        )?)
        .await?;
    Ok(())
}
Source

pub async fn publish<'a>(&'a self, id: Uuid) -> Result<ProjectResponse, Error>

Submit one of the authenticated user’s projects for public review.

Parameters:

  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_publish() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::ProjectResponse = client
        .projects()
        .publish(uuid::Uuid::from_str(
            "d9797f8d-9ad6-4e08-90d7-2ec17e13471c",
        )?)
        .await?;
    println!("{:?}", result);
    Ok(())
}

List share links for one of the authenticated user’s projects.

Parameters:

  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_list_share_links() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: Vec<kittycad::types::ProjectShareLinkResponse> = client
        .projects()
        .list_share_links(uuid::Uuid::from_str(
            "d9797f8d-9ad6-4e08-90d7-2ec17e13471c",
        )?)
        .await?;
    println!("{:?}", result);
    Ok(())
}

Create a share link for one of the authenticated user’s projects.

Parameters:

  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_create_share_link() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::ProjectShareLinkResponse = client
        .projects()
        .create_share_link(
            uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
            &kittycad::types::CreateProjectShareLinkRequest {
                access_mode: Some(kittycad::types::KclProjectShareLinkAccessMode::OrganizationOnly),
            },
        )
        .await?;
    println!("{:?}", result);
    Ok(())
}

Delete one share link for one of the authenticated user’s projects.

Parameters:

  • id: uuid::Uuid: Project identifier. (required)
  • key: &'astr: Share-link key. (required)
use std::str::FromStr;
async fn example_projects_delete_share_link() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    client
        .projects()
        .delete_share_link(
            uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
            "some-string",
        )
        .await?;
    Ok(())
}
Source

pub async fn get_thumbnail<'a>(&'a self, id: Uuid) -> Result<(), Error>

Fetch the authenticated owner’s current project thumbnail.

Parameters:

  • id: uuid::Uuid: The identifier. (required)
use std::str::FromStr;
async fn example_projects_get_thumbnail() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    client
        .projects()
        .get_thumbnail(uuid::Uuid::from_str(
            "d9797f8d-9ad6-4e08-90d7-2ec17e13471c",
        )?)
        .await?;
    Ok(())
}
Source

pub async fn list_versions<'a>( &'a self, id: Uuid, limit: Option<u32>, page_token: Option<String>, ) -> Result<ProjectVersionSummaryResponseResultsPage, Error>

List a project’s saved versions, newest first.

Requires access to the project. Public visibility or link sharing will not grant access to history.

Parameters:

  • id: uuid::Uuid: The identifier. (required)
  • 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
use std::str::FromStr;
async fn example_projects_list_versions() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::ProjectVersionSummaryResponseResultsPage = client
        .projects()
        .list_versions(
            uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
            Some(4 as u32),
            Some("some-string".to_string()),
        )
        .await?;
    println!("{:?}", result);
    Ok(())
}


/// - OR -

/// Get a stream of results.
///
/// This allows you to paginate through all the items.
use futures_util::TryStreamExt;
async fn example_projects_list_versions_stream() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let mut projects = client.projects();
    let mut stream = projects.list_versions_stream(
        uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
        Some(4 as u32),
    );
    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_version<'a>( &'a self, id: Uuid, version_id: Uuid, ) -> Result<ProjectVersionDetailResponse, Error>

Get metadata and files for a single saved project version.

Parameters:

  • id: uuid::Uuid: Project identifier. (required)
  • version_id: uuid::Uuid: Requested version identifier. (required)
use std::str::FromStr;
async fn example_projects_get_version() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::ProjectVersionDetailResponse = client
        .projects()
        .get_version(
            uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
            uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
        )
        .await?;
    println!("{:?}", result);
    Ok(())
}
Source

pub async fn download_version<'a>( &'a self, format: Option<ProjectArchiveFormat>, id: Uuid, version_id: Uuid, ) -> Result<(), Error>

Download the files saved in one project version.

Parameters:

  • format: Option<crate::types::ProjectArchiveFormat>: Archive format to return. Defaults to tar.
  • id: uuid::Uuid: Project identifier. (required)
  • version_id: uuid::Uuid: Requested version identifier. (required)
use std::str::FromStr;
async fn example_projects_download_version() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    client
        .projects()
        .download_version(
            Some(kittycad::types::ProjectArchiveFormat::Zip),
            uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
            uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
        )
        .await?;
    Ok(())
}
Source

pub async fn get_version_thumbnail<'a>( &'a self, id: Uuid, version_id: Uuid, ) -> Result<(), Error>

Fetch the thumbnail for a single saved project version.

Parameters:

  • id: uuid::Uuid: Project identifier. (required)
  • version_id: uuid::Uuid: Requested version identifier. (required)
use std::str::FromStr;
async fn example_projects_get_version_thumbnail() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    client
        .projects()
        .get_version_thumbnail(
            uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
            uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
        )
        .await?;
    Ok(())
}

Trait Implementations§

Source§

impl Clone for Projects

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 Projects

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