Metadata-Version: 2.5
Name: govcitizenhub-sdk
Version: 2026.1123.1
Summary: Official Python SDK for Govcitizenhub — thin shell over burdenoff-sdk-libs
Project-URL: Homepage, https://github.com/algoshred/govcitizenhub-sdk-python
Project-URL: Documentation, https://docs.algoshred.com/sdk/python
Project-URL: Repository, https://github.com/algoshred/govcitizenhub-sdk-python
Project-URL: Issues, https://github.com/algoshred/govcitizenhub-sdk-python/issues
Project-URL: Changelog, https://github.com/algoshred/govcitizenhub-sdk-python/blob/main/CHANGELOG.md
Author-email: "Vignesh T.V" <vignesh@algoshred.com>
Maintainer-email: "Vignesh T.V" <vignesh@algoshred.com>
License: Copyright (c) 2025 Burdenoff Consultancy Services Private Limited, Algoshred Technologies Private Limited and all sister companies.
        
        All rights reserved.
        
        This software is proprietary and confidential. Unauthorized copying, modification, distribution, or use of this software, via any medium, is strictly prohibited without the express written permission of the copyright holders.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
        For licensing inquiries, please contact: legal@algoshred.com
License-File: LICENSE
Keywords: api-client,burdenoff,citizen-services,e-government,govcitizenhub,graphql,python,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: burdenoff-sdk-libs>=2026.1107.1
Requires-Dist: httpx>=0.24.0
Requires-Dist: typing-extensions>=4.0.0; python_version < '3.11'
Provides-Extra: dev
Requires-Dist: black>=23.0.0; extra == 'dev'
Requires-Dist: flake8>=6.0.0; extra == 'dev'
Requires-Dist: isort>=5.12.0; extra == 'dev'
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: sphinx-autodoc-typehints>=1.19.0; extra == 'docs'
Requires-Dist: sphinx-rtd-theme>=1.2.0; extra == 'docs'
Requires-Dist: sphinx>=6.0.0; extra == 'docs'
Provides-Extra: test
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'test'
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
Requires-Dist: pytest>=7.0.0; extra == 'test'
Requires-Dist: respx>=0.21.0; extra == 'test'
Description-Content-Type: text/markdown

# govcitizenhub-sdk

Official Python SDK for **Govcitizenhub** — a citizen-services / e-government platform on the Burdenoff platform.

The client defaults to the GovCitizenHub production gateways. Workspace queries require a GovCitizenHub account with access to the selected workspace.

This SDK is a **thin shell** over [`burdenoff-sdk-libs`](https://github.com/algoshred/sdk-libs-python). It mounts the shared platform modules plus the Govcitizenhub domain module and a standalone sandbox module, and exposes them as one ergonomic, fully typed client.

## Features

- Async/await throughout, built on `httpx`
- Dual-endpoint GraphQL client (workspace + global gateways)
- 23 mounted modules: the shared generic set + `govcitizenhub` + `sandbox`
- Multiple auth flows: email/password, device code, PKCE, client credentials
- Automatic token refresh
- Typed error hierarchy
- Full type hints with `py.typed` marker

## Installation

```bash
pip install govcitizenhub-sdk

# Development install
pip install -e ".[dev]"
```

## Quick Start

Set `GOVCITIZENHUB_USERNAME`, `GOVCITIZENHUB_PASSWORD`, `GOVCITIZENHUB_WORKSPACE_ID`,
and `GOVCITIZENHUB_ORGANIZATION_ID` for an account that can access the workspace.

```python
import asyncio
import os

from burdenoff_sdk_libs.modules.auth.types import SignInInput

from govcitizenhub_sdk import GovcitizenhubSDK


async def main():
    # Defaults to the shared prod gateways and the burdenoff_cli_govcitizenhub
    # OIDC client. Override the endpoints for local dev.
    sdk = GovcitizenhubSDK()

    try:
        await sdk.auth.sign_in(
            SignInInput(
                username=os.environ["GOVCITIZENHUB_USERNAME"],
                password=os.environ["GOVCITIZENHUB_PASSWORD"],
            )
        )
        await sdk.auth.issue_workspace_token(
            workspace_id=os.environ["GOVCITIZENHUB_WORKSPACE_ID"],
            organization_id=os.environ["GOVCITIZENHUB_ORGANIZATION_ID"],
        )

        agencies = await sdk.govcitizenhub.agencies.list()
        tags = await sdk.tags.list()
        print(f"Found {len(agencies)} agencies and {len(tags.items)} tags")
    finally:
        await sdk.close()


asyncio.run(main())
```

## Nested namespace

Per the platform mandate (no compatibility shim), every module surface is nested
under its owning module. The Govcitizenhub domain bundle keeps its sub-entities
nested:

```python
await sdk.govcitizenhub.agencies.list()
await sdk.govcitizenhub.services.list()
await sdk.govcitizenhub.applications.list()
await sdk.govcitizenhub.documents.list()
await sdk.govcitizenhub.case_notes.list()
await sdk.govcitizenhub.grievances.list()
await sdk.govcitizenhub.permits.list()
await sdk.govcitizenhub.payments.list()
await sdk.govcitizenhub.system.health()
```

## Modules

All methods are async. The following modules are mounted on the `GovcitizenhubSDK`
instance: `auth`, `billing`, `channels`, `conversations`, `devportal`,
`export`, `files`, `govcitizenhub`, `groups`, `health`, `integrations`,
`notifications`, `organizations`, `products`, `rbac`, `sandbox`, `scheduler`,
`security`, `store`, `support`, `tags`, `tours`, `workspaces`.

## Configuration

```python
from govcitizenhub_sdk import GovcitizenhubSDK

sdk = GovcitizenhubSDK(
    workspace_endpoint="https://graphqlworkspaces.burdenoff.com/workspaces/graphql",
    global_endpoint="https://graphql.burdenoff.com/global/graphql",
    client_id="burdenoff_cli_govcitizenhub",   # default
    oidc_issuer=None,                       # derived from global_endpoint
    api_key=None,
    access_token=None,
    refresh_token=None,
    workspace_token=None,
    timeout=30.0,
    auto_refresh=True,
)
```

## Error Handling

```python
from burdenoff_sdk_libs.modules.auth.types import SignInInput

from govcitizenhub_sdk import (
    GovcitizenhubError,
    AuthenticationError,
    AuthorizationError,
    NetworkError,
    ValidationError,
    RateLimitError,
    DeviceCodeExpiredError,
    DeviceCodeDeniedError,
)

try:
    await sdk.auth.sign_in(SignInInput(username=username, password=password))
except AuthenticationError:
    print("Invalid credentials")
except NetworkError:
    print("Could not reach the API")
except GovcitizenhubError as e:
    print(f"SDK error: {e}")
```

## Development

```bash
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

make format        # black + isort
make lint          # flake8
make type-check    # mypy (strict)
make test          # pytest
make sanity        # format-check + lint + type-check + test (cov>=80) + build
```

## License

Proprietary — Copyright Burdenoff Consultancy Services Pvt. Ltd.

## Support

- Issues: [GitHub Issues](https://github.com/algoshred/govcitizenhub-sdk-python/issues)
