// !!!
// WARNING: This file is autogenerated
// Only modify code within MANUAL() sections
// or your changes may be overwritten later!
// !!!

use serde::{Deserialize, Serialize};
use serde_urlencoded;

#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct WhoamiRequest {}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct WhoamiResponse {
    pub request_id: String,
    pub project_id: String,
    pub name: String,
    #[serde(with = "http_serde::status_code")]
    pub status_code: http::StatusCode,
}

pub struct Debug {
    http_client: crate::client::Client,
}

impl Debug {
    pub fn new(http_client: crate::client::Client) -> Self {
        Self {
            http_client: http_client.clone(),
        }
    }

    pub async fn whoami(&self, body: WhoamiRequest) -> crate::Result<WhoamiResponse> {
        let path = format!(
            "/v1/debug/whoami?{}",
            serde_urlencoded::to_string(body).unwrap()
        );
        self.http_client
            .send(crate::Request {
                method: http::Method::GET,
                path,
                body: serde_json::json!({}),
            })
            .await
    }
}
