1.0.5 • Published 10 months ago

@_publicai/cms v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

CMS Client

A lightweight client for interacting with the CMS API.

Installation

npm install @_publicai/cms

Usage

import { CmsClient } from '@_publicai/cms';

const cms = new CmsClient({
  baseUrl: 'https://your-api-url',
  projectId: 'your-project-id'
});

// Example: Get content for a page
const pageContent = await cms.getPage('homepage');

Configuration Options

const cms = new CmsClient({
  baseUrl: 'https://your-api-url',       // API base URL
  projectId: 'your-project-id',          // Default project ID
  defaultVariant: 'default',             // Default variant (optional)
  defaultLanguage: 'en',                 // Default language (optional)
  cacheEnabled: true,                    // Enable caching (optional)
  cacheTimeout: 60000                    // Cache timeout in ms (optional)
});

Available Methods

  • setProject(projectId): Set the project ID
  • setVariant(variantId): Set the default variant
  • setLanguage(language): Set the default language
  • clearCache(): Clear the cache
  • get(pageId, entryId, options): Get a single content entry
  • getPage(pageId, options): Get content for an entire page
  • getVariant(variantId, options): Get content for a specific variant
  • getBatch(keys): Get multiple content entries at once
  • create(pageId, entryId, data, options): Create content entry
  • update(pageId, entryId, updates, options): Update content entry
  • delete(pageId, entryId, options): Delete content entry
  • loadContent(pageId, options): Load all content for a page
  • batchCreate(contentItems, options): Create multiple content entries
  • batchUpdate(contentUpdates): Update multiple content entries
1.0.5

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago