babelforce-manager-sdk 0.42.1

Rust SDK for the babelforce manager APIs — auth, user & agent management, call reporting, metrics, and task automations.
Documentation
/*
 * babelforce Auth API
 *
 * OAuth 2.0 authorization endpoints: token issuance (`/oauth/token`), the authorization-code consent endpoint (`/oauth/authorize`) and token revocation (`/oauth/revoke`). Supports the Authorization Code grant with PKCE (RFC 7636) so public clients (SPA / CLI / mobile) can authenticate without exposing the user's password or holding a client secret.
 *
 * The version of the OpenAPI document: 0.0.0-dev
 * Contact: support@babelforce.com
 * Generated by: https://openapi-generator.tech
 */

use crate::gen::auth::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct OAuth2Error {
    /// RFC 6749 error code, e.g. invalid_grant, invalid_client, invalid_request.
    #[serde(rename = "error")]
    pub error: String,
    #[serde(rename = "error_description", skip_serializing_if = "Option::is_none")]
    pub error_description: Option<String>,
    /// Echoed from the request when present.
    #[serde(rename = "state", skip_serializing_if = "Option::is_none")]
    pub state: Option<String>,
}

impl OAuth2Error {
    pub fn new(error: String) -> OAuth2Error {
        OAuth2Error {
            error,
            error_description: None,
            state: None,
        }
    }
}