@skedulo/optimization-manager-client
TypeScript icon, indicating that this package has built-in type declarations

1.18.0 • Public • Published

optimization-manager-client

This package provides a client for the Optimization Manager API. The client is generated from the OpenAPI spec of the Optimization Manager API.

Also included are some Adapter functions to help with common use cases when working with the Optimization Manager API.

Setup

Run yarn install to install the dependencies

Development

Yarn commands:

  • build - Build the package
  • generate - Run generation for the autogenerated client code using the OpenAPI spec from the Optimization Manager API dev environment
  • test - Run the tests

The client will be generated automatically when commits are made to

Usage

Installation

Install @skedulo/optimization-manager-client in your project

npm install @skedulo/optimization-manager-client

OR

yarn add @skedulo/optimization-manager-client

Example

Below is a simple example connected function using ScheduleTransformer to override the Optimization Manager API /schedule endpoint.

import express from 'express';
import {createOptimizationRoutes, TransformerDataShape} from "@skedulo/optimization-manager-client";

import {FunctionRoute, extractAuthorizationInfoFromHeader} from '@skedulo/sdk-utilities'

// tslint:disable-next-line:no-empty-interface
interface RequestPayload {
}

const transform = (data: TransformerInput): TransformerOutput => {
    // NOTE: data.passthrough == { customData: true }

    const resources = data.featureModel.resources.map((resource) => ({
        ...resource,
        maxDailyTravelTimeInMinutes: resource.maxDailyTravelTimeInMinutes * 2,
    }))
    return {...data, featureModel: {...data.featureModel, resources}}
}

export function getRoutes(): FunctionRoute[] {
    return createOptimizationRoutes(transform, { customData: true })
}


Readme

Keywords

none

Package Sidebar

Install

npm i @skedulo/optimization-manager-client

Weekly Downloads

96

Version

1.18.0

License

ISC

Unpacked Size

792 kB

Total Files

530

Last publish

Collaborators

  • hoangmphung
  • alopez
  • jahrens
  • skeddevvn
  • edwardsmatt
  • filipeskedulo
  • sked-dev-uk
  • abyerly
  • drsk
  • krystlel
  • nedmules
  • adtennant
  • yurychislov
  • antran.skedulo
  • ehollonds
  • cong.le
  • skedsondang
  • skedadmin
  • simon_filipiak
  • tdaosked
  • willthames_sked
  • dhayesskedulo
  • sophiewheeler
  • sgassmann
  • skedlephan
  • krista-b
  • taylorskedulo
  • ngahoang
  • bezzer
  • doonleith
  • qvuongskedulo
  • martin-greber
  • james.davies.skedulo