flexport-sdk-patterns

Featured

Apply production-ready Flexport API patterns for TypeScript and Python. Use when building typed HTTP clients, implementing pagination, or establishing team coding standards for Flexport logistics integration. Trigger: "flexport SDK patterns", "flexport best practices", "flexport client wrapper".

AI & Automation 2,944 stars 440 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Flexport SDK Patterns ## Overview Production-ready patterns for the Flexport REST API v2. Since Flexport has no official npm/pip SDK, you build typed HTTP clients. Key patterns: singleton client, paginated iteration, retry wrapper, and Zod response validation. ## Instructions ### Pattern 1: Singleton Client with Auto-Retry ```typescript // src/flexport/client.ts import { z } from 'zod'; class FlexportClient { private static instance: FlexportClient | null = null; private base = 'https://api.flexport.com'; private headers: Record<string, string>; private constructor(apiKey: string) { this.headers = { 'Authorization': `Bearer ${apiKey}`, 'Flexport-Version': '2', 'Content-Type': 'application/json', }; } static getInstance(): FlexportClient { if (!this.instance) { const key = process.env.FLEXPORT_API_KEY; if (!key) throw new Error('Missing FLEXPORT_API_KEY'); this.instance = new FlexportClient(key); } return this.instance; } async request<T>(path: string, options: RequestInit = {}): Promise<T> { const res = await fetch(`${this.base}${path}`, { ...options, headers: { ...this.headers, ...options.headers } }); if (res.status === 429) { const retryAfter = parseInt(res.headers.get('Retry-After') || '60'); await new Promise(r => setTimeout(r, retryAfter * 1000)); return this.request(path, options); // Retry once } if (!res.ok) { const body = await res.text(); ...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category