Aller au contenu
← Documentation

JavaScript SDK

SDK officiel pour JavaScript/TypeScript

Installation

npm install @luneo/sdk
# or
pnpm add @luneo/sdk
# or
yarn add @luneo/sdk

Initialisation

import { LuneoClient } from '@luneo/sdk';

const client = new LuneoClient({
  apiKey: process.env.LUNEO_API_KEY,
  projectId: 'proj_xxx'
});

Products

// Products
const products = await client.products.list({ limit: 20 });
const product = await client.products.get('prod_xxx');
const newProduct = await client.products.create({
  name: 'T-Shirt',
  price: 29.99
});

Designs

// Designs
const design = await client.designs.create({
  product_id: 'prod_xxx',
  canvas_data: { objects: [...] }
});

const exported = await client.designs.export('design_xxx', {
  format: 'png',
  dpi: 300
});