pub fn request(endpoint : &str) -> Result<bytes::Bytes, Error> {
    
    let resp = reqwest::blocking::get(format!("https://api.dhravya.me/{}", endpoint)).unwrap();

    let status : u16 = resp.status().as_u16();

    if status == 200 {
        let bytes : bytes::Bytes = resp.bytes().unwrap();
        return Ok(bytes);
    } else {
        if status == 500 {
            return Err(Error::HTTPException("Internal Server Error".to_string()));
        } else {
            return Err(Error::HTTPException("Unknown Error".to_string()));
        }
    }
}
/// Makes a GET request to an endpoint of the api 
/// 
/// # Example
/// ```
/// let bytes = request("meme/minecraft").unwrap();
/// ```
Makes a GET request to an endpoint of the api
Makes a GET request to an endpoint of the api
pub fn request(endpoint : &str) -> Result<bytes::Bytes, Error> {
    let resp = reqwest::blocking::get(format!("https://api.dhravya.me/{}", endpoint)).unwrap();
    let status : u16 = resp.status().as_u16();
    if status == 200 {
        let bytes : bytes::Bytes = resp.bytes().unwrap();
        return Ok(bytes);
    } else {
        if status == 500 {
            return Err(Error::HTTPException("Internal Server Error".to_string()));
        } else {
            return Err(Error::HTTPException("Unknown Error".to_string()));
        }
    }
}
pub fn request ( endpoint : & str ) -> Result < bytes :: Bytes , Error > { let resp = reqwest :: blocking :: get ( format ! ( " " endpoint ) ) . unwrap ( ) ; let status : u16 = resp . status ( ) . as_u16 ( ) ; if status == 200 { let bytes : bytes :: Bytes = resp . bytes ( ) . unwrap ( ) ; return Ok ( bytes ) ; } else { if status == 500 { return Err ( Error :: HTTPException ( " " . to_string ( ) ) ) ; } else { return Err ( Error :: HTTPException ( " " . to_string ( ) ) ) ; } } }
Makes a GET request to an endpoint of the api
Makes a GET request to an endpoint of the api
endpoint
&str
endpoint
&str
example
```
let bytes = request("meme/minecraft").unwrap();
```
` ` ` let bytes = request ( " meme / minecraft " ) . unwrap () ; ` ` `