Skip to content

Latest commit

 

History

History
123 lines (89 loc) · 2.18 KB

SLOT.md

File metadata and controls

123 lines (89 loc) · 2.18 KB

Slot Module

This document provides a concise guide to the Slot module, focusing on the Slot model and its usage.

Models

Slot

Defines the structure for Slot entities.

type Slot = {
  _id?: string;
  id: string;
  createdAt: Date | string;
  updatedAt: Date | string;
  deletedAt?: Date;
  kind: 'SLOT';
  connectables: (string | null)[];
  label?: string;
  starting_pon_numbere: number;
  olt?: string;
  external_id?: any;
};

CreateSlotDTO

Defines the structure for creating a new Slot.

type CreateSlotDTO = {
  connectables?: (string | null)[];
  label?: string;
  starting_pon_numbere?: number;
  olt: string;
  external_id?: any;
};

UpdateSlotDTO

Defines the structure for updating an existing Slot.

type UpdateSlotDTO = {
  connectables?: (string | null)[];
  label?: string;
  starting_pon_numbere?: number;
  external_id?: any;
};

Example Usage

Creating a Slot

import OZMapSDK from 'ozmapsdk';

const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });

const newSlotData: CreateSlotDTO = {
  olt: 'OLT001',
  starting_pon_numbere: 1,
};

sdk.slot.create(newSlotData).then((slot) => {
  console.log('Slot created:', slot);
});

Updating a Slot

import OZMapSDK from 'ozmapsdk';

const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });

const updateSlotData: UpdateSlotDTO = {
  label: 'Updated Label',
};

sdk.slot.updateById('slotId', updateSlotData).then(() => {
  console.log('Slot updated');
});

Deleting a Slot

import OZMapSDK from 'ozmapsdk';

const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });

sdk.slot.deleteById('slotId').then(() => {
  console.log('Slot deleted');
});

Fetching slots

import OZMapSDK from 'ozmapsdk';

const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });

sdk.slot.find({ page: 1, limit: 10 }).then((pagination) => {
  console.log('slot:', pagination);
});

Fetching a slot by ID

import OZMapSDK from 'ozmapsdk';

const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });

sdk.slot.findById('slotId').then((slot) => {
  console.log('slot:', slot);
});