Skip to main content

SDK Examples

This guide provides complete, production-ready examples for integrating the Nexus API in popular programming languages. Each example includes error handling, best practices, and common use cases.

JavaScript/TypeScript

Installation

npm

Complete SDK Implementation

TypeScript

Python

Installation

Complete SDK Implementation

Python

Go

Complete SDK Implementation

Go

Ruby

Installation

Complete SDK Implementation

Ruby

Swift

Installation

Package.swift

Complete SDK Implementation

Swift

Kotlin

Installation

build.gradle.kts

Complete SDK Implementation

Kotlin

Best Practices for All SDKs

  • Implement specific error types for different scenarios
  • Use exponential backoff for retries
  • Log errors with context for debugging
  • Provide meaningful error messages to users
  • Store session IDs persistently for long-running applications
  • Implement session recovery mechanisms
  • Handle session expiration gracefully
  • Clean up old sessions when appropriate
  • Use connection pooling for HTTP clients
  • Implement caching for frequently accessed data
  • Batch requests when possible
  • Use appropriate timeouts for different operations
  • Never hardcode API keys
  • Use environment variables or secure vaults
  • Implement rate limiting on the client side
  • Validate and sanitize all user inputs

Next Steps

Now that you have a complete SDK implementation, explore:

Error Handling

Learn about all possible errors and how to handle them

Rate Limiting

Understand rate limits and optimization strategies

Best Practices

Follow our recommended patterns for production