ferrtable/lib.rs
1//! # Ferrtable: Ferris the Crab's Favorite Airtable Client
2//!
3//! ## Status: Work in Progress
4//!
5//! Only a limited set of operations are currently supported. Any version bumps
6//! before version 0.1 may include breaking changes to the crate API.
7//!
8//! ## Usage
9//!
10//! ```no_run
11//! use std::error::Error;
12//!
13//! use futures::prelude::*;
14//! use serde::{Deserialize, Serialize};
15//!
16//! // Ferrtable allows us to use any record types that implement Clone,
17//! // Deserialize, and Serialize.
18//! ##[derive(Clone, Debug, Deserialize, Serialize)]
19//! struct MyRecord {
20//! #[serde(rename = "Name")]
21//! name: String,
22//!
23//! #[serde(rename = "Notes")]
24//! notes: String,
25//!
26//! #[serde(rename = "Assignee")]
27//! assignee: Option<String>,
28//!
29//! #[serde(rename = "Status")]
30//! status: Status,
31//!
32//! #[serde(rename = "Attachments")]
33//! attachments: Vec<ferrtable::cell_values::AttachmentRead>,
34//! }
35//!
36//! ##[derive(Clone, Debug, Deserialize, Serialize)]
37//! enum Status {
38//! Todo,
39//!
40//! #[serde(rename = "In progress")]
41//! InProgress,
42//!
43//! Done,
44//! }
45//!
46//! ##[tokio::main]
47//! async fn main() -> Result<(), Box<dyn Error>> {
48//! let client = ferrtable::Client::new_from_access_token("******")?;
49//!
50//! client
51//! .create_records([MyRecord {
52//! name: "Steal Improbability Drive".to_owned(),
53//! notes: "Just for fun, no other reason.".to_owned(),
54//! assignee: None,
55//! status: Status::InProgress,
56//! attachments: vec![],
57//! }])
58//! .with_base_id("***")
59//! .with_table_id("***")
60//! .execute()
61//! .await?;
62//!
63//! let mut rec_stream = client
64//! .list_records()
65//! .with_base_id("***")
66//! .with_table_id("***")
67//! .with_filter("{status} = 'Todo' || {status} = 'In Progress'")
68//! .stream_items::<MyRecord>()?;
69//!
70//! while let Some(result) = rec_stream.next().await {
71//! dbg!(result?.fields);
72//! }
73//!
74//! Ok(())
75//! }
76//! ```
77//!
78//! ## Features
79//!
80//! ### `chrono`
81//!
82//! Deserializes certain Airtable timestamp fields as `chrono::DateTime` values
83//! instead of [`String`]s. Disabled by default.
84
85pub mod cell_values;
86pub mod client;
87pub mod errors;
88mod pagination;
89pub mod types;
90
91// Each API operation is organized into a dedicated Rust module.
92pub mod create_records;
93pub mod get_record;
94pub mod list_bases;
95pub mod list_records;
96
97pub use client::Client;