Official SDKs

Official client libraries for JavaScript/TypeScript, Python, and Go

JavaScript / TypeScript

Full TypeScript support with type definitions included

v1.0.0
10k+
View on GitHub

Python

Pythonic interface with async support and type hints

v1.0.0
5k+
View on GitHub

Go

Idiomatic Go with context support and comprehensive error handling

v1.0.0
3k+
View on GitHub

JavaScript / TypeScript SDK

Installation

npm install @shambarecords/sdk

Quick Start

example.jsjavascript
import { ShambaRecords } from '@shambarecords/sdk';

// Initialize with your API key
const client = new ShambaRecords({
  apiKey: 'sr_pub_your_public_key',
  // For secret key operations:
  // secretKey: 'sr_sec_your_secret_key'
});

// Fetch latest prices
const prices = await client.prices.getLatest({
  product_uuids: ['550e8400-e29b-41d4-a716-446655440000'],
  county_id: 47
});

console.log(prices);

// Search prices with filters
const searchResults = await client.prices.search({
  product_uuid: '550e8400-e29b-41d4-a716-446655440000',
  start_date: '2024-01-01',
  end_date: '2024-01-31',
  county_id: 47
});

// Get price statistics
const stats = await client.prices.getStatistics({
  product_uuid: '550e8400-e29b-41d4-a716-446655440000',
  start_date: '2024-01-01',
  end_date: '2024-12-31',
  group_by: 'month'
});

// List products
const products = await client.products.list({
  category: 'Cereals',
  page: 1
});

// Get markets
const markets = await client.markets.list({
  county_id: 47,
  market_type: 'Wholesale'
});

Features

  • ✓ Full TypeScript support with type definitions
  • ✓ Automatic HMAC signature generation for secret key requests
  • ✓ Promise-based async/await API
  • ✓ Automatic retry with exponential backoff
  • ✓ Built-in request validation
  • ✓ Comprehensive error handling

Python SDK

Installation

pip install shambarecords

Quick Start

example.pypython
from shambarecords import ShambaRecords

# Initialize with your API key
client = ShambaRecords(
    api_key='sr_pub_your_public_key',
    # For secret key operations:
    # secret_key='sr_sec_your_secret_key'
)

# Fetch latest prices
prices = client.prices.get_latest(
    product_uuids=['550e8400-e29b-41d4-a716-446655440000'],
    county_id=47
)

print(prices)

# Search prices with filters
search_results = client.prices.search(
    product_uuid='550e8400-e29b-41d4-a716-446655440000',
    start_date='2024-01-01',
    end_date='2024-01-31',
    county_id=47
)

# Get price statistics
stats = client.prices.get_statistics(
    product_uuid='550e8400-e29b-41d4-a716-446655440000',
    start_date='2024-01-01',
    end_date='2024-12-31',
    group_by='month'
)

# List products
products = client.products.list(
    category='Cereals',
    page=1
)

# Get markets
markets = client.markets.list(
    county_id=47,
    market_type='Wholesale'
)

Features

  • ✓ Type hints for better IDE support
  • ✓ Automatic HMAC signature generation
  • ✓ Async/await support with asyncio
  • ✓ Automatic retry with exponential backoff
  • ✓ Pythonic naming conventions
  • ✓ Comprehensive error handling with custom exceptions

Go SDK

Installation

go get github.com/shambarecords/shambarecords-go

Quick Start

main.gogo
package main

import (
    "context"
    "fmt"
    "log"

    "github.com/shambarecords/shambarecords-go"
)

func main() {
    // Initialize with your API key
    client := shambarecords.NewClient(
        shambarecords.WithAPIKey("sr_pub_your_public_key"),
        // For secret key operations:
        // shambarecords.WithSecretKey("sr_sec_your_secret_key"),
    )

    ctx := context.Background()

    // Fetch latest prices
    prices, err := client.Prices.GetLatest(ctx, &shambarecords.LatestPricesRequest{
        ProductUUIDs: []string{"550e8400-e29b-41d4-a716-446655440000"},
        CountyID:     shambarecords.Int(47),
    })
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("Prices: %+v\n", prices)

    // Search prices with filters
    searchResults, err := client.Prices.Search(ctx, &shambarecords.SearchPricesRequest{
        ProductUUID: shambarecords.String("550e8400-e29b-41d4-a716-446655440000"),
        StartDate:   shambarecords.String("2024-01-01"),
        EndDate:     shambarecords.String("2024-01-31"),
        CountyID:    shambarecords.Int(47),
    })
    if err != nil {
        log.Fatal(err)
    }

    // Get price statistics
    stats, err := client.Prices.GetStatistics(ctx, &shambarecords.StatisticsRequest{
        ProductUUID: "550e8400-e29b-41d4-a716-446655440000",
        StartDate:   "2024-01-01",
        EndDate:     "2024-12-31",
        GroupBy:     shambarecords.String("month"),
    })

    // List products
    products, err := client.Products.List(ctx, &shambarecords.ListProductsRequest{
        Category: shambarecords.String("Cereals"),
        Page:     shambarecords.Int(1),
    })

    // Get markets
    markets, err := client.Markets.List(ctx, &shambarecords.ListMarketsRequest{
        CountyID:   shambarecords.Int(47),
        MarketType: shambarecords.String("Wholesale"),
    })
}

Features

  • ✓ Idiomatic Go with context support
  • ✓ Automatic HMAC signature generation
  • ✓ Strongly typed request/response structures
  • ✓ Automatic retry with exponential backoff
  • ✓ Comprehensive error handling
  • ✓ Thread-safe client implementation

Support & Contributing

All SDKs are open source and accepting contributions. If you encounter any issues or have feature requests:

Report Issues

Open an issue on the respective GitHub repository

Join the Community

Connect with other developers using ShambaRecords

Community Forum