Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shevernitskiy/post-tracking

📦RussianPost tracking API client
https://github.com/shevernitskiy/post-tracking

api client deno javascript js node nodejs pochta post russianpost tracking ts typescript

Last synced: about 1 month ago
JSON representation

📦RussianPost tracking API client

Awesome Lists containing this project

README

        

# 📦RussianPost tracking API client

[![npm](https://img.shields.io/npm/v/@shevernitskiy/post-tracking?logo=npm&style=flat&labelColor=000)](https://www.npmjs.com/package/@shevernitskiy/post-tracking)
[![JSR](https://jsr.io/badges/@shevernitskiy/post-tracking)](https://jsr.io/@shevernitskiy/post-tracking)
![dependencies](https://img.shields.io/badge/dependencies-0-green?style=flat&labelColor=000)
[![license](https://img.shields.io/github/license/shevernitskiy/amo?style=flat&labelColor=000)](https://github.com/shevernitskiy/post-tracking/blob/main/LICENSE)

This is super simple API client for RussianPost Traking API.
It just fetch the tracking history from the API.

# Installation

## Node.js

```sh
npm i @shevernitskiy/post-tracking
```

```sh
npx jsr add @shevernitskiy/post-tracking
```

## Deno

```sh
deno add @shevernitskiy/post-tracking
```

# Usage

Create an instance and call method `tracking`. That's it.

```ts
const client = new PostTracking("your_login", "your_password");
const history = await client.tracking(1116949696969);
console.log(history);
```

You can pass `options` object as a third argument.

```ts
const client = new PostTracking("your_login", "your_password", { language: "ENG" });
```

As as result you will get the history:

```js
{
history: [
{
index: 111024,
place: "Москва 24",
operation_type: "Прием",
operation_desc: "Единичный",
datetime: 2024-07-10T10:31:41.000Z
},
{
index: 111024,
place: "Москва 24",
operation_type: "Обработка",
operation_desc: "Покинуло место приёма",
datetime: 2024-07-10T13:08:20.000Z
},
{
index: 111974,
place: "Москва МСП-3 Цех-4 МПКО-Восток",
operation_type: "Обработка",
operation_desc: "Прибыло в сортировочный центр",
datetime: 2024-07-10T14:18:07.001Z
},
{
index: 111974,
place: "Москва МСП-3 Цех-4 МПКО-Восток",
operation_type: "Обработка",
operation_desc: "Сортировка",
datetime: 2024-07-10T14:32:54.000Z
}
],
last_operation: "Обработка",
duration: 434992
}
```

# Contribution

Pull request, issues and feedback are very welcome. Code style is formatted with deno fmt.

# License

Copyright 2024, shevernitskiy. MIT license.