pub async fn stop(&self) -> Result<(), Box<dyn std::error::Error>> {
        // create payload for JSON request
        let payload = StopRequest {
            secret: Secret(&self.config.client_secret),
        };

        // format URL and make the request to the server (handling any errors that happen in the
        // process)
        let url = url::Url::options()
            .base_url(Some(&BASE_URL))
            .parse("/stop")?;
        let res = self
            .client
            .post(url)
            .json(&payload)
            .header("Content-Type", "application/json")
            .send()
            .await?;

        // match the status code with different errors
        match res.status() {
            reqwest::StatusCode::OK => Ok(()),
            reqwest::StatusCode::UNAUTHORIZED => Err(Box::new(BackendError::InvalidSecret)),
            status => Err(Box::new(BackendError::UnexpectedResponse(
                status,
                res.text().await.unwrap_or_else(|_| "NO BODY".to_string()),
            ))),
        }
    }
/// Pings the backend API alerting to the stop of the client
///
/// This function does not modify the internal state, therefore doesn't lock any of the
/// internal structures at all.
Pings the backend API alerting to the stop of the client
This function does not modify the internal state, therefore doesn't lock any of the
internal structures at all.
Pings the backend API alerting to the stop of the client This function does not modify the internal state therefore doesn ' t lock any of the internal structures at all .
pub async fn stop(&self) -> Result<(), Box<dyn std::error::Error>> {
        // create payload for JSON request
        let payload = StopRequest {
            secret: Secret(&self.config.client_secret),
        };
        // format URL and make the request to the server (handling any errors that happen in the
        // process)
        let url = url::Url::options()
            .base_url(Some(&BASE_URL))
            .parse("/stop")?;
        let res = self
            .client
            .post(url)
            .json(&payload)
            .header("Content-Type", "application/json")
            .send()
            .await?;
        // match the status code with different errors
        match res.status() {
            reqwest::StatusCode::OK => Ok(()),
            reqwest::StatusCode::UNAUTHORIZED => Err(Box::new(BackendError::InvalidSecret)),
            status => Err(Box::new(BackendError::UnexpectedResponse(
                status,
                res.text().await.unwrap_or_else(|_| "NO BODY".to_string()),
            ))),
        }
    }
pub async fn stop ( & self ) -> Result < ( ) , Box < dyn std :: error :: Error > > { // create payload for JSON request let payload = StopRequest { secret : Secret ( & self . config . client_secret ) , } ; // format URL and make the request to the server (handling any errors that happen in the // process) let url = url :: Url :: options ( ) . base_url ( Some ( & BASE_URL ) ) . parse ( " " ) ? ; let res = self . client . post ( url ) . json ( & payload ) . header ( " " , " " ) . send ( ) . await ? ; // match the status code with different errors match res . status ( ) { reqwest :: StatusCode :: OK => Ok ( ( ) ) , reqwest :: StatusCode :: UNAUTHORIZED => Err ( Box :: new ( BackendError :: InvalidSecret ) ) , status => Err ( Box :: new ( BackendError :: UnexpectedResponse ( status , res . text ( ) . await . unwrap_or_else ( | _ | " " . to_string ( ) ) , ) ) ) , } }
Pings the backend API alerting to the stop of the client
This function does not modify the internal state, therefore doesn't lock any of the
internal structures at all.
Pings the backend API alerting to the stop of the client This function does not modify the internal state therefore doesn ' t lock any of the internal structures at all .
&self