openlark_workflow/v2/custom_field/
models.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
7#[serde(rename_all = "snake_case")]
8pub enum CustomFieldType {
9 Text,
11 Number,
13 Date,
15 Person,
17 Checkbox,
19 Select,
21}
22
23#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
25pub struct CustomFieldConfig {
26 #[serde(rename = "type")]
28 pub field_type: CustomFieldType,
29 #[serde(skip_serializing_if = "Option::is_none")]
31 pub options: Option<Vec<String>>,
32}
33
34impl Default for CustomFieldConfig {
35 fn default() -> Self {
36 Self {
37 field_type: CustomFieldType::Text,
38 options: None,
39 }
40 }
41}
42
43#[derive(Debug, Clone, Serialize, Default)]
45pub struct CreateCustomFieldBody {
46 pub name: String,
48 pub config: CustomFieldConfig,
50 pub resource_type: String,
52 pub resource_id: String,
54}
55
56#[derive(Debug, Clone, Serialize, Default)]
58pub struct UpdateCustomFieldBody {
59 #[serde(skip_serializing_if = "Option::is_none")]
61 pub name: Option<String>,
62 #[serde(skip_serializing_if = "Option::is_none")]
64 pub config: Option<CustomFieldConfig>,
65}
66
67#[derive(Debug, Clone, Deserialize)]
69pub struct CreateCustomFieldResponse {
70 pub field_guid: String,
72 pub name: String,
74 pub config: CustomFieldConfig,
76 pub created_at: String,
78 pub updated_at: String,
80}
81
82#[derive(Debug, Clone, Deserialize)]
84pub struct GetCustomFieldResponse {
85 pub field_guid: String,
87 pub name: String,
89 pub config: CustomFieldConfig,
91 pub created_at: String,
93 pub updated_at: String,
95}
96
97#[derive(Debug, Clone, Deserialize)]
99pub struct UpdateCustomFieldResponse {
100 pub field_guid: String,
102 pub name: String,
104 pub config: CustomFieldConfig,
106 pub updated_at: String,
108}
109
110#[derive(Debug, Clone, Deserialize)]
112pub struct DeleteCustomFieldResponse {
113 pub success: bool,
115 pub field_guid: String,
117}
118
119#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
121pub struct CustomFieldItem {
122 pub field_guid: String,
124 pub name: String,
126 pub config: CustomFieldConfig,
128 pub created_at: String,
130 pub updated_at: String,
132}
133
134#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
136pub struct ListCustomFieldsResponse {
137 #[serde(default)]
139 pub has_more: bool,
140 #[serde(skip_serializing_if = "Option::is_none")]
142 pub page_token: Option<String>,
143 #[serde(skip_serializing_if = "Option::is_none")]
145 pub total: Option<i32>,
146 #[serde(default)]
148 pub items: Vec<CustomFieldItem>,
149}