Crate plaid [] [src]

Plaid is the technology layer for financial services. This library makes it easy to interface with Plaid.

In order to make calls to the API, you'll be using Client as the dispatcher.

Plaid's API is grouped into different products, which are represented types that implement the Product trait. Most of these products have the same authentication mechanism and data retrieval style. Therefore an API request is built by combining a product with a Payload.

Overview

The following provides a high-level outline of the core components in this library:

  • Client represents the configuration of your API credentials, endpoint and HTTP client.

  • User represents an end-user that has authenticated their bank account, and of which you have a Plaid access token for.

  • Product is a trait that provides the bare minimum definition of a product (e.g Connect, Auth, Income) required in order for the Client to infer request/response behavior with.

See the data module for a complete list.

Products

Below are the currently supported Plaid products. Each product has its own module, and is documented with usage examples.

Quick Start

Add plaid as a dependency to Cargo.toml:

[dependencies]
plaid = "0.1"

Write some code, notice that it uses Hyper under the hood:

let hyper = hyper::client::Client::new();

use plaid::api::product;
use plaid::api::client::{ Client, Payload };

// Build a client given your current credentials.
let client = Client {
    endpoint: "https://tartan.plaid.com",
    client_id: "yourclientid",
    secret: "yourclientsecret",
    hyper: &hyper
};

// Authenticate the user for Plaid Connect.
// `response` will be `Authenticated(..)` if successful, which includes a `User`
let response = client.request(product::Connect,
    Payload::Authenticate(client,
                          "Chase".to_string(),
                          "username".to_string(),
                          "password".to_string(),
                          None,
                          None));

Respond to multifactor authentication challenges:

let user = User { access_token: "useraccesstoken".to_string() };
let response = client.request(
    product::Connect,
    Payload::StepMFA(client, user, mfa::Response::Code("1234".to_string())));

Fetch data from the product:

let user = User { access_token: "useraccesstoken".to_string() };
let response = client.request(
    product::Connect,
    Payload::FetchData(client, user, Some(FetchDataOptions::default())));

Modules

api

The namespace that everything in this library falls under.