17 lines
544 B
Rust
17 lines
544 B
Rust
use cartographer::libcanvas::CanvasClient;
|
|
use reqwest::{Error, Url};
|
|
use std::env;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Error> {
|
|
let token =
|
|
env::var("CANVAS_SECRET").expect("Canvas API key is not defined in the environment.");
|
|
|
|
// Base URL must have trailing slash or URL `.join()` will not work
|
|
let client = CanvasClient::create(
|
|
token,
|
|
Url::parse("https://ucsb.instructure.com/api/v1/").expect("Could not parse API URL."),
|
|
)?;
|
|
println!("{:?}", client.get_courses().await?);
|
|
Ok(())
|
|
}
|