Integration
fetch
Data fetching and retrieval
fetch
High-performance data fetching with automatic retries, caching, parallel requests, and response transformation for HTTP and API operations.
Overview
The fetch primitive provides an enhanced HTTP client with built-in best practices for reliability, performance, and developer experience when fetching data from APIs and web services.
Quick Example
import { fetch } from 'sdk.do'
// Simple fetch
const user = await fetch('https://api.example.com/users/123')
// With options
const response = await fetch('https://api.example.com/users', {
method: 'POST',
body: { name: 'Alice', email: '[email protected]' },
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
},
retry: 3,
timeout: 5000,
})
// Parallel fetching
const [users, products, orders] = await fetch.all(['https://api.example.com/users', 'https://api.example.com/products', 'https://api.example.com/orders'])
// With caching
const cached = await fetch('https://api.example.com/config', {
cache: '1h', // Cache for 1 hour
})Core Capabilities
- Automatic Retries - Configurable retry logic with backoff
- Request Caching - In-memory and distributed caching
- Parallel Requests - Batch multiple requests efficiently
- Response Parsing - Auto JSON/XML/text parsing
- Timeout Management - Request and response timeouts
Access Methods
SDK
TypeScript/JavaScript library for fetching data
await fetch('https://api.example.com/users/123')CLI
Command-line tool for HTTP requests
do fetch https://api.example.com/users/123API
REST/RPC endpoints for proxied fetching
curl -X POST https://api.do/v1/fetch -d '{"url":"https://api.example.com/users/123"}'MCP
Model Context Protocol for AI-driven data fetching
Fetch user data from https://api.example.com/users/123