-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from lta-rs/backend_split
Backend split
- Loading branch information
Showing
57 changed files
with
1,911 additions
and
1,517 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use lta::{LTAError, LTAClient, Client, Bus, BusRequests}; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), LTAError> { | ||
let api_key = env!("API_KEY"); | ||
let client = LTAClient::with_api_key(api_key)?; | ||
let bus_timing = Bus::get_arrival(&client, 83139, None).await?; | ||
dbg!(bus_timing); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use lta::{reqwest_async::ReqwestAsync, Bus, BusRequests, Client, LTAClient, LTAError}; | ||
use std::time::Duration; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), LTAError> { | ||
let api_key = env!("API_KEY"); | ||
|
||
let custom_reqwest_client = ReqwestAsync::builder() | ||
.connect_timeout(Duration::from_secs(10)) | ||
.no_brotli() | ||
.build() | ||
.map_err(|e| LTAError::BackendError(Box::new(e)))?; | ||
|
||
let client = LTAClient::new(api_key, custom_reqwest_client); | ||
let bus_timing = Bus::get_arrival(&client, 83139, None).await?; | ||
dbg!(bus_timing); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use lta::{ | ||
blocking::{prelude::TrafficRequests, LTAClient}, | ||
reqwest_blocking::ReqwestBlocking, | ||
Client, LTAError, Traffic, | ||
}; | ||
|
||
fn main() -> Result<(), LTAError> { | ||
let api_key = env!("API_KEY"); | ||
let client = LTAClient::<ReqwestBlocking>::with_api_key(api_key)?; | ||
let erp_rates = Traffic::get_erp_rates(&client, None)?; | ||
dbg!(erp_rates); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use lta::{ | ||
blocking::{prelude::TrafficRequests, LTAClient}, | ||
ureq_blocking::Agent, | ||
Client, LTAError, Traffic, | ||
}; | ||
|
||
fn main() -> Result<(), LTAError> { | ||
let api_key = env!("API_KEY"); | ||
let client = LTAClient::<Agent>::with_api_key(api_key)?; | ||
let erp_rates = Traffic::get_carpark_avail(&client, None)?; | ||
dbg!(erp_rates); | ||
Ok(()) | ||
} |
Oops, something went wrong.