babelforce-manager-sdk 0.46.0

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 OAuthTokenResponse {
    #[serde(rename = "access_token")]
    pub access_token: String,
    #[serde(rename = "token_type")]
    pub token_type: String,
    /// Lifetime in seconds. Omitted for non-expiring tokens.
    #[serde(rename = "expires_in", skip_serializing_if = "Option::is_none")]
    pub expires_in: Option<i64>,
    /// Present when a refresh token was issued (rotated on every refresh).
    #[serde(rename = "refresh_token", skip_serializing_if = "Option::is_none")]
    pub refresh_token: Option<String>,
    #[serde(rename = "scope", skip_serializing_if = "Option::is_none")]
    pub scope: Option<String>,
    #[serde(rename = "client_id", skip_serializing_if = "Option::is_none")]
    pub client_id: Option<String>,
}

impl OAuthTokenResponse {
    pub fn new(access_token: String, token_type: String) -> OAuthTokenResponse {
        OAuthTokenResponse {
            access_token,
            token_type,
            expires_in: None,
            refresh_token: None,
            scope: None,
            client_id: None,
        }
    }
}