Skip to content

chore: add more helper funcs and bump deps #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,26 @@ futures-util = { version = "0.3.30", default-features = false, features = [
hmac = "0.12.1"
lazy_static = "1.4.0"
log = "0.4.21"
prost = { version = "0.13.1", optional = true }
prost = { version = "0.13", optional = true }
quick_cache = { version = "0.6.3", features = [] }
reqwest = { version = "0.12.7", default-features = false, features = ["json", "multipart", "rustls-tls"] }
reqwest = { version = "0.12.7", default-features = false, features = [
"json",
"multipart",
"rustls-tls",
] }
simd-adler32 = "0.3.7"
serde_repr = "0.1.19"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sha2 = "0.10.8"
strum = "0.26.2"
strum_macros = "0.26.4"
thiserror = "1.0.61"
strum = "0.27"
strum_macros = "0.27"
thiserror = "2.0"
tokio = { version = "1.38", features = ["rt", "rt-multi-thread", "macros"] }
url = { version = "2.5.0", features = ["serde"] }
tokio-tungstenite = { version = "0.23", features = ["rustls-tls-native-roots"], optional = true }

tokio-tungstenite = { version = "0.23", features = [
"rustls-tls-native-roots",
], optional = true }


[dev-dependencies]
Expand Down Expand Up @@ -267,7 +272,6 @@ name = "get_bitable"
path = "examples/api/bitable/v1/app/get.rs"



[[example]]
name = "app_table_field_list"
path = "examples/api/bitable/v1/app_table_field/list.rs"
Expand All @@ -293,4 +297,4 @@ path = "examples/api/bitable/v1/app_table_record/batch_create.rs"

[[example]]
name = "app_table_record_search"
path = "examples/api/bitable/v1/app_table_record/search.rs"
path = "examples/api/bitable/v1/app_table_record/search.rs"
26 changes: 26 additions & 0 deletions src/service/bitable/v1/share.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,30 @@ impl Record {
}
Some(texts)
}

/// 获取单选文本
pub fn get_single_select_text(&self, key: &str) -> Option<String> {
let value = self.fields.get(key)?;
let text = value.as_str()?;
Some(text.to_string())
}

/// 获取多选文本
pub fn get_multi_select_text(&self, key: &str) -> Option<Vec<String>> {
let value = self.fields.get(key)?;
let array = value.as_array()?;
let mut texts = Vec::new();
for item in array {
let text = item.as_str()?.to_string();
texts.push(text);
}
Some(texts)
}

/// 获取布尔值(通过 checkbox)
pub fn get_checkbox(&self, key: &str) -> Option<bool> {
let value = self.fields.get(key)?;
let checkbox = value.as_bool()?;
Some(checkbox)
}
}
Loading