Skip to main content

dhan_rs/api/
edis.rs

1//! EDIS endpoints — T-PIN, Form, Inquiry.
2
3use crate::client::DhanClient;
4use crate::error::Result;
5use crate::types::edis::*;
6
7impl DhanClient {
8    /// Generate a T-PIN on the user's registered mobile number.
9    ///
10    /// Returns `202 Accepted` on success.
11    ///
12    /// **Endpoint:** `GET /v2/edis/tpin`
13    pub async fn generate_tpin(&self) -> Result<()> {
14        self.get_no_content("/v2/edis/tpin").await
15    }
16
17    /// Generate an eDIS form for CDSL T-PIN entry.
18    ///
19    /// **Endpoint:** `POST /v2/edis/form`
20    pub async fn generate_edis_form(&self, req: &EdisFormRequest) -> Result<EdisFormResponse> {
21        self.post("/v2/edis/form", req).await
22    }
23
24    /// Inquire the eDIS status for a stock by ISIN.
25    ///
26    /// Pass `"ALL"` as the ISIN to get status of all holdings.
27    ///
28    /// **Endpoint:** `GET /v2/edis/inquire/{isin}`
29    pub async fn inquire_edis(&self, isin: &str) -> Result<EdisInquiry> {
30        self.get(&format!("/v2/edis/inquire/{isin}")).await
31    }
32}