Skip to content

Add structure_response helper to consolidate response deserialization#2024

Merged
iMicknl merged 2 commits intov2/mainfrom
v2/structure_converter
Apr 30, 2026
Merged

Add structure_response helper to consolidate response deserialization#2024
iMicknl merged 2 commits intov2/mainfrom
v2/structure_converter

Conversation

@iMicknl
Copy link
Copy Markdown
Owner

@iMicknl iMicknl commented Apr 30, 2026

Summary

  • Introduces structure_response helper in pyoverkiz/converter.py that combines decamelize + converter.structure into a single call
  • Replaces all repeated converter.structure(decamelize(response), Type) patterns in client.py and tests with the new helper
  • Uses PEP 695 type parameter syntax (def structure_response[T](...))

Test plan

  • All 127 existing model tests pass
  • Ruff linting passes

Copilot AI review requested due to automatic review settings April 30, 2026 20:06
@iMicknl iMicknl requested a review from tetienne as a code owner April 30, 2026 20:06
@iMicknl iMicknl added enhancement New feature or request v2 labels Apr 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates Overkiz API response deserialization by introducing a single helper that decamelizes payloads and structures them via the shared cattrs converter, then updates client + model tests to use it.

Changes:

  • Added structure_response helper in pyoverkiz/converter.py to combine decamelize() + converter.structure().
  • Replaced repeated converter.structure(decamelize(response), T) call sites in pyoverkiz/client.py and tests/test_models.py with structure_response(response, T).
  • Adopted PEP 695 type parameter syntax for the helper signature.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
pyoverkiz/converter.py Adds structure_response to centralize response decamelization + structuring.
pyoverkiz/client.py Refactors multiple endpoint methods to use structure_response for consistent deserialization.
tests/test_models.py Updates model/event structuring tests to use structure_response instead of repeated decamelize+structure patterns.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyoverkiz/converter.py
Comment thread pyoverkiz/converter.py Outdated
@iMicknl iMicknl merged commit f6427e5 into v2/main Apr 30, 2026
6 checks passed
@iMicknl iMicknl deleted the v2/structure_converter branch April 30, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants