hugging_face_client/api/
create_collection.rs

1use serde::Serialize;
2
3/// Request of [`crate::client::Client::create_collection`]
4#[derive(Debug, Serialize)]
5pub struct CreateCollectionReq<'a> {
6  title: &'a str,
7  namespace: &'a str,
8
9  #[serde(skip_serializing_if = "Option::is_none")]
10  description: Option<&'a str>,
11
12  // #[serde(skip_serializing_if = "Option::is_none")]
13  // item: Option<CreateCollectionItem<'a>>,
14  private: bool,
15}
16
17impl<'a> CreateCollectionReq<'a> {
18  pub fn new(title: &'a str, namespace: &'a str, private: bool) -> Self {
19    CreateCollectionReq {
20      title,
21      namespace,
22      description: None,
23      // item: None,
24      private,
25    }
26  }
27
28  pub fn description(mut self, description: &'a str) -> Self {
29    self.description = Some(description);
30    self
31  }
32
33  // pub fn item(mut self, item: CreateCollectionItem<'a>) -> Self {
34  //   self.item = Some(item);
35  //   self
36  // }
37}