get_license_as_json_string/
get_license_as_json_string.rs

1use githubapi::{GitHubApi, ToJsonString};
2use std::env;
3
4/// To run this example, you must first set two environment variables.
5/// ```bash
6/// export GH_USER="SandyClaws"
7/// export GH_PASS="ThisIsHalloween"
8///
9/// cargo run --example get_license
10/// ```
11fn main() {
12    let username = env::var("GH_USER").expect("GH_USER not defined.");
13    let password = env::var("GH_PASS").expect("GH_PASS not defined.");
14
15    let gh = GitHubApi::new(&username, &password);
16
17    let license = gh.get_license("sous-chefs", "postgresql");
18    println!("{:#?}", license.unwrap().result.to_json_string());
19}