Skip to content

Build a standard NextGenSwitch Python SDK - #1

Merged
masum0009 merged 3 commits into
mainfrom
agent/standard-python-sdk
Jul 18, 2026
Merged

Build a standard NextGenSwitch Python SDK#1
masum0009 merged 3 commits into
mainfrom
agent/standard-python-sdk

Conversation

@masum0009

Copy link
Copy Markdown
Contributor

Summary

Builds the first standard Python SDK for the official NextGenSwitch Programmable Voice API.

API clients

  • Adds typed synchronous and asynchronous clients using HTTPX
  • Implements create-call requests with inline XML or a hosted response URL
  • Implements active-call modification through PUT /api/v1/call/{call_id}
  • Sends the documented authentication headers
  • Supports injected HTTPX clients/transports for custom networking and deterministic testing
  • Adds context-manager lifecycle, configurable timeouts, safe call-ID encoding, response decoding, and transport errors

Voice XML

  • Adds an ElementTree-backed fluent builder with automatic XML escaping
  • Supports Say, Play, Gather, Dial, Record, Connect/Stream, Hangup, Pause, Redirect, Bridge, and Leave
  • Supports nested Say and Play instructions and Stream parameters

Typed SDK behavior

  • Adds immutable ApiResponse, GatherResult, and DialResult models
  • Adds ApiError, ValidationError, TransportError, and base NextGenSwitchError
  • Ships a py.typed marker for downstream type checking

Package quality

  • Adds modern pyproject.toml packaging for Python 3.9+
  • Adds Ruff, strict MyPy, pytest, build, and Twine validation
  • Adds tests for sync/async requests, authentication, XML generation and escaping, call modification, errors, and callbacks
  • Adds GitHub Actions across Python 3.9–3.13
  • Adds MIT license, README, and practical create, modify, record, and AI-streaming examples

Documentation source

Implementation follows the official NextGenSwitch Programmable Voice API documentation.

Validation

  • Local Python 3.12 checks passed: compile, Ruff, strict MyPy, pytest, wheel/sdist build, and Twine metadata validation
  • GitHub Actions will repeat validation across Python 3.9–3.13
  • This PR remains an unmerged draft

@masum0009
masum0009 marked this pull request as ready for review July 18, 2026 08:33
@masum0009
masum0009 merged commit ed032b9 into main Jul 18, 2026
10 checks passed
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