JavaScript SDK

Official JavaScript SDK for Node.js and browser environments

Installation

npm install @content-hub/sdk

Or with yarn:

yarn add @content-hub/sdk

Quick Start

import { ContentHub } from '@content-hub/sdk';

const hub = new ContentHub({
  apiKey: 'YOUR_API_KEY'
});

// List domains
const domains = await hub.domains.list();
console.log(domains);

// Create content
const content = await hub.content.create({
  title: 'My Article',
  content: 'Article content',
  domain: 'example.com'
});
console.log(content);

Working with Domains

// List all domains
const domains = await hub.domains.list();

// Get a specific domain
const domain = await hub.domains.get('example.com');

// Create a new domain
const newDomain = await hub.domains.create({
  name: 'newdomain.com'
});

// Update domain settings
await hub.domains.update('example.com', {
  settings: { /* ... */ }
});

Working with Content

// List content
const content = await hub.content.list({
  domain: 'example.com',
  limit: 20
});

// Get specific content
const item = await hub.content.get('content-id');

// Create content
const newContent = await hub.content.create({
  title: 'New Article',
  content: 'Content here',
  domain: 'example.com'
});

// Update content
await hub.content.update('content-id', {
  title: 'Updated Title'
});

// Delete content
await hub.content.delete('content-id');

Documentation

For complete documentation and API reference, visit:

github.com/content-hub/sdk-js