diff --git a/api.md b/api.md
index cc7f243..d35cf34 100644
--- a/api.md
+++ b/api.md
@@ -100,6 +100,7 @@ from cas_parser.types import (
InboxConnectEmailResponse,
InboxDisconnectEmailResponse,
InboxListCasFilesResponse,
+ InboxReadResponse,
)
```
@@ -109,6 +110,7 @@ Methods:
- client.inbox.connect_email(\*\*params) -> InboxConnectEmailResponse
- client.inbox.disconnect_email() -> InboxDisconnectEmailResponse
- client.inbox.list_cas_files(\*\*params) -> InboxListCasFilesResponse
+- client.inbox.read(\*\*params) -> InboxReadResponse
# Nsdl
@@ -132,6 +134,7 @@ from cas_parser.types import (
InboundEmailRetrieveResponse,
InboundEmailListResponse,
InboundEmailDeleteResponse,
+ InboundEmailListFilesResponse,
)
```
@@ -141,3 +144,57 @@ Methods:
- client.inbound_email.retrieve(inbound_email_id) -> InboundEmailRetrieveResponse
- client.inbound_email.list(\*\*params) -> InboundEmailListResponse
- client.inbound_email.delete(inbound_email_id) -> InboundEmailDeleteResponse
+- client.inbound_email.list_files(inbound_email_id, \*\*params) -> InboundEmailListFilesResponse
+
+# AgentAuth
+
+Types:
+
+```python
+from cas_parser.types import AgentAuthPollResponse, AgentAuthApproveResponse
+```
+
+Methods:
+
+- client.agent_auth.poll(token) -> AgentAuthPollResponse
+- client.agent_auth.approve(token, \*\*params) -> AgentAuthApproveResponse
+
+# Kyc
+
+Types:
+
+```python
+from cas_parser.types import KycLookupDigilockerAccountResponse, KycStartDigilockerSessionResponse, KycGetDigilockerResultResponse, KycCheckPanStatusResponse
+```
+
+Methods:
+
+- client.kyc.lookup_digilocker_account(\*\*params) -> KycLookupDigilockerAccountResponse
+- client.kyc.start_digilocker_session(\*\*params) -> KycStartDigilockerSessionResponse
+- client.kyc.get_digilocker_result(session_id, \*\*params) -> KycGetDigilockerResultResponse
+- client.kyc.check_pan_status(\*\*params) -> KycCheckPanStatusResponse
+
+# Verification
+
+Types:
+
+```python
+from cas_parser.types import VerificationVerifyMfdResponse, VerificationVerifySebiResponse
+```
+
+Methods:
+
+- client.verification.verify_mfd(\*\*params) -> VerificationVerifyMfdResponse
+- client.verification.verify_sebi(\*\*params) -> VerificationVerifySebiResponse
+
+# CasGenerator
+
+Types:
+
+```python
+from cas_parser.types import CasGeneratorGenerateCasResponse
+```
+
+Methods:
+
+- client.cas_generator.generate_cas(\*\*params) -> CasGeneratorGenerateCasResponse
diff --git a/src/cas_parser/_client.py b/src/cas_parser/_client.py
index 7cb49cc..3a13bd1 100644
--- a/src/cas_parser/_client.py
+++ b/src/cas_parser/_client.py
@@ -37,27 +37,35 @@
if TYPE_CHECKING:
from .resources import (
+ kyc,
cdsl,
logs,
nsdl,
inbox,
smart,
credits,
+ agent_auth,
access_token,
+ verification,
verify_token,
cams_kfintech,
+ cas_generator,
contract_note,
inbound_email,
)
+ from .resources.kyc import KycResource, AsyncKycResource
from .resources.logs import LogsResource, AsyncLogsResource
from .resources.nsdl import NsdlResource, AsyncNsdlResource
from .resources.inbox import InboxResource, AsyncInboxResource
from .resources.smart import SmartResource, AsyncSmartResource
from .resources.credits import CreditsResource, AsyncCreditsResource
from .resources.cdsl.cdsl import CdslResource, AsyncCdslResource
+ from .resources.agent_auth import AgentAuthResource, AsyncAgentAuthResource
from .resources.access_token import AccessTokenResource, AsyncAccessTokenResource
+ from .resources.verification import VerificationResource, AsyncVerificationResource
from .resources.verify_token import VerifyTokenResource, AsyncVerifyTokenResource
from .resources.cams_kfintech import CamsKfintechResource, AsyncCamsKfintechResource
+ from .resources.cas_generator import CasGeneratorResource, AsyncCasGeneratorResource
from .resources.contract_note import ContractNoteResource, AsyncContractNoteResource
from .resources.inbound_email import InboundEmailResource, AsyncInboundEmailResource
@@ -273,6 +281,73 @@ def inbound_email(self) -> InboundEmailResource:
return InboundEmailResource(self)
+ @cached_property
+ def agent_auth(self) -> AgentAuthResource:
+ """
+ Endpoints for coding agents to obtain API keys via a browser-based approval flow.
+
+ **How it works:**
+ 1. Agent generates a random token locally (e.g. `openssl rand -hex 32`). No API call needed.
+ 2. Agent asks the user to open `https://app.casparser.in/agent-auth?token=&client_name=`
+ 3. User signs in via the browser and clicks Approve.
+ 4. Agent polls `GET /v1/agent-auth/token/{token}` every 5 seconds until the key is delivered.
+
+ **Security:**
+ - Token must be 16-128 characters (recommended: 64 hex chars / 256 bits)
+ - Approved keys are delivered once (one-shot) and then deleted
+ - Tokens expire after 10 minutes if not approved
+ """
+ from .resources.agent_auth import AgentAuthResource
+
+ return AgentAuthResource(self)
+
+ @cached_property
+ def kyc(self) -> KycResource:
+ """
+ Endpoints for verifying KYC (Know Your Customer) status of Indian investors.
+
+ **Data source:** CVL KRA public inquiry portal (cvlkra.com), which aggregates
+ records from all five SEBI-registered KRAs: CVL, NDML, CAMS, Karvy, and KFin.
+
+ **Status normalization:** Raw CVL portal strings are normalized into clean enums.
+ See the `kyc_status` property on `KycPanStatusResponse` for the full list.
+
+ **Credits:** 0.25 per successful lookup. Failed lookups are not billed.
+ """
+ from .resources.kyc import KycResource
+
+ return KycResource(self)
+
+ @cached_property
+ def verification(self) -> VerificationResource:
+ """
+ Verify the regulatory registration of a financial intermediary — a yes/no
+ check rather than a directory search.
+
+ - **`/v1/verify/sebi`** — any SEBI-registered intermediary (Investment
+ Adviser, Research Analyst, Portfolio Manager, Stock Broker, Mutual Fund,
+ AIF, and more). Send a `registration_number` and the category is
+ auto-detected from its sequence; or send a `name` with an explicit `type`.
+ - **`/v1/verify/mfd`** — AMFI mutual-fund distributors by ARN, including a
+ screen against AMFI's suspended / terminated / terminated-EUIN lists.
+
+ A "not found" result is a successful verification (HTTP 200,
+ `verified: false`) and is billed. Upstream failures surface as 5xx and are
+ not billed.
+
+ **Credits:** 0.25 per successful verification.
+ """
+ from .resources.verification import VerificationResource
+
+ return VerificationResource(self)
+
+ @cached_property
+ def cas_generator(self) -> CasGeneratorResource:
+ """Endpoints for generating new CAS documents via email mailback (KFintech and CAMS)."""
+ from .resources.cas_generator import CasGeneratorResource
+
+ return CasGeneratorResource(self)
+
@cached_property
def with_raw_response(self) -> CasParserWithRawResponse:
return CasParserWithRawResponse(self)
@@ -593,6 +668,73 @@ def inbound_email(self) -> AsyncInboundEmailResource:
return AsyncInboundEmailResource(self)
+ @cached_property
+ def agent_auth(self) -> AsyncAgentAuthResource:
+ """
+ Endpoints for coding agents to obtain API keys via a browser-based approval flow.
+
+ **How it works:**
+ 1. Agent generates a random token locally (e.g. `openssl rand -hex 32`). No API call needed.
+ 2. Agent asks the user to open `https://app.casparser.in/agent-auth?token=&client_name=`
+ 3. User signs in via the browser and clicks Approve.
+ 4. Agent polls `GET /v1/agent-auth/token/{token}` every 5 seconds until the key is delivered.
+
+ **Security:**
+ - Token must be 16-128 characters (recommended: 64 hex chars / 256 bits)
+ - Approved keys are delivered once (one-shot) and then deleted
+ - Tokens expire after 10 minutes if not approved
+ """
+ from .resources.agent_auth import AsyncAgentAuthResource
+
+ return AsyncAgentAuthResource(self)
+
+ @cached_property
+ def kyc(self) -> AsyncKycResource:
+ """
+ Endpoints for verifying KYC (Know Your Customer) status of Indian investors.
+
+ **Data source:** CVL KRA public inquiry portal (cvlkra.com), which aggregates
+ records from all five SEBI-registered KRAs: CVL, NDML, CAMS, Karvy, and KFin.
+
+ **Status normalization:** Raw CVL portal strings are normalized into clean enums.
+ See the `kyc_status` property on `KycPanStatusResponse` for the full list.
+
+ **Credits:** 0.25 per successful lookup. Failed lookups are not billed.
+ """
+ from .resources.kyc import AsyncKycResource
+
+ return AsyncKycResource(self)
+
+ @cached_property
+ def verification(self) -> AsyncVerificationResource:
+ """
+ Verify the regulatory registration of a financial intermediary — a yes/no
+ check rather than a directory search.
+
+ - **`/v1/verify/sebi`** — any SEBI-registered intermediary (Investment
+ Adviser, Research Analyst, Portfolio Manager, Stock Broker, Mutual Fund,
+ AIF, and more). Send a `registration_number` and the category is
+ auto-detected from its sequence; or send a `name` with an explicit `type`.
+ - **`/v1/verify/mfd`** — AMFI mutual-fund distributors by ARN, including a
+ screen against AMFI's suspended / terminated / terminated-EUIN lists.
+
+ A "not found" result is a successful verification (HTTP 200,
+ `verified: false`) and is billed. Upstream failures surface as 5xx and are
+ not billed.
+
+ **Credits:** 0.25 per successful verification.
+ """
+ from .resources.verification import AsyncVerificationResource
+
+ return AsyncVerificationResource(self)
+
+ @cached_property
+ def cas_generator(self) -> AsyncCasGeneratorResource:
+ """Endpoints for generating new CAS documents via email mailback (KFintech and CAMS)."""
+ from .resources.cas_generator import AsyncCasGeneratorResource
+
+ return AsyncCasGeneratorResource(self)
+
@cached_property
def with_raw_response(self) -> AsyncCasParserWithRawResponse:
return AsyncCasParserWithRawResponse(self)
@@ -855,6 +997,73 @@ def inbound_email(self) -> inbound_email.InboundEmailResourceWithRawResponse:
return InboundEmailResourceWithRawResponse(self._client.inbound_email)
+ @cached_property
+ def agent_auth(self) -> agent_auth.AgentAuthResourceWithRawResponse:
+ """
+ Endpoints for coding agents to obtain API keys via a browser-based approval flow.
+
+ **How it works:**
+ 1. Agent generates a random token locally (e.g. `openssl rand -hex 32`). No API call needed.
+ 2. Agent asks the user to open `https://app.casparser.in/agent-auth?token=&client_name=`
+ 3. User signs in via the browser and clicks Approve.
+ 4. Agent polls `GET /v1/agent-auth/token/{token}` every 5 seconds until the key is delivered.
+
+ **Security:**
+ - Token must be 16-128 characters (recommended: 64 hex chars / 256 bits)
+ - Approved keys are delivered once (one-shot) and then deleted
+ - Tokens expire after 10 minutes if not approved
+ """
+ from .resources.agent_auth import AgentAuthResourceWithRawResponse
+
+ return AgentAuthResourceWithRawResponse(self._client.agent_auth)
+
+ @cached_property
+ def kyc(self) -> kyc.KycResourceWithRawResponse:
+ """
+ Endpoints for verifying KYC (Know Your Customer) status of Indian investors.
+
+ **Data source:** CVL KRA public inquiry portal (cvlkra.com), which aggregates
+ records from all five SEBI-registered KRAs: CVL, NDML, CAMS, Karvy, and KFin.
+
+ **Status normalization:** Raw CVL portal strings are normalized into clean enums.
+ See the `kyc_status` property on `KycPanStatusResponse` for the full list.
+
+ **Credits:** 0.25 per successful lookup. Failed lookups are not billed.
+ """
+ from .resources.kyc import KycResourceWithRawResponse
+
+ return KycResourceWithRawResponse(self._client.kyc)
+
+ @cached_property
+ def verification(self) -> verification.VerificationResourceWithRawResponse:
+ """
+ Verify the regulatory registration of a financial intermediary — a yes/no
+ check rather than a directory search.
+
+ - **`/v1/verify/sebi`** — any SEBI-registered intermediary (Investment
+ Adviser, Research Analyst, Portfolio Manager, Stock Broker, Mutual Fund,
+ AIF, and more). Send a `registration_number` and the category is
+ auto-detected from its sequence; or send a `name` with an explicit `type`.
+ - **`/v1/verify/mfd`** — AMFI mutual-fund distributors by ARN, including a
+ screen against AMFI's suspended / terminated / terminated-EUIN lists.
+
+ A "not found" result is a successful verification (HTTP 200,
+ `verified: false`) and is billed. Upstream failures surface as 5xx and are
+ not billed.
+
+ **Credits:** 0.25 per successful verification.
+ """
+ from .resources.verification import VerificationResourceWithRawResponse
+
+ return VerificationResourceWithRawResponse(self._client.verification)
+
+ @cached_property
+ def cas_generator(self) -> cas_generator.CasGeneratorResourceWithRawResponse:
+ """Endpoints for generating new CAS documents via email mailback (KFintech and CAMS)."""
+ from .resources.cas_generator import CasGeneratorResourceWithRawResponse
+
+ return CasGeneratorResourceWithRawResponse(self._client.cas_generator)
+
class AsyncCasParserWithRawResponse:
_client: AsyncCasParser
@@ -998,6 +1207,73 @@ def inbound_email(self) -> inbound_email.AsyncInboundEmailResourceWithRawRespons
return AsyncInboundEmailResourceWithRawResponse(self._client.inbound_email)
+ @cached_property
+ def agent_auth(self) -> agent_auth.AsyncAgentAuthResourceWithRawResponse:
+ """
+ Endpoints for coding agents to obtain API keys via a browser-based approval flow.
+
+ **How it works:**
+ 1. Agent generates a random token locally (e.g. `openssl rand -hex 32`). No API call needed.
+ 2. Agent asks the user to open `https://app.casparser.in/agent-auth?token=&client_name=`
+ 3. User signs in via the browser and clicks Approve.
+ 4. Agent polls `GET /v1/agent-auth/token/{token}` every 5 seconds until the key is delivered.
+
+ **Security:**
+ - Token must be 16-128 characters (recommended: 64 hex chars / 256 bits)
+ - Approved keys are delivered once (one-shot) and then deleted
+ - Tokens expire after 10 minutes if not approved
+ """
+ from .resources.agent_auth import AsyncAgentAuthResourceWithRawResponse
+
+ return AsyncAgentAuthResourceWithRawResponse(self._client.agent_auth)
+
+ @cached_property
+ def kyc(self) -> kyc.AsyncKycResourceWithRawResponse:
+ """
+ Endpoints for verifying KYC (Know Your Customer) status of Indian investors.
+
+ **Data source:** CVL KRA public inquiry portal (cvlkra.com), which aggregates
+ records from all five SEBI-registered KRAs: CVL, NDML, CAMS, Karvy, and KFin.
+
+ **Status normalization:** Raw CVL portal strings are normalized into clean enums.
+ See the `kyc_status` property on `KycPanStatusResponse` for the full list.
+
+ **Credits:** 0.25 per successful lookup. Failed lookups are not billed.
+ """
+ from .resources.kyc import AsyncKycResourceWithRawResponse
+
+ return AsyncKycResourceWithRawResponse(self._client.kyc)
+
+ @cached_property
+ def verification(self) -> verification.AsyncVerificationResourceWithRawResponse:
+ """
+ Verify the regulatory registration of a financial intermediary — a yes/no
+ check rather than a directory search.
+
+ - **`/v1/verify/sebi`** — any SEBI-registered intermediary (Investment
+ Adviser, Research Analyst, Portfolio Manager, Stock Broker, Mutual Fund,
+ AIF, and more). Send a `registration_number` and the category is
+ auto-detected from its sequence; or send a `name` with an explicit `type`.
+ - **`/v1/verify/mfd`** — AMFI mutual-fund distributors by ARN, including a
+ screen against AMFI's suspended / terminated / terminated-EUIN lists.
+
+ A "not found" result is a successful verification (HTTP 200,
+ `verified: false`) and is billed. Upstream failures surface as 5xx and are
+ not billed.
+
+ **Credits:** 0.25 per successful verification.
+ """
+ from .resources.verification import AsyncVerificationResourceWithRawResponse
+
+ return AsyncVerificationResourceWithRawResponse(self._client.verification)
+
+ @cached_property
+ def cas_generator(self) -> cas_generator.AsyncCasGeneratorResourceWithRawResponse:
+ """Endpoints for generating new CAS documents via email mailback (KFintech and CAMS)."""
+ from .resources.cas_generator import AsyncCasGeneratorResourceWithRawResponse
+
+ return AsyncCasGeneratorResourceWithRawResponse(self._client.cas_generator)
+
class CasParserWithStreamedResponse:
_client: CasParser
@@ -1141,6 +1417,73 @@ def inbound_email(self) -> inbound_email.InboundEmailResourceWithStreamingRespon
return InboundEmailResourceWithStreamingResponse(self._client.inbound_email)
+ @cached_property
+ def agent_auth(self) -> agent_auth.AgentAuthResourceWithStreamingResponse:
+ """
+ Endpoints for coding agents to obtain API keys via a browser-based approval flow.
+
+ **How it works:**
+ 1. Agent generates a random token locally (e.g. `openssl rand -hex 32`). No API call needed.
+ 2. Agent asks the user to open `https://app.casparser.in/agent-auth?token=&client_name=`
+ 3. User signs in via the browser and clicks Approve.
+ 4. Agent polls `GET /v1/agent-auth/token/{token}` every 5 seconds until the key is delivered.
+
+ **Security:**
+ - Token must be 16-128 characters (recommended: 64 hex chars / 256 bits)
+ - Approved keys are delivered once (one-shot) and then deleted
+ - Tokens expire after 10 minutes if not approved
+ """
+ from .resources.agent_auth import AgentAuthResourceWithStreamingResponse
+
+ return AgentAuthResourceWithStreamingResponse(self._client.agent_auth)
+
+ @cached_property
+ def kyc(self) -> kyc.KycResourceWithStreamingResponse:
+ """
+ Endpoints for verifying KYC (Know Your Customer) status of Indian investors.
+
+ **Data source:** CVL KRA public inquiry portal (cvlkra.com), which aggregates
+ records from all five SEBI-registered KRAs: CVL, NDML, CAMS, Karvy, and KFin.
+
+ **Status normalization:** Raw CVL portal strings are normalized into clean enums.
+ See the `kyc_status` property on `KycPanStatusResponse` for the full list.
+
+ **Credits:** 0.25 per successful lookup. Failed lookups are not billed.
+ """
+ from .resources.kyc import KycResourceWithStreamingResponse
+
+ return KycResourceWithStreamingResponse(self._client.kyc)
+
+ @cached_property
+ def verification(self) -> verification.VerificationResourceWithStreamingResponse:
+ """
+ Verify the regulatory registration of a financial intermediary — a yes/no
+ check rather than a directory search.
+
+ - **`/v1/verify/sebi`** — any SEBI-registered intermediary (Investment
+ Adviser, Research Analyst, Portfolio Manager, Stock Broker, Mutual Fund,
+ AIF, and more). Send a `registration_number` and the category is
+ auto-detected from its sequence; or send a `name` with an explicit `type`.
+ - **`/v1/verify/mfd`** — AMFI mutual-fund distributors by ARN, including a
+ screen against AMFI's suspended / terminated / terminated-EUIN lists.
+
+ A "not found" result is a successful verification (HTTP 200,
+ `verified: false`) and is billed. Upstream failures surface as 5xx and are
+ not billed.
+
+ **Credits:** 0.25 per successful verification.
+ """
+ from .resources.verification import VerificationResourceWithStreamingResponse
+
+ return VerificationResourceWithStreamingResponse(self._client.verification)
+
+ @cached_property
+ def cas_generator(self) -> cas_generator.CasGeneratorResourceWithStreamingResponse:
+ """Endpoints for generating new CAS documents via email mailback (KFintech and CAMS)."""
+ from .resources.cas_generator import CasGeneratorResourceWithStreamingResponse
+
+ return CasGeneratorResourceWithStreamingResponse(self._client.cas_generator)
+
class AsyncCasParserWithStreamedResponse:
_client: AsyncCasParser
@@ -1284,6 +1627,73 @@ def inbound_email(self) -> inbound_email.AsyncInboundEmailResourceWithStreamingR
return AsyncInboundEmailResourceWithStreamingResponse(self._client.inbound_email)
+ @cached_property
+ def agent_auth(self) -> agent_auth.AsyncAgentAuthResourceWithStreamingResponse:
+ """
+ Endpoints for coding agents to obtain API keys via a browser-based approval flow.
+
+ **How it works:**
+ 1. Agent generates a random token locally (e.g. `openssl rand -hex 32`). No API call needed.
+ 2. Agent asks the user to open `https://app.casparser.in/agent-auth?token=&client_name=`
+ 3. User signs in via the browser and clicks Approve.
+ 4. Agent polls `GET /v1/agent-auth/token/{token}` every 5 seconds until the key is delivered.
+
+ **Security:**
+ - Token must be 16-128 characters (recommended: 64 hex chars / 256 bits)
+ - Approved keys are delivered once (one-shot) and then deleted
+ - Tokens expire after 10 minutes if not approved
+ """
+ from .resources.agent_auth import AsyncAgentAuthResourceWithStreamingResponse
+
+ return AsyncAgentAuthResourceWithStreamingResponse(self._client.agent_auth)
+
+ @cached_property
+ def kyc(self) -> kyc.AsyncKycResourceWithStreamingResponse:
+ """
+ Endpoints for verifying KYC (Know Your Customer) status of Indian investors.
+
+ **Data source:** CVL KRA public inquiry portal (cvlkra.com), which aggregates
+ records from all five SEBI-registered KRAs: CVL, NDML, CAMS, Karvy, and KFin.
+
+ **Status normalization:** Raw CVL portal strings are normalized into clean enums.
+ See the `kyc_status` property on `KycPanStatusResponse` for the full list.
+
+ **Credits:** 0.25 per successful lookup. Failed lookups are not billed.
+ """
+ from .resources.kyc import AsyncKycResourceWithStreamingResponse
+
+ return AsyncKycResourceWithStreamingResponse(self._client.kyc)
+
+ @cached_property
+ def verification(self) -> verification.AsyncVerificationResourceWithStreamingResponse:
+ """
+ Verify the regulatory registration of a financial intermediary — a yes/no
+ check rather than a directory search.
+
+ - **`/v1/verify/sebi`** — any SEBI-registered intermediary (Investment
+ Adviser, Research Analyst, Portfolio Manager, Stock Broker, Mutual Fund,
+ AIF, and more). Send a `registration_number` and the category is
+ auto-detected from its sequence; or send a `name` with an explicit `type`.
+ - **`/v1/verify/mfd`** — AMFI mutual-fund distributors by ARN, including a
+ screen against AMFI's suspended / terminated / terminated-EUIN lists.
+
+ A "not found" result is a successful verification (HTTP 200,
+ `verified: false`) and is billed. Upstream failures surface as 5xx and are
+ not billed.
+
+ **Credits:** 0.25 per successful verification.
+ """
+ from .resources.verification import AsyncVerificationResourceWithStreamingResponse
+
+ return AsyncVerificationResourceWithStreamingResponse(self._client.verification)
+
+ @cached_property
+ def cas_generator(self) -> cas_generator.AsyncCasGeneratorResourceWithStreamingResponse:
+ """Endpoints for generating new CAS documents via email mailback (KFintech and CAMS)."""
+ from .resources.cas_generator import AsyncCasGeneratorResourceWithStreamingResponse
+
+ return AsyncCasGeneratorResourceWithStreamingResponse(self._client.cas_generator)
+
Client = CasParser
diff --git a/src/cas_parser/resources/__init__.py b/src/cas_parser/resources/__init__.py
index 6b86f9e..e4afe76 100644
--- a/src/cas_parser/resources/__init__.py
+++ b/src/cas_parser/resources/__init__.py
@@ -1,5 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+from .kyc import (
+ KycResource,
+ AsyncKycResource,
+ KycResourceWithRawResponse,
+ AsyncKycResourceWithRawResponse,
+ KycResourceWithStreamingResponse,
+ AsyncKycResourceWithStreamingResponse,
+)
from .cdsl import (
CdslResource,
AsyncCdslResource,
@@ -48,6 +56,14 @@
CreditsResourceWithStreamingResponse,
AsyncCreditsResourceWithStreamingResponse,
)
+from .agent_auth import (
+ AgentAuthResource,
+ AsyncAgentAuthResource,
+ AgentAuthResourceWithRawResponse,
+ AsyncAgentAuthResourceWithRawResponse,
+ AgentAuthResourceWithStreamingResponse,
+ AsyncAgentAuthResourceWithStreamingResponse,
+)
from .access_token import (
AccessTokenResource,
AsyncAccessTokenResource,
@@ -56,6 +72,14 @@
AccessTokenResourceWithStreamingResponse,
AsyncAccessTokenResourceWithStreamingResponse,
)
+from .verification import (
+ VerificationResource,
+ AsyncVerificationResource,
+ VerificationResourceWithRawResponse,
+ AsyncVerificationResourceWithRawResponse,
+ VerificationResourceWithStreamingResponse,
+ AsyncVerificationResourceWithStreamingResponse,
+)
from .verify_token import (
VerifyTokenResource,
AsyncVerifyTokenResource,
@@ -72,6 +96,14 @@
CamsKfintechResourceWithStreamingResponse,
AsyncCamsKfintechResourceWithStreamingResponse,
)
+from .cas_generator import (
+ CasGeneratorResource,
+ AsyncCasGeneratorResource,
+ CasGeneratorResourceWithRawResponse,
+ AsyncCasGeneratorResourceWithRawResponse,
+ CasGeneratorResourceWithStreamingResponse,
+ AsyncCasGeneratorResourceWithStreamingResponse,
+)
from .contract_note import (
ContractNoteResource,
AsyncContractNoteResource,
@@ -156,4 +188,28 @@
"AsyncInboundEmailResourceWithRawResponse",
"InboundEmailResourceWithStreamingResponse",
"AsyncInboundEmailResourceWithStreamingResponse",
+ "AgentAuthResource",
+ "AsyncAgentAuthResource",
+ "AgentAuthResourceWithRawResponse",
+ "AsyncAgentAuthResourceWithRawResponse",
+ "AgentAuthResourceWithStreamingResponse",
+ "AsyncAgentAuthResourceWithStreamingResponse",
+ "KycResource",
+ "AsyncKycResource",
+ "KycResourceWithRawResponse",
+ "AsyncKycResourceWithRawResponse",
+ "KycResourceWithStreamingResponse",
+ "AsyncKycResourceWithStreamingResponse",
+ "VerificationResource",
+ "AsyncVerificationResource",
+ "VerificationResourceWithRawResponse",
+ "AsyncVerificationResourceWithRawResponse",
+ "VerificationResourceWithStreamingResponse",
+ "AsyncVerificationResourceWithStreamingResponse",
+ "CasGeneratorResource",
+ "AsyncCasGeneratorResource",
+ "CasGeneratorResourceWithRawResponse",
+ "AsyncCasGeneratorResourceWithRawResponse",
+ "CasGeneratorResourceWithStreamingResponse",
+ "AsyncCasGeneratorResourceWithStreamingResponse",
]
diff --git a/src/cas_parser/resources/agent_auth.py b/src/cas_parser/resources/agent_auth.py
new file mode 100644
index 0000000..072e8be
--- /dev/null
+++ b/src/cas_parser/resources/agent_auth.py
@@ -0,0 +1,338 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Any, cast
+
+import httpx
+
+from ..types import agent_auth_approve_params
+from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
+from .._utils import path_template, maybe_transform, async_maybe_transform
+from .._compat import cached_property
+from .._resource import SyncAPIResource, AsyncAPIResource
+from .._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from .._base_client import make_request_options
+from ..types.agent_auth_poll_response import AgentAuthPollResponse
+from ..types.agent_auth_approve_response import AgentAuthApproveResponse
+
+__all__ = ["AgentAuthResource", "AsyncAgentAuthResource"]
+
+
+class AgentAuthResource(SyncAPIResource):
+ """
+ Endpoints for coding agents to obtain API keys via a browser-based approval flow.
+
+ **How it works:**
+ 1. Agent generates a random token locally (e.g. `openssl rand -hex 32`). No API call needed.
+ 2. Agent asks the user to open `https://app.casparser.in/agent-auth?token=&client_name=`
+ 3. User signs in via the browser and clicks Approve.
+ 4. Agent polls `GET /v1/agent-auth/token/{token}` every 5 seconds until the key is delivered.
+
+ **Security:**
+ - Token must be 16-128 characters (recommended: 64 hex chars / 256 bits)
+ - Approved keys are delivered once (one-shot) and then deleted
+ - Tokens expire after 10 minutes if not approved
+ """
+
+ @cached_property
+ def with_raw_response(self) -> AgentAuthResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#accessing-raw-response-data-eg-headers
+ """
+ return AgentAuthResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AgentAuthResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#with_streaming_response
+ """
+ return AgentAuthResourceWithStreamingResponse(self)
+
+ def poll(
+ self,
+ token: str,
+ *,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> AgentAuthPollResponse:
+ """
+ Agent polls this endpoint to check if the user has approved the authorization.
+
+ Returns `{"status": "pending"}` while waiting for user approval.
+ Returns `{"status": "approved", "api_key": "sk_...", "email": "..."}` once approved.
+
+ **One-shot delivery:** the API key is returned exactly once. After delivery, the token is deleted
+ and subsequent polls return `{"status": "pending"}`.
+
+ **Recommended polling interval:** 5 seconds. Token expires after 10 minutes.
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not token:
+ raise ValueError(f"Expected a non-empty value for `token` but received {token!r}")
+ return cast(
+ AgentAuthPollResponse,
+ self._get(
+ path_template("/v1/agent-auth/token/{token}", token=token),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=cast(
+ Any, AgentAuthPollResponse
+ ), # Union types cannot be passed in as arguments in the type system
+ ),
+ )
+
+ def approve(
+ self,
+ token: str,
+ *,
+ id_token: str,
+ client_name: str | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> AgentAuthApproveResponse:
+ """
+ Called by the frontend after the user signs in.
+
+ Verifies the identity token, creates or looks up the user's API key,
+ and stores it against the token for the agent to poll via `GET /v1/agent-auth/token/{token}`.
+
+ **This endpoint is called by the browser, not by agents directly.**
+
+ Args:
+ client_name: Name of the agent/application (stored in customer metadata for audit)
+
+ id_token: Identity token obtained after the user signs in on the approval page
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not token:
+ raise ValueError(f"Expected a non-empty value for `token` but received {token!r}")
+ return self._post(
+ path_template("/v1/agent-auth/token/{token}/approve", token=token),
+ body=maybe_transform(
+ {
+ "client_name": client_name,
+ "id_token": id_token,
+ },
+ agent_auth_approve_params.AgentAuthApproveParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=AgentAuthApproveResponse,
+ )
+
+
+class AsyncAgentAuthResource(AsyncAPIResource):
+ """
+ Endpoints for coding agents to obtain API keys via a browser-based approval flow.
+
+ **How it works:**
+ 1. Agent generates a random token locally (e.g. `openssl rand -hex 32`). No API call needed.
+ 2. Agent asks the user to open `https://app.casparser.in/agent-auth?token=&client_name=`
+ 3. User signs in via the browser and clicks Approve.
+ 4. Agent polls `GET /v1/agent-auth/token/{token}` every 5 seconds until the key is delivered.
+
+ **Security:**
+ - Token must be 16-128 characters (recommended: 64 hex chars / 256 bits)
+ - Approved keys are delivered once (one-shot) and then deleted
+ - Tokens expire after 10 minutes if not approved
+ """
+
+ @cached_property
+ def with_raw_response(self) -> AsyncAgentAuthResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncAgentAuthResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncAgentAuthResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#with_streaming_response
+ """
+ return AsyncAgentAuthResourceWithStreamingResponse(self)
+
+ async def poll(
+ self,
+ token: str,
+ *,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> AgentAuthPollResponse:
+ """
+ Agent polls this endpoint to check if the user has approved the authorization.
+
+ Returns `{"status": "pending"}` while waiting for user approval.
+ Returns `{"status": "approved", "api_key": "sk_...", "email": "..."}` once approved.
+
+ **One-shot delivery:** the API key is returned exactly once. After delivery, the token is deleted
+ and subsequent polls return `{"status": "pending"}`.
+
+ **Recommended polling interval:** 5 seconds. Token expires after 10 minutes.
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not token:
+ raise ValueError(f"Expected a non-empty value for `token` but received {token!r}")
+ return cast(
+ AgentAuthPollResponse,
+ await self._get(
+ path_template("/v1/agent-auth/token/{token}", token=token),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=cast(
+ Any, AgentAuthPollResponse
+ ), # Union types cannot be passed in as arguments in the type system
+ ),
+ )
+
+ async def approve(
+ self,
+ token: str,
+ *,
+ id_token: str,
+ client_name: str | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> AgentAuthApproveResponse:
+ """
+ Called by the frontend after the user signs in.
+
+ Verifies the identity token, creates or looks up the user's API key,
+ and stores it against the token for the agent to poll via `GET /v1/agent-auth/token/{token}`.
+
+ **This endpoint is called by the browser, not by agents directly.**
+
+ Args:
+ client_name: Name of the agent/application (stored in customer metadata for audit)
+
+ id_token: Identity token obtained after the user signs in on the approval page
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not token:
+ raise ValueError(f"Expected a non-empty value for `token` but received {token!r}")
+ return await self._post(
+ path_template("/v1/agent-auth/token/{token}/approve", token=token),
+ body=await async_maybe_transform(
+ {
+ "client_name": client_name,
+ "id_token": id_token,
+ },
+ agent_auth_approve_params.AgentAuthApproveParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=AgentAuthApproveResponse,
+ )
+
+
+class AgentAuthResourceWithRawResponse:
+ def __init__(self, agent_auth: AgentAuthResource) -> None:
+ self._agent_auth = agent_auth
+
+ self.poll = to_raw_response_wrapper(
+ agent_auth.poll,
+ )
+ self.approve = to_raw_response_wrapper(
+ agent_auth.approve,
+ )
+
+
+class AsyncAgentAuthResourceWithRawResponse:
+ def __init__(self, agent_auth: AsyncAgentAuthResource) -> None:
+ self._agent_auth = agent_auth
+
+ self.poll = async_to_raw_response_wrapper(
+ agent_auth.poll,
+ )
+ self.approve = async_to_raw_response_wrapper(
+ agent_auth.approve,
+ )
+
+
+class AgentAuthResourceWithStreamingResponse:
+ def __init__(self, agent_auth: AgentAuthResource) -> None:
+ self._agent_auth = agent_auth
+
+ self.poll = to_streamed_response_wrapper(
+ agent_auth.poll,
+ )
+ self.approve = to_streamed_response_wrapper(
+ agent_auth.approve,
+ )
+
+
+class AsyncAgentAuthResourceWithStreamingResponse:
+ def __init__(self, agent_auth: AsyncAgentAuthResource) -> None:
+ self._agent_auth = agent_auth
+
+ self.poll = async_to_streamed_response_wrapper(
+ agent_auth.poll,
+ )
+ self.approve = async_to_streamed_response_wrapper(
+ agent_auth.approve,
+ )
diff --git a/src/cas_parser/resources/cas_generator.py b/src/cas_parser/resources/cas_generator.py
new file mode 100644
index 0000000..45d3b4f
--- /dev/null
+++ b/src/cas_parser/resources/cas_generator.py
@@ -0,0 +1,249 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal
+
+import httpx
+
+from ..types import cas_generator_generate_cas_params
+from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
+from .._utils import maybe_transform, async_maybe_transform
+from .._compat import cached_property
+from .._resource import SyncAPIResource, AsyncAPIResource
+from .._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from .._base_client import make_request_options
+from ..types.cas_generator_generate_cas_response import CasGeneratorGenerateCasResponse
+
+__all__ = ["CasGeneratorResource", "AsyncCasGeneratorResource"]
+
+
+class CasGeneratorResource(SyncAPIResource):
+ """Endpoints for generating new CAS documents via email mailback (KFintech and CAMS)."""
+
+ @cached_property
+ def with_raw_response(self) -> CasGeneratorResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#accessing-raw-response-data-eg-headers
+ """
+ return CasGeneratorResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> CasGeneratorResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#with_streaming_response
+ """
+ return CasGeneratorResourceWithStreamingResponse(self)
+
+ def generate_cas(
+ self,
+ *,
+ email: str,
+ from_date: str,
+ password: str,
+ to_date: str,
+ cas_authority: Literal["kfintech", "cams"] | Omit = omit,
+ pan_no: str | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> CasGeneratorGenerateCasResponse:
+ """
+ Generate a mutual fund CAS statement via email mailback. The CAS PDF will be sent to the investor's email.
+
+ KFintech and CAMS have a mutual partnership for data sharing and consolidation,
+ so this endpoint retrieves mutual fund data from **both RTAs**, covering all
+ mutual funds in India.
+
+ This is an async operation - the investor receives the CAS via email within a few minutes.
+
+ By default, a **Detailed CAS** is generated, which includes the complete transaction history.
+ The parsing layer supports all statement types (Detailed, Summary, etc.), but generation
+ always requests the Detailed variant for maximum data coverage.
+
+ `cas_authority` picks which RTA sends the email. The portfolio data is the same either
+ way — only the PDF password policy differs. With `cams`, a PAN is a valid password.
+
+ Args:
+ cas_authority: RTA that sends the mailback. Affects only the password policy, not the portfolio data returned.
+
+ email: Email address to receive the CAS document
+
+ from_date: Start date (YYYY-MM-DD)
+
+ pan_no: PAN number (optional)
+
+ password: Password protecting the emailed PDF. Must satisfy the chosen authority's policy — `cams` requires 6-20 characters with at least two digits, so a PAN works.
+
+ to_date: End date (YYYY-MM-DD)
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return self._post(
+ "/v4/generate",
+ body=maybe_transform(
+ {
+ "cas_authority": cas_authority,
+ "email": email,
+ "from_date": from_date,
+ "pan_no": pan_no,
+ "password": password,
+ "to_date": to_date,
+ },
+ cas_generator_generate_cas_params.CasGeneratorGenerateCasParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=CasGeneratorGenerateCasResponse,
+ )
+
+
+class AsyncCasGeneratorResource(AsyncAPIResource):
+ """Endpoints for generating new CAS documents via email mailback (KFintech and CAMS)."""
+
+ @cached_property
+ def with_raw_response(self) -> AsyncCasGeneratorResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncCasGeneratorResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncCasGeneratorResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#with_streaming_response
+ """
+ return AsyncCasGeneratorResourceWithStreamingResponse(self)
+
+ async def generate_cas(
+ self,
+ *,
+ email: str,
+ from_date: str,
+ password: str,
+ to_date: str,
+ cas_authority: Literal["kfintech", "cams"] | Omit = omit,
+ pan_no: str | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> CasGeneratorGenerateCasResponse:
+ """
+ Generate a mutual fund CAS statement via email mailback. The CAS PDF will be sent to the investor's email.
+
+ KFintech and CAMS have a mutual partnership for data sharing and consolidation,
+ so this endpoint retrieves mutual fund data from **both RTAs**, covering all
+ mutual funds in India.
+
+ This is an async operation - the investor receives the CAS via email within a few minutes.
+
+ By default, a **Detailed CAS** is generated, which includes the complete transaction history.
+ The parsing layer supports all statement types (Detailed, Summary, etc.), but generation
+ always requests the Detailed variant for maximum data coverage.
+
+ `cas_authority` picks which RTA sends the email. The portfolio data is the same either
+ way — only the PDF password policy differs. With `cams`, a PAN is a valid password.
+
+ Args:
+ cas_authority: RTA that sends the mailback. Affects only the password policy, not the portfolio data returned.
+
+ email: Email address to receive the CAS document
+
+ from_date: Start date (YYYY-MM-DD)
+
+ pan_no: PAN number (optional)
+
+ password: Password protecting the emailed PDF. Must satisfy the chosen authority's policy — `cams` requires 6-20 characters with at least two digits, so a PAN works.
+
+ to_date: End date (YYYY-MM-DD)
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return await self._post(
+ "/v4/generate",
+ body=await async_maybe_transform(
+ {
+ "cas_authority": cas_authority,
+ "email": email,
+ "from_date": from_date,
+ "pan_no": pan_no,
+ "password": password,
+ "to_date": to_date,
+ },
+ cas_generator_generate_cas_params.CasGeneratorGenerateCasParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=CasGeneratorGenerateCasResponse,
+ )
+
+
+class CasGeneratorResourceWithRawResponse:
+ def __init__(self, cas_generator: CasGeneratorResource) -> None:
+ self._cas_generator = cas_generator
+
+ self.generate_cas = to_raw_response_wrapper(
+ cas_generator.generate_cas,
+ )
+
+
+class AsyncCasGeneratorResourceWithRawResponse:
+ def __init__(self, cas_generator: AsyncCasGeneratorResource) -> None:
+ self._cas_generator = cas_generator
+
+ self.generate_cas = async_to_raw_response_wrapper(
+ cas_generator.generate_cas,
+ )
+
+
+class CasGeneratorResourceWithStreamingResponse:
+ def __init__(self, cas_generator: CasGeneratorResource) -> None:
+ self._cas_generator = cas_generator
+
+ self.generate_cas = to_streamed_response_wrapper(
+ cas_generator.generate_cas,
+ )
+
+
+class AsyncCasGeneratorResourceWithStreamingResponse:
+ def __init__(self, cas_generator: AsyncCasGeneratorResource) -> None:
+ self._cas_generator = cas_generator
+
+ self.generate_cas = async_to_streamed_response_wrapper(
+ cas_generator.generate_cas,
+ )
diff --git a/src/cas_parser/resources/inbound_email.py b/src/cas_parser/resources/inbound_email.py
index 75c1229..3d953bc 100644
--- a/src/cas_parser/resources/inbound_email.py
+++ b/src/cas_parser/resources/inbound_email.py
@@ -2,12 +2,13 @@
from __future__ import annotations
-from typing import Dict, List, Optional
+from typing import Dict, List, Union, Optional
+from datetime import datetime
from typing_extensions import Literal
import httpx
-from ..types import inbound_email_list_params, inbound_email_create_params
+from ..types import inbound_email_list_params, inbound_email_create_params, inbound_email_list_files_params
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from .._utils import path_template, maybe_transform, async_maybe_transform
from .._compat import cached_property
@@ -23,6 +24,7 @@
from ..types.inbound_email_create_response import InboundEmailCreateResponse
from ..types.inbound_email_delete_response import InboundEmailDeleteResponse
from ..types.inbound_email_retrieve_response import InboundEmailRetrieveResponse
+from ..types.inbound_email_list_files_response import InboundEmailListFilesResponse
__all__ = ["InboundEmailResource", "AsyncInboundEmailResource"]
@@ -266,6 +268,63 @@ def delete(
cast_to=InboundEmailDeleteResponse,
)
+ def list_files(
+ self,
+ inbound_email_id: str,
+ *,
+ since: Union[str, datetime] | Omit = omit,
+ limit: int | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> InboundEmailListFilesResponse:
+ """
+ Retrieve CAS files forwarded to this inbound email. Available for every
+ inbound email, regardless of whether a `callback_url` was set — use it
+ to avoid building a webhook consumer, to poll alongside a webhook, or
+ to replay missed webhook deliveries.
+
+ Pass the `cursor` from the previous response as `since` to receive only
+ new files.
+
+ Args:
+ since: ISO 8601 timestamp. Only files with `received_at` strictly greater
+ than this value are returned. Use the `cursor` value from the
+ previous response.
+
+ limit: Maximum files to return.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not inbound_email_id:
+ raise ValueError(f"Expected a non-empty value for `inbound_email_id` but received {inbound_email_id!r}")
+ return self._get(
+ path_template("/v4/inbound-email/{inbound_email_id}/files", inbound_email_id=inbound_email_id),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "since": since,
+ "limit": limit,
+ },
+ inbound_email_list_files_params.InboundEmailListFilesParams,
+ ),
+ ),
+ cast_to=InboundEmailListFilesResponse,
+ )
+
class AsyncInboundEmailResource(AsyncAPIResource):
"""
@@ -506,6 +565,63 @@ async def delete(
cast_to=InboundEmailDeleteResponse,
)
+ async def list_files(
+ self,
+ inbound_email_id: str,
+ *,
+ since: Union[str, datetime] | Omit = omit,
+ limit: int | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> InboundEmailListFilesResponse:
+ """
+ Retrieve CAS files forwarded to this inbound email. Available for every
+ inbound email, regardless of whether a `callback_url` was set — use it
+ to avoid building a webhook consumer, to poll alongside a webhook, or
+ to replay missed webhook deliveries.
+
+ Pass the `cursor` from the previous response as `since` to receive only
+ new files.
+
+ Args:
+ since: ISO 8601 timestamp. Only files with `received_at` strictly greater
+ than this value are returned. Use the `cursor` value from the
+ previous response.
+
+ limit: Maximum files to return.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not inbound_email_id:
+ raise ValueError(f"Expected a non-empty value for `inbound_email_id` but received {inbound_email_id!r}")
+ return await self._get(
+ path_template("/v4/inbound-email/{inbound_email_id}/files", inbound_email_id=inbound_email_id),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "since": since,
+ "limit": limit,
+ },
+ inbound_email_list_files_params.InboundEmailListFilesParams,
+ ),
+ ),
+ cast_to=InboundEmailListFilesResponse,
+ )
+
class InboundEmailResourceWithRawResponse:
def __init__(self, inbound_email: InboundEmailResource) -> None:
@@ -523,6 +639,9 @@ def __init__(self, inbound_email: InboundEmailResource) -> None:
self.delete = to_raw_response_wrapper(
inbound_email.delete,
)
+ self.list_files = to_raw_response_wrapper(
+ inbound_email.list_files,
+ )
class AsyncInboundEmailResourceWithRawResponse:
@@ -541,6 +660,9 @@ def __init__(self, inbound_email: AsyncInboundEmailResource) -> None:
self.delete = async_to_raw_response_wrapper(
inbound_email.delete,
)
+ self.list_files = async_to_raw_response_wrapper(
+ inbound_email.list_files,
+ )
class InboundEmailResourceWithStreamingResponse:
@@ -559,6 +681,9 @@ def __init__(self, inbound_email: InboundEmailResource) -> None:
self.delete = to_streamed_response_wrapper(
inbound_email.delete,
)
+ self.list_files = to_streamed_response_wrapper(
+ inbound_email.list_files,
+ )
class AsyncInboundEmailResourceWithStreamingResponse:
@@ -577,3 +702,6 @@ def __init__(self, inbound_email: AsyncInboundEmailResource) -> None:
self.delete = async_to_streamed_response_wrapper(
inbound_email.delete,
)
+ self.list_files = async_to_streamed_response_wrapper(
+ inbound_email.list_files,
+ )
diff --git a/src/cas_parser/resources/inbox.py b/src/cas_parser/resources/inbox.py
index d58c55a..e2ef428 100644
--- a/src/cas_parser/resources/inbox.py
+++ b/src/cas_parser/resources/inbox.py
@@ -8,8 +8,8 @@
import httpx
-from ..types import inbox_connect_email_params, inbox_list_cas_files_params
-from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
+from ..types import inbox_read_params, inbox_connect_email_params, inbox_list_cas_files_params
+from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from .._utils import maybe_transform, async_maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -20,6 +20,7 @@
async_to_streamed_response_wrapper,
)
from .._base_client import make_request_options
+from ..types.inbox_read_response import InboxReadResponse
from ..types.inbox_connect_email_response import InboxConnectEmailResponse
from ..types.inbox_list_cas_files_response import InboxListCasFilesResponse
from ..types.inbox_disconnect_email_response import InboxDisconnectEmailResponse
@@ -285,6 +286,166 @@ def list_cas_files(
cast_to=InboxListCasFilesResponse,
)
+ def read(
+ self,
+ *,
+ x_inbox_token: str,
+ categories: List[Literal["investments", "credit", "banking", "insurance", "tax"]] | Omit = omit,
+ document_types: List[
+ Literal[
+ "consolidated_statement",
+ "contract_note",
+ "broker_statement",
+ "nps_statement",
+ "card_statement",
+ "account_statement",
+ "insurance_document",
+ "tax_notice",
+ "tds_certificate",
+ ]
+ ]
+ | Omit = omit,
+ end_date: Union[str, date] | Omit = omit,
+ include_body: bool | Omit = omit,
+ senders: SequenceNotStr[str] | Omit = omit,
+ sources: List[
+ Literal[
+ "cams",
+ "kfintech",
+ "cdsl",
+ "nsdl",
+ "zerodha_contract_note",
+ "zerodha_statement",
+ "kfintech_nps",
+ "protean_nps",
+ "hdfc_credit_card",
+ "sbi_card",
+ "icici_credit_card",
+ "axis_credit_card",
+ "idfc_first_credit_card",
+ "kotak_credit_card",
+ "rbl_credit_card",
+ "bobcard",
+ "yes_credit_card",
+ "indusind_credit_card",
+ "scapia_credit_card",
+ "au_credit_card",
+ "niyo_global_credit_card",
+ "hdfc_bank_account",
+ "sbi_bank_account",
+ "icici_bank_account",
+ "axis_bank_account",
+ "kotak_bank_account",
+ "idfc_first_bank_account",
+ "yes_bank_account",
+ "au_bank_account",
+ "sbm_bank_account",
+ "federal_bank_account",
+ "policybazaar",
+ "icici_lombard",
+ "hdfc_life",
+ "income_tax",
+ "dividend_tds",
+ ]
+ ]
+ | Omit = omit,
+ start_date: Union[str, date] | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> InboxReadResponse:
+ """
+ List statement emails and their attachment details in a connected mailbox.
+
+ Download files directly from their `attachment_url`. No additional
+ headers are needed. URLs expire 30 minutes after this read.
+ Anyone with a URL can download that file until it expires, so keep
+ these URLs private.
+
+ A source is one institution sending one kind of document. Each has a
+ category and a document type, listed below. Choose what to read with any
+ mix of `categories`, `document_types`, `sources` and `senders` (at least
+ one); you get everything that matches any of them. For example,
+ `document_types: ["card_statement"]` reads every card issuer, and
+ `document_types: ["consolidated_statement"]` reads CAS only.
+
+ | Category | Document type | Sources |
+ |---|---|---|
+ | `investments` | `consolidated_statement` | `cams`, `kfintech`, `cdsl`, `nsdl` |
+ | `investments` | `contract_note` | `zerodha_contract_note` |
+ | `investments` | `broker_statement` | `zerodha_statement` |
+ | `investments` | `nps_statement` | `kfintech_nps`, `protean_nps` |
+ | `credit` | `card_statement` | `hdfc_credit_card`, `sbi_card`, `icici_credit_card`, `axis_credit_card`, `idfc_first_credit_card`, `kotak_credit_card`, `rbl_credit_card`, `bobcard`, `yes_credit_card`, `indusind_credit_card`, `scapia_credit_card`, `au_credit_card`, `niyo_global_credit_card` |
+ | `banking` | `account_statement` | `hdfc_bank_account`, `sbi_bank_account`, `icici_bank_account`, `axis_bank_account`, `kotak_bank_account`, `idfc_first_bank_account`, `yes_bank_account`, `au_bank_account`, `sbm_bank_account`, `federal_bank_account` |
+ | `insurance` | `insurance_document` | `policybazaar`, `icici_lombard`, `hdfc_life` |
+ | `tax` | `tax_notice` | `income_tax` |
+ | `tax` | `tds_certificate` | `dividend_tds` |
+
+ To read from an institution that isn't listed, pass its exact addresses
+ in `senders` (up to 20 per request). A message from one of them is
+ labelled with the known source it matches, if any; otherwise `source`,
+ `category`, `document_type` and `institution` are `null`.
+
+ **Sender verification:** `sender_verified` is the email provider's DMARC
+ check of the sender's domain: `true` means it passed, `false` means it
+ failed, and `null` means no result was available.
+
+ **Paging:** at most 50 messages per call, newest first. When `truncated`
+ is true, call again with `end_date` set to the oldest `message_date` you
+ received, and skip `message_id`s you already have.
+
+ `start_date` and `end_date` are inclusive calendar dates in IST
+ (UTC+05:30). `message_date` is the date the email was received, also in IST.
+
+ **Billing:** 0.2 credits per request (charged regardless of success or number of messages found). Attachment downloads are free.
+
+ Args:
+ categories: Read every source in these categories.
+
+ document_types: Read every source of these document types.
+
+ end_date: Last day to search (YYYY-MM-DD, inclusive, IST). Defaults to today in IST.
+
+ include_body: Return each message's body as well.
+
+ senders: Exact sender addresses to read, for institutions not in the table above. Domains and wildcards aren't accepted.
+
+ sources: Read these sources.
+
+ start_date: First day to search (YYYY-MM-DD, inclusive, IST). Defaults to 30 days before `end_date`.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ extra_headers = {"x-inbox-token": x_inbox_token, **(extra_headers or {})}
+ return self._post(
+ "/v4/inbox/read",
+ body=maybe_transform(
+ {
+ "categories": categories,
+ "document_types": document_types,
+ "end_date": end_date,
+ "include_body": include_body,
+ "senders": senders,
+ "sources": sources,
+ "start_date": start_date,
+ },
+ inbox_read_params.InboxReadParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=InboxReadResponse,
+ )
+
class AsyncInboxResource(AsyncAPIResource):
"""Endpoints for importing CAS files directly from user email inboxes.
@@ -543,6 +704,166 @@ async def list_cas_files(
cast_to=InboxListCasFilesResponse,
)
+ async def read(
+ self,
+ *,
+ x_inbox_token: str,
+ categories: List[Literal["investments", "credit", "banking", "insurance", "tax"]] | Omit = omit,
+ document_types: List[
+ Literal[
+ "consolidated_statement",
+ "contract_note",
+ "broker_statement",
+ "nps_statement",
+ "card_statement",
+ "account_statement",
+ "insurance_document",
+ "tax_notice",
+ "tds_certificate",
+ ]
+ ]
+ | Omit = omit,
+ end_date: Union[str, date] | Omit = omit,
+ include_body: bool | Omit = omit,
+ senders: SequenceNotStr[str] | Omit = omit,
+ sources: List[
+ Literal[
+ "cams",
+ "kfintech",
+ "cdsl",
+ "nsdl",
+ "zerodha_contract_note",
+ "zerodha_statement",
+ "kfintech_nps",
+ "protean_nps",
+ "hdfc_credit_card",
+ "sbi_card",
+ "icici_credit_card",
+ "axis_credit_card",
+ "idfc_first_credit_card",
+ "kotak_credit_card",
+ "rbl_credit_card",
+ "bobcard",
+ "yes_credit_card",
+ "indusind_credit_card",
+ "scapia_credit_card",
+ "au_credit_card",
+ "niyo_global_credit_card",
+ "hdfc_bank_account",
+ "sbi_bank_account",
+ "icici_bank_account",
+ "axis_bank_account",
+ "kotak_bank_account",
+ "idfc_first_bank_account",
+ "yes_bank_account",
+ "au_bank_account",
+ "sbm_bank_account",
+ "federal_bank_account",
+ "policybazaar",
+ "icici_lombard",
+ "hdfc_life",
+ "income_tax",
+ "dividend_tds",
+ ]
+ ]
+ | Omit = omit,
+ start_date: Union[str, date] | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> InboxReadResponse:
+ """
+ List statement emails and their attachment details in a connected mailbox.
+
+ Download files directly from their `attachment_url`. No additional
+ headers are needed. URLs expire 30 minutes after this read.
+ Anyone with a URL can download that file until it expires, so keep
+ these URLs private.
+
+ A source is one institution sending one kind of document. Each has a
+ category and a document type, listed below. Choose what to read with any
+ mix of `categories`, `document_types`, `sources` and `senders` (at least
+ one); you get everything that matches any of them. For example,
+ `document_types: ["card_statement"]` reads every card issuer, and
+ `document_types: ["consolidated_statement"]` reads CAS only.
+
+ | Category | Document type | Sources |
+ |---|---|---|
+ | `investments` | `consolidated_statement` | `cams`, `kfintech`, `cdsl`, `nsdl` |
+ | `investments` | `contract_note` | `zerodha_contract_note` |
+ | `investments` | `broker_statement` | `zerodha_statement` |
+ | `investments` | `nps_statement` | `kfintech_nps`, `protean_nps` |
+ | `credit` | `card_statement` | `hdfc_credit_card`, `sbi_card`, `icici_credit_card`, `axis_credit_card`, `idfc_first_credit_card`, `kotak_credit_card`, `rbl_credit_card`, `bobcard`, `yes_credit_card`, `indusind_credit_card`, `scapia_credit_card`, `au_credit_card`, `niyo_global_credit_card` |
+ | `banking` | `account_statement` | `hdfc_bank_account`, `sbi_bank_account`, `icici_bank_account`, `axis_bank_account`, `kotak_bank_account`, `idfc_first_bank_account`, `yes_bank_account`, `au_bank_account`, `sbm_bank_account`, `federal_bank_account` |
+ | `insurance` | `insurance_document` | `policybazaar`, `icici_lombard`, `hdfc_life` |
+ | `tax` | `tax_notice` | `income_tax` |
+ | `tax` | `tds_certificate` | `dividend_tds` |
+
+ To read from an institution that isn't listed, pass its exact addresses
+ in `senders` (up to 20 per request). A message from one of them is
+ labelled with the known source it matches, if any; otherwise `source`,
+ `category`, `document_type` and `institution` are `null`.
+
+ **Sender verification:** `sender_verified` is the email provider's DMARC
+ check of the sender's domain: `true` means it passed, `false` means it
+ failed, and `null` means no result was available.
+
+ **Paging:** at most 50 messages per call, newest first. When `truncated`
+ is true, call again with `end_date` set to the oldest `message_date` you
+ received, and skip `message_id`s you already have.
+
+ `start_date` and `end_date` are inclusive calendar dates in IST
+ (UTC+05:30). `message_date` is the date the email was received, also in IST.
+
+ **Billing:** 0.2 credits per request (charged regardless of success or number of messages found). Attachment downloads are free.
+
+ Args:
+ categories: Read every source in these categories.
+
+ document_types: Read every source of these document types.
+
+ end_date: Last day to search (YYYY-MM-DD, inclusive, IST). Defaults to today in IST.
+
+ include_body: Return each message's body as well.
+
+ senders: Exact sender addresses to read, for institutions not in the table above. Domains and wildcards aren't accepted.
+
+ sources: Read these sources.
+
+ start_date: First day to search (YYYY-MM-DD, inclusive, IST). Defaults to 30 days before `end_date`.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ extra_headers = {"x-inbox-token": x_inbox_token, **(extra_headers or {})}
+ return await self._post(
+ "/v4/inbox/read",
+ body=await async_maybe_transform(
+ {
+ "categories": categories,
+ "document_types": document_types,
+ "end_date": end_date,
+ "include_body": include_body,
+ "senders": senders,
+ "sources": sources,
+ "start_date": start_date,
+ },
+ inbox_read_params.InboxReadParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=InboxReadResponse,
+ )
+
class InboxResourceWithRawResponse:
def __init__(self, inbox: InboxResource) -> None:
@@ -560,6 +881,9 @@ def __init__(self, inbox: InboxResource) -> None:
self.list_cas_files = to_raw_response_wrapper(
inbox.list_cas_files,
)
+ self.read = to_raw_response_wrapper(
+ inbox.read,
+ )
class AsyncInboxResourceWithRawResponse:
@@ -578,6 +902,9 @@ def __init__(self, inbox: AsyncInboxResource) -> None:
self.list_cas_files = async_to_raw_response_wrapper(
inbox.list_cas_files,
)
+ self.read = async_to_raw_response_wrapper(
+ inbox.read,
+ )
class InboxResourceWithStreamingResponse:
@@ -596,6 +923,9 @@ def __init__(self, inbox: InboxResource) -> None:
self.list_cas_files = to_streamed_response_wrapper(
inbox.list_cas_files,
)
+ self.read = to_streamed_response_wrapper(
+ inbox.read,
+ )
class AsyncInboxResourceWithStreamingResponse:
@@ -614,3 +944,6 @@ def __init__(self, inbox: AsyncInboxResource) -> None:
self.list_cas_files = async_to_streamed_response_wrapper(
inbox.list_cas_files,
)
+ self.read = async_to_streamed_response_wrapper(
+ inbox.read,
+ )
diff --git a/src/cas_parser/resources/kyc.py b/src/cas_parser/resources/kyc.py
new file mode 100644
index 0000000..54a7d1f
--- /dev/null
+++ b/src/cas_parser/resources/kyc.py
@@ -0,0 +1,680 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List
+from typing_extensions import Literal
+
+import httpx
+
+from ..types import (
+ kyc_check_pan_status_params,
+ kyc_get_digilocker_result_params,
+ kyc_start_digilocker_session_params,
+ kyc_lookup_digilocker_account_params,
+)
+from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
+from .._utils import path_template, maybe_transform, async_maybe_transform
+from .._compat import cached_property
+from .._resource import SyncAPIResource, AsyncAPIResource
+from .._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from .._base_client import make_request_options
+from ..types.kyc_check_pan_status_response import KycCheckPanStatusResponse
+from ..types.kyc_get_digilocker_result_response import KycGetDigilockerResultResponse
+from ..types.kyc_start_digilocker_session_response import KycStartDigilockerSessionResponse
+from ..types.kyc_lookup_digilocker_account_response import KycLookupDigilockerAccountResponse
+
+__all__ = ["KycResource", "AsyncKycResource"]
+
+
+class KycResource(SyncAPIResource):
+ """
+ Endpoints for verifying KYC (Know Your Customer) status of Indian investors.
+
+ **Data source:** CVL KRA public inquiry portal (cvlkra.com), which aggregates
+ records from all five SEBI-registered KRAs: CVL, NDML, CAMS, Karvy, and KFin.
+
+ **Status normalization:** Raw CVL portal strings are normalized into clean enums.
+ See the `kyc_status` property on `KycPanStatusResponse` for the full list.
+
+ **Credits:** 0.25 per successful lookup. Failed lookups are not billed.
+ """
+
+ @cached_property
+ def with_raw_response(self) -> KycResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#accessing-raw-response-data-eg-headers
+ """
+ return KycResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> KycResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#with_streaming_response
+ """
+ return KycResourceWithStreamingResponse(self)
+
+ def lookup_digilocker_account(
+ self,
+ *,
+ aadhaar_number: str | Omit = omit,
+ mobile: str | Omit = omit,
+ reference_id: str | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> KycLookupDigilockerAccountResponse:
+ """
+ Check whether a mobile number or Aadhaar number is already registered
+ with DigiLocker. This is a pre-consent lookup: it helps you decide
+ whether to start the user in `signin` or `signup` flow.
+
+ Provide exactly one of `aadhaar_number` or `mobile`.
+
+ **Credits:** Free.
+
+ Args:
+ aadhaar_number: 12-digit Aadhaar number.
+
+ mobile: 10-digit Indian mobile number.
+
+ reference_id: Optional caller-side request identifier.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return self._post(
+ "/v1/kyc/digilocker/account-lookup",
+ body=maybe_transform(
+ {
+ "aadhaar_number": aadhaar_number,
+ "mobile": mobile,
+ "reference_id": reference_id,
+ },
+ kyc_lookup_digilocker_account_params.KycLookupDigilockerAccountParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=KycLookupDigilockerAccountResponse,
+ )
+
+ def start_digilocker_session(
+ self,
+ *,
+ consent: bool,
+ consent_purpose: str,
+ redirect_url: str,
+ documents: List[Literal["aadhaar", "pan", "driving_licence", "email", "mobile"]] | Omit = omit,
+ prefill_mobile: str | Omit = omit,
+ state: str | Omit = omit,
+ user_flow: Literal["signin", "signup"] | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> KycStartDigilockerSessionResponse:
+ """
+ Start a DigiLocker session to fetch the investor's government-issued
+ documents (Aadhaar, PAN, etc.) with their consent.
+
+ **How it works:**
+ 1. Call this endpoint — you get back an `authorization_url` and a
+ `session_id`. The `session_id` is the single identifier you use
+ for everything else.
+ 2. Redirect the investor to `authorization_url` to log in to DigiLocker
+ and grant consent.
+ 3. After consent, the investor is redirected back to your `redirect_url`
+ with query parameters appended (see the table below).
+ 4. Use the `session_id` (path parameter) on the
+ `POST /v1/kyc/digilocker/result/{session_id}` endpoint to read the
+ consented data — identity, documents, and parsed document content.
+
+ **Redirect parameters appended to your `redirect_url`:**
+
+ | Outcome | Appended query parameters |
+ | --- | --- |
+ | Consent granted | `?success=true&id={session_id}&state={state}&documents=pan+driving_licence&has_verified_data=1` |
+ | Partial consent (e.g. PAN only) | `?success=true&id={session_id}&state={state}&documents=pan` |
+ | Consent denied / failed | `?success=false&id={session_id}&state={state}&error={error}` |
+
+ `documents` lists the documents the investor agreed to share;
+ `has_verified_data=1` appears only when verified identity is available.
+
+ **Credits:** Free. Billing happens when documents/identity are returned.
+
+ Args:
+ consent: Explicit end-user consent. Must be `true` to proceed
+ (regulatory requirement under DPDP / RBI). Captured for audit.
+
+ consent_purpose: Specific purpose for which consent is taken (min 20 chars).
+ Stored in the session and returned as a consent receipt.
+
+ documents: Identities to verify and return in the response.
+
+ prefill_mobile: Pre-verified mobile to skip the signup OTP step (only applies with user_flow=signup).
+
+ redirect_url: Where to redirect the user after consent. Must be a valid http/https URL.
+
+ state: Opaque value echoed back to your redirect_url unchanged.
+
+ user_flow: Use "signin" for users with an existing DigiLocker account, "signup" for account-on-the-fly.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return self._post(
+ "/v1/kyc/digilocker/session",
+ body=maybe_transform(
+ {
+ "consent": consent,
+ "consent_purpose": consent_purpose,
+ "documents": documents,
+ "prefill_mobile": prefill_mobile,
+ "redirect_url": redirect_url,
+ "state": state,
+ "user_flow": user_flow,
+ },
+ kyc_start_digilocker_session_params.KycStartDigilockerSessionParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=KycStartDigilockerSessionResponse,
+ )
+
+ def get_digilocker_result(
+ self,
+ session_id: str,
+ *,
+ fetch_documents: List[Literal["pan", "aadhaar", "driving_licence"]] | Omit = omit,
+ include_documents: bool | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> KycGetDigilockerResultResponse:
+ """
+ Return everything available for a DigiLocker session in a single call.
+ Each section is independent: if one is unavailable (e.g. the investor
+ didn't consent to it), it's reported under `errors` and the rest of the
+ response still succeeds.
+
+ - `identity` — verified identity, when requested via `documents` (free).
+ - `documents` — list of the investor's documents (free). Set
+ `include_documents: false` to skip.
+ - `fetched` — for each document in `fetch_documents`, the parsed document data.
+
+ **Credits:** 0.25 per call, regardless of how many documents are
+ fetched or whether identity is returned.
+
+ Args:
+ fetch_documents: Documents to additionally fetch + parse from the locker.
+ Default: [] (no document fetch, no fetch billing).
+
+ include_documents: Include the issued-documents list.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not session_id:
+ raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
+ return self._post(
+ path_template("/v1/kyc/digilocker/result/{session_id}", session_id=session_id),
+ body=maybe_transform(
+ {
+ "fetch_documents": fetch_documents,
+ "include_documents": include_documents,
+ },
+ kyc_get_digilocker_result_params.KycGetDigilockerResultParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=KycGetDigilockerResultResponse,
+ )
+
+ def check_pan_status(
+ self,
+ *,
+ pan_no: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> KycCheckPanStatusResponse:
+ """
+ Query KYC registration status for a PAN number across all five SEBI-registered KRAs
+ (CVL, NDML, CAMS, Karvy, KFin) via the CVL KRA portal.
+
+ Raw portal status strings are normalized into clean enums (see `kyc_status`).
+
+ **`kyc_compliant`** is `true` only when `kyc_status` is `validated` or `registered`.
+ Use this for quick onboarding gate decisions.
+
+ **`remarks`** on a KRA object is only actionable when `status` is `on_hold` —
+ it contains the reason (e.g. `"APPLICANT PHOTO MISMATCH"`). For `validated` KRAs,
+ remarks like `"FATCA NOT APPLICABLE"` can be safely ignored.
+
+ **Note:** This endpoint may take up to 60 seconds. Set your client timeout accordingly.
+
+ **Credits:** 0.25 per successful lookup. Failed lookups are not billed.
+
+ Args:
+ pan_no: PAN number to look up (10 characters, uppercase)
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return self._post(
+ "/v1/kyc/pan/status",
+ body=maybe_transform(
+ {
+ "pan_no": pan_no,
+ },
+ kyc_check_pan_status_params.KycCheckPanStatusParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=KycCheckPanStatusResponse,
+ )
+
+
+class AsyncKycResource(AsyncAPIResource):
+ """
+ Endpoints for verifying KYC (Know Your Customer) status of Indian investors.
+
+ **Data source:** CVL KRA public inquiry portal (cvlkra.com), which aggregates
+ records from all five SEBI-registered KRAs: CVL, NDML, CAMS, Karvy, and KFin.
+
+ **Status normalization:** Raw CVL portal strings are normalized into clean enums.
+ See the `kyc_status` property on `KycPanStatusResponse` for the full list.
+
+ **Credits:** 0.25 per successful lookup. Failed lookups are not billed.
+ """
+
+ @cached_property
+ def with_raw_response(self) -> AsyncKycResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncKycResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncKycResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#with_streaming_response
+ """
+ return AsyncKycResourceWithStreamingResponse(self)
+
+ async def lookup_digilocker_account(
+ self,
+ *,
+ aadhaar_number: str | Omit = omit,
+ mobile: str | Omit = omit,
+ reference_id: str | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> KycLookupDigilockerAccountResponse:
+ """
+ Check whether a mobile number or Aadhaar number is already registered
+ with DigiLocker. This is a pre-consent lookup: it helps you decide
+ whether to start the user in `signin` or `signup` flow.
+
+ Provide exactly one of `aadhaar_number` or `mobile`.
+
+ **Credits:** Free.
+
+ Args:
+ aadhaar_number: 12-digit Aadhaar number.
+
+ mobile: 10-digit Indian mobile number.
+
+ reference_id: Optional caller-side request identifier.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return await self._post(
+ "/v1/kyc/digilocker/account-lookup",
+ body=await async_maybe_transform(
+ {
+ "aadhaar_number": aadhaar_number,
+ "mobile": mobile,
+ "reference_id": reference_id,
+ },
+ kyc_lookup_digilocker_account_params.KycLookupDigilockerAccountParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=KycLookupDigilockerAccountResponse,
+ )
+
+ async def start_digilocker_session(
+ self,
+ *,
+ consent: bool,
+ consent_purpose: str,
+ redirect_url: str,
+ documents: List[Literal["aadhaar", "pan", "driving_licence", "email", "mobile"]] | Omit = omit,
+ prefill_mobile: str | Omit = omit,
+ state: str | Omit = omit,
+ user_flow: Literal["signin", "signup"] | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> KycStartDigilockerSessionResponse:
+ """
+ Start a DigiLocker session to fetch the investor's government-issued
+ documents (Aadhaar, PAN, etc.) with their consent.
+
+ **How it works:**
+ 1. Call this endpoint — you get back an `authorization_url` and a
+ `session_id`. The `session_id` is the single identifier you use
+ for everything else.
+ 2. Redirect the investor to `authorization_url` to log in to DigiLocker
+ and grant consent.
+ 3. After consent, the investor is redirected back to your `redirect_url`
+ with query parameters appended (see the table below).
+ 4. Use the `session_id` (path parameter) on the
+ `POST /v1/kyc/digilocker/result/{session_id}` endpoint to read the
+ consented data — identity, documents, and parsed document content.
+
+ **Redirect parameters appended to your `redirect_url`:**
+
+ | Outcome | Appended query parameters |
+ | --- | --- |
+ | Consent granted | `?success=true&id={session_id}&state={state}&documents=pan+driving_licence&has_verified_data=1` |
+ | Partial consent (e.g. PAN only) | `?success=true&id={session_id}&state={state}&documents=pan` |
+ | Consent denied / failed | `?success=false&id={session_id}&state={state}&error={error}` |
+
+ `documents` lists the documents the investor agreed to share;
+ `has_verified_data=1` appears only when verified identity is available.
+
+ **Credits:** Free. Billing happens when documents/identity are returned.
+
+ Args:
+ consent: Explicit end-user consent. Must be `true` to proceed
+ (regulatory requirement under DPDP / RBI). Captured for audit.
+
+ consent_purpose: Specific purpose for which consent is taken (min 20 chars).
+ Stored in the session and returned as a consent receipt.
+
+ documents: Identities to verify and return in the response.
+
+ prefill_mobile: Pre-verified mobile to skip the signup OTP step (only applies with user_flow=signup).
+
+ redirect_url: Where to redirect the user after consent. Must be a valid http/https URL.
+
+ state: Opaque value echoed back to your redirect_url unchanged.
+
+ user_flow: Use "signin" for users with an existing DigiLocker account, "signup" for account-on-the-fly.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return await self._post(
+ "/v1/kyc/digilocker/session",
+ body=await async_maybe_transform(
+ {
+ "consent": consent,
+ "consent_purpose": consent_purpose,
+ "documents": documents,
+ "prefill_mobile": prefill_mobile,
+ "redirect_url": redirect_url,
+ "state": state,
+ "user_flow": user_flow,
+ },
+ kyc_start_digilocker_session_params.KycStartDigilockerSessionParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=KycStartDigilockerSessionResponse,
+ )
+
+ async def get_digilocker_result(
+ self,
+ session_id: str,
+ *,
+ fetch_documents: List[Literal["pan", "aadhaar", "driving_licence"]] | Omit = omit,
+ include_documents: bool | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> KycGetDigilockerResultResponse:
+ """
+ Return everything available for a DigiLocker session in a single call.
+ Each section is independent: if one is unavailable (e.g. the investor
+ didn't consent to it), it's reported under `errors` and the rest of the
+ response still succeeds.
+
+ - `identity` — verified identity, when requested via `documents` (free).
+ - `documents` — list of the investor's documents (free). Set
+ `include_documents: false` to skip.
+ - `fetched` — for each document in `fetch_documents`, the parsed document data.
+
+ **Credits:** 0.25 per call, regardless of how many documents are
+ fetched or whether identity is returned.
+
+ Args:
+ fetch_documents: Documents to additionally fetch + parse from the locker.
+ Default: [] (no document fetch, no fetch billing).
+
+ include_documents: Include the issued-documents list.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not session_id:
+ raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
+ return await self._post(
+ path_template("/v1/kyc/digilocker/result/{session_id}", session_id=session_id),
+ body=await async_maybe_transform(
+ {
+ "fetch_documents": fetch_documents,
+ "include_documents": include_documents,
+ },
+ kyc_get_digilocker_result_params.KycGetDigilockerResultParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=KycGetDigilockerResultResponse,
+ )
+
+ async def check_pan_status(
+ self,
+ *,
+ pan_no: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> KycCheckPanStatusResponse:
+ """
+ Query KYC registration status for a PAN number across all five SEBI-registered KRAs
+ (CVL, NDML, CAMS, Karvy, KFin) via the CVL KRA portal.
+
+ Raw portal status strings are normalized into clean enums (see `kyc_status`).
+
+ **`kyc_compliant`** is `true` only when `kyc_status` is `validated` or `registered`.
+ Use this for quick onboarding gate decisions.
+
+ **`remarks`** on a KRA object is only actionable when `status` is `on_hold` —
+ it contains the reason (e.g. `"APPLICANT PHOTO MISMATCH"`). For `validated` KRAs,
+ remarks like `"FATCA NOT APPLICABLE"` can be safely ignored.
+
+ **Note:** This endpoint may take up to 60 seconds. Set your client timeout accordingly.
+
+ **Credits:** 0.25 per successful lookup. Failed lookups are not billed.
+
+ Args:
+ pan_no: PAN number to look up (10 characters, uppercase)
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return await self._post(
+ "/v1/kyc/pan/status",
+ body=await async_maybe_transform(
+ {
+ "pan_no": pan_no,
+ },
+ kyc_check_pan_status_params.KycCheckPanStatusParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=KycCheckPanStatusResponse,
+ )
+
+
+class KycResourceWithRawResponse:
+ def __init__(self, kyc: KycResource) -> None:
+ self._kyc = kyc
+
+ self.lookup_digilocker_account = to_raw_response_wrapper(
+ kyc.lookup_digilocker_account,
+ )
+ self.start_digilocker_session = to_raw_response_wrapper(
+ kyc.start_digilocker_session,
+ )
+ self.get_digilocker_result = to_raw_response_wrapper(
+ kyc.get_digilocker_result,
+ )
+ self.check_pan_status = to_raw_response_wrapper(
+ kyc.check_pan_status,
+ )
+
+
+class AsyncKycResourceWithRawResponse:
+ def __init__(self, kyc: AsyncKycResource) -> None:
+ self._kyc = kyc
+
+ self.lookup_digilocker_account = async_to_raw_response_wrapper(
+ kyc.lookup_digilocker_account,
+ )
+ self.start_digilocker_session = async_to_raw_response_wrapper(
+ kyc.start_digilocker_session,
+ )
+ self.get_digilocker_result = async_to_raw_response_wrapper(
+ kyc.get_digilocker_result,
+ )
+ self.check_pan_status = async_to_raw_response_wrapper(
+ kyc.check_pan_status,
+ )
+
+
+class KycResourceWithStreamingResponse:
+ def __init__(self, kyc: KycResource) -> None:
+ self._kyc = kyc
+
+ self.lookup_digilocker_account = to_streamed_response_wrapper(
+ kyc.lookup_digilocker_account,
+ )
+ self.start_digilocker_session = to_streamed_response_wrapper(
+ kyc.start_digilocker_session,
+ )
+ self.get_digilocker_result = to_streamed_response_wrapper(
+ kyc.get_digilocker_result,
+ )
+ self.check_pan_status = to_streamed_response_wrapper(
+ kyc.check_pan_status,
+ )
+
+
+class AsyncKycResourceWithStreamingResponse:
+ def __init__(self, kyc: AsyncKycResource) -> None:
+ self._kyc = kyc
+
+ self.lookup_digilocker_account = async_to_streamed_response_wrapper(
+ kyc.lookup_digilocker_account,
+ )
+ self.start_digilocker_session = async_to_streamed_response_wrapper(
+ kyc.start_digilocker_session,
+ )
+ self.get_digilocker_result = async_to_streamed_response_wrapper(
+ kyc.get_digilocker_result,
+ )
+ self.check_pan_status = async_to_streamed_response_wrapper(
+ kyc.check_pan_status,
+ )
diff --git a/src/cas_parser/resources/verification.py b/src/cas_parser/resources/verification.py
new file mode 100644
index 0000000..56903ca
--- /dev/null
+++ b/src/cas_parser/resources/verification.py
@@ -0,0 +1,396 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal
+
+import httpx
+
+from ..types import verification_verify_mfd_params, verification_verify_sebi_params
+from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
+from .._utils import maybe_transform, async_maybe_transform
+from .._compat import cached_property
+from .._resource import SyncAPIResource, AsyncAPIResource
+from .._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from .._base_client import make_request_options
+from ..types.verification_verify_mfd_response import VerificationVerifyMfdResponse
+from ..types.verification_verify_sebi_response import VerificationVerifySebiResponse
+
+__all__ = ["VerificationResource", "AsyncVerificationResource"]
+
+
+class VerificationResource(SyncAPIResource):
+ """
+ Verify the regulatory registration of a financial intermediary — a yes/no
+ check rather than a directory search.
+
+ - **`/v1/verify/sebi`** — any SEBI-registered intermediary (Investment
+ Adviser, Research Analyst, Portfolio Manager, Stock Broker, Mutual Fund,
+ AIF, and more). Send a `registration_number` and the category is
+ auto-detected from its sequence; or send a `name` with an explicit `type`.
+ - **`/v1/verify/mfd`** — AMFI mutual-fund distributors by ARN, including a
+ screen against AMFI's suspended / terminated / terminated-EUIN lists.
+
+ A "not found" result is a successful verification (HTTP 200,
+ `verified: false`) and is billed. Upstream failures surface as 5xx and are
+ not billed.
+
+ **Credits:** 0.25 per successful verification.
+ """
+
+ @cached_property
+ def with_raw_response(self) -> VerificationResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#accessing-raw-response-data-eg-headers
+ """
+ return VerificationResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> VerificationResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#with_streaming_response
+ """
+ return VerificationResourceWithStreamingResponse(self)
+
+ def verify_mfd(
+ self,
+ *,
+ arn: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> VerificationVerifyMfdResponse:
+ """
+ Verify a mutual-fund distributor by ARN. The ARN (and its EUIN) is
+ screened against AMFI's suspended, terminated, and terminated-EUIN
+ lists; a hit sets `registration_status` to `SUSPENDED`/`TERMINATED`,
+ `negative_list_hit` to `true`, and `verified` to `false`.
+
+ **Credits:** 0.25 per successful verification.
+
+ Args:
+ arn: AMFI Registration Number. Digits only; an `ARN-` prefix is tolerated.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return self._post(
+ "/v1/verify/mfd",
+ body=maybe_transform(
+ {
+ "arn": arn,
+ },
+ verification_verify_mfd_params.VerificationVerifyMfdParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=VerificationVerifyMfdResponse,
+ )
+
+ def verify_sebi(
+ self,
+ *,
+ name: str | Omit = omit,
+ registration_number: str | Omit = omit,
+ type: Literal[
+ "investment-adviser",
+ "research-analyst",
+ "portfolio-manager",
+ "stock-broker",
+ "merchant-banker",
+ "registrar-transfer-agent",
+ "mutual-fund",
+ "alternative-investment-fund",
+ "credit-rating-agency",
+ "custodian",
+ "debenture-trustee",
+ "venture-capital-fund",
+ "foreign-venture-capital-investor",
+ "foreign-portfolio-investor",
+ "kyc-registration-agency",
+ "infrastructure-investment-trust",
+ "real-estate-investment-trust",
+ "esg-rating-provider",
+ "vault-manager",
+ ]
+ | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> VerificationVerifySebiResponse:
+ """
+ Verify any SEBI-registered intermediary. Provide a `registration_number`
+ and the category is auto-detected from its sequence (e.g. `INA…` →
+ Investment Adviser, `INP…` → Portfolio Manager, `INZ…` → Stock Broker).
+ Alternatively, provide a `name` together with a `type` slug. `type` can
+ also override detection, and is required for fund/FPI registration
+ numbers that do not encode a category.
+
+ `verified` is `true` only when a current registration is found and its
+ status is `ACTIVE`. A missing registration returns HTTP 200 with
+ `verified: false` and `registration_status: NOT_FOUND`.
+
+ **Credits:** 0.25 per successful verification.
+
+ Args:
+ name: Entity/trade name to search by. Used only when `registration_number` is absent, and then `type` is required.
+
+ registration_number: SEBI registration number. When provided, the category is auto-detected from its sequence (INA…→investment-adviser, INH…→research-analyst, INP…→portfolio-manager, INM…→merchant-banker, INR…→registrar-transfer-agent, INZ…→stock-broker). This is the authoritative input — any `name` sent alongside it is ignored.
+
+ type: Category slug. Overrides auto-detection; required for a name search and for fund/FPI registration numbers that don't encode a category. Short aliases are also accepted (ria, ra, pms, broker, rta, mf, aif, cra, vcf, fvci, fpi, kra, invit, reit).
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return self._post(
+ "/v1/verify/sebi",
+ body=maybe_transform(
+ {
+ "name": name,
+ "registration_number": registration_number,
+ "type": type,
+ },
+ verification_verify_sebi_params.VerificationVerifySebiParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=VerificationVerifySebiResponse,
+ )
+
+
+class AsyncVerificationResource(AsyncAPIResource):
+ """
+ Verify the regulatory registration of a financial intermediary — a yes/no
+ check rather than a directory search.
+
+ - **`/v1/verify/sebi`** — any SEBI-registered intermediary (Investment
+ Adviser, Research Analyst, Portfolio Manager, Stock Broker, Mutual Fund,
+ AIF, and more). Send a `registration_number` and the category is
+ auto-detected from its sequence; or send a `name` with an explicit `type`.
+ - **`/v1/verify/mfd`** — AMFI mutual-fund distributors by ARN, including a
+ screen against AMFI's suspended / terminated / terminated-EUIN lists.
+
+ A "not found" result is a successful verification (HTTP 200,
+ `verified: false`) and is billed. Upstream failures surface as 5xx and are
+ not billed.
+
+ **Credits:** 0.25 per successful verification.
+ """
+
+ @cached_property
+ def with_raw_response(self) -> AsyncVerificationResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncVerificationResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncVerificationResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/CASParser/cas-parser-python#with_streaming_response
+ """
+ return AsyncVerificationResourceWithStreamingResponse(self)
+
+ async def verify_mfd(
+ self,
+ *,
+ arn: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> VerificationVerifyMfdResponse:
+ """
+ Verify a mutual-fund distributor by ARN. The ARN (and its EUIN) is
+ screened against AMFI's suspended, terminated, and terminated-EUIN
+ lists; a hit sets `registration_status` to `SUSPENDED`/`TERMINATED`,
+ `negative_list_hit` to `true`, and `verified` to `false`.
+
+ **Credits:** 0.25 per successful verification.
+
+ Args:
+ arn: AMFI Registration Number. Digits only; an `ARN-` prefix is tolerated.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return await self._post(
+ "/v1/verify/mfd",
+ body=await async_maybe_transform(
+ {
+ "arn": arn,
+ },
+ verification_verify_mfd_params.VerificationVerifyMfdParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=VerificationVerifyMfdResponse,
+ )
+
+ async def verify_sebi(
+ self,
+ *,
+ name: str | Omit = omit,
+ registration_number: str | Omit = omit,
+ type: Literal[
+ "investment-adviser",
+ "research-analyst",
+ "portfolio-manager",
+ "stock-broker",
+ "merchant-banker",
+ "registrar-transfer-agent",
+ "mutual-fund",
+ "alternative-investment-fund",
+ "credit-rating-agency",
+ "custodian",
+ "debenture-trustee",
+ "venture-capital-fund",
+ "foreign-venture-capital-investor",
+ "foreign-portfolio-investor",
+ "kyc-registration-agency",
+ "infrastructure-investment-trust",
+ "real-estate-investment-trust",
+ "esg-rating-provider",
+ "vault-manager",
+ ]
+ | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> VerificationVerifySebiResponse:
+ """
+ Verify any SEBI-registered intermediary. Provide a `registration_number`
+ and the category is auto-detected from its sequence (e.g. `INA…` →
+ Investment Adviser, `INP…` → Portfolio Manager, `INZ…` → Stock Broker).
+ Alternatively, provide a `name` together with a `type` slug. `type` can
+ also override detection, and is required for fund/FPI registration
+ numbers that do not encode a category.
+
+ `verified` is `true` only when a current registration is found and its
+ status is `ACTIVE`. A missing registration returns HTTP 200 with
+ `verified: false` and `registration_status: NOT_FOUND`.
+
+ **Credits:** 0.25 per successful verification.
+
+ Args:
+ name: Entity/trade name to search by. Used only when `registration_number` is absent, and then `type` is required.
+
+ registration_number: SEBI registration number. When provided, the category is auto-detected from its sequence (INA…→investment-adviser, INH…→research-analyst, INP…→portfolio-manager, INM…→merchant-banker, INR…→registrar-transfer-agent, INZ…→stock-broker). This is the authoritative input — any `name` sent alongside it is ignored.
+
+ type: Category slug. Overrides auto-detection; required for a name search and for fund/FPI registration numbers that don't encode a category. Short aliases are also accepted (ria, ra, pms, broker, rta, mf, aif, cra, vcf, fvci, fpi, kra, invit, reit).
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return await self._post(
+ "/v1/verify/sebi",
+ body=await async_maybe_transform(
+ {
+ "name": name,
+ "registration_number": registration_number,
+ "type": type,
+ },
+ verification_verify_sebi_params.VerificationVerifySebiParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=VerificationVerifySebiResponse,
+ )
+
+
+class VerificationResourceWithRawResponse:
+ def __init__(self, verification: VerificationResource) -> None:
+ self._verification = verification
+
+ self.verify_mfd = to_raw_response_wrapper(
+ verification.verify_mfd,
+ )
+ self.verify_sebi = to_raw_response_wrapper(
+ verification.verify_sebi,
+ )
+
+
+class AsyncVerificationResourceWithRawResponse:
+ def __init__(self, verification: AsyncVerificationResource) -> None:
+ self._verification = verification
+
+ self.verify_mfd = async_to_raw_response_wrapper(
+ verification.verify_mfd,
+ )
+ self.verify_sebi = async_to_raw_response_wrapper(
+ verification.verify_sebi,
+ )
+
+
+class VerificationResourceWithStreamingResponse:
+ def __init__(self, verification: VerificationResource) -> None:
+ self._verification = verification
+
+ self.verify_mfd = to_streamed_response_wrapper(
+ verification.verify_mfd,
+ )
+ self.verify_sebi = to_streamed_response_wrapper(
+ verification.verify_sebi,
+ )
+
+
+class AsyncVerificationResourceWithStreamingResponse:
+ def __init__(self, verification: AsyncVerificationResource) -> None:
+ self._verification = verification
+
+ self.verify_mfd = async_to_streamed_response_wrapper(
+ verification.verify_mfd,
+ )
+ self.verify_sebi = async_to_streamed_response_wrapper(
+ verification.verify_sebi,
+ )
diff --git a/src/cas_parser/types/__init__.py b/src/cas_parser/types/__init__.py
index 3643e2e..bce7a06 100644
--- a/src/cas_parser/types/__init__.py
+++ b/src/cas_parser/types/__init__.py
@@ -5,22 +5,28 @@
from .transaction import Transaction as Transaction
from .linked_holder import LinkedHolder as LinkedHolder
from .unified_response import UnifiedResponse as UnifiedResponse
+from .inbox_read_params import InboxReadParams as InboxReadParams
from .log_create_params import LogCreateParams as LogCreateParams
from .nsdl_parse_params import NsdlParseParams as NsdlParseParams
+from .inbox_read_response import InboxReadResponse as InboxReadResponse
from .log_create_response import LogCreateResponse as LogCreateResponse
from .cdsl_parse_pdf_params import CdslParsePdfParams as CdslParsePdfParams
from .credit_check_response import CreditCheckResponse as CreditCheckResponse
from .log_get_summary_params import LogGetSummaryParams as LogGetSummaryParams
+from .agent_auth_poll_response import AgentAuthPollResponse as AgentAuthPollResponse
from .log_get_summary_response import LogGetSummaryResponse as LogGetSummaryResponse
+from .agent_auth_approve_params import AgentAuthApproveParams as AgentAuthApproveParams
from .inbound_email_list_params import InboundEmailListParams as InboundEmailListParams
from .access_token_create_params import AccessTokenCreateParams as AccessTokenCreateParams
from .cams_kfintech_parse_params import CamsKfintechParseParams as CamsKfintechParseParams
from .contract_note_parse_params import ContractNoteParseParams as ContractNoteParseParams
from .inbox_connect_email_params import InboxConnectEmailParams as InboxConnectEmailParams
from .smart_parse_cas_pdf_params import SmartParseCasPdfParams as SmartParseCasPdfParams
+from .agent_auth_approve_response import AgentAuthApproveResponse as AgentAuthApproveResponse
from .inbound_email_create_params import InboundEmailCreateParams as InboundEmailCreateParams
from .inbound_email_list_response import InboundEmailListResponse as InboundEmailListResponse
from .inbox_list_cas_files_params import InboxListCasFilesParams as InboxListCasFilesParams
+from .kyc_check_pan_status_params import KycCheckPanStatusParams as KycCheckPanStatusParams
from .access_token_create_response import AccessTokenCreateResponse as AccessTokenCreateResponse
from .contract_note_parse_response import ContractNoteParseResponse as ContractNoteParseResponse
from .inbox_connect_email_response import InboxConnectEmailResponse as InboxConnectEmailResponse
@@ -28,8 +34,27 @@
from .inbound_email_create_response import InboundEmailCreateResponse as InboundEmailCreateResponse
from .inbound_email_delete_response import InboundEmailDeleteResponse as InboundEmailDeleteResponse
from .inbox_list_cas_files_response import InboxListCasFilesResponse as InboxListCasFilesResponse
+from .kyc_check_pan_status_response import KycCheckPanStatusResponse as KycCheckPanStatusResponse
+from .verification_verify_mfd_params import VerificationVerifyMfdParams as VerificationVerifyMfdParams
+from .inbound_email_list_files_params import InboundEmailListFilesParams as InboundEmailListFilesParams
from .inbound_email_retrieve_response import InboundEmailRetrieveResponse as InboundEmailRetrieveResponse
from .inbox_disconnect_email_response import InboxDisconnectEmailResponse as InboxDisconnectEmailResponse
+from .verification_verify_sebi_params import VerificationVerifySebiParams as VerificationVerifySebiParams
+from .kyc_get_digilocker_result_params import KycGetDigilockerResultParams as KycGetDigilockerResultParams
+from .verification_verify_mfd_response import VerificationVerifyMfdResponse as VerificationVerifyMfdResponse
+from .cas_generator_generate_cas_params import CasGeneratorGenerateCasParams as CasGeneratorGenerateCasParams
+from .inbound_email_list_files_response import InboundEmailListFilesResponse as InboundEmailListFilesResponse
+from .verification_verify_sebi_response import VerificationVerifySebiResponse as VerificationVerifySebiResponse
+from .kyc_get_digilocker_result_response import KycGetDigilockerResultResponse as KycGetDigilockerResultResponse
+from .cas_generator_generate_cas_response import CasGeneratorGenerateCasResponse as CasGeneratorGenerateCasResponse
+from .kyc_start_digilocker_session_params import KycStartDigilockerSessionParams as KycStartDigilockerSessionParams
+from .kyc_lookup_digilocker_account_params import KycLookupDigilockerAccountParams as KycLookupDigilockerAccountParams
+from .kyc_start_digilocker_session_response import (
+ KycStartDigilockerSessionResponse as KycStartDigilockerSessionResponse,
+)
from .inbox_check_connection_status_response import (
InboxCheckConnectionStatusResponse as InboxCheckConnectionStatusResponse,
)
+from .kyc_lookup_digilocker_account_response import (
+ KycLookupDigilockerAccountResponse as KycLookupDigilockerAccountResponse,
+)
diff --git a/src/cas_parser/types/agent_auth_approve_params.py b/src/cas_parser/types/agent_auth_approve_params.py
new file mode 100644
index 0000000..611fb7c
--- /dev/null
+++ b/src/cas_parser/types/agent_auth_approve_params.py
@@ -0,0 +1,15 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["AgentAuthApproveParams"]
+
+
+class AgentAuthApproveParams(TypedDict, total=False):
+ id_token: Required[str]
+ """Identity token obtained after the user signs in on the approval page"""
+
+ client_name: str
+ """Name of the agent/application (stored in customer metadata for audit)"""
diff --git a/src/cas_parser/types/agent_auth_approve_response.py b/src/cas_parser/types/agent_auth_approve_response.py
new file mode 100644
index 0000000..51e3c3c
--- /dev/null
+++ b/src/cas_parser/types/agent_auth_approve_response.py
@@ -0,0 +1,13 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from typing import Optional
+
+from .._models import BaseModel
+
+__all__ = ["AgentAuthApproveResponse"]
+
+
+class AgentAuthApproveResponse(BaseModel):
+ email: Optional[str] = None
+
+ status: Optional[str] = None
diff --git a/src/cas_parser/types/agent_auth_poll_response.py b/src/cas_parser/types/agent_auth_poll_response.py
new file mode 100644
index 0000000..526b7fb
--- /dev/null
+++ b/src/cas_parser/types/agent_auth_poll_response.py
@@ -0,0 +1,25 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from typing import Union, Optional
+from typing_extensions import Literal, TypeAlias
+
+from .._models import BaseModel
+
+__all__ = ["AgentAuthPollResponse", "AgentAuthPollResponsePending", "AgentAuthPollResponseApproved"]
+
+
+class AgentAuthPollResponsePending(BaseModel):
+ status: Optional[Literal["pending"]] = None
+
+
+class AgentAuthPollResponseApproved(BaseModel):
+ api_key: Optional[str] = None
+ """The issued API key (sk_ prefix)"""
+
+ email: Optional[str] = None
+ """Email of the user who approved"""
+
+ status: Optional[Literal["approved"]] = None
+
+
+AgentAuthPollResponse: TypeAlias = Union[AgentAuthPollResponsePending, AgentAuthPollResponseApproved]
diff --git a/src/cas_parser/types/cas_generator_generate_cas_params.py b/src/cas_parser/types/cas_generator_generate_cas_params.py
new file mode 100644
index 0000000..806fcc8
--- /dev/null
+++ b/src/cas_parser/types/cas_generator_generate_cas_params.py
@@ -0,0 +1,29 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, Required, TypedDict
+
+__all__ = ["CasGeneratorGenerateCasParams"]
+
+
+class CasGeneratorGenerateCasParams(TypedDict, total=False):
+ email: Required[str]
+ """Email address to receive the CAS document"""
+
+ from_date: Required[str]
+ """Start date (YYYY-MM-DD)"""
+
+ password: Required[str]
+ """
+ Password protecting the emailed PDF. Must satisfy the chosen authority's policy — `cams` requires 6-20 characters with at least two digits, so a PAN works.
+ """
+
+ to_date: Required[str]
+ """End date (YYYY-MM-DD)"""
+
+ cas_authority: Literal["kfintech", "cams"]
+ """RTA that sends the mailback. Affects only the password policy, not the portfolio data returned."""
+
+ pan_no: str
+ """PAN number (optional)"""
diff --git a/src/cas_parser/types/cas_generator_generate_cas_response.py b/src/cas_parser/types/cas_generator_generate_cas_response.py
new file mode 100644
index 0000000..6849a16
--- /dev/null
+++ b/src/cas_parser/types/cas_generator_generate_cas_response.py
@@ -0,0 +1,13 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from typing import Optional
+
+from .._models import BaseModel
+
+__all__ = ["CasGeneratorGenerateCasResponse"]
+
+
+class CasGeneratorGenerateCasResponse(BaseModel):
+ msg: Optional[str] = None
+
+ status: Optional[str] = None
diff --git a/src/cas_parser/types/inbound_email_list_files_params.py b/src/cas_parser/types/inbound_email_list_files_params.py
new file mode 100644
index 0000000..365e3f8
--- /dev/null
+++ b/src/cas_parser/types/inbound_email_list_files_params.py
@@ -0,0 +1,23 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Union
+from datetime import datetime
+from typing_extensions import Annotated, TypedDict
+
+from .._utils import PropertyInfo
+
+__all__ = ["InboundEmailListFilesParams"]
+
+
+class InboundEmailListFilesParams(TypedDict, total=False):
+ limit: int
+ """Maximum files to return."""
+
+ since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
+ """
+ ISO 8601 timestamp. Only files with `received_at` strictly greater
+ than this value are returned. Use the `cursor` value from the
+ previous response.
+ """
diff --git a/src/cas_parser/types/inbound_email_list_files_response.py b/src/cas_parser/types/inbound_email_list_files_response.py
new file mode 100644
index 0000000..14721b2
--- /dev/null
+++ b/src/cas_parser/types/inbound_email_list_files_response.py
@@ -0,0 +1,67 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from datetime import date, datetime
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["InboundEmailListFilesResponse", "File"]
+
+
+class File(BaseModel):
+ """
+ A CAS file that has arrived at an inbound email address.
+ Matches `EmailCASFile` plus a `received_at` timestamp used as a
+ monotonic cursor for polling.
+ """
+
+ cas_type: Optional[Literal["cdsl", "nsdl", "cams", "kfintech"]] = None
+ """Detected CAS provider based on sender email"""
+
+ expires_in: Optional[int] = None
+ """
+ URL expiration time in seconds. Defaults vary by source:
+ - Email Inbox Import (Gmail, Outlook, Zoho): 86400 (24h)
+ - Inbound Email with `callback_url` set: 172800 (48h)
+ - Inbound Email without `callback_url`: aligned with the session TTL (~30 min)
+ """
+
+ filename: Optional[str] = None
+ """Standardized filename (provider_YYYYMMDD_uniqueid.pdf)"""
+
+ message_date: Optional[date] = None
+ """Date the email was received"""
+
+ message_id: Optional[str] = None
+ """Unique identifier for the email message (use for subsequent API calls)"""
+
+ original_filename: Optional[str] = None
+ """Original attachment filename from the email"""
+
+ received_at: Optional[datetime] = None
+ """
+ ISO 8601 timestamp (microsecond precision) when the file was
+ persisted. Use as the `since` cursor on subsequent polls.
+ """
+
+ sender_email: Optional[str] = None
+ """Email address of the CAS authority (CDSL, NSDL, CAMS, or KFintech) who originally sent this statement"""
+
+ size: Optional[int] = None
+ """File size in bytes"""
+
+ url: Optional[str] = None
+ """Direct download URL (presigned, expires based on expires_in)"""
+
+
+class InboundEmailListFilesResponse(BaseModel):
+ count: Optional[int] = None
+
+ cursor: Optional[datetime] = None
+ """Pass as `since` on the next poll. `null` if no files and no prior cursor."""
+
+ files: Optional[List[File]] = None
+ """Files received (sorted oldest-first)"""
+
+ status: Optional[str] = None
diff --git a/src/cas_parser/types/inbox_read_params.py b/src/cas_parser/types/inbox_read_params.py
new file mode 100644
index 0000000..2979061
--- /dev/null
+++ b/src/cas_parser/types/inbox_read_params.py
@@ -0,0 +1,91 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List, Union
+from datetime import date
+from typing_extensions import Literal, Required, Annotated, TypedDict
+
+from .._types import SequenceNotStr
+from .._utils import PropertyInfo
+
+__all__ = ["InboxReadParams"]
+
+
+class InboxReadParams(TypedDict, total=False):
+ x_inbox_token: Required[Annotated[str, PropertyInfo(alias="x-inbox-token")]]
+ """The encrypted inbox token"""
+
+ categories: List[Literal["investments", "credit", "banking", "insurance", "tax"]]
+ """Read every source in these categories."""
+
+ document_types: List[
+ Literal[
+ "consolidated_statement",
+ "contract_note",
+ "broker_statement",
+ "nps_statement",
+ "card_statement",
+ "account_statement",
+ "insurance_document",
+ "tax_notice",
+ "tds_certificate",
+ ]
+ ]
+ """Read every source of these document types."""
+
+ end_date: Annotated[Union[str, date], PropertyInfo(format="iso8601")]
+ """Last day to search (YYYY-MM-DD, inclusive, IST). Defaults to today in IST."""
+
+ include_body: bool
+ """Return each message's body as well."""
+
+ senders: SequenceNotStr[str]
+ """
+ Exact sender addresses to read, for institutions not in the table above. Domains and wildcards aren't accepted.
+ """
+
+ sources: List[
+ Literal[
+ "cams",
+ "kfintech",
+ "cdsl",
+ "nsdl",
+ "zerodha_contract_note",
+ "zerodha_statement",
+ "kfintech_nps",
+ "protean_nps",
+ "hdfc_credit_card",
+ "sbi_card",
+ "icici_credit_card",
+ "axis_credit_card",
+ "idfc_first_credit_card",
+ "kotak_credit_card",
+ "rbl_credit_card",
+ "bobcard",
+ "yes_credit_card",
+ "indusind_credit_card",
+ "scapia_credit_card",
+ "au_credit_card",
+ "niyo_global_credit_card",
+ "hdfc_bank_account",
+ "sbi_bank_account",
+ "icici_bank_account",
+ "axis_bank_account",
+ "kotak_bank_account",
+ "idfc_first_bank_account",
+ "yes_bank_account",
+ "au_bank_account",
+ "sbm_bank_account",
+ "federal_bank_account",
+ "policybazaar",
+ "icici_lombard",
+ "hdfc_life",
+ "income_tax",
+ "dividend_tds",
+ ]
+ ]
+ """Read these sources."""
+
+ start_date: Annotated[Union[str, date], PropertyInfo(format="iso8601")]
+ """First day to search (YYYY-MM-DD, inclusive, IST). Defaults to 30 days before `end_date`."""
diff --git a/src/cas_parser/types/inbox_read_response.py b/src/cas_parser/types/inbox_read_response.py
new file mode 100644
index 0000000..b57d7a9
--- /dev/null
+++ b/src/cas_parser/types/inbox_read_response.py
@@ -0,0 +1,97 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from datetime import date
+
+from .._models import BaseModel
+
+__all__ = ["InboxReadResponse", "MessageAttachment", "MessageBody", "Message"]
+
+
+class MessageAttachment(BaseModel):
+ """An attachment listed by `/v4/inbox/read`, with a direct download URL"""
+
+ attachment_url: Optional[str] = None
+ """Direct download URL. No headers required. Valid for 30 minutes after the read."""
+
+ content_type: Optional[str] = None
+
+ filename: Optional[str] = None
+ """
+ Standardized filename, `{source}_{YYYYMMDD}_{id}.{ext}`, with `custom` in place of the source when there's no known source. The same attachment always gets the same name.
+ """
+
+ original_filename: Optional[str] = None
+ """Filename as sent"""
+
+ size: Optional[int] = None
+ """File size in bytes"""
+
+
+class MessageBody(BaseModel):
+ """
+ Present when `include_body` is true. Gmail can return both `html` and `text`, Outlook one of them, Zoho `html` only.
+ """
+
+ html: Optional[str] = None
+
+ text: Optional[str] = None
+
+
+class Message(BaseModel):
+ """A message returned by `/v4/inbox/read`"""
+
+ attachments: Optional[List[MessageAttachment]] = None
+ """PDF, CSV, XLS and XLSX attachments. Other files, such as images, are left out."""
+
+ body: Optional[MessageBody] = None
+ """
+ Present when `include_body` is true. Gmail can return both `html` and `text`, Outlook one of them, Zoho `html` only.
+ """
+
+ category: Optional[str] = None
+ """The source's category. `null` when `source` is."""
+
+ document_type: Optional[str] = None
+ """The kind of document the source sends. `null` when `source` is."""
+
+ institution: Optional[str] = None
+ """The institution's name. `null` when `source` is."""
+
+ message_date: Optional[date] = None
+ """Date the email was received, in IST (UTC+05:30)"""
+
+ message_id: Optional[str] = None
+ """The email provider's message ID. It stays the same across reads, so you can skip messages you already have."""
+
+ sender_email: Optional[str] = None
+ """Sender address, lowercased"""
+
+ sender_verified: Optional[bool] = None
+ """
+ The email provider's DMARC check of the sender's domain.
+ `true`: passed. `false`: failed. `null`: no result available.
+ """
+
+ source: Optional[str] = None
+ """The source the message matched. `null` for a message from `senders` that matches no known source."""
+
+ subject: Optional[str] = None
+
+
+class InboxReadResponse(BaseModel):
+ count: Optional[int] = None
+
+ failures: Optional[int] = None
+ """Messages that could not be read. The rest are still returned."""
+
+ messages: Optional[List[Message]] = None
+ """Newest first"""
+
+ status: Optional[str] = None
+
+ truncated: Optional[bool] = None
+ """
+ True when more messages may match than were returned. Page back with
+ `end_date` as described above, or narrow the range if no messages came back.
+ """
diff --git a/src/cas_parser/types/kyc_check_pan_status_params.py b/src/cas_parser/types/kyc_check_pan_status_params.py
new file mode 100644
index 0000000..a6e35d4
--- /dev/null
+++ b/src/cas_parser/types/kyc_check_pan_status_params.py
@@ -0,0 +1,12 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["KycCheckPanStatusParams"]
+
+
+class KycCheckPanStatusParams(TypedDict, total=False):
+ pan_no: Required[str]
+ """PAN number to look up (10 characters, uppercase)"""
diff --git a/src/cas_parser/types/kyc_check_pan_status_response.py b/src/cas_parser/types/kyc_check_pan_status_response.py
new file mode 100644
index 0000000..f0fa245
--- /dev/null
+++ b/src/cas_parser/types/kyc_check_pan_status_response.py
@@ -0,0 +1,315 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import date
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["KycCheckPanStatusResponse", "KrasCams", "KrasCvl", "KrasKarvy", "KrasKfin", "KrasNdml", "Kras"]
+
+
+class KrasCams(BaseModel):
+ """
+ KYC status at a single KRA. All six keys are always present (never omitted).
+ For `not_checked` and `not_available` KRAs, date/mode/remarks fields are `null`.
+ """
+
+ kyc_mode: Optional[Literal["normal", "digilocker", "ekyc", "paper", "unknown"]] = None
+ """KYC completion mode at this KRA"""
+
+ last_updated_on: Optional[date] = None
+ """Date KYC was last updated at this KRA"""
+
+ raw_status: Optional[str] = None
+ """
+ The original status string from the CVL portal. `null` for exact-matched
+ statuses. Non-null when a fuzzy match or unknown string was encountered —
+ preserve this for debugging and to help us expand coverage.
+ """
+
+ registered_on: Optional[date] = None
+ """Date KYC was first registered at this KRA"""
+
+ remarks: Optional[str] = None
+ """
+ Remarks from the KRA. Only actionable when `status` is `on_hold`
+ (e.g. `"APPLICANT PHOTO MISMATCH"`). For `validated` KRAs,
+ remarks like `"FATCA NOT APPLICABLE"` can be safely ignored.
+ Multiple remarks are comma-separated.
+ """
+
+ status: Literal[
+ "validated",
+ "registered",
+ "under_process",
+ "on_hold",
+ "rejected",
+ "legacy",
+ "not_available",
+ "not_checked",
+ "unknown",
+ ]
+ """Normalized status for this KRA"""
+
+
+class KrasCvl(BaseModel):
+ """
+ KYC status at a single KRA. All six keys are always present (never omitted).
+ For `not_checked` and `not_available` KRAs, date/mode/remarks fields are `null`.
+ """
+
+ kyc_mode: Optional[Literal["normal", "digilocker", "ekyc", "paper", "unknown"]] = None
+ """KYC completion mode at this KRA"""
+
+ last_updated_on: Optional[date] = None
+ """Date KYC was last updated at this KRA"""
+
+ raw_status: Optional[str] = None
+ """
+ The original status string from the CVL portal. `null` for exact-matched
+ statuses. Non-null when a fuzzy match or unknown string was encountered —
+ preserve this for debugging and to help us expand coverage.
+ """
+
+ registered_on: Optional[date] = None
+ """Date KYC was first registered at this KRA"""
+
+ remarks: Optional[str] = None
+ """
+ Remarks from the KRA. Only actionable when `status` is `on_hold`
+ (e.g. `"APPLICANT PHOTO MISMATCH"`). For `validated` KRAs,
+ remarks like `"FATCA NOT APPLICABLE"` can be safely ignored.
+ Multiple remarks are comma-separated.
+ """
+
+ status: Literal[
+ "validated",
+ "registered",
+ "under_process",
+ "on_hold",
+ "rejected",
+ "legacy",
+ "not_available",
+ "not_checked",
+ "unknown",
+ ]
+ """Normalized status for this KRA"""
+
+
+class KrasKarvy(BaseModel):
+ """
+ KYC status at a single KRA. All six keys are always present (never omitted).
+ For `not_checked` and `not_available` KRAs, date/mode/remarks fields are `null`.
+ """
+
+ kyc_mode: Optional[Literal["normal", "digilocker", "ekyc", "paper", "unknown"]] = None
+ """KYC completion mode at this KRA"""
+
+ last_updated_on: Optional[date] = None
+ """Date KYC was last updated at this KRA"""
+
+ raw_status: Optional[str] = None
+ """
+ The original status string from the CVL portal. `null` for exact-matched
+ statuses. Non-null when a fuzzy match or unknown string was encountered —
+ preserve this for debugging and to help us expand coverage.
+ """
+
+ registered_on: Optional[date] = None
+ """Date KYC was first registered at this KRA"""
+
+ remarks: Optional[str] = None
+ """
+ Remarks from the KRA. Only actionable when `status` is `on_hold`
+ (e.g. `"APPLICANT PHOTO MISMATCH"`). For `validated` KRAs,
+ remarks like `"FATCA NOT APPLICABLE"` can be safely ignored.
+ Multiple remarks are comma-separated.
+ """
+
+ status: Literal[
+ "validated",
+ "registered",
+ "under_process",
+ "on_hold",
+ "rejected",
+ "legacy",
+ "not_available",
+ "not_checked",
+ "unknown",
+ ]
+ """Normalized status for this KRA"""
+
+
+class KrasKfin(BaseModel):
+ """
+ KYC status at a single KRA. All six keys are always present (never omitted).
+ For `not_checked` and `not_available` KRAs, date/mode/remarks fields are `null`.
+ """
+
+ kyc_mode: Optional[Literal["normal", "digilocker", "ekyc", "paper", "unknown"]] = None
+ """KYC completion mode at this KRA"""
+
+ last_updated_on: Optional[date] = None
+ """Date KYC was last updated at this KRA"""
+
+ raw_status: Optional[str] = None
+ """
+ The original status string from the CVL portal. `null` for exact-matched
+ statuses. Non-null when a fuzzy match or unknown string was encountered —
+ preserve this for debugging and to help us expand coverage.
+ """
+
+ registered_on: Optional[date] = None
+ """Date KYC was first registered at this KRA"""
+
+ remarks: Optional[str] = None
+ """
+ Remarks from the KRA. Only actionable when `status` is `on_hold`
+ (e.g. `"APPLICANT PHOTO MISMATCH"`). For `validated` KRAs,
+ remarks like `"FATCA NOT APPLICABLE"` can be safely ignored.
+ Multiple remarks are comma-separated.
+ """
+
+ status: Literal[
+ "validated",
+ "registered",
+ "under_process",
+ "on_hold",
+ "rejected",
+ "legacy",
+ "not_available",
+ "not_checked",
+ "unknown",
+ ]
+ """Normalized status for this KRA"""
+
+
+class KrasNdml(BaseModel):
+ """
+ KYC status at a single KRA. All six keys are always present (never omitted).
+ For `not_checked` and `not_available` KRAs, date/mode/remarks fields are `null`.
+ """
+
+ kyc_mode: Optional[Literal["normal", "digilocker", "ekyc", "paper", "unknown"]] = None
+ """KYC completion mode at this KRA"""
+
+ last_updated_on: Optional[date] = None
+ """Date KYC was last updated at this KRA"""
+
+ raw_status: Optional[str] = None
+ """
+ The original status string from the CVL portal. `null` for exact-matched
+ statuses. Non-null when a fuzzy match or unknown string was encountered —
+ preserve this for debugging and to help us expand coverage.
+ """
+
+ registered_on: Optional[date] = None
+ """Date KYC was first registered at this KRA"""
+
+ remarks: Optional[str] = None
+ """
+ Remarks from the KRA. Only actionable when `status` is `on_hold`
+ (e.g. `"APPLICANT PHOTO MISMATCH"`). For `validated` KRAs,
+ remarks like `"FATCA NOT APPLICABLE"` can be safely ignored.
+ Multiple remarks are comma-separated.
+ """
+
+ status: Literal[
+ "validated",
+ "registered",
+ "under_process",
+ "on_hold",
+ "rejected",
+ "legacy",
+ "not_available",
+ "not_checked",
+ "unknown",
+ ]
+ """Normalized status for this KRA"""
+
+
+class Kras(BaseModel):
+ """Per-KRA status breakdown. All five KRA keys are always present."""
+
+ cams: KrasCams
+ """
+ KYC status at a single KRA. All six keys are always present (never omitted).
+ For `not_checked` and `not_available` KRAs, date/mode/remarks fields are `null`.
+ """
+
+ cvl: KrasCvl
+ """
+ KYC status at a single KRA. All six keys are always present (never omitted).
+ For `not_checked` and `not_available` KRAs, date/mode/remarks fields are `null`.
+ """
+
+ karvy: KrasKarvy
+ """
+ KYC status at a single KRA. All six keys are always present (never omitted).
+ For `not_checked` and `not_available` KRAs, date/mode/remarks fields are `null`.
+ """
+
+ kfin: KrasKfin
+ """
+ KYC status at a single KRA. All six keys are always present (never omitted).
+ For `not_checked` and `not_available` KRAs, date/mode/remarks fields are `null`.
+ """
+
+ ndml: KrasNdml
+ """
+ KYC status at a single KRA. All six keys are always present (never omitted).
+ For `not_checked` and `not_available` KRAs, date/mode/remarks fields are `null`.
+ """
+
+
+class KycCheckPanStatusResponse(BaseModel):
+ """Normalized KYC status response for a PAN number"""
+
+ active_kra: Optional[Literal["cvl", "ndml", "cams", "karvy", "kfin"]] = None
+ """Short key of the KRA where the active KYC record was found"""
+
+ kras: Optional[Kras] = None
+ """Per-KRA status breakdown. All five KRA keys are always present."""
+
+ kyc_compliant: Optional[bool] = None
+ """
+ `true` if the investor has a `validated` or `registered` KYC record.
+ Use this as the primary onboarding gate signal.
+ """
+
+ kyc_mode: Optional[Literal["normal", "digilocker", "ekyc", "paper", "unknown"]] = None
+ """
+ How the KYC was completed. Possible values:
+ - `normal` — Physical/paper KYC
+ - `digilocker` — DigiLocker-backed digital KYC
+ - `ekyc` — Aadhaar eKYC (OTP-based)
+ - `paper` — Offline paper submission
+ - `unknown` — Mode string not recognized
+ """
+
+ kyc_status: Optional[
+ Literal["validated", "registered", "under_process", "on_hold", "rejected", "legacy", "not_available", "unknown"]
+ ] = None
+ """
+ Normalized KYC status from the active KRA. Possible values:
+ - `validated` — KYC complete, investor can onboard and transact freely
+ - `registered` — KYC registered; some restrictions may apply depending on your platform's onboarding policy
+ - `under_process` — Recently submitted KYC, still being processed by KRA
+ - `on_hold` — KYC on hold due to discrepancy; check `remarks` on the KRA object
+ - `rejected` — KYC rejected; investor must submit fresh KYC
+ - `legacy` — Old/incomplete record; re-KYC recommended
+ - `not_available` — No KYC record found at any KRA
+ - `unknown` — Portal returned an unrecognized string; `raw_status` preserved
+ """
+
+ last_updated_on: Optional[date] = None
+ """Date the KYC record was last updated at the active KRA (ISO 8601)"""
+
+ pan: Optional[str] = None
+ """The PAN number that was queried (uppercase)"""
+
+ registered_on: Optional[date] = None
+ """Date the KYC was first registered at the active KRA (ISO 8601)"""
+
+ status: Optional[Literal["success"]] = None
diff --git a/src/cas_parser/types/kyc_get_digilocker_result_params.py b/src/cas_parser/types/kyc_get_digilocker_result_params.py
new file mode 100644
index 0000000..a9e0b23
--- /dev/null
+++ b/src/cas_parser/types/kyc_get_digilocker_result_params.py
@@ -0,0 +1,19 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List
+from typing_extensions import Literal, TypedDict
+
+__all__ = ["KycGetDigilockerResultParams"]
+
+
+class KycGetDigilockerResultParams(TypedDict, total=False):
+ fetch_documents: List[Literal["pan", "aadhaar", "driving_licence"]]
+ """
+ Documents to additionally fetch + parse from the locker.
+ Default: [] (no document fetch, no fetch billing).
+ """
+
+ include_documents: bool
+ """Include the issued-documents list."""
diff --git a/src/cas_parser/types/kyc_get_digilocker_result_response.py b/src/cas_parser/types/kyc_get_digilocker_result_response.py
new file mode 100644
index 0000000..7425931
--- /dev/null
+++ b/src/cas_parser/types/kyc_get_digilocker_result_response.py
@@ -0,0 +1,318 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+import datetime
+from typing import Dict, List, Optional
+
+from .._models import BaseModel
+
+__all__ = [
+ "KycGetDigilockerResultResponse",
+ "Consent",
+ "Document",
+ "FetchedAadhaarUnionMember0",
+ "FetchedDrivingLicenceUnionMember0Category",
+ "FetchedDrivingLicenceUnionMember0SignatureCertificate",
+ "FetchedDrivingLicenceUnionMember0Signature",
+ "FetchedDrivingLicenceUnionMember0",
+ "FetchedPanUnionMember0SignatureCertificate",
+ "FetchedPanUnionMember0Signature",
+ "FetchedPanUnionMember0",
+ "Fetched",
+ "IdentityUnionMember0Verified",
+ "IdentityUnionMember0",
+]
+
+
+class Consent(BaseModel):
+ """
+ Consent receipt captured at session start. Carried through the flow for
+ audit (DPDP / RBI compliance).
+ """
+
+ consented_at: Optional[datetime.datetime] = None
+ """ISO 8601 timestamp (UTC) when consent was captured."""
+
+ purpose: Optional[str] = None
+ """The consent_purpose provided at /session."""
+
+
+class Document(BaseModel):
+ """Metadata for a single issued document in the user's DigiLocker."""
+
+ date: Optional[datetime.date] = None
+ """Last modified date in DigiLocker, normalized to ISO 8601."""
+
+ doctype: Optional[str] = None
+ """5-character DigiLocker document type code"""
+
+ issuer: Optional[str] = None
+
+ issuerid: Optional[str] = None
+
+ mime: Optional[List[str]] = None
+
+ name: Optional[str] = None
+ """Document name"""
+
+ type: Optional[str] = None
+
+ uri: Optional[str] = None
+ """Unique DigiLocker identifier for the document"""
+
+
+class FetchedAadhaarUnionMember0(BaseModel):
+ """
+ e-Aadhaar (Aadhaar Paperless Offline eKYC) data parsed from DigiLocker XML.
+ Any field may be null if not present in the source XML.
+ """
+
+ address: Optional[str] = None
+ """Full address assembled from the Aadhaar address fields"""
+
+ care_of: Optional[str] = None
+ """Care-of / guardian field"""
+
+ dob: Optional[str] = None
+ """Date of birth (as returned by DigiLocker, typically DD-MM-YYYY)"""
+
+ gender: Optional[str] = None
+ """Gender (M, F, or T)"""
+
+ masked_aadhaar: Optional[str] = None
+ """Masked Aadhaar number (only last 4 digits visible)"""
+
+ name: Optional[str] = None
+ """Full name as on Aadhaar"""
+
+ photo_base64: Optional[str] = None
+ """Base64-encoded photograph from the Aadhaar XML"""
+
+ session_id: Optional[str] = None
+ """DigiLocker/UIDAI reference id for this eKYC document"""
+
+
+class FetchedDrivingLicenceUnionMember0Category(BaseModel):
+ abbreviation: Optional[str] = None
+
+ code: Optional[str] = None
+
+ description: Optional[str] = None
+
+ issue_date: Optional[datetime.date] = None
+
+
+class FetchedDrivingLicenceUnionMember0SignatureCertificate(BaseModel):
+ issuer: Optional[str] = None
+
+ serial_number: Optional[str] = None
+
+ subject: Optional[str] = None
+
+ valid_from: Optional[datetime.datetime] = None
+
+ valid_until: Optional[datetime.datetime] = None
+
+
+class FetchedDrivingLicenceUnionMember0Signature(BaseModel):
+ """
+ Signature provenance for a fetched document. Reports whether a signed
+ XML block with an X.509 certificate is present, plus the signing
+ certificate's details. Note: this is provenance reporting, not full
+ XML-DSIG cryptographic verification (the trust model is direct-from-source
+ retrieval, consistent with the industry).
+ """
+
+ certificate: Optional[FetchedDrivingLicenceUnionMember0SignatureCertificate] = None
+
+ signature_present: Optional[bool] = None
+
+
+class FetchedDrivingLicenceUnionMember0(BaseModel):
+ """
+ Driving licence data parsed from DigiLocker XML (returned under
+ `fetched.driving_licence`). Any field may be null if absent in the
+ source XML.
+ """
+
+ categories: Optional[List[FetchedDrivingLicenceUnionMember0Category]] = None
+ """Vehicle classes the holder is licensed for."""
+
+ dl_number: Optional[str] = None
+
+ dob: Optional[str] = None
+ """Date of birth, normalized to ISO 8601."""
+
+ expiry_date: Optional[datetime.date] = None
+
+ father_name: Optional[str] = None
+
+ gender: Optional[str] = None
+
+ issue_date: Optional[datetime.date] = None
+
+ issued_at: Optional[str] = None
+
+ name: Optional[str] = None
+
+ permanent_address: Optional[str] = None
+
+ present_address: Optional[str] = None
+
+ signature: Optional[FetchedDrivingLicenceUnionMember0Signature] = None
+ """
+ Signature provenance for a fetched document. Reports whether a signed
+ XML block with an X.509 certificate is present, plus the signing
+ certificate's details. Note: this is provenance reporting, not full
+ XML-DSIG cryptographic verification (the trust model is direct-from-source
+ retrieval, consistent with the industry).
+ """
+
+ status: Optional[str] = None
+
+ valid_from: Optional[datetime.date] = None
+
+
+class FetchedPanUnionMember0SignatureCertificate(BaseModel):
+ issuer: Optional[str] = None
+
+ serial_number: Optional[str] = None
+
+ subject: Optional[str] = None
+
+ valid_from: Optional[datetime.datetime] = None
+
+ valid_until: Optional[datetime.datetime] = None
+
+
+class FetchedPanUnionMember0Signature(BaseModel):
+ """
+ Signature provenance for a fetched document. Reports whether a signed
+ XML block with an X.509 certificate is present, plus the signing
+ certificate's details. Note: this is provenance reporting, not full
+ XML-DSIG cryptographic verification (the trust model is direct-from-source
+ retrieval, consistent with the industry).
+ """
+
+ certificate: Optional[FetchedPanUnionMember0SignatureCertificate] = None
+
+ signature_present: Optional[bool] = None
+
+
+class FetchedPanUnionMember0(BaseModel):
+ """
+ PAN certificate data parsed from DigiLocker XML (returned as `parsed`
+ when `parse=pan`). Any field may be null if absent in the source XML.
+ """
+
+ dob: Optional[str] = None
+ """Date of birth (DD-MM-YYYY as returned)"""
+
+ father_name: Optional[str] = None
+ """Father/spouse name (the `swd` field; often empty)"""
+
+ gender: Optional[str] = None
+
+ name: Optional[str] = None
+ """PAN holder name"""
+
+ pan: Optional[str] = None
+ """PAN number"""
+
+ signature: Optional[FetchedPanUnionMember0Signature] = None
+ """
+ Signature provenance for a fetched document. Reports whether a signed
+ XML block with an X.509 certificate is present, plus the signing
+ certificate's details. Note: this is provenance reporting, not full
+ XML-DSIG cryptographic verification (the trust model is direct-from-source
+ retrieval, consistent with the industry).
+ """
+
+ status: Optional[str] = None
+ """Certificate status (e.g. "A" = Active)"""
+
+ verified_on: Optional[str] = None
+ """Timestamp DigiLocker verified the record"""
+
+
+class Fetched(BaseModel):
+ """
+ Parsed documents keyed by the `fetch_documents` value
+ (pan/aadhaar/driving_licence). Value is null if the document
+ was requested but unavailable. Each parsed object also
+ includes a `signature` block.
+ """
+
+ aadhaar: Optional[FetchedAadhaarUnionMember0] = None
+
+ driving_licence: Optional[FetchedDrivingLicenceUnionMember0] = None
+
+ pan: Optional[FetchedPanUnionMember0] = None
+
+
+class IdentityUnionMember0Verified(BaseModel):
+ """Authenticated document identifiers (keys present only when verified)."""
+
+ aadhaar: Optional[str] = None
+ """Usually masked"""
+
+ driving_licence: Optional[str] = None
+
+ pan: Optional[str] = None
+
+
+class IdentityUnionMember0(BaseModel):
+ """
+ The investor's verified identity. Only fields the investor shared are
+ populated. `verified` contains the authenticated document identifiers
+ (e.g. PAN, Aadhaar number).
+ """
+
+ address: Optional[str] = None
+
+ care_of: Optional[str] = None
+
+ digilocker_id: Optional[str] = None
+
+ dob: Optional[str] = None
+
+ email: Optional[str] = None
+
+ gender: Optional[str] = None
+
+ mobile: Optional[str] = None
+
+ name: Optional[str] = None
+
+ username: Optional[str] = None
+ """DigiLocker preferred username"""
+
+ verified: Optional[IdentityUnionMember0Verified] = None
+ """Authenticated document identifiers (keys present only when verified)."""
+
+
+class KycGetDigilockerResultResponse(BaseModel):
+ consent: Optional[Consent] = None
+ """
+ Consent receipt captured at session start. Carried through the flow for
+ audit (DPDP / RBI compliance).
+ """
+
+ consented_documents: Optional[List[str]] = None
+ """Friendly names of documents the user consented to share."""
+
+ documents: Optional[List[Document]] = None
+
+ errors: Optional[Dict[str, str]] = None
+ """Per-section error codes (omitted when there are none)."""
+
+ fetched: Optional[Fetched] = None
+ """
+ Parsed documents keyed by the `fetch_documents` value
+ (pan/aadhaar/driving_licence). Value is null if the document
+ was requested but unavailable. Each parsed object also
+ includes a `signature` block.
+ """
+
+ identity: Optional[IdentityUnionMember0] = None
+
+ status: Optional[str] = None
diff --git a/src/cas_parser/types/kyc_lookup_digilocker_account_params.py b/src/cas_parser/types/kyc_lookup_digilocker_account_params.py
new file mode 100644
index 0000000..88889b7
--- /dev/null
+++ b/src/cas_parser/types/kyc_lookup_digilocker_account_params.py
@@ -0,0 +1,18 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import TypedDict
+
+__all__ = ["KycLookupDigilockerAccountParams"]
+
+
+class KycLookupDigilockerAccountParams(TypedDict, total=False):
+ aadhaar_number: str
+ """12-digit Aadhaar number."""
+
+ mobile: str
+ """10-digit Indian mobile number."""
+
+ reference_id: str
+ """Optional caller-side request identifier."""
diff --git a/src/cas_parser/types/kyc_lookup_digilocker_account_response.py b/src/cas_parser/types/kyc_lookup_digilocker_account_response.py
new file mode 100644
index 0000000..670f8a6
--- /dev/null
+++ b/src/cas_parser/types/kyc_lookup_digilocker_account_response.py
@@ -0,0 +1,32 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["KycLookupDigilockerAccountResponse", "NextStep"]
+
+
+class NextStep(BaseModel):
+ action: Optional[str] = None
+
+ endpoint: Optional[str] = None
+
+ message: Optional[str] = None
+
+
+class KycLookupDigilockerAccountResponse(BaseModel):
+ digilocker_id: Optional[str] = None
+ """DigiLocker username if registered, null otherwise."""
+
+ next_step: Optional[NextStep] = None
+
+ reference_id: Optional[str] = None
+
+ registered: Optional[bool] = None
+ """Whether the identifier has a DigiLocker account."""
+
+ status: Optional[str] = None
+
+ suggested_user_flow: Optional[Literal["signin", "signup"]] = None
diff --git a/src/cas_parser/types/kyc_start_digilocker_session_params.py b/src/cas_parser/types/kyc_start_digilocker_session_params.py
new file mode 100644
index 0000000..2e52753
--- /dev/null
+++ b/src/cas_parser/types/kyc_start_digilocker_session_params.py
@@ -0,0 +1,37 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List
+from typing_extensions import Literal, Required, TypedDict
+
+__all__ = ["KycStartDigilockerSessionParams"]
+
+
+class KycStartDigilockerSessionParams(TypedDict, total=False):
+ consent: Required[bool]
+ """
+ Explicit end-user consent. Must be `true` to proceed
+ (regulatory requirement under DPDP / RBI). Captured for audit.
+ """
+
+ consent_purpose: Required[str]
+ """
+ Specific purpose for which consent is taken (min 20 chars).
+ Stored in the session and returned as a consent receipt.
+ """
+
+ redirect_url: Required[str]
+ """Where to redirect the user after consent. Must be a valid http/https URL."""
+
+ documents: List[Literal["aadhaar", "pan", "driving_licence", "email", "mobile"]]
+ """Identities to verify and return in the response."""
+
+ prefill_mobile: str
+ """Pre-verified mobile to skip the signup OTP step (only applies with user_flow=signup)."""
+
+ state: str
+ """Opaque value echoed back to your redirect_url unchanged."""
+
+ user_flow: Literal["signin", "signup"]
+ """Use "signin" for users with an existing DigiLocker account, "signup" for account-on-the-fly."""
diff --git a/src/cas_parser/types/kyc_start_digilocker_session_response.py b/src/cas_parser/types/kyc_start_digilocker_session_response.py
new file mode 100644
index 0000000..0ede622
--- /dev/null
+++ b/src/cas_parser/types/kyc_start_digilocker_session_response.py
@@ -0,0 +1,24 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from typing import Optional
+
+from .._models import BaseModel
+
+__all__ = ["KycStartDigilockerSessionResponse"]
+
+
+class KycStartDigilockerSessionResponse(BaseModel):
+ authorization_url: Optional[str] = None
+ """DigiLocker consent URL to redirect the investor to."""
+
+ expires_in: Optional[int] = None
+ """Seconds the authorization_url is valid for."""
+
+ session_id: Optional[str] = None
+ """
+ The single identifier for this verification. Use it as the
+ path parameter in `POST /v1/kyc/digilocker/result/{session_id}`
+ to retrieve identity + documents.
+ """
+
+ status: Optional[str] = None
diff --git a/src/cas_parser/types/verification_verify_mfd_params.py b/src/cas_parser/types/verification_verify_mfd_params.py
new file mode 100644
index 0000000..887b1d8
--- /dev/null
+++ b/src/cas_parser/types/verification_verify_mfd_params.py
@@ -0,0 +1,12 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["VerificationVerifyMfdParams"]
+
+
+class VerificationVerifyMfdParams(TypedDict, total=False):
+ arn: Required[str]
+ """AMFI Registration Number. Digits only; an `ARN-` prefix is tolerated."""
diff --git a/src/cas_parser/types/verification_verify_mfd_response.py b/src/cas_parser/types/verification_verify_mfd_response.py
new file mode 100644
index 0000000..fd094b1
--- /dev/null
+++ b/src/cas_parser/types/verification_verify_mfd_response.py
@@ -0,0 +1,64 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import date
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["VerificationVerifyMfdResponse", "NegativeList"]
+
+
+class NegativeList(BaseModel):
+ """Details of the adverse-list hit, else null."""
+
+ since: Optional[str] = None
+ """Effective date as published by AMFI."""
+
+ type: Optional[Literal["suspended", "terminated", "euin_terminated"]] = None
+
+
+class VerificationVerifyMfdResponse(BaseModel):
+ """
+ Result of an AMFI mutual-fund distributor (ARN) verification. Every listed property is always present on a 200 response (null when not applicable); `verified` is the boolean gate to act on.
+ """
+
+ address: Optional[str] = None
+
+ arn: str
+
+ authority: Literal["AMFI"]
+
+ category: Literal["mutual-fund-distributor"]
+
+ category_label: Optional[str] = None
+
+ euin: Optional[str] = None
+
+ is_perpetual: Optional[bool] = None
+
+ kyd_compliant: Optional[bool] = None
+
+ name: Optional[str] = None
+
+ negative_list: Optional[NegativeList] = None
+ """Details of the adverse-list hit, else null."""
+
+ negative_list_hit: bool
+ """True when the ARN/EUIN appears on an AMFI adverse list."""
+
+ pincode: Optional[str] = None
+
+ registration_status: Literal["ACTIVE", "EXPIRED", "SUSPENDED", "TERMINATED", "NOT_FOUND"]
+ """
+ ACTIVE = on the active register; SUSPENDED / TERMINATED = on an AMFI adverse list (see `negative_list`); EXPIRED = ARN validity lapsed; NOT_FOUND = no active registration and not on an adverse list.
+ """
+
+ status: Literal["success"]
+
+ valid_from: Optional[date] = None
+
+ valid_till: Optional[date] = None
+
+ verified: bool
+ """True only when the ARN is on the active register and not on an adverse list."""
diff --git a/src/cas_parser/types/verification_verify_sebi_params.py b/src/cas_parser/types/verification_verify_sebi_params.py
new file mode 100644
index 0000000..d5d3c97
--- /dev/null
+++ b/src/cas_parser/types/verification_verify_sebi_params.py
@@ -0,0 +1,42 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, TypedDict
+
+__all__ = ["VerificationVerifySebiParams"]
+
+
+class VerificationVerifySebiParams(TypedDict, total=False):
+ name: str
+ """Entity/trade name to search by. Used only when `registration_number` is absent, and then `type` is required."""
+
+ registration_number: str
+ """
+ SEBI registration number. When provided, the category is auto-detected from its sequence (INA…→investment-adviser, INH…→research-analyst, INP…→portfolio-manager, INM…→merchant-banker, INR…→registrar-transfer-agent, INZ…→stock-broker). This is the authoritative input — any `name` sent alongside it is ignored.
+ """
+
+ type: Literal[
+ "investment-adviser",
+ "research-analyst",
+ "portfolio-manager",
+ "stock-broker",
+ "merchant-banker",
+ "registrar-transfer-agent",
+ "mutual-fund",
+ "alternative-investment-fund",
+ "credit-rating-agency",
+ "custodian",
+ "debenture-trustee",
+ "venture-capital-fund",
+ "foreign-venture-capital-investor",
+ "foreign-portfolio-investor",
+ "kyc-registration-agency",
+ "infrastructure-investment-trust",
+ "real-estate-investment-trust",
+ "esg-rating-provider",
+ "vault-manager",
+ ]
+ """
+ Category slug. Overrides auto-detection; required for a name search and for fund/FPI registration numbers that don't encode a category. Short aliases are also accepted (ria, ra, pms, broker, rta, mf, aif, cra, vcf, fvci, fpi, kra, invit, reit).
+ """
diff --git a/src/cas_parser/types/verification_verify_sebi_response.py b/src/cas_parser/types/verification_verify_sebi_response.py
new file mode 100644
index 0000000..373abbc
--- /dev/null
+++ b/src/cas_parser/types/verification_verify_sebi_response.py
@@ -0,0 +1,74 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import date
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["VerificationVerifySebiResponse"]
+
+
+class VerificationVerifySebiResponse(BaseModel):
+ """
+ Result of a SEBI intermediary verification. Every listed property is always present on a 200 response (fields are null when not applicable); `verified` is the boolean gate to act on.
+ """
+
+ address: Optional[str] = None
+
+ authority: Literal["SEBI"]
+
+ category: Literal[
+ "investment-adviser",
+ "research-analyst",
+ "portfolio-manager",
+ "stock-broker",
+ "merchant-banker",
+ "registrar-transfer-agent",
+ "mutual-fund",
+ "alternative-investment-fund",
+ "credit-rating-agency",
+ "custodian",
+ "debenture-trustee",
+ "venture-capital-fund",
+ "foreign-venture-capital-investor",
+ "foreign-portfolio-investor",
+ "kyc-registration-agency",
+ "infrastructure-investment-trust",
+ "real-estate-investment-trust",
+ "esg-rating-provider",
+ "vault-manager",
+ ]
+ """Detected/selected category slug."""
+
+ category_label: Optional[str] = None
+
+ contact_person: Optional[str] = None
+
+ detected_by: Literal["registration_number", "type"]
+ """How the category was resolved."""
+
+ email: Optional[str] = None
+
+ is_perpetual: Optional[bool] = None
+
+ name: Optional[str] = None
+
+ registration_number: Optional[str] = None
+
+ registration_status: Literal["ACTIVE", "EXPIRED", "NOT_FOUND"]
+ """
+ ACTIVE = currently registered; EXPIRED = validity end date passed; NOT_FOUND = no current registration in this category.
+ """
+
+ status: Literal["success"]
+
+ telephone: Optional[str] = None
+
+ valid_from: Optional[date] = None
+
+ valid_till: Optional[date] = None
+ """Null when the registration is perpetual."""
+
+ verified: bool
+ """True only when a current registration is found and ACTIVE."""
diff --git a/tests/api_resources/test_agent_auth.py b/tests/api_resources/test_agent_auth.py
new file mode 100644
index 0000000..2df8fc9
--- /dev/null
+++ b/tests/api_resources/test_agent_auth.py
@@ -0,0 +1,223 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cas_parser import CasParser, AsyncCasParser
+from tests.utils import assert_matches_type
+from cas_parser.types import (
+ AgentAuthPollResponse,
+ AgentAuthApproveResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestAgentAuth:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_poll(self, client: CasParser) -> None:
+ agent_auth = client.agent_auth.poll(
+ "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2",
+ )
+ assert_matches_type(AgentAuthPollResponse, agent_auth, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_poll(self, client: CasParser) -> None:
+ response = client.agent_auth.with_raw_response.poll(
+ "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ agent_auth = response.parse()
+ assert_matches_type(AgentAuthPollResponse, agent_auth, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_poll(self, client: CasParser) -> None:
+ with client.agent_auth.with_streaming_response.poll(
+ "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ agent_auth = response.parse()
+ assert_matches_type(AgentAuthPollResponse, agent_auth, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_path_params_poll(self, client: CasParser) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `token` but received ''"):
+ client.agent_auth.with_raw_response.poll(
+ "",
+ )
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_approve(self, client: CasParser) -> None:
+ agent_auth = client.agent_auth.approve(
+ "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2",
+ id_token="id_token",
+ )
+ assert_matches_type(AgentAuthApproveResponse, agent_auth, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_approve_with_all_params(self, client: CasParser) -> None:
+ agent_auth = client.agent_auth.approve(
+ "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2",
+ client_name="Claude Code",
+ id_token="id_token",
+ )
+ assert_matches_type(AgentAuthApproveResponse, agent_auth, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_approve(self, client: CasParser) -> None:
+ response = client.agent_auth.with_raw_response.approve(
+ "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2",
+ id_token="id_token",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ agent_auth = response.parse()
+ assert_matches_type(AgentAuthApproveResponse, agent_auth, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_approve(self, client: CasParser) -> None:
+ with client.agent_auth.with_streaming_response.approve(
+ "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2",
+ id_token="id_token",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ agent_auth = response.parse()
+ assert_matches_type(AgentAuthApproveResponse, agent_auth, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_path_params_approve(self, client: CasParser) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `token` but received ''"):
+ client.agent_auth.with_raw_response.approve(
+ "",
+ id_token="id_token",
+ )
+
+
+class TestAsyncAgentAuth:
+ parametrize = pytest.mark.parametrize(
+ "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
+ )
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_poll(self, async_client: AsyncCasParser) -> None:
+ agent_auth = await async_client.agent_auth.poll(
+ "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2",
+ )
+ assert_matches_type(AgentAuthPollResponse, agent_auth, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_poll(self, async_client: AsyncCasParser) -> None:
+ response = await async_client.agent_auth.with_raw_response.poll(
+ "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ agent_auth = await response.parse()
+ assert_matches_type(AgentAuthPollResponse, agent_auth, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_poll(self, async_client: AsyncCasParser) -> None:
+ async with async_client.agent_auth.with_streaming_response.poll(
+ "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ agent_auth = await response.parse()
+ assert_matches_type(AgentAuthPollResponse, agent_auth, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_path_params_poll(self, async_client: AsyncCasParser) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `token` but received ''"):
+ await async_client.agent_auth.with_raw_response.poll(
+ "",
+ )
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_approve(self, async_client: AsyncCasParser) -> None:
+ agent_auth = await async_client.agent_auth.approve(
+ "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2",
+ id_token="id_token",
+ )
+ assert_matches_type(AgentAuthApproveResponse, agent_auth, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_approve_with_all_params(self, async_client: AsyncCasParser) -> None:
+ agent_auth = await async_client.agent_auth.approve(
+ "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2",
+ client_name="Claude Code",
+ id_token="id_token",
+ )
+ assert_matches_type(AgentAuthApproveResponse, agent_auth, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_approve(self, async_client: AsyncCasParser) -> None:
+ response = await async_client.agent_auth.with_raw_response.approve(
+ "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2",
+ id_token="id_token",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ agent_auth = await response.parse()
+ assert_matches_type(AgentAuthApproveResponse, agent_auth, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_approve(self, async_client: AsyncCasParser) -> None:
+ async with async_client.agent_auth.with_streaming_response.approve(
+ "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2",
+ id_token="id_token",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ agent_auth = await response.parse()
+ assert_matches_type(AgentAuthApproveResponse, agent_auth, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_path_params_approve(self, async_client: AsyncCasParser) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `token` but received ''"):
+ await async_client.agent_auth.with_raw_response.approve(
+ "",
+ id_token="id_token",
+ )
diff --git a/tests/api_resources/test_cas_generator.py b/tests/api_resources/test_cas_generator.py
new file mode 100644
index 0000000..295abbd
--- /dev/null
+++ b/tests/api_resources/test_cas_generator.py
@@ -0,0 +1,138 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cas_parser import CasParser, AsyncCasParser
+from tests.utils import assert_matches_type
+from cas_parser.types import (
+ CasGeneratorGenerateCasResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestCasGenerator:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_generate_cas(self, client: CasParser) -> None:
+ cas_generator = client.cas_generator.generate_cas(
+ email="user@example.com",
+ from_date="2023-01-01",
+ password="Abcdefghi12$",
+ to_date="2023-12-31",
+ )
+ assert_matches_type(CasGeneratorGenerateCasResponse, cas_generator, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_generate_cas_with_all_params(self, client: CasParser) -> None:
+ cas_generator = client.cas_generator.generate_cas(
+ cas_authority="kfintech",
+ email="user@example.com",
+ from_date="2023-01-01",
+ pan_no="ABCDE1234F",
+ password="Abcdefghi12$",
+ to_date="2023-12-31",
+ )
+ assert_matches_type(CasGeneratorGenerateCasResponse, cas_generator, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_generate_cas(self, client: CasParser) -> None:
+ response = client.cas_generator.with_raw_response.generate_cas(
+ email="user@example.com",
+ from_date="2023-01-01",
+ password="Abcdefghi12$",
+ to_date="2023-12-31",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ cas_generator = response.parse()
+ assert_matches_type(CasGeneratorGenerateCasResponse, cas_generator, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_generate_cas(self, client: CasParser) -> None:
+ with client.cas_generator.with_streaming_response.generate_cas(
+ email="user@example.com",
+ from_date="2023-01-01",
+ password="Abcdefghi12$",
+ to_date="2023-12-31",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ cas_generator = response.parse()
+ assert_matches_type(CasGeneratorGenerateCasResponse, cas_generator, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+
+class TestAsyncCasGenerator:
+ parametrize = pytest.mark.parametrize(
+ "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
+ )
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_generate_cas(self, async_client: AsyncCasParser) -> None:
+ cas_generator = await async_client.cas_generator.generate_cas(
+ email="user@example.com",
+ from_date="2023-01-01",
+ password="Abcdefghi12$",
+ to_date="2023-12-31",
+ )
+ assert_matches_type(CasGeneratorGenerateCasResponse, cas_generator, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_generate_cas_with_all_params(self, async_client: AsyncCasParser) -> None:
+ cas_generator = await async_client.cas_generator.generate_cas(
+ cas_authority="kfintech",
+ email="user@example.com",
+ from_date="2023-01-01",
+ pan_no="ABCDE1234F",
+ password="Abcdefghi12$",
+ to_date="2023-12-31",
+ )
+ assert_matches_type(CasGeneratorGenerateCasResponse, cas_generator, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_generate_cas(self, async_client: AsyncCasParser) -> None:
+ response = await async_client.cas_generator.with_raw_response.generate_cas(
+ email="user@example.com",
+ from_date="2023-01-01",
+ password="Abcdefghi12$",
+ to_date="2023-12-31",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ cas_generator = await response.parse()
+ assert_matches_type(CasGeneratorGenerateCasResponse, cas_generator, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_generate_cas(self, async_client: AsyncCasParser) -> None:
+ async with async_client.cas_generator.with_streaming_response.generate_cas(
+ email="user@example.com",
+ from_date="2023-01-01",
+ password="Abcdefghi12$",
+ to_date="2023-12-31",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ cas_generator = await response.parse()
+ assert_matches_type(CasGeneratorGenerateCasResponse, cas_generator, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_inbound_email.py b/tests/api_resources/test_inbound_email.py
index 9b120e5..3901e1e 100644
--- a/tests/api_resources/test_inbound_email.py
+++ b/tests/api_resources/test_inbound_email.py
@@ -14,7 +14,9 @@
InboundEmailCreateResponse,
InboundEmailDeleteResponse,
InboundEmailRetrieveResponse,
+ InboundEmailListFilesResponse,
)
+from cas_parser._utils import parse_datetime
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -187,6 +189,58 @@ def test_path_params_delete(self, client: CasParser) -> None:
"",
)
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_list_files(self, client: CasParser) -> None:
+ inbound_email = client.inbound_email.list_files(
+ "inbound_email_id",
+ )
+ assert_matches_type(InboundEmailListFilesResponse, inbound_email, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_list_files_with_all_params(self, client: CasParser) -> None:
+ inbound_email = client.inbound_email.list_files(
+ "inbound_email_id",
+ since=parse_datetime("2019-12-27T18:11:19.117Z"),
+ limit=1,
+ )
+ assert_matches_type(InboundEmailListFilesResponse, inbound_email, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_list_files(self, client: CasParser) -> None:
+ response = client.inbound_email.with_raw_response.list_files(
+ "inbound_email_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ inbound_email = response.parse()
+ assert_matches_type(InboundEmailListFilesResponse, inbound_email, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_list_files(self, client: CasParser) -> None:
+ with client.inbound_email.with_streaming_response.list_files(
+ "inbound_email_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ inbound_email = response.parse()
+ assert_matches_type(InboundEmailListFilesResponse, inbound_email, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_path_params_list_files(self, client: CasParser) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `inbound_email_id` but received ''"):
+ client.inbound_email.with_raw_response.list_files(
+ "",
+ )
+
class TestAsyncInboundEmail:
parametrize = pytest.mark.parametrize(
@@ -357,3 +411,55 @@ async def test_path_params_delete(self, async_client: AsyncCasParser) -> None:
await async_client.inbound_email.with_raw_response.delete(
"",
)
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_list_files(self, async_client: AsyncCasParser) -> None:
+ inbound_email = await async_client.inbound_email.list_files(
+ "inbound_email_id",
+ )
+ assert_matches_type(InboundEmailListFilesResponse, inbound_email, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_list_files_with_all_params(self, async_client: AsyncCasParser) -> None:
+ inbound_email = await async_client.inbound_email.list_files(
+ "inbound_email_id",
+ since=parse_datetime("2019-12-27T18:11:19.117Z"),
+ limit=1,
+ )
+ assert_matches_type(InboundEmailListFilesResponse, inbound_email, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_list_files(self, async_client: AsyncCasParser) -> None:
+ response = await async_client.inbound_email.with_raw_response.list_files(
+ "inbound_email_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ inbound_email = await response.parse()
+ assert_matches_type(InboundEmailListFilesResponse, inbound_email, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_list_files(self, async_client: AsyncCasParser) -> None:
+ async with async_client.inbound_email.with_streaming_response.list_files(
+ "inbound_email_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ inbound_email = await response.parse()
+ assert_matches_type(InboundEmailListFilesResponse, inbound_email, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_path_params_list_files(self, async_client: AsyncCasParser) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `inbound_email_id` but received ''"):
+ await async_client.inbound_email.with_raw_response.list_files(
+ "",
+ )
diff --git a/tests/api_resources/test_inbox.py b/tests/api_resources/test_inbox.py
index deba9e3..d9febd4 100644
--- a/tests/api_resources/test_inbox.py
+++ b/tests/api_resources/test_inbox.py
@@ -10,6 +10,7 @@
from cas_parser import CasParser, AsyncCasParser
from tests.utils import assert_matches_type
from cas_parser.types import (
+ InboxReadResponse,
InboxConnectEmailResponse,
InboxListCasFilesResponse,
InboxDisconnectEmailResponse,
@@ -180,6 +181,55 @@ def test_streaming_response_list_cas_files(self, client: CasParser) -> None:
assert cast(Any, response.is_closed) is True
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_read(self, client: CasParser) -> None:
+ inbox = client.inbox.read(
+ x_inbox_token="x-inbox-token",
+ )
+ assert_matches_type(InboxReadResponse, inbox, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_read_with_all_params(self, client: CasParser) -> None:
+ inbox = client.inbox.read(
+ x_inbox_token="x-inbox-token",
+ categories=["investments"],
+ document_types=["consolidated_statement"],
+ end_date=parse_date("2026-10-31"),
+ include_body=True,
+ senders=["senders"],
+ sources=["cams"],
+ start_date=parse_date("2026-08-01"),
+ )
+ assert_matches_type(InboxReadResponse, inbox, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_read(self, client: CasParser) -> None:
+ response = client.inbox.with_raw_response.read(
+ x_inbox_token="x-inbox-token",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ inbox = response.parse()
+ assert_matches_type(InboxReadResponse, inbox, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_read(self, client: CasParser) -> None:
+ with client.inbox.with_streaming_response.read(
+ x_inbox_token="x-inbox-token",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ inbox = response.parse()
+ assert_matches_type(InboxReadResponse, inbox, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
class TestAsyncInbox:
parametrize = pytest.mark.parametrize(
@@ -342,3 +392,52 @@ async def test_streaming_response_list_cas_files(self, async_client: AsyncCasPar
assert_matches_type(InboxListCasFilesResponse, inbox, path=["response"])
assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_read(self, async_client: AsyncCasParser) -> None:
+ inbox = await async_client.inbox.read(
+ x_inbox_token="x-inbox-token",
+ )
+ assert_matches_type(InboxReadResponse, inbox, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_read_with_all_params(self, async_client: AsyncCasParser) -> None:
+ inbox = await async_client.inbox.read(
+ x_inbox_token="x-inbox-token",
+ categories=["investments"],
+ document_types=["consolidated_statement"],
+ end_date=parse_date("2026-10-31"),
+ include_body=True,
+ senders=["senders"],
+ sources=["cams"],
+ start_date=parse_date("2026-08-01"),
+ )
+ assert_matches_type(InboxReadResponse, inbox, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_read(self, async_client: AsyncCasParser) -> None:
+ response = await async_client.inbox.with_raw_response.read(
+ x_inbox_token="x-inbox-token",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ inbox = await response.parse()
+ assert_matches_type(InboxReadResponse, inbox, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_read(self, async_client: AsyncCasParser) -> None:
+ async with async_client.inbox.with_streaming_response.read(
+ x_inbox_token="x-inbox-token",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ inbox = await response.parse()
+ assert_matches_type(InboxReadResponse, inbox, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_kyc.py b/tests/api_resources/test_kyc.py
new file mode 100644
index 0000000..f3646df
--- /dev/null
+++ b/tests/api_resources/test_kyc.py
@@ -0,0 +1,385 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cas_parser import CasParser, AsyncCasParser
+from tests.utils import assert_matches_type
+from cas_parser.types import (
+ KycCheckPanStatusResponse,
+ KycGetDigilockerResultResponse,
+ KycStartDigilockerSessionResponse,
+ KycLookupDigilockerAccountResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestKyc:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_lookup_digilocker_account(self, client: CasParser) -> None:
+ kyc = client.kyc.lookup_digilocker_account()
+ assert_matches_type(KycLookupDigilockerAccountResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_lookup_digilocker_account_with_all_params(self, client: CasParser) -> None:
+ kyc = client.kyc.lookup_digilocker_account(
+ aadhaar_number="123456789012",
+ mobile="9876543210",
+ reference_id="reference_id",
+ )
+ assert_matches_type(KycLookupDigilockerAccountResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_lookup_digilocker_account(self, client: CasParser) -> None:
+ response = client.kyc.with_raw_response.lookup_digilocker_account()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ kyc = response.parse()
+ assert_matches_type(KycLookupDigilockerAccountResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_lookup_digilocker_account(self, client: CasParser) -> None:
+ with client.kyc.with_streaming_response.lookup_digilocker_account() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ kyc = response.parse()
+ assert_matches_type(KycLookupDigilockerAccountResponse, kyc, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_start_digilocker_session(self, client: CasParser) -> None:
+ kyc = client.kyc.start_digilocker_session(
+ consent=True,
+ consent_purpose="KYC for loan account opening",
+ redirect_url="https://yourapp.com/digilocker/callback",
+ )
+ assert_matches_type(KycStartDigilockerSessionResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_start_digilocker_session_with_all_params(self, client: CasParser) -> None:
+ kyc = client.kyc.start_digilocker_session(
+ consent=True,
+ consent_purpose="KYC for loan account opening",
+ documents=["aadhaar"],
+ prefill_mobile="9999999999",
+ redirect_url="https://yourapp.com/digilocker/callback",
+ state="investor_42",
+ user_flow="signin",
+ )
+ assert_matches_type(KycStartDigilockerSessionResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_start_digilocker_session(self, client: CasParser) -> None:
+ response = client.kyc.with_raw_response.start_digilocker_session(
+ consent=True,
+ consent_purpose="KYC for loan account opening",
+ redirect_url="https://yourapp.com/digilocker/callback",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ kyc = response.parse()
+ assert_matches_type(KycStartDigilockerSessionResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_start_digilocker_session(self, client: CasParser) -> None:
+ with client.kyc.with_streaming_response.start_digilocker_session(
+ consent=True,
+ consent_purpose="KYC for loan account opening",
+ redirect_url="https://yourapp.com/digilocker/callback",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ kyc = response.parse()
+ assert_matches_type(KycStartDigilockerSessionResponse, kyc, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_get_digilocker_result(self, client: CasParser) -> None:
+ kyc = client.kyc.get_digilocker_result(
+ "session_id",
+ )
+ assert_matches_type(KycGetDigilockerResultResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_get_digilocker_result_with_all_params(self, client: CasParser) -> None:
+ kyc = client.kyc.get_digilocker_result(
+ "session_id",
+ fetch_documents=["pan"],
+ include_documents=True,
+ )
+ assert_matches_type(KycGetDigilockerResultResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_get_digilocker_result(self, client: CasParser) -> None:
+ response = client.kyc.with_raw_response.get_digilocker_result(
+ "session_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ kyc = response.parse()
+ assert_matches_type(KycGetDigilockerResultResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_get_digilocker_result(self, client: CasParser) -> None:
+ with client.kyc.with_streaming_response.get_digilocker_result(
+ "session_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ kyc = response.parse()
+ assert_matches_type(KycGetDigilockerResultResponse, kyc, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_path_params_get_digilocker_result(self, client: CasParser) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"):
+ client.kyc.with_raw_response.get_digilocker_result(
+ "",
+ )
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_check_pan_status(self, client: CasParser) -> None:
+ kyc = client.kyc.check_pan_status(
+ pan_no="ABCDE1234F",
+ )
+ assert_matches_type(KycCheckPanStatusResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_check_pan_status(self, client: CasParser) -> None:
+ response = client.kyc.with_raw_response.check_pan_status(
+ pan_no="ABCDE1234F",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ kyc = response.parse()
+ assert_matches_type(KycCheckPanStatusResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_check_pan_status(self, client: CasParser) -> None:
+ with client.kyc.with_streaming_response.check_pan_status(
+ pan_no="ABCDE1234F",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ kyc = response.parse()
+ assert_matches_type(KycCheckPanStatusResponse, kyc, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+
+class TestAsyncKyc:
+ parametrize = pytest.mark.parametrize(
+ "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
+ )
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_lookup_digilocker_account(self, async_client: AsyncCasParser) -> None:
+ kyc = await async_client.kyc.lookup_digilocker_account()
+ assert_matches_type(KycLookupDigilockerAccountResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_lookup_digilocker_account_with_all_params(self, async_client: AsyncCasParser) -> None:
+ kyc = await async_client.kyc.lookup_digilocker_account(
+ aadhaar_number="123456789012",
+ mobile="9876543210",
+ reference_id="reference_id",
+ )
+ assert_matches_type(KycLookupDigilockerAccountResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_lookup_digilocker_account(self, async_client: AsyncCasParser) -> None:
+ response = await async_client.kyc.with_raw_response.lookup_digilocker_account()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ kyc = await response.parse()
+ assert_matches_type(KycLookupDigilockerAccountResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_lookup_digilocker_account(self, async_client: AsyncCasParser) -> None:
+ async with async_client.kyc.with_streaming_response.lookup_digilocker_account() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ kyc = await response.parse()
+ assert_matches_type(KycLookupDigilockerAccountResponse, kyc, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_start_digilocker_session(self, async_client: AsyncCasParser) -> None:
+ kyc = await async_client.kyc.start_digilocker_session(
+ consent=True,
+ consent_purpose="KYC for loan account opening",
+ redirect_url="https://yourapp.com/digilocker/callback",
+ )
+ assert_matches_type(KycStartDigilockerSessionResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_start_digilocker_session_with_all_params(self, async_client: AsyncCasParser) -> None:
+ kyc = await async_client.kyc.start_digilocker_session(
+ consent=True,
+ consent_purpose="KYC for loan account opening",
+ documents=["aadhaar"],
+ prefill_mobile="9999999999",
+ redirect_url="https://yourapp.com/digilocker/callback",
+ state="investor_42",
+ user_flow="signin",
+ )
+ assert_matches_type(KycStartDigilockerSessionResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_start_digilocker_session(self, async_client: AsyncCasParser) -> None:
+ response = await async_client.kyc.with_raw_response.start_digilocker_session(
+ consent=True,
+ consent_purpose="KYC for loan account opening",
+ redirect_url="https://yourapp.com/digilocker/callback",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ kyc = await response.parse()
+ assert_matches_type(KycStartDigilockerSessionResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_start_digilocker_session(self, async_client: AsyncCasParser) -> None:
+ async with async_client.kyc.with_streaming_response.start_digilocker_session(
+ consent=True,
+ consent_purpose="KYC for loan account opening",
+ redirect_url="https://yourapp.com/digilocker/callback",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ kyc = await response.parse()
+ assert_matches_type(KycStartDigilockerSessionResponse, kyc, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_get_digilocker_result(self, async_client: AsyncCasParser) -> None:
+ kyc = await async_client.kyc.get_digilocker_result(
+ "session_id",
+ )
+ assert_matches_type(KycGetDigilockerResultResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_get_digilocker_result_with_all_params(self, async_client: AsyncCasParser) -> None:
+ kyc = await async_client.kyc.get_digilocker_result(
+ "session_id",
+ fetch_documents=["pan"],
+ include_documents=True,
+ )
+ assert_matches_type(KycGetDigilockerResultResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_get_digilocker_result(self, async_client: AsyncCasParser) -> None:
+ response = await async_client.kyc.with_raw_response.get_digilocker_result(
+ "session_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ kyc = await response.parse()
+ assert_matches_type(KycGetDigilockerResultResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_get_digilocker_result(self, async_client: AsyncCasParser) -> None:
+ async with async_client.kyc.with_streaming_response.get_digilocker_result(
+ "session_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ kyc = await response.parse()
+ assert_matches_type(KycGetDigilockerResultResponse, kyc, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_path_params_get_digilocker_result(self, async_client: AsyncCasParser) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"):
+ await async_client.kyc.with_raw_response.get_digilocker_result(
+ "",
+ )
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_check_pan_status(self, async_client: AsyncCasParser) -> None:
+ kyc = await async_client.kyc.check_pan_status(
+ pan_no="ABCDE1234F",
+ )
+ assert_matches_type(KycCheckPanStatusResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_check_pan_status(self, async_client: AsyncCasParser) -> None:
+ response = await async_client.kyc.with_raw_response.check_pan_status(
+ pan_no="ABCDE1234F",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ kyc = await response.parse()
+ assert_matches_type(KycCheckPanStatusResponse, kyc, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_check_pan_status(self, async_client: AsyncCasParser) -> None:
+ async with async_client.kyc.with_streaming_response.check_pan_status(
+ pan_no="ABCDE1234F",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ kyc = await response.parse()
+ assert_matches_type(KycCheckPanStatusResponse, kyc, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_verification.py b/tests/api_resources/test_verification.py
new file mode 100644
index 0000000..46342c2
--- /dev/null
+++ b/tests/api_resources/test_verification.py
@@ -0,0 +1,171 @@
+# File generated from our OpenAPI spec. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cas_parser import CasParser, AsyncCasParser
+from tests.utils import assert_matches_type
+from cas_parser.types import (
+ VerificationVerifyMfdResponse,
+ VerificationVerifySebiResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestVerification:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_verify_mfd(self, client: CasParser) -> None:
+ verification = client.verification.verify_mfd(
+ arn="123456",
+ )
+ assert_matches_type(VerificationVerifyMfdResponse, verification, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_verify_mfd(self, client: CasParser) -> None:
+ response = client.verification.with_raw_response.verify_mfd(
+ arn="123456",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ verification = response.parse()
+ assert_matches_type(VerificationVerifyMfdResponse, verification, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_verify_mfd(self, client: CasParser) -> None:
+ with client.verification.with_streaming_response.verify_mfd(
+ arn="123456",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ verification = response.parse()
+ assert_matches_type(VerificationVerifyMfdResponse, verification, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_verify_sebi(self, client: CasParser) -> None:
+ verification = client.verification.verify_sebi()
+ assert_matches_type(VerificationVerifySebiResponse, verification, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_verify_sebi_with_all_params(self, client: CasParser) -> None:
+ verification = client.verification.verify_sebi(
+ name="Motilal Oswal",
+ registration_number="INP000000670",
+ type="investment-adviser",
+ )
+ assert_matches_type(VerificationVerifySebiResponse, verification, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_verify_sebi(self, client: CasParser) -> None:
+ response = client.verification.with_raw_response.verify_sebi()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ verification = response.parse()
+ assert_matches_type(VerificationVerifySebiResponse, verification, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_verify_sebi(self, client: CasParser) -> None:
+ with client.verification.with_streaming_response.verify_sebi() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ verification = response.parse()
+ assert_matches_type(VerificationVerifySebiResponse, verification, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+
+class TestAsyncVerification:
+ parametrize = pytest.mark.parametrize(
+ "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
+ )
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_verify_mfd(self, async_client: AsyncCasParser) -> None:
+ verification = await async_client.verification.verify_mfd(
+ arn="123456",
+ )
+ assert_matches_type(VerificationVerifyMfdResponse, verification, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_verify_mfd(self, async_client: AsyncCasParser) -> None:
+ response = await async_client.verification.with_raw_response.verify_mfd(
+ arn="123456",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ verification = await response.parse()
+ assert_matches_type(VerificationVerifyMfdResponse, verification, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_verify_mfd(self, async_client: AsyncCasParser) -> None:
+ async with async_client.verification.with_streaming_response.verify_mfd(
+ arn="123456",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ verification = await response.parse()
+ assert_matches_type(VerificationVerifyMfdResponse, verification, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_verify_sebi(self, async_client: AsyncCasParser) -> None:
+ verification = await async_client.verification.verify_sebi()
+ assert_matches_type(VerificationVerifySebiResponse, verification, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_verify_sebi_with_all_params(self, async_client: AsyncCasParser) -> None:
+ verification = await async_client.verification.verify_sebi(
+ name="Motilal Oswal",
+ registration_number="INP000000670",
+ type="investment-adviser",
+ )
+ assert_matches_type(VerificationVerifySebiResponse, verification, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_verify_sebi(self, async_client: AsyncCasParser) -> None:
+ response = await async_client.verification.with_raw_response.verify_sebi()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ verification = await response.parse()
+ assert_matches_type(VerificationVerifySebiResponse, verification, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_verify_sebi(self, async_client: AsyncCasParser) -> None:
+ async with async_client.verification.with_streaming_response.verify_sebi() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ verification = await response.parse()
+ assert_matches_type(VerificationVerifySebiResponse, verification, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
diff --git a/tests/test_added_calls_stubbed.py b/tests/test_added_calls_stubbed.py
new file mode 100644
index 0000000..06d2ed3
--- /dev/null
+++ b/tests/test_added_calls_stubbed.py
@@ -0,0 +1,78 @@
+# Checks each call added from the live API description against a stubbed transport (respx).
+# For every call: one request with the description's method and path, every argument sent where the description
+# puts it, and the documented response parsed into the method's return type with strict validation on.
+
+from __future__ import annotations
+
+import json
+from typing import Any, Dict, cast
+
+import httpx
+import respx
+import pytest
+
+from cas_parser import CasParser, AsyncCasParser, types
+from cas_parser._models import BaseModel
+
+base_url = "http://stub.test"
+
+CASES: list[Dict[str, Any]] = json.loads(
+ '[{"id": "agent_auth.poll", "resource": "agent_auth", "method": "poll", "http": "GET", "path": "/v1/agent-auth/token/a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2", "args": ["a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2"], "kwargs": {}, "body": {}, "query": {}, "headers": {}, "response": {"status": "pending"}, "response_type": "AgentAuthPollResponse"}, {"id": "agent_auth.approve", "resource": "agent_auth", "method": "approve", "http": "POST", "path": "/v1/agent-auth/token/a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2/approve", "args": ["a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2"], "kwargs": {"client_name": "Claude Code", "id_token": "id_token-value"}, "body": {"client_name": "Claude Code", "id_token": "id_token-value"}, "query": {}, "headers": {}, "response": {"email": "user@example.com", "status": "approved"}, "response_type": "AgentAuthApproveResponse"}, {"id": "kyc.lookup_digilocker_account", "resource": "kyc", "method": "lookup_digilocker_account", "http": "POST", "path": "/v1/kyc/digilocker/account-lookup", "args": [], "kwargs": {"aadhaar_number": "123456789012", "mobile": "9876543210", "reference_id": "reference_id-value"}, "body": {"aadhaar_number": "123456789012", "mobile": "9876543210", "reference_id": "reference_id-value"}, "query": {}, "headers": {}, "response": {"digilocker_id": "digilocker_id-value", "next_step": {"action": "start_session", "endpoint": "POST /v1/kyc/digilocker/session", "message": "message-value"}, "reference_id": "reference_id-value", "registered": true, "status": "success", "suggested_user_flow": "signin"}, "response_type": "KycLookupDigilockerAccountResponse"}, {"id": "kyc.start_digilocker_session", "resource": "kyc", "method": "start_digilocker_session", "http": "POST", "path": "/v1/kyc/digilocker/session", "args": [], "kwargs": {"consent": true, "consent_purpose": "KYC for loan account opening", "documents": ["aadhaar", "pan"], "prefill_mobile": "9999999999", "redirect_url": "https://yourapp.com/digilocker/callback", "state": "investor_42", "user_flow": "signin"}, "body": {"consent": true, "consent_purpose": "KYC for loan account opening", "documents": ["aadhaar", "pan"], "prefill_mobile": "9999999999", "redirect_url": "https://yourapp.com/digilocker/callback", "state": "investor_42", "user_flow": "signin"}, "query": {}, "headers": {}, "response": {"authorization_url": "authorization_url-value", "expires_in": 600, "session_id": "3f9a2c1e8b7d4e6fa1c2d3e4f5a6b7c8", "status": "success"}, "response_type": "KycStartDigilockerSessionResponse"}, {"id": "kyc.get_digilocker_result", "resource": "kyc", "method": "get_digilocker_result", "http": "POST", "path": "/v1/kyc/digilocker/result/session_id-value", "args": ["session_id-value"], "kwargs": {"fetch_documents": ["pan", "driving_licence"], "include_documents": true}, "body": {"fetch_documents": ["pan", "driving_licence"], "include_documents": true}, "query": {}, "headers": {}, "response": {"consent": {"consented_at": "2026-05-30T22:37:17+00:00", "purpose": "KYC for loan account opening"}, "consented_documents": ["pan", "driving_licence"], "documents": [{"date": "2024-09-19", "doctype": "PANCR", "issuer": "Income Tax Department", "issuerid": "in.gov.pan", "mime": ["application/pdf", "application/xml"], "name": "PAN Verification Record", "type": "file", "uri": "in.gov.pan-PANCR-xxxxxxxxxxxx"}], "errors": {}, "fetched": {"aadhaar": {"address": "12, MG Road, Indiranagar, Bengaluru, Karnataka, 560038, India", "care_of": "S/O Rajesh Sharma", "dob": "16-05-1990", "gender": "F", "masked_aadhaar": "XXXXXXXX1234", "name": "Anjali Sharma", "photo_base64": "photo_base64-value", "session_id": "session_id-value"}, "driving_licence": {"categories": [{"abbreviation": "abbreviation-value", "code": "code-value", "description": "description-value", "issue_date": "2026-01-15"}], "dl_number": "KA0120190008989", "dob": "1995-03-22", "expiry_date": "2026-01-15", "father_name": "Suresh Sharma", "gender": "M", "issue_date": "2026-01-15", "issued_at": "RTO, Bengaluru", "name": "Rahul Sharma", "permanent_address": "permanent_address-value", "present_address": "present_address-value", "signature": {"certificate": {"issuer": "issuer-value", "serial_number": "serial_number-value", "subject": "C=IN,O=DIGITAL INDIA CORPORATION,CN=DS DIGITAL INDIA CORPORATION", "valid_from": "2026-01-15T10:00:00+00:00", "valid_until": "2026-01-15T10:00:00+00:00"}, "signature_present": true}, "status": "A", "valid_from": "2026-01-15"}, "pan": {"dob": "22-03-1995", "father_name": null, "gender": "MALE", "name": "RAHUL SHARMA", "pan": "ABCPD1234E", "signature": {"certificate": {"issuer": "issuer-value", "serial_number": "serial_number-value", "subject": "C=IN,O=DIGITAL INDIA CORPORATION,CN=DS DIGITAL INDIA CORPORATION", "valid_from": "2026-01-15T10:00:00+00:00", "valid_until": "2026-01-15T10:00:00+00:00"}, "signature_present": true}, "status": "A", "verified_on": "31-05-2026 03:55:02"}}, "identity": {"address": "address-value", "care_of": "S/O Rajesh Sharma", "digilocker_id": "rahul22031995", "dob": "1990-05-16", "email": "anjali@example.com", "gender": "F", "mobile": "98XXXXXX10", "name": "Anjali Sharma", "username": "rahul22031995", "verified": {"aadhaar": "XXXXXXXX1234", "driving_licence": "KA01-20110012345", "pan": "ABCDE1234F"}}, "status": "success"}, "response_type": "KycGetDigilockerResultResponse"}, {"id": "kyc.check_pan_status", "resource": "kyc", "method": "check_pan_status", "http": "POST", "path": "/v1/kyc/pan/status", "args": [], "kwargs": {"pan_no": "ABCDE1234F"}, "body": {"pan_no": "ABCDE1234F"}, "query": {}, "headers": {}, "response": {"active_kra": "cvl", "kras": {"cams": {"kyc_mode": null, "last_updated_on": null, "raw_status": null, "registered_on": null, "remarks": null, "status": "not_checked"}, "cvl": {"kyc_mode": "normal", "last_updated_on": "2026-04-25", "raw_status": "ON HOLD - New KYC", "registered_on": "2026-04-24", "remarks": "APPLICANT PHOTO MISMATCH IN THE APPLICATION,FATCA NOT APPLICABLE", "status": "on_hold"}, "karvy": {"kyc_mode": null, "last_updated_on": null, "raw_status": null, "registered_on": null, "remarks": null, "status": "not_checked"}, "kfin": {"kyc_mode": null, "last_updated_on": null, "raw_status": null, "registered_on": null, "remarks": null, "status": "not_checked"}, "ndml": {"kyc_mode": null, "last_updated_on": null, "raw_status": null, "registered_on": null, "remarks": null, "status": "not_available"}}, "kyc_compliant": false, "kyc_mode": "normal", "kyc_status": "on_hold", "last_updated_on": "2026-04-25", "pan": "XYZPQ9876R", "registered_on": "2026-04-24", "status": "success"}, "response_type": "KycCheckPanStatusResponse"}, {"id": "verification.verify_mfd", "resource": "verification", "method": "verify_mfd", "http": "POST", "path": "/v1/verify/mfd", "args": [], "kwargs": {"arn": "123456"}, "body": {"arn": "123456"}, "query": {}, "headers": {}, "response": {"address": "MG Road, Bengaluru, Karnataka", "arn": "123456", "authority": "AMFI", "category": "mutual-fund-distributor", "category_label": "Mutual Fund Distributor (ARN)", "euin": "E123456", "is_perpetual": false, "kyd_compliant": true, "name": "Example Wealth Distributors LLP", "negative_list": null, "negative_list_hit": false, "pincode": "560001", "registration_status": "ACTIVE", "status": "success", "valid_from": "2024-04-01", "valid_till": "2027-03-31", "verified": true}, "response_type": "VerificationVerifyMfdResponse"}, {"id": "verification.verify_sebi", "resource": "verification", "method": "verify_sebi", "http": "POST", "path": "/v1/verify/sebi", "args": [], "kwargs": {"name": "Motilal Oswal", "registration_number": "INP000000670", "type": "portfolio-manager"}, "body": {"name": "Motilal Oswal", "registration_number": "INP000000670", "type": "portfolio-manager"}, "query": {}, "headers": {}, "response": {"address": "10th Floor, Motilal Oswal Tower, Prabhadevi, MUMBAI, MAHARASHTRA, 400025", "authority": "SEBI", "category": "portfolio-manager", "category_label": "Portfolio Manager (PMS)", "contact_person": null, "detected_by": "registration_number", "email": null, "is_perpetual": true, "name": "MOTILAL OSWAL ASSET MANAGEMENT COMPANY LIMITED", "registration_number": "INP000000670", "registration_status": "ACTIVE", "status": "success", "telephone": null, "valid_from": "2014-09-16", "valid_till": null, "verified": true}, "response_type": "VerificationVerifySebiResponse"}, {"id": "cas_generator.generate_cas", "resource": "cas_generator", "method": "generate_cas", "http": "POST", "path": "/v4/generate", "args": [], "kwargs": {"cas_authority": "cams", "email": "user@example.com", "from_date": "2023-01-01", "pan_no": "ABCDE1234F", "password": "Abcdefghi12$", "to_date": "2023-12-31"}, "body": {"cas_authority": "cams", "email": "user@example.com", "from_date": "2023-01-01", "pan_no": "ABCDE1234F", "password": "Abcdefghi12$", "to_date": "2023-12-31"}, "query": {}, "headers": {}, "response": {"msg": "CAS request submitted. Check email shortly.", "status": "success"}, "response_type": "CasGeneratorGenerateCasResponse"}, {"id": "inbox.read", "resource": "inbox", "method": "read", "http": "POST", "path": "/v4/inbox/read", "args": [], "kwargs": {"x_inbox_token": "x-inbox-token-value", "categories": ["credit"], "document_types": ["card_statement"], "end_date": "2026-10-31", "include_body": true, "senders": ["estatement@examplebank.in"], "sources": ["hdfc_credit_card", "axis_credit_card"], "start_date": "2026-08-01"}, "body": {"categories": ["credit"], "document_types": ["card_statement"], "end_date": "2026-10-31", "include_body": true, "senders": ["estatement@examplebank.in"], "sources": ["hdfc_credit_card", "axis_credit_card"], "start_date": "2026-08-01"}, "query": {}, "headers": {"x-inbox-token": "x-inbox-token-value"}, "response": {"count": 3, "failures": 0, "messages": [{"attachments": [{"attachment_url": "attachment_url-value", "content_type": "application/pdf", "filename": "hdfc_credit_card_20261012_a1b2c3d4e5f6.pdf", "original_filename": "Infinia_Statement_Oct2026.pdf", "size": 245000}], "body": {"html": "html-value", "text": "text-value"}, "category": "credit", "document_type": "card_statement", "institution": "HDFC Bank", "message_date": "2026-10-12", "message_id": "18d4a2b3c4d5e6f7", "sender_email": "emailstatements.cards@hdfcbank.net", "sender_verified": true, "source": "hdfc_credit_card", "subject": "Your HDFC Bank Credit Card Statement for October 2026"}], "status": "success", "truncated": false}, "response_type": "InboxReadResponse"}, {"id": "inbound_email.list_files", "resource": "inbound_email", "method": "list_files", "http": "GET", "path": "/v4/inbound-email/inbound_email_id-value/files", "args": ["inbound_email_id-value"], "kwargs": {"since": "2026-01-15T10:00:00+00:00", "limit": 1}, "body": {}, "query": {"since": "2026-01-15T10:00:00+00:00", "limit": "1"}, "headers": {}, "response": {"count": 1, "cursor": "2025-02-21T10:45:12.000123+00:00", "files": [{"cas_type": "cdsl", "expires_in": 86400, "filename": "cdsl_20250115_a1b2c3d4.pdf", "message_date": "2025-01-15", "message_id": "18d4a2b3c4d5e6f7", "original_filename": "CDSL_CAS_Statement.pdf", "sender_email": "eCAS@cdslstatement.com", "size": 245000, "url": "https://cdn.casparser.in/email-cas/user123/cdsl_20250115_a1b2c3d4.pdf", "received_at": "2025-02-21T10:45:12.000123+00:00"}], "status": "success"}, "response_type": "InboundEmailListFilesResponse"}]'
+)
+
+
+def _check_request(route: respx.Route, case: Dict[str, Any]) -> None:
+ assert route.call_count == 1
+ request = cast(httpx.Request, route.calls[0].request) # pyright: ignore[reportUnknownMemberType]
+ assert request.method == case["http"]
+ assert request.url.path == case["path"]
+ if case["body"]:
+ sent = json.loads(request.content or b"{}")
+ for key, expected in case["body"].items():
+ assert sent.get(key) == expected, key
+ for key, expected in case["query"].items():
+ assert str(request.url.params.get(key)).lower() == expected.lower(), key
+ for key, expected in case["headers"].items():
+ assert request.headers.get(key) == expected, key
+
+
+def _check_response(result: Any, case: Dict[str, Any]) -> None:
+ expected = case["response"]
+ if isinstance(result, BaseModel):
+ # every field of the documented response came back, under its wire name
+ assert set(result.to_dict(use_api_names=True).keys()) == set(expected.keys())
+ elif isinstance(expected, str):
+ # a string response comes back as the response body's text, as the existing string methods do
+ assert result == json.dumps(expected)
+ else:
+ # a list or map response is returned as parsed
+ assert result == expected
+ expected_type = getattr(types, case["response_type"])
+ if isinstance(expected_type, type):
+ assert isinstance(result, expected_type)
+
+
+@pytest.mark.parametrize("case", CASES, ids=[c["id"] for c in CASES])
+@respx.mock
+def test_added_call_sync(case: Dict[str, Any]) -> None:
+ route = respx.route(method=case["http"], url__startswith=base_url + case["path"]).mock(
+ return_value=httpx.Response(200, json=case["response"])
+ )
+ client = CasParser(base_url=base_url, api_key="My API Key", _strict_response_validation=True)
+ method = getattr(getattr(client, case["resource"]), case["method"])
+ result = method(*case["args"], **case["kwargs"])
+ _check_request(route, case)
+ _check_response(result, case)
+
+
+@pytest.mark.parametrize("case", CASES, ids=[c["id"] for c in CASES])
+@respx.mock
+async def test_added_call_async(case: Dict[str, Any]) -> None:
+ route = respx.route(method=case["http"], url__startswith=base_url + case["path"]).mock(
+ return_value=httpx.Response(200, json=case["response"])
+ )
+ client = AsyncCasParser(base_url=base_url, api_key="My API Key", _strict_response_validation=True)
+ method = getattr(getattr(client, case["resource"]), case["method"])
+ result = await method(*case["args"], **case["kwargs"])
+ _check_request(route, case)
+ _check_response(result, case)