Crate smartsheet_rs

Source
Expand description

githubcrates-iodocs-rs


An async Rust library implementation to interact with the Smartsheet API v2.


§Example

use smartsheet_rs::SmartsheetApi;

#[tokio::main]
async fn main() -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
    let smart = SmartsheetApi::from_env()?;
    println!("Created a Smartsheet API client");

    let sheets = smart.list_sheets().await?;

    println!("Printing sheet IDs and names:");
    for sheet in sheets.data {
        println!(
            "{sep}{id:<20}|{sep}{name}",
            sep = '\t',
            id = sheet.id,
            name = sheet.name
        );
    }

    Ok(())
}

§Implemented Methods

The following API methods from the official documentation have been implemented currently:

You can check out sample usage of these API methods in the examples/ folder in the project repo on GitHub.

§A Larger Example

This section contains more examples of usage. You can find it in the readme documentation on the crates.io page, or alternatively in the README.md file on the GitHub project repo.

§Dependencies and Features

This library uses only the minimum required dependencies, in order to keep the overall size small. This crate uses hyper and hyper-rustls internally, to make HTTPS requests to the Smartsheet API.

While hyper-rustls was chosen as the default TLS implementation because it works without issue when cross-compiling for the x86_64-unknown-linux-musl target as is common for AWS Lambda deployments, it is still possible to instead use the native hyper-tls implementation, which relies on OpenSSL.

To do this, disable the default “rust-tls” feature and enable the “native-tls” feature:

[dependencies]
smartsheet-rs = { version = "0.6.2", default-features = false, features = ["native-tls", "logging", "serde-std"] }

Re-exports§

pub use helpers::CellGetter;
pub use helpers::ColumnMapper;
pub use helpers::RowGetter;

Modules§

auth
Authentication helper utilities
builders
Builder constructs
constants
Library-specific constants
helpers
Public helper utilities
models
Library-specific models for interacting with the Smartsheet API.
status
Utilities to validate a response to ensure that its status code indicates that it is a success.
types
Library-specific type definitions
utils
Library-specific utilities, mainly for internal use.

Structs§

CellFactory
Cell Factory - Utility to make it easier to construct a Cell object, which is useful when adding or updating Rows in a Sheet.
SmartsheetApi
Client implementation for making requests to the Smartsheet API v2