Skip to content

Use this SDK to access the OZmap platform and connect it to your systems.

License

Notifications You must be signed in to change notification settings

ozmap/ozmap-sdk

Repository files navigation

OZmap SDK

OZmap is a solution by devOZ. Based in FlorianĂłpolis since 2012, we develop software focused on facilitating the mapping of georeferenced data with the intention of generating intelligent information for strategic decisions.

What is OZmap SDK?

The OZmap SDK is a tool designed to help developers interact with the OZmap API, providing a streamlined interface for managing georeferenced data. This SDK includes various methods for creating, updating, retrieving, and deleting different models within the OZmap ecosystem, such as projects, cables, boxes, poles, and more.

Features

  • CRUD Operations: Easily create, read, update, and delete data.
  • Data Mapping: Simplifies the interaction with georeferenced data.
  • Batch Operations: Perform batch updates and retrieves efficiently.
  • Pagination Support: Handle large datasets with pagination.
  • Filter and Query: Advanced filtering and querying capabilities.

Installation

To install the OZmap SDK, use npm:

npm i --save @ozmap/ozmap-sdk

Usage

Using login and password

import OZMapSDK from '@ozmap/ozmap-sdk';

const sdk = new OZMapSDK('https://api.example.com', { login: 'your-ozmap-login', password: 'your-ozmap-password' });

Using API Key

import OZMapSDK from '@ozmap/ozmap-sdk';

const sdk = new OZMapSDK('https://api.example.com', { apiKey: 'your-ozmap-api-key' });

CRUD operations

Create

import OZMapSDK from 'ozmapsdk';

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

const newPopData: CreatePopDTO = {
  name: "New Pop",
  hierarchyLevel: 1,
  popType: "popTypeId",
  pole: "poleId",
  implanted: true,
};

sdk.pop.create(newPopData).then((pop) => {
  console.log('Pop created:', pop);
});

Update

import OZMapSDK from 'ozmapsdk';

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

const updatePopData: UpdatePopDTO = {
  name: "Updated Pop",
  hierarchyLevel: 2,
};

sdk.pop.updateById('popId', updatePopData).then(() => {
  console.log('Pop updated');
});

Fetch

import OZMapSDK from 'ozmapsdk';

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

sdk.pop.find({ page: 1, limit: 10, filter: [
    {
      property: "name",
      operator: FilterOperator.EQUAL,
      value: "Popname",
    }]
}).then((pagination) => {
  console.log('Pops:', pagination);
});

Fetch by id

import OZMapSDK from 'ozmapsdk';

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

sdk.pop.findById('popId').then((pop) => {
  console.log('Pop:', pop);
});

Delete

import OZMapSDK from 'ozmapsdk';

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

sdk.pop.deleteById('popId').then(() => {
  console.log('Pop deleted');
});

Documentation

Models

Boxes

Building

Cables

Clients

Colors

Connectors

Cords

Devices

Ducts

Fibers

Files

Fusion

Horizontal Condominium

Junction Boxes

OLT

Passing

Pendencies

Points

Poles

PON

POP

POST

Projects

Properties

Regions

Roles

Shelves

Slots

Splitters

Switches

System

API

For detailed information about the API endpoints and how to use them, please refer to the OZmap API Documentation.

License

This project is licensed under the MIT License.

Links