Struct Airtable

Source
pub struct Airtable { /* private fields */ }
Expand description

Entrypoint for interacting with the Airtable API.

Implementations§

Source§

impl Airtable

Source

pub fn new<K, B, E>(key: K, base_id: B, enterprise_account_id: E) -> Self
where K: ToString, B: ToString, E: ToString,

Create a new Airtable client struct. It takes a type that can convert into an &str (String or Vec<u8> for example). As long as the function is given a valid API Key and Base ID your requests will work. You can leave the Enterprise Account ID empty if you are not using the Enterprise API features.

Source

pub fn new_from_env() -> Self

Create a new Airtable client struct from environment variables. It takes a type that can convert into an &str (String or Vec<u8> for example). As long as the function is given a valid API Key and Base ID your requests will work.

Source

pub fn get_key(&self) -> &str

Get the currently set API key.

Source

pub async fn list_records<T: DeserializeOwned>( &self, table: &str, view: &str, fields: Vec<&str>, ) -> Result<Vec<Record<T>>>

List records in a table for a particular view.

Source

pub async fn get_record<T: DeserializeOwned>( &self, table: &str, record_id: &str, ) -> Result<Record<T>>

Get record from a table.

Source

pub async fn delete_record(&self, table: &str, record_id: &str) -> Result<()>

Delete record from a table.

Source

pub async fn create_records<T: Serialize + DeserializeOwned>( &self, table: &str, records: Vec<Record<T>>, ) -> Result<Vec<Record<T>>>

Bulk create records in a table.

Due to limitations on the Airtable API, you can only bulk create 10 records at a time.

Source

pub async fn update_records<T: Serialize + DeserializeOwned>( &self, table: &str, records: Vec<Record<T>>, ) -> Result<Vec<Record<T>>>

Bulk update records in a table.

Due to limitations on the Airtable API, you can only bulk update 10 records at a time.

Source

pub async fn list_users(&self) -> Result<Vec<User>>

List users. This is for an enterprise admin to do only. FROM: https://airtable.com/api/enterprise

Source

pub async fn get_enterprise_user(&self, email: &str) -> Result<EnterpriseUser>

Get an enterprise user. This is for an enterprise admin to do only. FROM: https://airtable.com/api/enterprise#enterpriseAccountUserGetInformationByEmail Permission level can be: owner | create | edit | comment | read

Source

pub async fn add_collaborator_to_workspace( &self, workspace_id: &str, user_id: &str, permission_level: &str, ) -> Result<()>

Add a collaborator to a workspace. This is for an enterprise admin to do only. FROM: https://airtable.com/api/enterprise#enterpriseWorkspaceAddCollaborator Permission level can be: owner | create | edit | comment | read

Source

pub async fn get_enterprise_workspace<const N: usize>( &self, workspace_id: &str, includes: Option<[WorkspaceIncludes; N]>, ) -> Result<Workspace>

Returns basic information on the workspace. Does not include deleted collaborators and only include outstanding invites. FROM: https://airtable.com/api/enterprise#enterpriseWorkspaceGetInformation

Source

pub async fn delete_internal_user_by_email(&self, email: &str) -> Result<()>

Delete internal user by email. This is for an enterprise admin to do only. The user must be an internal user, meaning they have an email with the company domain. FROM: https://airtable.com/api/enterprise#enterpriseAccountUserDeleteUserByEmail

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T