This file contains hidden or 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
image: redis:5.0.3 | |
ports: | |
- "6379:6379" |
This file contains hidden or 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
container-juggler generate auth |
This file contains hidden or 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
[dependencies] | |
reqwest = { version = "0.10", features = ["json"] } | |
tokio = { version = "0.2", features = ["macros", "fs"] } | |
serde = {version = "1.0", features = ["derive"] } | |
serde_json = "1.0" | |
once_cell = "1.4" |
This file contains hidden or 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
use once_cell::sync::Lazy; | |
use reqwest::Client; | |
use serde::{Deserialize, Serialize}; | |
use std::env; | |
use tokio::fs; | |
type Error = Box<dyn std::error::Error>; | |
static CLIENT: Lazy<Client> = Lazy::new(|| Client::new()); |
This file contains hidden or 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
#[tokio::main] | |
async fn main() -> Result<(), Error> { | |
let api_key = env::var("TMLR_API_KEY").expect("TMLR_API_KEY needs to be set"); | |
let api_secret = env::var("TMLR_API_SECRET").expect("TMLR_API_SECRET needs to be set"); | |
println!("signing in.."); | |
let token = sign_in(api_key, api_secret).await?; |
This file contains hidden or 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
#[derive(Serialize, Debug)] | |
#[serde(rename_all = "camelCase")] | |
struct SignInRequest { | |
api_key: String, | |
api_secret: String, | |
} | |
#[derive(Deserialize, Debug)] | |
struct SignInResponse { | |
token: String, |
This file contains hidden or 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
fn url(path: &str) -> String { | |
format!("{}{}", BASE_URL, path) | |
} |
This file contains hidden or 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
println!("fetching me and spaces..."); | |
let me = fetch_me(&token).await?; | |
let spaces = fetch_spaces(&token).await?; | |
println!("fetched spaces: {:?} for {:?}", spaces, me); |
This file contains hidden or 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
#[derive(Deserialize, Debug)] | |
struct MeResponse { | |
data: Me, | |
} | |
#[derive(Deserialize, Debug)] | |
#[serde(rename_all = "camelCase")] | |
struct Me { | |
user_id: String, | |
name: String, |
This file contains hidden or 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
#[derive(Deserialize, Debug)] | |
struct SpacesResponse { | |
data: Vec<Space>, | |
} | |
#[derive(Deserialize, Debug)] | |
#[serde(rename_all = "camelCase")] | |
struct Space { | |
id: String, | |
name: String, |