hugging_face_client/api/
modify_collection.rs1use serde::{Deserialize, Serialize};
2
3use crate::collection::Collection;
4
5#[derive(Debug, Serialize)]
7pub struct ModifyCollectionReq<'a> {
8 #[serde(skip_serializing)]
9 pub(crate) slug: &'a str,
10
11 #[serde(skip_serializing_if = "Option::is_none")]
12 pub(crate) title: Option<&'a str>,
13
14 #[serde(skip_serializing_if = "Option::is_none")]
15 pub(crate) description: Option<&'a str>,
16
17 #[serde(skip_serializing_if = "Option::is_none")]
18 pub(crate) private: Option<bool>,
19
20 #[serde(skip_serializing_if = "Option::is_none")]
21 pub(crate) position: Option<usize>,
22
23 #[serde(skip_serializing_if = "Option::is_none")]
24 pub(crate) theme: Option<&'a str>,
25}
26
27impl<'a> ModifyCollectionReq<'a> {
28 pub fn new(slug: &'a str) -> ModifyCollectionReq<'a> {
29 ModifyCollectionReq {
30 slug,
31 title: None,
32 description: None,
33 private: None,
34 position: None,
35 theme: None,
36 }
37 }
38
39 pub fn title(mut self, title: &'a str) -> Self {
40 self.title = Some(title);
41 self
42 }
43
44 pub fn description(mut self, description: &'a str) -> Self {
45 self.description = Some(description);
46 self
47 }
48
49 pub fn private(mut self, private: bool) -> Self {
50 self.private = Some(private);
51 self
52 }
53
54 pub fn position(mut self, position: usize) -> Self {
55 self.position = Some(position);
56 self
57 }
58
59 pub fn theme(mut self, theme: &'a str) -> Self {
60 self.theme = Some(theme);
61 self
62 }
63}
64
65#[derive(Debug, Deserialize)]
67pub struct ModifyCollectionRes {
68 pub success: bool,
69 pub data: Collection,
70}