Compare commits

..

2 commits

Author SHA1 Message Date
Brent Schroeter
b5a961d7cc prepare crate for publishing 2025-09-16 23:12:20 -07:00
Brent Schroeter
11b92d78a0 add mit license 2025-09-16 22:54:43 -07:00
5 changed files with 74 additions and 38 deletions

20
LICENSE.md Normal file
View file

@ -0,0 +1,20 @@
MIT License
Copyright (c) 2025 Brent Schroeter
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

38
ferrtable/Cargo.lock generated
View file

@ -233,7 +233,7 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
name = "ferrtable"
version = "0.1.0"
version = "0.0.1"
dependencies = [
"chrono",
"derive_builder",
@ -546,9 +546,9 @@ dependencies = [
[[package]]
name = "iana-time-zone"
version = "0.1.63"
version = "0.1.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8"
checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb"
dependencies = [
"android_system_properties",
"core-foundation-sys",
@ -1540,15 +1540,15 @@ dependencies = [
[[package]]
name = "windows-core"
version = "0.61.2"
version = "0.62.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
checksum = "57fe7168f7de578d2d8a05b07fd61870d2e73b4020e9f49aa00da8471723497c"
dependencies = [
"windows-implement",
"windows-interface",
"windows-link 0.1.3",
"windows-result",
"windows-strings",
"windows-link 0.2.0",
"windows-result 0.4.0",
"windows-strings 0.5.0",
]
[[package]]
@ -1592,8 +1592,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b8a9ed28765efc97bbc954883f4e6796c33a06546ebafacbabee9696967499e"
dependencies = [
"windows-link 0.1.3",
"windows-result",
"windows-strings",
"windows-result 0.3.4",
"windows-strings 0.4.2",
]
[[package]]
@ -1605,6 +1605,15 @@ dependencies = [
"windows-link 0.1.3",
]
[[package]]
name = "windows-result"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7084dcc306f89883455a206237404d3eaf961e5bd7e0f312f7c91f57eb44167f"
dependencies = [
"windows-link 0.2.0",
]
[[package]]
name = "windows-strings"
version = "0.4.2"
@ -1614,6 +1623,15 @@ dependencies = [
"windows-link 0.1.3",
]
[[package]]
name = "windows-strings"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7218c655a553b0bed4426cf54b20d7ba363ef543b52d515b3e48d7fd55318dda"
dependencies = [
"windows-link 0.2.0",
]
[[package]]
name = "windows-sys"
version = "0.52.0"

View file

@ -1,17 +1,24 @@
[package]
name = "ferrtable"
version = "0.1.0"
version = "0.0.1"
categories = ["api-bindings"]
description = "Ferris the crab's favorite Airtable library"
homepage = "https://forge.secondsystemtech.com/brent/ferrtable"
edition = "2024"
keywords = ["api", "client"]
license = "MIT"
readme = "README.md"
repository = "https://forge.secondsystemtech.com/brent/ferrtable"
[dependencies]
derive_builder = { version = "0.20.2", features = ["clippy"] }
futures = "0.3.31"
percent-encoding = "2.3.2"
reqwest = { version = "0.12.23", features = ["json"] }
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.143"
thiserror = "2.0.16"
chrono = { version = "0.4.42", features = ["serde"], optional = true }
derive_builder = { version = "0.20.2" }
futures = "0.3"
percent-encoding = "2.3"
reqwest = { version = "0.12", features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "2.0"
[features]
chrono = ["dep:chrono"]

View file

@ -55,7 +55,7 @@ enum Status {
}
#[tokio::main]
async fn main() {
async fn main() -> Result<(), Box<dyn Error>> {
let client = ferrtable::Client::new_from_access_token("******").unwrap();
client
@ -68,24 +68,20 @@ async fn main() {
}])
.with_base_id("***".to_owned())
.with_table_id("***".to_owned())
.build()
.unwrap()
.build()?
.execute()
.await
.unwrap();
.await?;
let mut rec_stream = client
.list_records()
.with_base_id("***".to_owned())
.with_table_id("***".to_owned())
.with_filter("{status} = 'Todo' || {status} = 'In Progress'".to_owned())
.build()
.unwrap()
.build()?
.stream_items::<MyRecord>();
while let Some(result) = rec_stream.next().await {
let rec = result.unwrap();
dbg!(rec.fields);
dbg!(result?.fields);
}
}
```

View file

@ -52,11 +52,9 @@ impl Client {
/// ])
/// .with_base_id("***".to_owned())
/// .with_table_id("***".to_owned())
/// .build()
/// .unwrap()
/// .build()?
/// .execute()
/// .await
/// .unwrap();
/// .await?;
/// ```
pub fn create_records<I, T>(&self, records: I) -> CreateRecordsQueryBuilder<T>
where
@ -79,12 +77,11 @@ impl Client {
///
/// let mut base_stream = client
/// .list_bases()
/// .build()
/// .unwrap()
/// .build()?
/// .stream_items();
///
/// while let Some(result) = base_stream.next().await {
/// dbg!(result.unwrap());
/// dbg!(result?);
/// }
/// ```
pub fn list_bases(&self) -> ListBasesQueryBuilder {
@ -104,13 +101,11 @@ impl Client {
/// .list_records()
/// .with_base_id("***")
/// .with_table_id("***")
/// .build()
/// .unwrap()
/// .build()?
/// .stream_items::<HashMap<String, serde_json::Value>>();
///
/// while let Some(result) = rec_stream.next().await {
/// let rec = result.unwrap();
/// dbg!(rec.fields);
/// dbg!(rec?.fields);
/// }
/// ```
pub fn list_records(&self) -> ListRecordsQueryBuilder {