Skip to content

shevernitskiy/post-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📦RussianPost calculator API client

npm JSR dependencies license

This is super simple typed API client for RussianPost Calculator API. It just fetch calculator response from the API.

Installation

Node.js

npm i @shevernitskiy/post-calculator
npx jsr add @shevernitskiy/post-calculator

Deno

deno add @shevernitskiy/post-calculator

Usage

Call the postCalculator function with the required parameters (typed as well).

import { postCalculator } from "@shevernitskiy/post-calculator";

const result = await postCalculator({
  object: 27030,
  from: 115211,
  to: 620000,
  weight: 1000,
});

// result will be typeof PostCalcResponse (typed json)

const result2 = await postCalculator({
  format: "html",
  object: 27030,
  from: 115211,
  to: 620000,
  weight: 1000,
});

// result2 will be typeof string

Contribution

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

License

Copyright 2024, shevernitskiy. MIT license.