Git Product home page Git Product logo

plaid-rs's Introduction

plaid-rs

Build Status MIT licensed

Rust async client library for accessing the Plaid API.

Documentation

Please see the documentation website, or at docs.rs.

The source code can be found at https://github.com/ammubhave/plaid-rs. Source code for older versions (<= 0.2.0) of this crate can found at https://github.com/nathankot/plaid-rust.

Usage

Add this to your Cargo.toml:

[dependencies]
plaid = "1"

To make API calls, you need to create an instance of the Plaid Client. The client can be created by calling plaid::Client::new(client_id, secret, environment), or by calling plaid::Client::from_env() and passing the credentials in PLAID_CLIENT_ID, PLAID_SECRET, and PLAID_ENVIRONMENT environment variables.

Examples

The following example shows you how to connect to Plaid, and retrieve transactions:

use plaid::Client;

#[tokio::main]
async fn main() {
    // Get a valid sandbox access token. You should substitute `access_token` with your own valid access token.
    let sandbox_resp = client
        .create_sandbox_public_token("ins_109508", &["auth", "identity", "transactions"])
        .await
        .unwrap();
    let token_resp = client
        .exchange_public_token(&sandbox_resp.public_token)
        .await
        .unwrap();
    let access_token = token_resp.access_token;

    let end_date = Utc::now().naive_utc().date();
    let start_date = end_date.sub(chrono::Duration::days(365));

    let resp = client
        .get_transactions(&access_token, start_date, end_date, None)
        .await
        .unwrap();
    for transaction in &resp.transactions {
        println!("{:?}", transaction);
    }
}

Testing

You can run cargo test to run the test suite. You must supply sandbox credentials in PLAID_CLIENT_ID and PLAID_SECRET environment variables, or the tests will fail.

Contribution

Your contribution is highly appreciated. Do not hesitate to open an issue or a pull request. Note that any contribution submitted for inclusion in the project will be licensed according to the terms given in LICENSE.

Disclaimer

This SOFTWARE PRODUCT is provided by THE PROVIDER "as is" and "with all faults." THE PROVIDER makes no representations or warranties of any kind concerning the safety, suitability, lack of viruses, inaccuracies, typographical errors, or other harmful components of this SOFTWARE PRODUCT. There are inherent dangers in the use of any software, and you are solely responsible for determining whether this SOFTWARE PRODUCT is compatible with your equipment and other software installed on your equipment. You are also solely responsible for the protection of your equipment and backup of your data, and THE PROVIDER will not be liable for any damages you may suffer in connection with using, modifying, or distributing this SOFTWARE PRODUCT.

plaid-rs's People

Contributors

ammubhave avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.