Skip to content

SDKs

Official Software Development Kits (SDKs) for integrating 0.link into your applications. Our SDKs provide type-safe, feature-complete access to the 0.link platform with built-in error handling, retry logic, and best practices.

Available SDKs

JavaScript/TypeScript

Perfect for web applications, Node.js servers, and React/Vue projects.

  • JavaScript SDK → - Complete documentation
  • Package: @0link/sdk
  • React Package: @0link/react
  • Vue Package: @0link/vue

Python

Ideal for backend services, data processing, and automation.

  • Python SDK → - Complete documentation
  • Package: zerolink
  • Async Support: Built-in async/await support

Coming Soon

  • Go SDK - For high-performance services
  • PHP SDK - For web applications
  • Ruby SDK - For Rails applications
  • .NET SDK - For C# applications

Quick Comparison

FeatureJavaScriptPythonStatus
Type Safety✅ TypeScript✅ Type hintsReady
Async/AwaitReady
React HooksReady
Vue ComposablesReady
Retry LogicReady
WebSocket SupportReady
File UploadReady
Rate LimitingReady

Installation

JavaScript/Node.js

bash
npm install @0link/sdk
# or
yarn add @0link/sdk

React

bash
npm install @0link/react @0link/sdk
# or
yarn add @0link/react @0link/sdk

Vue

bash
npm install @0link/vue @0link/sdk
# or
yarn add @0link/vue @0link/sdk

Python

bash
pip install zerolink
# or
poetry add zerolink

Basic Usage

JavaScript

javascript
import { ZeroLink } from '@0link/sdk';

const client = new ZeroLink({
  apiKey: 'your_api_key_here'
});

// Get account information
const account = await client.account.get();

// List projects
const projects = await client.projects.list();

// Create a project
const project = await client.projects.create({
  name: 'My New Project',
  description: 'A sample project'
});

Python

python
from zerolink import Client

client = Client(api_key='your_api_key_here')

# Get account information
account = client.account.get()

# List projects
projects = client.projects.list()

# Create a project
project = client.projects.create(
    name='My New Project',
    description='A sample project'
)

SDK Features

Authentication

All SDKs handle authentication automatically using your API key.

Error Handling

Built-in error handling with detailed error information and retry logic.

Type Safety

Full TypeScript support (JavaScript) and type hints (Python).

Rate Limiting

Automatic rate limit handling with exponential backoff.

Pagination

Simple pagination with cursor-based navigation.

File Uploads

Streamlined file upload with progress tracking.

WebSocket Support

Real-time updates through WebSocket connections.

Framework Integration

React Hooks

jsx
import { ZeroLinkProvider, useProjects } from '@0link/react';

function App() {
  return (
    <ZeroLinkProvider apiKey="your_api_key">
      <ProjectsList />
    </ZeroLinkProvider>
  );
}

function ProjectsList() {
  const { projects, loading, error } = useProjects();

  if (loading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return (
    <ul>
      {projects.map(project => (
        <li key={project.id}>{project.name}</li>
      ))}
    </ul>
  );
}

Vue Composables

vue
<template>
  <div>
    <div v-if="loading">Loading...</div>
    <div v-else-if="error">Error: {{ error.message }}</div>
    <ul v-else>
      <li v-for="project in projects" :key="project.id">
        {{ project.name }}
      </li>
    </ul>
  </div>
</template>

<script setup>
import { useProjects } from '@0link/vue';

const { projects, loading, error } = useProjects();
</script>

Configuration Options

JavaScript Configuration

javascript
const client = new ZeroLink({
  apiKey: 'your_api_key',
  environment: 'production', // or 'development'
  timeout: 10000, // Request timeout in ms
  retryAttempts: 3, // Number of retry attempts
  retryDelay: 1000, // Base retry delay in ms
  baseURL: 'https://api.0link.com/v2', // Custom base URL
  debug: false // Enable debug logging
});

Python Configuration

python
client = Client(
    api_key='your_api_key',
    environment='production',  # or 'development'
    timeout=10.0,  # Request timeout in seconds
    retry_attempts=3,  # Number of retry attempts
    retry_delay=1.0,  # Base retry delay in seconds
    base_url='https://api.0link.com/v2',  # Custom base URL
    debug=False  # Enable debug logging
)

Error Handling

JavaScript

javascript
try {
  const project = await client.projects.create(projectData);
} catch (error) {
  if (error.code === 'VALIDATION_ERROR') {
    console.log('Validation failed:', error.details);
  } else if (error.code === 'RATE_LIMIT_EXCEEDED') {
    console.log('Rate limited, retry after:', error.retryAfter);
  } else {
    console.log('Unexpected error:', error.message);
  }
}

Python

python
from zerolink.exceptions import ValidationError, RateLimitError

try:
    project = client.projects.create(project_data)
except ValidationError as e:
    print(f'Validation failed: {e.details}')
except RateLimitError as e:
    print(f'Rate limited, retry after: {e.retry_after}')
except Exception as e:
    print(f'Unexpected error: {e}')

Testing Support

Mock Clients

javascript
// JavaScript
import { MockZeroLink } from '@0link/sdk/testing';

const mockClient = new MockZeroLink({
  projects: [
    { id: '1', name: 'Test Project' }
  ]
});
python
# Python
from zerolink.testing import MockClient

mock_client = MockClient(
    projects=[
        {'id': '1', 'name': 'Test Project'}
    ]
)

Migration Guide

From Direct API Calls

If you're currently using direct API calls, migrating to an SDK is straightforward:

javascript
// Before: Direct API calls
const response = await fetch('https://api.0link.com/v2/projects', {
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json'
  }
});
const projects = await response.json();

// After: Using SDK
const projects = await client.projects.list();

Version Compatibility

SDK VersionAPI VersionNode.jsPython
2.xv2≥14≥3.8
1.xv1 (deprecated)≥12≥3.7

Performance Tips

  1. Reuse Client Instances: Create one client instance and reuse it
  2. Use Pagination: Don't fetch all data at once
  3. Implement Caching: Cache frequently accessed data
  4. Handle Rate Limits: Implement proper retry logic
  5. Use Batch Operations: Group related operations when possible

Getting Help

  • Documentation: Detailed guides for each SDK
  • Examples: Sample code and tutorials
  • Support: Email support@0link.com
  • GitHub: Report issues and contribute
  • Community: Join our developer Discord

Next Steps