@salesduck/kkmserver-types
TypeScript icon, indicating that this package has built-in type declarations

0.6.4 • Public • Published

kkmserver-types

Define types for kkmserver.ru

Setup

Add to your project

yarn add -D @salesduck/kkmserver-types

Usage

// 1. Import types
import type { CloseShiftCommandRequest, CloseShiftCommandResponse } from '@salesduck/kkmserver-types';

// 2. Define method using types
const closeShift = async (CashierName: string, CashierVATIN: string): Promise<CloseShiftCommandResponse> => {
    const command: CloseShiftCommandRequest = {
        Command: 'CloseShift',
        NumDevice: 1,
        CashierName,
        CashierVATIN
    };

    const response = await fetch('kkmserver:port/Execute', { body: JSON.stringify(command) });
    const json = await response.json();

    return json;
};

// 3. Use type-safe method
closeShift('Cashier Name', '430601071197').then(console.log).catch(console.error);

TODO

  1. Write tests
  2. Not all methods have types

Package Sidebar

Install

npm i @salesduck/kkmserver-types

Weekly Downloads

3

Version

0.6.4

License

MIT

Unpacked Size

80.7 kB

Total Files

58

Last publish

Collaborators

  • webworkdeveloper