pub struct Projects {
pub client: Client,
}requests only.Fields§
§client: ClientImplementations§
Source§impl Projects
impl Projects
Sourcepub async fn list_categories<'a>(
&'a self,
) -> Result<Vec<ProjectCategoryResponse>, Error>
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(())
}Sourcepub async fn list_public<'a>(
&'a self,
) -> Result<Vec<PublicProjectResponse>, Error>
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(())
}Sourcepub async fn get_public<'a>(
&'a self,
id: Uuid,
) -> Result<PublicProjectResponse, Error>
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(())
}Sourcepub async fn download_public<'a>(
&'a self,
format: Option<ProjectArchiveFormat>,
id: Uuid,
) -> Result<(), Error>
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 totar.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(())
}Sourcepub async fn get_public_thumbnail<'a>(&'a self, id: Uuid) -> Result<(), Error>
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(())
}Sourcepub async fn create_public_vote<'a>(
&'a self,
id: Uuid,
) -> Result<PublicProjectVoteResponse, Error>
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(())
}Sourcepub async fn delete_public_vote<'a>(
&'a self,
id: Uuid,
) -> Result<PublicProjectVoteResponse, Error>
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(())
}Sourcepub async fn list<'a>(&'a self) -> Result<Vec<ProjectSummaryResponse>, Error>
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(())
}Sourcepub async fn create<'a>(
&'a self,
attachments: Vec<Attachment>,
) -> Result<ProjectResponse, Error>
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(())
}Sourcepub async fn get<'a>(&'a self, id: Uuid) -> Result<ProjectResponse, Error>
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(())
}Sourcepub async fn update<'a>(
&'a self,
attachments: Vec<Attachment>,
id: Uuid,
) -> Result<ProjectResponse, Error>
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(())
}Sourcepub async fn delete<'a>(&'a self, id: Uuid) -> Result<(), Error>
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(())
}Sourcepub async fn download<'a>(
&'a self,
format: Option<ProjectArchiveFormat>,
id: Uuid,
) -> Result<(), Error>
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 totar.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(())
}Sourcepub async fn update_organization<'a>(
&'a self,
id: Uuid,
) -> Result<ProjectResponse, Error>
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(())
}Sourcepub async fn delete_organization<'a>(&'a self, id: Uuid) -> Result<(), Error>
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(())
}Sourcepub async fn publish<'a>(&'a self, id: Uuid) -> Result<ProjectResponse, Error>
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(())
}Sourcepub async fn get_thumbnail<'a>(&'a self, id: Uuid) -> Result<(), Error>
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(())
}Sourcepub async fn list_versions<'a>(
&'a self,
id: Uuid,
limit: Option<u32>,
page_token: Option<String>,
) -> Result<ProjectVersionSummaryResponseResultsPage, Error>
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 callpage_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(())
}Sourcepub async fn get_version<'a>(
&'a self,
id: Uuid,
version_id: Uuid,
) -> Result<ProjectVersionDetailResponse, Error>
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(())
}Sourcepub async fn download_version<'a>(
&'a self,
format: Option<ProjectArchiveFormat>,
id: Uuid,
version_id: Uuid,
) -> Result<(), Error>
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 totar.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(())
}Sourcepub async fn get_version_thumbnail<'a>(
&'a self,
id: Uuid,
version_id: Uuid,
) -> Result<(), Error>
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§
Auto Trait Implementations§
impl !RefUnwindSafe for Projects
impl !UnwindSafe for Projects
impl Freeze for Projects
impl Send for Projects
impl Sync for Projects
impl Unpin for Projects
impl UnsafeUnpin for Projects
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