npm package: @mapify/core
Description: Mapify core package
Author: Mapify
Latest version: 0.7.1

# README

## Summary

- Mapify Core - a software developer toolkit for the Mapify platform

The `@mapify/core` project contains the Mapify software development toolkit Typescript package which can be used to connect to mapify services.

## Further Documentation and Blog Posts

For further information and blog posts you can go <a href="https://www.mapify.ai/blog">here</a>.

## General Setup

You will need to have `nodejs` and `npm` installed.

You will need a Mapify account in order to get an API Key to use when configuring the SDK and other components.

- Get your desired API Key from the Mapify console.

## Mapify Core

### Core Setup

Install `@mapify/core` from npm:

- `npm i @mapify/core --save`

The Mapify core sdk requires:

- A Mapify API Key in order to access the Mapify platform. Get your API Key from the Mapify console.

### Using Mapify Core

To use the Mapify core sdk you will need to initialize a new instance of the `MapifyClient`. This can be done like so:

```ts
import { MapifyClient, ClientConfig } from '@mapify/core';

const clientConfig: ClientConfig = {
	// Your API key
	apiKey: environment.mapifyApiKey,
};
const mapifyClient = MapifyClient.createClient(clientConfig);
```

From this point on you can use `mapifyClient` in order to get services related to different data you want to manage.

For example to list layers:

```ts
const layerService = mapifyClient.layers;
const layersPaginated = await layerService.getAllPaginated();
const layers = layersPaginated?.items;
```

Examples of services available include:

```ts
const buildingService = mapifyClient.buildings;
const layerService = mapifyClient.layers;
const panoramaService = mapifyClient.panoramas;
const datasetService = mapifyClient.datasets;
const datafeedService = mapifyClient.datafeeds;
const mapService = mapifyClient.maps;
const workflowService = mapifyClient.workflows;
```

From these servives you can access the methods to deal with the respective content. For example from the `mapifyClient.maps` you can access methods related to maps, such as listing, getting a specific map, altering an exisiting, and creating a new map. Below are examples of how to list some of the content available:

Examples of using the services:

```ts
// Example listing apis
const apiService = mapifyClient.api;
const apis = await apiService.getAll();
console.log('apis:', apis);

// Example listing buildings
const buildingService = mapifyClient.buildings;
const buildingsPaginated = await buildingService.getAllPaginated();
const buildings = buildingsPaginated?.items;
console.log('buildings:', buildings);

// Example listing layers
const layerService = mapifyClient.layers;
const layersPaginated = await layerService.getAllPaginated();
const layers = layersPaginated?.items;
console.log('layers:', layers);

// Example listing datasets
const datasetService = mapifyClient.datasets;
const datasetsPaginated = await datasetService.getAllPaginated();
const datasets = datasetsPaginated?.items;
console.log('datasets:', datasets);

// Example listing datafeeds
const datafeedService = mapifyClient.datafeeds;
const datafeedsPaginated = await datafeedService.getAllPaginated();
const datafeeds = datafeedsPaginated?.items;
console.log('datafeeds:', datafeeds);

// Example listing maps
const mapService = mapifyClient.maps;
const mapsPaginated = await mapService.getAllPaginated();
const maps = mapsPaginated?.items;
console.log('maps:', maps);

// Example listing workflows
const workflowService = mapifyClient.workflows;
const workflowsPaginated = await workflowService.getAllPaginated();
const workflows = workflowsPaginated?.items;
console.log('workflows:', workflows);
```