#![allow(missing_docs)]
use serde::{Deserialize, Serialize};
#[derive(Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TokenResponse {
pub dhan_client_id: String,
#[serde(default)]
pub dhan_client_name: Option<String>,
#[serde(default)]
pub dhan_client_ucc: Option<String>,
#[serde(default)]
pub given_power_of_attorney: Option<bool>,
pub access_token: String,
#[serde(default)]
pub expiry_time: Option<String>,
}
impl std::fmt::Debug for TokenResponse {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("TokenResponse")
.field("dhan_client_id", &self.dhan_client_id)
.field("dhan_client_name", &self.dhan_client_name)
.field("dhan_client_ucc", &self.dhan_client_ucc)
.field("given_power_of_attorney", &self.given_power_of_attorney)
.field("access_token", &"[REDACTED]")
.field("expiry_time", &self.expiry_time)
.finish()
}
}
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AppConsentResponse {
pub consent_app_id: String,
pub consent_app_status: String,
#[serde(default)]
pub status: Option<String>,
}
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PartnerConsentResponse {
pub consent_id: String,
pub consent_status: String,
}
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetIpRequest {
pub dhan_client_id: String,
pub ip: String,
pub ip_flag: crate::types::IpFlag,
}
#[derive(Debug, Clone, Deserialize)]
pub struct IpInfo {
#[serde(default, rename = "primaryIP")]
pub primary_ip: Option<String>,
#[serde(default, rename = "modifyDatePrimary")]
pub modify_date_primary: Option<String>,
#[serde(default, rename = "secondaryIP")]
pub secondary_ip: Option<String>,
#[serde(default, rename = "modifyDateSecondary")]
pub modify_date_secondary: Option<String>,
#[serde(default, rename = "detectedIP")]
pub detected_ip: Option<String>,
#[serde(default, rename = "ipMatchStatus")]
pub ip_match_status: Option<IpMatchStatus>,
#[serde(default, rename = "ordersAllowed")]
pub orders_allowed: Option<bool>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)]
#[allow(non_camel_case_types)]
pub enum IpMatchStatus {
PRIMARY_MATCH,
SECONDARY_MATCH,
MISMATCH,
NOT_CONFIGURED,
}
#[derive(Debug, Clone, Deserialize)]
pub struct IpSetResponse {
pub message: String,
pub status: String,
}