@salesduck/kkmserver-types
v0.6.4
Published
Type definitions for kkmserver.ru
Downloads
8
Maintainers
Readme
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
- Write tests
- Not all methods have types