Skip to content

Commit

Permalink
const the manifold api url
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel-Jacobsen committed Dec 28, 2023
1 parent 880b8bd commit b47a0c3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use serde_json::Value;

use crate::errors;

const MANIFOLD_API_URL: &str = "https://api.manifold.markets/v0";

fn get_env_key(key: &str) -> Result<String, String> {
match env::var(key) {
Ok(key) => Ok(format!("Key {key}")),
Expand All @@ -24,7 +26,7 @@ pub async fn get_endpoint(
let client = reqwest::Client::new();

let req = client
.get(format!("https://manifold.markets/api/v0/{endpoint}"))
.get(format!("{MANIFOLD_API_URL}/{endpoint}"))
.query(&query_params)
.header("Authorization", get_env_key("MANIFOLD_KEY").unwrap());

Expand All @@ -50,7 +52,7 @@ pub async fn post_endpoint(

let client = reqwest::Client::new();
let req = client
.post(format!("https://api.manifold.markets/v0/{endpoint}"))
.post(format!("{MANIFOLD_API_URL}/{endpoint}"))
.query(&query_params)
.header("Authorization", get_env_key("MANIFOLD_KEY").unwrap());

Expand Down

0 comments on commit b47a0c3

Please sign in to comment.