This is super simple typed API client for RussianPost Calculator API. It just fetch calculator response from the API.
npm i @shevernitskiy/post-calculator
npx jsr add @shevernitskiy/post-calculator
deno add @shevernitskiy/post-calculator
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
Pull request, issues and feedback are very welcome. Code style is formatted with deno fmt.
Copyright 2024, shevernitskiy. MIT license.