Assemble fragments to get API endpoint
This commit is contained in:
@@ -8,14 +8,21 @@ use clap::Parser;
|
|||||||
use reqwest::Error;
|
use reqwest::Error;
|
||||||
use reqwest::header::{ACCEPT, USER_AGENT};
|
use reqwest::header::{ACCEPT, USER_AGENT};
|
||||||
|
|
||||||
|
const API_HOSTNAME: &'static str = "http://localhost:3000";
|
||||||
|
const API_RELEASE_FRONT: &'static str = "/api/v1/repos/";
|
||||||
|
const API_RELEASE_BACK: &'static str = "/releases";
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Error> {
|
async fn main() -> Result<(), Error> {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
|
|
||||||
let request_url = format!(
|
let request_url = format!(
|
||||||
"http://localhost:3000/api/v1/repos/{owner}/{repo}/releases",
|
"{hostname}{front}{owner}{repo}{back}",
|
||||||
|
hostname = API_HOSTNAME,
|
||||||
|
front = API_RELEASE_FRONT,
|
||||||
owner = "robert",
|
owner = "robert",
|
||||||
repo = "rcalc",
|
repo = "rcalc",
|
||||||
|
back = API_RELEASE_BACK
|
||||||
);
|
);
|
||||||
let client = reqwest::Client::new();
|
let client = reqwest::Client::new();
|
||||||
match args.command {
|
match args.command {
|
||||||
|
|||||||
Reference in New Issue
Block a user