Client SDKs
HVAKR provides official client SDKs to simplify API integration in your applications.
Available SDKs
Section titled “Available SDKs”TypeScript/JavaScript
Section titled “TypeScript/JavaScript”For Node.js and browser applications.
Installation:
npm install @hvakr/clientRepository: https://github.com/flowcircuits/hvakr-client
Python
Section titled “Python”For Python applications and scripts.
Installation:
pip install hvakrRepository: https://github.com/flowcircuits/hvakr-python
TypeScript SDK
Section titled “TypeScript SDK”Basic Usage
Section titled “Basic Usage”import { HvakrClient } from '@hvakr/client'
const client = new HvakrClient({ apiKey: process.env.HVAKR_API_KEY })
// List projectsconst projects = await client.projects.list()
// Get project detailsconst project = await client.projects.get('project-id')
// Get load calculationsconst loads = await client.projects.getLoads('project-id')Available Methods
Section titled “Available Methods”Projects:
projects.list()- List all projectsprojects.get(id)- Get project detailsprojects.create(data)- Create new projectprojects.update(id, data)- Update project
Calculations:
projects.getLoads(id)- Get load calculationsprojects.getVentilation(id)- Get ventilation data
Reports:
projects.exportReport(id, format)- Export report
Python SDK
Section titled “Python SDK”Basic Usage
Section titled “Basic Usage”from hvakr import HvakrClient
client = HvakrClient(api_key=os.environ['HVAKR_API_KEY'])
# List projectsprojects = client.projects.list()
# Get project detailsproject = client.projects.get('project-id')
# Get load calculationsloads = client.projects.get_loads('project-id')Available Methods
Section titled “Available Methods”Projects:
projects.list()- List all projectsprojects.get(id)- Get project detailsprojects.create(data)- Create new projectprojects.update(id, data)- Update project
Calculations:
projects.get_loads(id)- Get load calculationsprojects.get_ventilation(id)- Get ventilation data
Authentication
Section titled “Authentication”Both SDKs support:
API Key
Section titled “API Key”Set via constructor or environment variable:
const client = new HvakrClient({ apiKey: 'your-key' })Environment Variable
Section titled “Environment Variable”export HVAKR_API_KEY=your-keyThe SDK will automatically use the environment variable.
Error Handling
Section titled “Error Handling”TypeScript
Section titled “TypeScript”try { const project = await client.projects.get('id')} catch (error) { if (error.status === 404) { console.log('Project not found') }}Python
Section titled “Python”try: project = client.projects.get('id')except NotFoundError: print('Project not found')Best Practices
Section titled “Best Practices”- Use environment variables for API keys
- Handle errors appropriately
- Cache results when possible
- Check SDK version for updates