@superyachttimes/sytiq-api-cli
v1.0.5
Published
CLI tool and module for interacting with SYT iQ API
Readme
SYT iQ API - CLI
A TypeScript CLI tool and module for interacting with the SYT iQ API.
Installation
npm install -g @superyachttimes/sytiq-api-cliUsage
As a CLI Tool
Run the interactive CLI:
sytiq
The CLI will:
- Prompt for your API key (stored in
~/.syt-iq-api/credentials) - Ask what action you'd like to perform
- Prompt for any required identifiers (IMO, MMSI, or SYT iQ ID)
- Ask where to save the results JSON file
- Execute the API calls and save the results
As a Module in Your Code
Class-based Approach
import { SYTIQApiClient } from '@superyachttimes/sytiq-api-cli'
const client = new SYTIQApiClient('your-api-key')
// Fetch by IMO
const yacht = await client.fetchYachtByIMO('1234567')
// Fetch by MMSI
const yacht = await client.fetchYachtByMMSI('123456789')
// Fetch by SYT iQ ID
const yacht = await client.fetchYachtBySYTIQId('abc123')
// Fetch all yachts with progress tracking
const yachts = await client.fetchAllYachts({
onProgress: (current, total) => {
console.log(`Progress: ${current}/${total}`)
},
})Function-based Approach
import { fetchYachtByIMO, fetchYachtByMMSI, fetchYachtBySYTIQId, fetchAllYachts } from '@superyachttimes/sytiq-api-cli'
const yacht = await fetchYachtByIMO('your-api-key', '1234567')
const allYachts = await fetchAllYachts('your-api-key')Development
# Build TypeScript
npm run build
# Run in development mode
npm run devProject Structure
src/
api/
client.ts # API client class
utils/
credentials.ts # Credential management
fileUtils.ts # File operations
cli.ts # CLI interface
index.ts # Module exportsNotes
- Credentials are stored in
~/.syt-iq-api/credentialswith restricted permissions (600). - The "fetch all yachts" operation makes approximately 14.5k API calls and includes a progress indicator.
