Skip to content

Add the 11 endpoints missing from the SDK (KYC, verification, agent auth, CAS generator, inbox read, inbound email files) - #28

Open
kriton-dev wants to merge 2 commits into
CASParser:mainfrom
kriton-dev:add-missing-endpoints
Open

kriton-dev wants to merge 2 commits into
CASParser:mainfrom
kriton-dev:add-missing-endpoints

Conversation

@kriton-dev

Copy link
Copy Markdown

The OpenAPI spec at https://api.casparser.in/openapi.json (v4.0.0) has 31 endpoints and this SDK covers 20 of them. This PR adds the other 11, following the generated code already in the repo: a params type and a response type for each endpoint, sync and async methods with the raw and streaming variants, four new resources wired into both clients, entries in api.md, and tests in the existing pattern (skipped like the rest, since the mock server tests are disabled here). Nothing that is already in the SDK is renamed or removed.

Endpoint New method
GET /v1/agent-auth/token/{token} client.agent_auth.poll()
POST /v1/agent-auth/token/{token}/approve client.agent_auth.approve()
POST /v1/kyc/digilocker/account-lookup client.kyc.lookup_digilocker_account()
POST /v1/kyc/digilocker/session client.kyc.start_digilocker_session()
POST /v1/kyc/digilocker/result/{session_id} client.kyc.get_digilocker_result()
POST /v1/kyc/pan/status client.kyc.check_pan_status()
POST /v1/verify/mfd client.verification.verify_mfd()
POST /v1/verify/sebi client.verification.verify_sebi()
POST /v4/generate client.cas_generator.generate_cas()
POST /v4/inbox/read client.inbox.read()
GET /v4/inbound-email/{inbound_email_id}/files client.inbound_email.list_files()

I generated the code from the spec with my own generator, set up to match the Stainless output in this repo, and then read through the result. ruff check, ruff format --check, strict pyright and mypy, with the versions pinned in requirements-dev.lock, give the same results as main (the one existing mypy error in _utils/_typing.py is unchanged). The full test suite passes, 494 tests, 22 of them in one new file, tests/test_added_calls_stubbed.py. That file calls every new method sync and async against a respx stub and checks the request method, path, body, query and headers against the spec, and that the documented response parses into the new type with strict validation on.

Two other things I noticed. The newest cas-parser-python on PyPI is 1.2.1 from February 14, and the changelog here lists 20 versions since then, up to 1.16.0, so pip install still gets the February build. The PHP SDK's composer.json still has the package name org-placeholder/cas-parser, so it cannot be installed from Packagist by name.

I found this repo while looking at SDKs that stopped getting updates when Stainless shut down its hosted service. The Node, Go and PHP SDKs are missing the same 11 endpoints. Bringing those up to date and keeping all four in sync with the API is paid work I do, and I would be glad to talk about it here. If a smaller review is easier, I can split this into one PR per resource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant