1 stable release

1.0.0 Jul 27, 2024

#1525 in Parser implementations

MIT license

170KB
3.5K SLoC

Nsg

Nsg is a library for interacting with Portal. It provides read-only methods for basic search, view request, work schedule and brief request

Usage

use nsg::Nsg;
use chrono::Utc;

#[tokio::main]
async fn main() {
    let nsg = Nsg::from_creds(
        "login".to_string(),
        "password_hash".to_string(),
        "https://net-stroy.itnet.lviv.ua".to_string(),
        "client".to_string(),
        "x.y".to_string(),
    ).await.unwrap();

    println!("Work schedule (orders) for today: {:#?}", nsg.work_schedule(Utc::now().date_naive()).await);
    println!("Brief request of 950974: {:#?}", nsg.brief_request(950974).await);
    println!("Full information about 950974: {:#?}", nsg.view_request(950974).await);
    println!("Search for 95097%: {:#?}", nsg.basic_search("95097%").await);
}

Install

To use nsg lib install it via cargo:

cargo add nsg

lib.rs:

Nsg is a library for interacting with Portal. It provides read-only methods for basic search, view request, work schedule and brief request

Note: This library is written to work only with users with the role of "Монтажник (все)" It may not work properly with other roles

use chrono::Utc;
use nsg::Nsg;

let nsg = Nsg::from_creds(
    "login".to_string(),
    "password_hash".to_string(),
    "https://net-stroy.itnet.lviv.ua".to_string(),
    "client".to_string(),
    "x.y".to_string(),
)
.await?;

// Fetch orders from Work Schedule for today
let work_schedule = nsg.work_schedule(Utc::now().date_naive()).await;
println!("{:?}", work_schedule.0);

Terminology

  • Internal order id: Kyivstar assigns unique identifiers to its orders. When orders are processed by the Portal, it creates its own record of the order in its database, thus creating an internal identifier for the request
  • Data pillar: Portal's endpoint or the way to access data from Portal. There are 4 data pillars: BasicSearch, BriefRequest, ViewRequest and WorkSchedule
  • Portal: Refers to "Нет-Строй"'s "IC Портал-К"
  • Kyivstar's version: Kyivstar's data is not always 100% right. It's really apparent in the client's full name

Dependencies

~11–24MB
~360K SLoC