Skip to content
huntrechtPublic

About

Huntrecht Platform SDKs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

164 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Huntrecht Platform SDK β€” v1

Official SDKs for the Huntrecht Platform API v1. All SDKs share a common protobuf schema definition for consistent types across languages.

Architecture

sdk/
β”œβ”€β”€ proto/huntrecht/v1/core.proto    # Single source of truth for all types
β”œβ”€β”€ Makefile                         # `make generate` β†’ protoc β†’ all languages
β”œβ”€β”€ python/                          # huntrecht-sdk (PyPI)
β”œβ”€β”€ typescript/                      # @huntrecht/sdk (npm)
β”œβ”€β”€ go/                              # github.com/huntrecht/sdk-go
β”œβ”€β”€ ruby/                            # huntrecht-sdk (RubyGems)
└── rust/                            # huntrecht-sdk (crates.io)

Available SDKs

Language Package Status
Python huntrecht-sdk βœ… v0.1.2
TypeScript/JavaScript @huntrecht/sdk βœ… v0.1.2
Go github.com/huntrecht/sdk-go βœ… v0.1.2
Ruby huntrecht-sdk βœ… v0.1.2
Rust huntrecht-sdk βœ… v0.1.2

API Coverage (v1)

All SDKs cover the complete Platform API v1 surface β€” 54 endpoints across 15 resource groups:

Resource Endpoints Scope
auth 2 Token, revoke
clients 5 API client CRUD, rotate secret
orders 3 List, get, create
payments 3 List, get, create
subscriptions 2 List, get
credit 2 Assess, score
kyc 3 List, get, submit
quotes 3 List, get, create
users 2 Me, get by ID
storefront 5 Collections, products, search
priceDrops 2 List, featured (public)
greencloud 2 Pricing feed, calculator (public)
arena 12 Orders, settlement, agents, risk, bonds, reconcile
appProxy 4 Shopify theme proxy
linkedPayments 4 Eligibility, link wallet/bank

Quick Start (Python)

pip install huntrecht-sdk
from huntrecht import HuntrechtClient

client = HuntrechtClient(
    client_id="hnt_your_client_id",
    client_secret="your_secret"
)

# Authenticate
tokens = client.auth.token()
print(f"Access token expires in {tokens['expires_in']}s")

# List orders
orders = client.orders.list(status="pending")
for order in orders["data"]:
    print(f"Order {order['id']}: {order['commodity']}")

# Get credit score
score = client.credit.score("customer@example.com")
print(f"Score: {score['data']['credit_score']}")

Quick Start (TypeScript)

npm install @huntrecht/sdk
import { HuntrechtClient } from '@huntrecht/sdk';

const client = new HuntrechtClient({
  clientId: 'hnt_your_client_id',
  clientSecret: 'your_secret',
});

// Authenticate
const tokens = await client.auth.token();
console.log(`Access token expires in ${tokens.expires_in}s`);

// List orders
const orders = await client.orders.list({ status: 'pending' });
for (const order of orders.data) {
  console.log(`Order ${order.id}: ${order.commodity}`);
}

// Get credit score
const score = await client.credit.score('customer@example.com');
console.log(`Score: ${score.data.credit_score}`);

Authentication

All SDKs use OAuth2 Client Credentials flow:

  1. Create an API client in your dashboard or via client.clients.create()
  2. Use the client_id and client_secret to initialize the SDK
  3. The SDK automatically obtains and refreshes tokens
# Python β€” automatic auth on first request
client = HuntrechtClient(client_id="hnt_abc", client_secret="secret")
orders = client.orders.list()  # token obtained automatically
// TypeScript β€” automatic auth on first request
const client = new HuntrechtClient({ clientId: 'hnt_abc', clientSecret: 'secret' });
const orders = await client.orders.list();  // token obtained automatically

Rate Limits

Rate limits are enforced by your subscription plan:

Plan Requests/Minute
Starter 60
Basic 300
Standard 1,000
Pro 3,000
Enterprise 10,000

All SDKs handle 429 responses automatically with exponential backoff.

Error Handling

from huntrecht import HuntrechtError, RateLimitError, AuthenticationError

try:
    orders = client.orders.list()
except AuthenticationError as e:
    print(f"Auth failed: {e}")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except HuntrechtError as e:
    print(f"API error: {e} (status={e.status_code})")
import { HuntrechtError, RateLimitError, AuthenticationError } from '@huntrecht/sdk';

try {
  const orders = await client.orders.list();
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error('Auth failed:', error.message);
  } else if (error instanceof RateLimitError) {
    console.error(`Rate limited. Retry after ${error.retryAfter}s`);
  } else if (error instanceof HuntrechtError) {
    console.error(`API error: ${error.message} (status=${error.status})`);
  }
}

Environment Variables

Variable Description
HUNTRECHT_BASE_URL API base URL (default: https://api.huntrecht.com)
HUNTRECHT_CLIENT_ID OAuth2 client ID
HUNTRECHT_CLIENT_SECRET OAuth2 client secret

Generating SDKs from Protobuf

cd sdk
make generate          # Generate all language types
make generate-python   # Python only
make generate-typescript  # TypeScript only

License

MIT

About

Huntrecht Platform SDKs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages