# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.4.0] - 2026-01-27

### Added
- **Hezor2SDK** - New SDK for Hezor2 API access with unified interface
- `Hezor2APIClient` - API client inheriting from BaseAPIClient with automatic authentication
- `publish_creation_report()` - Method and convenience function to publish creation reports to Hezor2 webhook
- `Hezor2EnvConfig` - Environment configuration class for Hezor2 SDK settings
- Hezor2 SDK exports creation data models: `CreationGenerateResult`, `CreationWebhookRequest`, `CreationWebhookResponse`

### Changed
- Hezor2SDK follows the same modular architecture as DataHub SDK with separated function files for better maintainability

## [0.3.0] - 2026-01-26

### Added
- Anonymous key fallback for DataAPIClient when `private_key_path` is not provided
- `private_key_pem` parameter to `MetaInfo.to_request_header()` for direct PEM content support
- `CredentialMiddleware` - FastAPI middleware for extracting and validating API key and MetaInfo JWT credentials
- Credential extraction helper functions: `require_api_key()`, `require_meta_info()`, `require_credentials()`, `get_meta_info()`, `get_credentials()`
- `credential_middleware_example.py` - Server example demonstrating credential middleware usage
- `base_sdk_example.py` - Client example demonstrating BaseAPIClient usage with custom client class inheritance

### Changed
- DataAPIClient now automatically uses anonymous private key with warning when `meta_info` is provided but `private_key_path` is None
- MetaInfo.to_request_header() now accepts either `private_key_path` (file) or `private_key_pem` (content)
- **BaseAPIClient**: Changed all HTTP method parameters from `url` to `path` for better clarity (methods now expect paths like "/api/users" instead of full URLs)
- **BaseAPIClient**: Now properly configures `httpx.AsyncClient` with `base_url` parameter
- **DataAPIClient**: Updated to use path-based requests instead of manually concatenating full URLs
- **MetaInfo**: Changed model config from `extra="forbid"` to `extra="ignore"` to allow JWT standard fields (exp, iat, etc.)

### Fixed
- DataAPIClient no longer raises ValueError when using MetaInfo without explicit private key path
- BaseAPIClient now correctly constructs request URLs using the configured base_url
- MetaInfo JWT decoding no longer fails due to standard JWT fields being rejected

### Breaking Changes
- **BaseAPIClient**: All HTTP methods (get, post, put, patch, delete) now use `path` parameter instead of `url`. Update your code to pass paths (e.g., "/api/users") instead of full URLs (e.g., "http://api.example.com/api/users")

## [0.2.0] - 2026-01-25

### Added
- Data models for creations (CreationModel, ChapterModel, SectionModel)
- Creation metadata models (CreationMeta, Author, Contributor)
- Result models for generation (SectionGenerateResult, ChapterGenerateResult)
- Security utilities (JWT, signature)
- DataHub SDK for data transfer operations
- Cache manager utilities
- Short snowflake ID utilities
- Agentic utilities with dependencies management

### Changed
- Updated Python requirement to >= 3.11
- Migrated to Pydantic 2.0+
- Modernized type hints from `Optional[T]` to `T | None` (PEP 604 syntax)

### Breaking Changes
- **Python 3.11+ required**: Dropped support for Python < 3.11. Projects using older Python versions must upgrade.
- **Pydantic 2.0+ migration**: Upgraded from Pydantic 1.x to 2.0+. This may require code changes if you're using Pydantic models from this library:
  - Model configuration uses `model_config` instead of `Config` class
  - Validation behavior may differ in some edge cases
  - See [Pydantic Migration Guide](https://docs.pydantic.dev/latest/migration/) for details

## [0.1.0] - Initial Release

### Added
- Initial project structure
- Basic utilities and data models
- MIT License

[0.4.0]: https://github.com/ericapaeus/hezor_common/releases/tag/v0.4.0
[0.3.0]: https://github.com/ericapaeus/hezor_common/releases/tag/v0.3.0
[0.2.0]: https://github.com/ericapaeus/hezor_common/releases/tag/v0.2.0
[0.1.0]: https://github.com/ericapaeus/hezor_common/releases/tag/v0.1.0
