Crates.io | sia_rs |
lib.rs | sia_rs |
version | 0.3.0 |
source | src |
created_at | 2024-04-06 15:54:39.447518 |
updated_at | 2024-04-14 06:44:43.274935 |
description | A Rust library for interacting with the UK SIA Register |
homepage | https://github.com/LordOfPolls/sia_rs |
repository | https://github.com/LordOfPolls/sia_rs |
max_upload_size | |
id | 1198379 |
size | 43,796 |
A rust library for searching the UK's Security Industry Authority (SIA) register of licenced security operatives.
Providing an easy-to use interface for searching by licenses by licence number or details of the licence holder.
blocking
featureuse sia_rs::{Query, search};
#[tokio::main]
async fn main() {
let query = Query::new()
.with_last_name("Smith".to_string())
.with_first_name("John".to_string());
let results: Result<Vec<LicenseState>, RequestError> = search(&query).await;
match results {
Ok(licenses) => {
for license in licenses {
println!("{}", license);
}
},
Err(e) => println!("Error: {}", e),
}
let query = Query::new()
.with_license_number("1234567890123456".to_string());
let results = search(&query).await;
match results {
Ok(licenses) => {
for license in licenses {
println!("{}", license);
}
},
Err(e) => println!("Error: {}", e),
}
}
All interactions are done through the Query
struct, which is used to build the search query.
The search
function is used to perform the search and returns a Vec<License>
containing the results.
The search_sync
function is a blocking function that will wait for the search to complete before returning the results.
This function is only available with the blocking
feature enabled.
[dependencies]
sia_rs = { version = "*", features = ["blocking"] }
Some tests require real data and will only run if certain environment variables are set:
KNOWN_FIRST_NAME
- The first name of a known license holderKNOWN_LAST_NAME
- The last name of a known license holderKNOWN_LICENSE_NUMBER
- The license number of a known license holderThese are not included in the source code for privacy reasons.
The SIA does not provide an official API for accessing the register, this library uses web scraping to retrieve the data. This means that the library may break if the SIA changes the structure of their website.
The author of this library is not responsible for any misuse of the data retrieved by this library.
Contributions are welcome, please open an issue or pull request.