cartographer/src/main.rs

18 lines
544 B
Rust
Raw Normal View History

use cartographer::libcanvas::CanvasClient;
use reqwest::{Error, Url};
2024-09-11 01:34:47 -07:00
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?);
2024-09-11 01:34:47 -07:00
Ok(())
}