OptiSigns TypeScript SDK Quickstart
npm install @optisigns/optisigns
import { OptiSigns } from "@optisigns/optisigns"; const client = new OptiSigns("YOUR_API_KEY");
const devices = await client.devices.listAllDevices();
const device = await client.devices.findByDeviceName("Reception");
const device = await client.devices.getDeviceById("device_id");
const newDevice = await client.devices.createDevice({ deviceName: "Reception Screen", orientation: "LANDSCAPE", });
await client.devices.updateDevice("device_id", { deviceName: "Updated Screen Name", });
await client.devices.deleteDeviceById("device_id", "team_id");
const asset = await client.assets.uploadFileAsset( "./path/to/image.jpg", "team_id" );
const websiteAsset = await client.assets.createWebsiteAppAsset( { url: "https://example.com", title: "Company Website", }, "team_id" );
await client.assets.modifyAssetSettings( "asset_id", { name: "Updated Asset Name", metadata: { key: "value" }, }, "team_id" );
await client.devices.pushContentToDevice( "device_id", "content_id", "team_id", "NOW" );
await client.devices.rebootDevice("device_id");
try { const devices = await client.devices.listAllDevices(); console.log(devices); } catch (error) { console.error("Error fetching devices:", error); }
import { OptiSigns } from "@optisigns/optisigns"; async function manageDevices() { const client = new OptiSigns("YOUR_API_KEY"); try { // List all devices const devices = await client.devices.listAllDevices(); // Create a new device const newDevice = await client.devices.createDevice({ deviceName: "Reception Screen", orientation: "LANDSCAPE", }); // Update device name await client.devices.updateDevice(newDevice.id, { deviceName: "Updated Screen Name", }); } catch (error) { console.error("Error:", error); } }