ofd.ru
Version:
API клиент ОФД OFD.ru на TypeScript
56 lines (41 loc) • 2.08 kB
Markdown
# ofd.ru
[](https://npmjs.com/package/ofd.ru)
[](https://bundlejs.com/?q=ofd.ru)
[](https://github.com/MonsterDeveloper/ofd.ru/actions/workflows/publish-to-npm.yml)
[](https://github.com/MonsterDeveloper/ofd.ru/blob/main/LICENSE)
API клиент для работы с [OFD.RU](https://ofd.ru/razrabotchikam). На данный момент поддерживается только работа с API Ferma.
## Использование
### Установка
<img height="18" src="https://raw.githubusercontent.com/PKief/vscode-material-icon-theme/main/icons/npm.svg"> npm
```bash
npm i ofd.ru
```
<details>
<summary>Другие менеджеры пакетов</summary>
<img height="18" src="https://raw.githubusercontent.com/PKief/vscode-material-icon-theme/main/icons/pnpm.svg"> pnpm
```bash
pnpm add ofd.ru
```
<img height="18" src="https://raw.githubusercontent.com/PKief/vscode-material-icon-theme/main/icons/yarn.svg"> Yarn
```bash
yarn add ofd.ru
```
<img height="18" src="https://raw.githubusercontent.com/PKief/vscode-material-icon-theme/main/icons/bun.svg"> bun
```bash
bun add ofd.ru
```
</details>
Библиотека требует Node.js версии 18 и выше, либо другой соответствующей среды исполнения, в которой доступен [`fetch` API](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
### Пример
```typescript
import { Ferma } from "ofd.ru";
const ferma = new Ferma({
login: "<ваш API логин Ferma>",
password: "<ваш API пароль Ferma>",
});
// Создать чек
const receiptId = await ferma.createReceipt({
Inn: "<ИНН>",
/// ...
})
```