Cache

SDKs

Native SDKs for every stack.

Typed clients for Python, Node.js, Go, and Ruby. Install in seconds, query in minutes.

Python
v2.4.1
Docs

Install

pip install cache

Usage

from cache import Client

client = Client(api_key="sk_live_...")

# List recent transactions
transactions = client.transactions.list(
    account_id="acc_8f3k2j1",
    limit=10
)

for txn in transactions:
    print(f"{txn.date}: {txn.merchant} - ${abs(txn.amount)}")
Node.js
v3.1.0
Docs

Install

npm install @usecache/node

Usage

import { Cache } from '@usecache/node';

const client = new Cache({ apiKey: 'sk_live_...' });

// List recent transactions
const transactions = await client.transactions.list({
  accountId: 'acc_8f3k2j1',
  limit: 10,
});

transactions.forEach((txn) => {
  console.log(`${txn.date}: ${txn.merchant} - $${Math.abs(txn.amount)}`);
});
Go
v1.8.3
Docs

Install

go get github.com/usecache/cache-go

Usage

package main

import (
    "fmt"
    "github.com/usecache/cache-go"
)

func main() {
    client := cache.New("sk_live_...")

    // List recent transactions
    txns, _ := client.Transactions.List(&cache.ListParams{
        AccountID: "acc_8f3k2j1",
        Limit:     10,
    })

    for _, txn := range txns {
        fmt.Printf("%s: %s - $%.2f\n", txn.Date, txn.Merchant, -txn.Amount)
    }
}
Ruby
v1.5.2
Docs

Install

gem install cache

Usage

require 'cache'

client = Cache::Client.new(api_key: 'sk_live_...')

# List recent transactions
transactions = client.transactions.list(
  account_id: 'acc_8f3k2j1',
  limit: 10
)

transactions.each do |txn|
  puts "#{txn.date}: #{txn.merchant} - $#{txn.amount.abs}"
end