npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

uz-booking-client

v2.0.0

Published

Unofficial UZ api client

Downloads

57

Readme

NPM version NPM downloads MIT License Build Status

uz-booking-client

Unofficial uz booking API client for Node.js. https://booking.uz.gov.ua/en/

Installation

Using npm:

$ npm i uz-booking-client

Note: add --save if you are using npm < 5.0.0

In Node.js:

import Client from "uz-booking-client"
//  or
const Client = require("uz-booking-client")

Usage

/*
   Data can be retrieved from the API either using callbacks (as in versions < 1.0)
   or using a new promise-based API. The promise-based API returns the raw Axios
   request promise.
 */
  import Client from "uz-booking-client"

  const uzClient = new Client.ApiV3("en")
  const phoneNumber = await askQuestion('Your phone number: ')

  await uzClient.Auth.sendSms(phoneNumber)

  const code = await askQuestion('Code from SMS: ')

  await uzClient.Auth.login(code)

  const ticketsDate = moment().add(10, 'days')

  const departureStations = await uzClient.Station.find('Київ')
  const departureStationId = departureStations[0].id

  const targetStations = await uzClient.Station.find('Львів')
  const targetStationId = targetStations[0].id

  const trains = await uzClient.Train.find(
    departureStationId,
    targetStationId,
    ticketsDate.format('YYYY-MM-DD'),
  )

  const tripId = trains[0].id
  const wagonType = trains[0].train.wagon_classes[0].id

  const wagons = await uzClient.Wagon.list(tripId, wagonType)

  console.dir(wagons, { depth: 20, colors: true })

  // [
  //     {
  //         "id": "eyJpdiI6IlZZd1JoeExwYVFadWdOb2JUbEo3eWc9PSIsInZhbHVlIjoiWFRaWUJPNjJkVmw1OUZRcHlMdWtPeUtjZUQrUUE5djdyejF4N3lnUEllVmJOTFVRZWgzelFEN1lFR2VsWmpDSkM0SCtVQnZOcFpIQ1NET0FNOUtNMlFlSjhEbjRNMTFSOEd5UVluZU5sMmgzZTdOeU9yZzJ6cWF1VGlnNEpadjgiLCJtYWMiOiJlODlkYTM5ZTE1OTRjMDgxMDhlNDBmN2M4NDcyMDYxMDJmYjUyNjY1Mjk3YTk1NTQ4ZWY0YzhjMDA1MDRjZjlhIiwidGFnIjoiIn0=",
  //         "number": "6",
  //         "mockup_name": "Вагон типу СВ на 20 місць з нижніми місцями",
  //         "seats": [
  //             1,
  //             2,
  //             5,
  //             6,
  //             9,
  //             10,
  //             11,
  //             12,
  //             13,
  //             14,
  //             15,
  //             16,
  //             17,
  //             18,
  //             19,
  //             20
  //         ],
  //         "free_seats_top": 0,
  //         "free_seats_lower": 16,
  //         "price": 164938,
  //         "air_conditioner": true,
  //         "services": [
  //             {
  //                 "id": "drinks",
  //                 "title": "Напій",
  //                 "details": {
  //                     "photo": null,
  //                     "content": [
  //                         {
  //                             "title": "На вибір:",
  //                             "description": "Класичний чай, розчинна кава або мінеральна вода 0,5 л.\n"
  //                         }
  //                     ]
  //                 },
  //                 "price": 1000,
  //                 "select_type": "units",
  //                 "select_units_max": 3
  //             },
  //             {
  //                 "id": "tea",
  //                 "title": "Авторський чай",
  //                 "details": {
  //                     "photo": "https://app.uz.gov.ua/img/api/services/tea.jpg",
  //                     "content": [
  //                         {
  //                             "title": "На вибір:",
  //                             "description": "Карпатський трав’яний чай, подільський чай з м’ятою або поліський чай з чебрецем\n"
  //                         }
  //                     ]
  //                 },
  //                 "price": 1500,
  //                 "select_type": "checkbox",
  //                 "select_units_max": null
  //             },
  //             {
  //                 "id": "drip_coffee",
  //                 "title": "Дріп кава",
  //                 "details": {
  //                     "photo": "https://app.uz.gov.ua/img/api/services/drip_coffee.jpg",
  //                     "content": [
  //                         {
  //                             "title": "Арабіка з Бразилії:",
  //                             "description": "Натуральна мелена кава в пакетиках для зручного заварювання.\n"
  //                         }
  //                     ]
  //                 },
  //                 "price": 2500,
  //                 "select_type": "checkbox",
  //                 "select_units_max": null
  //             },
}