# Migrating to SDK v2.0

## Key Changes

### Authentication

**Before:**
\```typescript
const config = new Configuration({ apiKey: 'YOUR_API_KEY' });
const api = new DefaultApi(config);
\```

**After:**
\```typescript
const sdk = new SpeakeasyCoffeeClient({
apiKeyAuth: 'YOUR_API_KEY'
});
\```

### Making API Calls

**Before:**
\```typescript
const orders = await api.getOrders({ coffeeType: 'Latte' });
const order = await api.getOrder(123);
\```

**After:**
\```typescript
const orders = await sdk.orders.list({ coffeeType: 'Latte' });
const order = await sdk.orders.getById({ orderId: 123 });
\```

### Error Handling

**Before:** Generic catch-all errors
**After:** Typed errors (`sdk.Error.BadRequestError`, etc.)
```

Speakeasy automatically generates SDK documentation, reducing the effort required on your end. In addition to generated docs, provide migration guides and examples to help customers understand the changes.

## Summary

Here's a quick recap of the steps involved in migrating an SDK from OpenAPI Generator to Speakeasy:

- Start with a thorough inventory of your current setup.
- Test the migrated SDK thoroughly, especially any custom functionality.
- Decide on a migration strategy that fits your customer base.
- Provide clear documentation of all changes to your customers.