This document provides a concise guide to the FusionType module, focusing on the FusionType model and its Data Transfer Objects (DTOs) for creation and update operations.
Defines the structure for fusion types.
type FusionType = {
code: string;
loss: number;
isDrop: boolean;
};
Defines the structure for creating a fusion type.
type CreateFusionTypeDTO = {
code: string;
loss: number;
isDrop: boolean;
external_id?: any;
};
Defines the structure for updating a fusion type.
type UpdateFusionTypeDTO = {
code?: string;
loss?: number;
isDrop?: boolean;
external_id?: any;
};
import OZMapSDK from 'ozmapsdk';
import { CreateFusionTypeDTO } from './FusionType';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
const newFusionTypeData: CreateFusionTypeDTO = {
code: "FT001",
loss: 0.1,
isDrop: false,
};
sdk.fusionType.create(newFusionTypeData).then((fusionType) => {
console.log('Fusion type created:', fusionType);
});
import OZMapSDK from 'ozmapsdk';
import { UpdateFusionTypeDTO } from './FusionType';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
const updateFusionTypeData: UpdateFusionTypeDTO = {
code: "FT002",
loss: 0.2,
};
sdk.fusionType.updateById('fusionTypeId', updateFusionTypeData).then(() => {
console.log('Fusion type updated');
});
import OZMapSDK from 'ozmapsdk';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
sdk.fusionType.find({ page: 1, limit: 10 }).then((pagination) => {
console.log('Fusion types:', pagination);
});
import OZMapSDK from 'ozmapsdk';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
sdk.fusionType.findById('fusionTypeId').then((fusionType) => {
console.log('Fusion type:', fusionType);
});
import OZMapSDK from 'ozmapsdk';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
sdk.fusionType.deleteById('fusionTypeId').then(() => {
console.log('Fusion type deleted');
});