Struct plaid::client::Client[][src]

pub struct Client {
    pub client_id: String,
    pub secret: String,
    // some fields omitted
}

Fields

client_id: Stringsecret: String

Implementations

impl Client[src]

pub async fn get_balances<'a>(
    &self,
    access_token: &str,
    options: Option<GetBalancesOptions<'a>>
) -> Result<GetBalancesResponse>
[src]

Retrieve real-time balance data.

The /accounts/balance/get endpoint returns the real-time balance for each of an Item's accounts. While other endpoints may return a balance object, only /accounts/balance/get forces the available and current balance fields to be refreshed rather than cached. This endpoint can be used for existing Items that were added via any of Plaid’s other products. This endpoint can be used as long as Link has been initialized with any other product, balance itself is not a product that can be used to initialize Link.

  • access_token - The access token associated with the Item data is being requested for.
  • options - An optional object to filter /accounts/balance/get results.

pub async fn get_accounts<'a>(
    &self,
    access_token: &str,
    options: Option<GetAccountsOptions<'a>>
) -> Result<GetAccountsResponse>
[src]

Retrieve accounts.

The /accounts/get endpoint can be used to retrieve information for any linked Item. Note that some information is nullable. Plaid will only return active bank accounts, i.e. accounts that are not closed and are capable of carrying a balance.

  • access_token - The access token associated with the Item data is being requested for.
  • options - An optional object to filter /accounts/get results.

impl Client[src]

pub async fn get_auth<'a>(
    &self,
    access_token: &str,
    options: Option<GetAuthOptions<'a>>
) -> Result<GetAuthResponse>
[src]

Retrieve auth data.

The /auth/get endpoint returns the bank account and bank identification numbers (such as routing numbers, for US accounts) associated with an Item's checking and savings accounts, along with high-level account data and balances when available.

  • access_token - The access token associated with the Item data is being requested for.
  • options - An optional object to filter /auth/get results.

impl Client[src]

pub async fn get_categories(&self) -> Result<GetCategoriesResponse>[src]

Get Categories

Send a request to the /categories/get endpoint to get detailed information on categories returned by Plaid.

impl Client[src]

pub fn new(
    client_id: String,
    secret: String,
    environment: Environment
) -> Client
[src]

Create a plaid client using the supplied credentials.

  • client_id - Your Plaid API client_id.
  • secret - Your Plaid API secret.
  • environment - The Plaid environment to use.

pub fn from_env() -> Client[src]

Create a plaid client using credentials supplied from the environment.

Credentials must be passed in PLAID_CLIENT_ID, PLAID_SECRET and PLAID_ENVIRONMENT environment variables. PLAID_ENVIRONMENT must be set to SANDBOX, DEVELOPMENT or PRODUCTION.

pub async fn send_request<T, U>(&self, url: &str, req: &T) -> Result<U> where
    T: Serialize,
    U: for<'de> Deserialize<'de>, 
[src]

impl Client[src]

pub async fn get_deposit_switch<'a>(
    &self,
    deposit_switch_id: &str
) -> Result<GetDepositSwitchResponse>
[src]

Retrieve a deposit switch.

This endpoint returns information related to how the user has configured their payroll allocation and the state of the switch. You can use this information to build logic related to the user's direct deposit allocation preferences.

  • deposit_switch_id - The ID of the deposit switch

pub async fn create_deposit_switch<'a>(
    &self,
    target_account_id: &str,
    target_access_token: &str
) -> Result<CreateDepositSwitchResponse>
[src]

Create a deposit switch.

This endpoint creates a deposit switch entity that will be persisted throughout the lifecycle of the switch.

  • target_account_id - Plaid Account ID that specifies the target bank account. This account will become the recipient for a user's direct deposit.
  • target_access_token - Access token for the target Item, typically provided in the Import Item response.

impl Client[src]

pub async fn get_holdings<'a>(
    &self,
    access_token: &str,
    options: Option<GetHoldingsOptions<'a>>
) -> Result<GetHoldingsResponse>
[src]

Get Investment holdings.

The /investments/holdings/get endpoint allows developers to receive user-authorized stock position data for investment-type accounts.

  • access_token - The access token associated with the Item data is being requested for.
  • options - An optional object to filter /investments/holdings/get results.

impl Client[src]

pub async fn get_identity<'a>(
    &self,
    access_token: &str,
    options: Option<GetIdentityOptions<'a>>
) -> Result<GetIdentityResponse>
[src]

Retrieve identity data.

The /identity/get endpoint allows you to retrieve various account holder information on file with the financial institution, including names, emails, phone numbers, and addresses. Only name data is guaranteed to be returned; other fields will be empty arrays if not provided by the institution.

  • access_token - The access token associated with the Item data is being requested for.
  • options - An optional object to filter /identity/get results.

impl Client[src]

pub async fn get_institution_by_id(
    &self,
    institution_id: &str,
    country_codes: &[&str],
    options: Option<GetInstitutionByIdOptions>
) -> Result<GetInstitutionByIdResponse>
[src]

Get details of an institution.

Returns a JSON response containing details on a specified financial institution currently supported by Plaid.

  • institution_id - The ID of the institution to get details about
  • country_codes - Specify an array of Plaid-supported country codes this institution supports, using the ISO-3166-1 alpha-2 country code standard. Possible values: US, GB, ES, NL, FR, IE, CA
  • options - Specifies optional parameters for /institutions/get_by_id.

pub async fn get_institutions(
    &self,
    count: i32,
    offset: i32,
    country_codes: &[&str],
    options: Option<GetInstitutionsOptions>
) -> Result<GetInstitutionsResponse>
[src]

Get details of all supported institutions.

Returns a JSON response containing details on all financial institutions currently supported by Plaid. Because Plaid supports thousands of institutions, results are paginated. This data changes frequently. If you store it locally on your system, be sure to update it regularly.

  • count - The total number of Institutions to return.
  • offset - The number of Institutions to skip.
  • country_codes - Specify an array of Plaid-supported country codes this institution supports, using the ISO-3166-1 alpha-2 country code standard.
  • options - An optional object to filter /institutions/get results.

pub async fn search_institutions(
    &self,
    query: &str,
    products: &[&str],
    country_codes: &[&str],
    options: Option<SearchInstitutionsOptions>
) -> Result<SearchInstitutionsResponse>
[src]

Search institutions.

Returns a JSON response containing details for institutions that match the query parameters, up to a maximum of ten institutions per query.

  • query - The search query. Institutions with names matching the query are returned
  • products - Filter the Institutions based on whether they support all products listed in products.
  • country_codes - Specify an array of Plaid-supported country codes this institution supports, using the ISO-3166-1 alpha-2 country code standard.
  • options - An optional object to filter /institutions/search results.

impl Client[src]

pub async fn get_investment_transactions<'a>(
    &self,
    access_token: &str,
    start_date: NaiveDate,
    end_date: NaiveDate,
    options: Option<GetInvestmentTransactionsOptions<'a>>
) -> Result<GetInvestmentTransactionsResponse>
[src]

Get investment transactions.

The /investments/transactions/get endpoint allows developers to retrieve user-authorized transaction data for investment accounts.

Transactions are returned in reverse-chronological order, and the sequence of transaction ordering is stable and will not shift.

Due to the potentially large number of investment transactions associated with an Item, results are paginated. Manipulate the count and offset parameters in conjunction with the total_investment_transactions response body field to fetch all available investment transactions.

  • access_token - The access token associated with the Item data is being requested for.
  • start_date - The earliest date for which to fetch transaction history.
  • end_date - The most recent date for which to fetch transaction history.
  • options - An optional object to filter /investments/transactions/get results.

impl Client[src]

pub async fn get_item(&self, access_token: &str) -> Result<GetItemResponse>[src]

Retrieve an Item.

Returns information about the status of an Item.

  • access_token - The access token associated with the Item data is being requested for.

pub async fn remove_item(
    &self,
    access_token: &str
) -> Result<RemoveItemResponse>
[src]

Remove an Item.

The /item/remove endpoint allows you to remove an Item. Once removed, the access_token associated with the Item is no longer valid and cannot be used to access any data that was associated with the Item.

  • access_token - The access token associated with the Item data is being requested for.

pub async fn update_item_webhook(
    &self,
    access_token: &str,
    webhook: &str
) -> Result<UpdateItemWebhookResponse>
[src]

Update Webhook URL.

The POST /item/webhook/update allows you to update the webhook URL associated with an Item. This request triggers a WEBHOOK_UPDATE_ACKNOWLEDGED webhook to the newly specified webhook URL.

  • access_token - The access token associated with the Item data is being requested for.
  • webhook - The new webhook URL to associate with the Item.

pub async fn invalidate_access_token(
    &self,
    access_token: &str
) -> Result<InvalidateAccessTokenResponse>
[src]

Invalidate access_token.

By default, the access_token associated with an Item does not expire and should be stored in a persistent, secure manner.

You can use the /item/access_token/invalidate endpoint to rotate the access_token associated with an Item. The endpoint returns a new access_token and immediately invalidates the previous access_token.

  • access_token - The access token associated with the Item data is being requested for.

pub async fn create_public_token(
    &self,
    access_token: &str
) -> Result<CreatePublicTokenResponse>
[src]

Create public token

Note: As of July 2020, the /item/public_token/create endpoint is deprecated. Instead, use /link/token/create with an access_token to create a Link token for use with update mode.

  • access_token - The access token associated with the Item data is being requested for.

pub async fn exchange_public_token(
    &self,
    public_token: &str
) -> Result<ExchangePublicTokenResponse>
[src]

Exchange public token for an access token.

Exchange a Link public_token for an API access_token. Link hands off the public_token client-side via the onSuccess callback once a user has successfully created an Item. The public_token is ephemeral and expires after 30 minutes.

The response also includes an item_id that should be stored with the access_token. The item_id is used to identify an Item in a webhook. The item_id can also be retrieved by making an /item/get request.

  • public_token - Your public_token, obtained from the Link onSuccess callback or /sandbox/item/public_token/create.

impl Client[src]

pub async fn get_liabilities<'a>(
    &self,
    access_token: &str,
    options: Option<GetLiabilitiesOptions<'a>>
) -> Result<GetLiabilitiesResponse>
[src]

Retrieve Liabilities data.

The /liabilities/get endpoint returns various details about an Item with loan or credit accounts. Liabilities data is available primarily for US financial institutions, with some limited coverage of Canadian institutions. Currently supported account types are account type credit with account subtype credit card or paypal, and account type loan with account subtype student or mortgage. To limit accounts listed in Link to types and subtypes supported by Liabilities, you can use the account_filter parameter when creating a Link token.

The types of information returned by Liabilities can include balances and due dates, loan terms, and account details such as original loan amount and guarantor. Data is refreshed approximately once per day; the latest data can be retrieved by calling /liabilities/get.

  • access_token - The access token associated with the Item data is being requested for.
  • options - An optional object to filter /liabilities/get results.

impl Client[src]

Create Link Token.

The /link/token/create endpoint creates a link_token, which is required as a parameter when initializing Link. Once Link has been initialized, it returns a public_token, which can then be exchanged for an access_token via /item/public_token/exchange as part of the main Link flow.

A link_token generated by /link/token/create is also used to initialize other Link flows, such as the update mode flow for tokens with expired credentials, or the Payment Initiation (Europe) flow.

  • configs - Parameters to use for creating link token.

Get Link Token.

The /link/token/get endpoint gets information about a previously-created link_token using the /link/token/create endpoint. It can be useful for debugging purposes.

  • link_token - A link_token from a previous invocation of /link/token/create

impl Client[src]

pub async fn create_processor_token(
    &self,
    access_token: &str,
    account_id: &str,
    processor: &str
) -> Result<CreateProcessorTokenResponse>
[src]

Create processor token.

Used to create a token suitable for sending to one of Plaid's partners to enable integrations. Note that Stripe partnerships use bank account tokens instead; see /processor/stripe/bank_account_token/create for creating tokens for use with Stripe integrations.

  • access_token - The access token associated with the Item data is being requested for.
  • account_id - The account_id value obtained from the onSuccess callback in Link.
  • processor - The processor you are integrating with. Valid values are "achq", "check", "checkbook", "circle", "drivewealth", "dwolla", "galileo", "interactive_brokers", "modern_treasury", "ocrolus", "prime_trust", "rize", "sila_money", "unit", "velox", "vesta", "vopay", "wyre"

impl Client[src]

pub async fn create_sandbox_public_token(
    &self,
    institution_id: &str,
    initial_products: &[&str]
) -> Result<CreateSandboxPublicTokenResponse>
[src]

Create a test Item.

Use the /sandbox/public_token/create endpoint to create a valid public_token for an arbitrary institution ID, initial products, and test credentials. The created public_token maps to a new Sandbox Item. You can then call /item/public_token/exchange to exchange the public_token for an access_token and perform all API actions. /sandbox/public_token/create can also be used with the user_custom test username to generate a test account with custom data.

  • institution_id - The ID of the institution the Item will be associated with.
  • initial_products - The products to initially pull for the Item. May be any products that the specified institution_id supports. This array may not be empty.

pub async fn reset_sandbox_item(
    &self,
    access_token: &str
) -> Result<ResetSandboxItemResponse>
[src]

Force a Sandbox Item into an error state.

/sandbox/item/reset_login/ forces an Item into an ITEM_LOGIN_REQUIRED state in order to simulate an Item whose login is no longer valid. This makes it easy to test Link's update mode flow in the Sandbox environment. After calling /sandbox/item/reset_login, You can then use Plaid Link update mode to restore the Item to a good state. An ITEM_LOGIN_REQUIRED webhook will also be fired after a call to this endpoint, if one is associated with the Item.

In the Sandbox, Items will transition to an ITEM_LOGIN_REQUIRED error state automatically after 30 days, even if this endpoint is not called.

  • access_token - The access token associated with the Item data is being requested for.

pub async fn set_sandbox_verification_status(
    &self,
    access_token: &str,
    account_id: &str,
    verification_status: &str
) -> Result<SetSandboxItemVerificationStatusResponse>
[src]

Set verification status for Sandbox account.

The /sandbox/item/set_verification_status endpoint can be used to change the verification status of an Item in in the Sandbox in order to simulate the Automated Micro-deposit flow.

Note that not all Plaid developer accounts are enabled for micro-deposit based verification by default. Your account must be enabled for this feature in order to test it in Sandbox. To enable this features or check your status, contact your account manager or submit a product access Support ticket.

  • access_token - The access token associated with the Item data is being requested for.
  • account_id - The account_id of the account whose verification status is to be modified
  • verification_status - The verification status to set the account to. Possible values: automatically_verified, verification_expired.

pub async fn fire_webhook(
    &self,
    access_token: &str,
    webhook_code: &str
) -> Result<FireWebhookResponse>
[src]

Fire a test webhook.

The /sandbox/item/fire_webhook endpoint is used to test that code correctly handles webhooks. Calling this endpoint triggers a Transactions DEFAULT_UPDATE webhook to be fired for a given Sandbox Item. If the Item does not support Transactions, a SANDBOX_PRODUCT_NOT_ENABLED error will result.

  • access_token - The access token associated with the Item data is being requested for.
  • webhook_code - The following values for webhook_code are supported: DEFAULT_UPDATE.

impl Client[src]

pub async fn get_transactions<'a>(
    &self,
    access_token: &str,
    start_date: NaiveDate,
    end_date: NaiveDate,
    options: Option<GetTransactionsOptions<'a>>
) -> Result<GetTransactionsResponse>
[src]

Get transaction data.

The /transactions/get endpoint allows developers to receive user-authorized transaction data for credit, depository, and some loan-type accounts (the list of loan-type accounts supported is the same as for Liabilities; for details, see the /liabilities/get endpoint). For transaction history from investments accounts, use the Investments endpoint instead. Transaction data is standardized across financial institutions, and in many cases transactions are linked to a clean name, entity type, location, and category. Similarly, account data is standardized and returned with a clean name, number, balance, and other meta information where available.

Transactions are returned in reverse-chronological order, and the sequence of transaction ordering is stable and will not shift. Transactions are not immutable and can also be removed altogether by the institution; a removed transaction will no longer appear in /transactions/get. For more details, see Pending and posted transactions.

Due to the potentially large number of transactions associated with an Item, results are paginated. Manipulate the count and offset parameters in conjunction with the total_transactions response body field to fetch all available transactions.

Note that data may not be immediately available to /transactions/get. Plaid will begin to prepare transactions data upon Item link, if Link was initialized with transactions, or upon the first call to /transactions/get, if it wasn't. To be alerted when transaction data is ready to be fetched, listen for the INITIAL_UPDATE and HISTORICAL_UPDATE webhooks. If no transaction history is ready when /transactions/get is called, it will return a PRODUCT_NOT_READY error.

  • access_token - The access token associated with the Item data is being requested for.
  • start_date - The earliest date for which data should be returned.
  • end_date - The latest date for which data should be returned.
  • options - An optional object to be used with the request.

pub async fn refresh_transactions(
    &self,
    access_token: &str
) -> Result<RefreshTransactionsResponse>
[src]

Refresh transaction data.

/transactions/refresh is an optional endpoint for users of the Transactions product. It initiates an on-demand extraction to fetch the newest transactions for an Item. This on-demand extraction takes place in addition to the periodic extractions that automatically occur multiple times a day for any Transactions-enabled Item. If changes to transactions are discovered after calling /transactions/refresh, Plaid will fire a webhook: TRANSACTIONS_REMOVED will be fired if any removed transactions are detected, and DEFAULT_UPDATE will be fired if any new transactions are detected. New transactions can be fetched by calling /transactions/get.

  • access_token - The access token associated with the Item data is being requested for.

impl Client[src]

pub async fn get_webhook_verification_key(
    &self,
    key_id: &str
) -> Result<GetWebhookVerificationKeyResponse>
[src]

Get webhook verification key.

Plaid signs all outgoing webhooks and provides JSON Web Tokens (JWTs) so that you can verify the authenticity of any incoming webhooks to your application. A message signature is included in the Plaid-Verification header.

The /webhook_verification_key/get endpoint provides a JSON Web Key (JWK) that can be used to verify a JWT.

  • key_id - The key ID ( kid ) from the JWT header.

Trait Implementations

impl Clone for Client[src]

impl Debug for Client[src]

Auto Trait Implementations

impl !RefUnwindSafe for Client[src]

impl Send for Client[src]

impl Sync for Client[src]

impl Unpin for Client[src]

impl !UnwindSafe for Client[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.