TypeScript SDK Reference
The Synodes TypeScript SDK provides a powerful interface for programmatically interacting with Synodes Sandboxes.
Installation
Install the Synodes TypeScript SDK using npm:
npm install @synodesio/sdkOr using yarn:
yarn add @synodesio/sdkGetting Started
Here’s a simple example to help you get started with the Synodes TypeScript SDK:
import { Synodes } from '@synodesio/sdk';
async function main() { // Initialize the SDK (uses environment variables by default) const synodes = new Synodes();
// Create a new sandbox const sandbox = await synodes.create({ language: 'typescript', envVars: { NODE_ENV: 'development' } });
// Execute a command const response = await sandbox.process.executeCommand('echo "Hello, World!"'); console.log(response.result);}
main().catch(console.error);Configuration
The SDK can be configured using environment variables or by passing options to the constructor:
import { Synodes } from '@synodesio/sdk';
// Using environment variables (SYNODES_API_KEY, SYNODES_API_URL, SYNODES_TARGET)const synodes = new Synodes();
// Using explicit configurationconst synodes = new Synodes({ apiKey: 'your-api-key', apiUrl: 'https://app.synodes.io/api', target: 'us'});