Metadata-Version: 2.4
Name: ibm-verify-community-sdk
Version: 0.3.0
Summary: A community Python SDK for the IBM Verify API, providing modules for users, factors, applications, authentication methods, password policies, and self-service credentials.
Author: Your Name
Project-URL: Homepage, https://example.com
Project-URL: Repository, https://example.com/repo
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.0
Requires-Dist: python-dotenv>=1.0

# ibm-verify-community-sdk

A Python API client library for IBM Verify.

## Documentation

- [Endpoint Reference](https://github.com/cds-snc/ibm-verify-community-sdk/blob/main/docs/endpoints.md)

## Requirements

- Python 3.9+
- pip

## Installation

```bash
make venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
```

This creates a virtual environment, installs the package in editable mode, and installs `pytest` and `python-dotenv`.

## Quick start

```python
import asyncio

from ibm_verify_community_sdk import IbmVerifyClient

async def main() -> None:
    client = IbmVerifyClient(
        tenant_url="https://your-tenant.verify.ibm.com",
        access_token="your-access-token",
        versions={"users": "v2.0"},
    )

    response = await client.users.get_account_details()
    print(response.data.userName)

    await client.close()

asyncio.run(main())
```

## Available modules

| Module | Access | Version |
|---|---|---|
| `users` | `client.users` | `v1.0`, `v2.0` |
| `factors` | `client.factors` | `v1.0`, `v2.0` |
| `applications` | `client.applications` | `v1.0` |
| `groups` | `client.groups` | `v2.0` |
| `oidc` | `client.oidc` | `v2.0` |
| `reports` | `client.reports` | `v1.0` |
| `authnmethods` | `client.authnmethods` | `v1.0` |
| `passwordpolicies` | `client.passwordpolicies` | `v3.0` |
| `usc` | `client.usc` | `v1.0` |

To use a specific version of a module, pass a `versions` dict when creating the client:

```python
client = IbmVerifyClient(
    tenant_url="https://your-tenant.verify.ibm.com",
    access_token="your-access-token",
    versions={
        "users": "v2.0",
        "factors": "v2.0",
    },
)
```

## Running the example script

```bash
python examples/client_examples.py
```

## Running the functional tests

Functional tests make real API calls and require credentials to be set in a `.env` file.

**First-time setup:**

```bash
make init_env
```

This copies `.env.example` to `.env`. Open `.env` and fill in your values:

```
# Required for all tests
IBM_VERIFY_TENANT_URL=https://your-tenant.verify.ibm.com

# Admin token (required for most tests)
IBM_VERIFY_ACCESS_TOKEN_ADMIN=your-admin-access-token-here

# User token (required for user-scoped tests e.g. get_applications)
IBM_VERIFY_ACCESS_TOKEN_USER=your-user-access-token-here

# Username and password (required for authnmethods tests)
IBM_VERIFY_USERNAME=your-username-here
IBM_VERIFY_PASSWORD=your-password-here

# User ID for user-specific tests
IBM_VERIFY_USER_ID=your-user-id-here

# Contact details for OTP tests
IBM_VERIFY_EMAIL_ADDRESS=user@example.com
IBM_VERIFY_PHONE_NUMBER=+15551234567

# Group ID for groups tests
IBM_VERIFY_GROUP_ID=your-group-id-here

# Application ID for application tests (get, entitlements)
IBM_VERIFY_APPLICATION_ID=your-application-id-here

# Bookmark template ID for create/update/delete application tests
IBM_VERIFY_APP_TEMPLATE_ID=your-bookmark-template-id-here

# OIDC relying party client ID for OIDC tests
IBM_VERIFY_OIDC_CLIENT_ID=your-oidc-client-id-here

# Application ID for report tests
IBM_VERIFY_REPORT_APPID=your-report-app-id-here
```

Tests that require variables not set in `.env` are skipped automatically.

**Run the tests:**

```bash
make test
```

Or run a specific test file:

```bash
python -m pytest tests/function_tests/test_users.py -v
```

If the environment variables are not set, all tests will be skipped automatically.

## Releasing to PyPI

**1. Bump the version** in `pyproject.toml`:

```toml
version = "x.y.z"
```

Follow [Semantic Versioning](https://semver.org/): `major.minor.patch`.

**2. Commit and push:**

```bash
git add pyproject.toml
git commit -m "chore: bump version to x.y.z"
git push origin main
```

**3. Create a GitHub release:**

```bash
gh release create vx.y.z --generate-notes --title "vx.y.z"
```

This creates a tag, generates release notes from merged PRs/commits, and publishes the release on GitHub. The CI pipeline will then automatically build and publish the package to PyPI.
