uslegalpro
is a simple library to help with interacting with uslegalpro's JSON API.
Currently there are a few endpoints available. I hope to add the rest as needed. Feel free to create a pull request to add more.
You can specify what url to use as the endpoint, you can also use the prebuilt on for Texas right now, I plan to add more states later on.
It's presumed the endpoints above have the following routes
POST /authenticate GET /searchcase GET /case/{CASETRACKING_ID}
The only way to make an authenticated request is IFF (if and only if) you have successfully authenticated. It is impossible to construct a client (authed or not) outside of the methods provided by the library. You can still modify and view properties used on the clients however.
```rust use uslegalpro::{client::NoAuthClient, state::State, auth::{authenticate, user::User}}; use reqwest::Client;
async fn auth() { let texas = State::Texas; let client = NoAuthClient::new(client, "MYCLIENTTOKEN", texas.endpoint());
let user = User {
username: "MY_USERNAME",
password: "MY_PASSWORD",
};
let authtoken = authenticate(client, user).await.unwrap();
println!("AUTHED = {}", authtoken);
let client = client.into_authed_client(&authtoken);
// client can now make authed requests
} ```
```rust use uslegalpro::{query::{query, Query}};
async fn pre() { // client from last part of authentication example let casequery = Query { client, casenumber: "MYCASE#", jurisdiction: "county:court", };
let previews = query(case_query).await.unwrap();
println!("my vector of previews = {:?}", previews);
} ```