From a44a97c761fa1d78ccb76f93044c64e0274615fe Mon Sep 17 00:00:00 2001 From: SudoMock Labs Date: Tue, 22 Sep 2026 16:01:23 +0300 Subject: [PATCH] AccountInfo.organization ekle API anahtarinin ait oldugu organization, id ve ad. Organization paketten export ediliyor. Alan optional ve None varsayiliyor, yani blogu tasimayan bir yanit eskisi gibi parse ediliyor ve AccountInfo'da baska hicbir sey degismiyor. --- CHANGELOG.md | 17 ++++++++++++++++- pyproject.toml | 2 +- src/sudomock/__init__.py | 2 ++ src/sudomock/models.py | 15 ++++++++++++++- tests/test_models.py | 3 +++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8339634..7cf0a0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.12.0] - 2026-09-22 + +### Added +- `AccountInfo.organization`, the organization the API key belongs to, as an + `Organization` with `id` and `name`. `client.account.get()` returns it when + the API sends the block. The field is optional and defaults to `None`, so a + response without it parses exactly as before and nothing else on + `AccountInfo` changes. +- `Organization` is exported from the package. + +### Changed +- `Account` docs: `uuid` identifies the account the API key belongs to. + + ## [0.11.1] - 2026-09-19 ### Fixed @@ -338,7 +352,8 @@ parses is still present and still required. - Typed Pydantic v2 response models, typed exceptions, and tenacity-backed retry with exponential backoff. -[Unreleased]: https://github.com/sudomock/sudomock-python/compare/v0.11.0...HEAD +[Unreleased]: https://github.com/sudomock/sudomock-python/compare/v0.12.0...HEAD +[0.12.0]: https://github.com/sudomock/sudomock-python/compare/v0.11.1...v0.12.0 [0.11.0]: https://github.com/sudomock/sudomock-python/compare/v0.10.0...v0.11.0 [0.10.0]: https://github.com/sudomock/sudomock-python/compare/v0.9.1...v0.10.0 [0.7.0]: https://github.com/sudomock/sudomock-python/compare/v0.6.1...v0.7.0 diff --git a/pyproject.toml b/pyproject.toml index ffe7712..389823c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "sudomock" -version = "0.11.1" +version = "0.12.0" description = "Official Python SDK for the SudoMock Mockup Generator API" readme = "README.md" license = "MIT" diff --git a/src/sudomock/__init__.py b/src/sudomock/__init__.py index 12223d9..dfece5a 100644 --- a/src/sudomock/__init__.py +++ b/src/sudomock/__init__.py @@ -54,6 +54,7 @@ JobList, Mockup, MockupList, + Organization, PhotoMockup, PhotoMockupList, PhotoMockupPrintAreasUpdate, @@ -108,6 +109,7 @@ "JobList", "Mockup", "MockupList", + "Organization", "PhotoMockup", "PhotoMockupList", "PhotoMockupPrintAreasUpdate", diff --git a/src/sudomock/models.py b/src/sudomock/models.py index 22495f6..87a5544 100644 --- a/src/sudomock/models.py +++ b/src/sudomock/models.py @@ -47,7 +47,10 @@ class _Outcome(_Base): class Account(_Base): - """User account information.""" + """User account information. + + ``uuid`` identifies the account the API key belongs to. + """ uuid: str email: str @@ -120,6 +123,13 @@ class ApiKeyInfo(_Base): total_requests: int +class Organization(_Base): + """The organization the API key belongs to.""" + + id: str + name: str + + class AccountInfo(_Base): """Aggregate response for GET /api/v1/me.""" @@ -127,6 +137,9 @@ class AccountInfo(_Base): subscription: Subscription usage: Usage api_key: ApiKeyInfo + # Defaulted, not required, for the same reason as ``Usage.prepaid_balance``: + # a response that predates the block must keep parsing. + organization: Optional[Organization] = None class StudioSessionUi(TypedDict, total=False): diff --git a/tests/test_models.py b/tests/test_models.py index 5b33427..30c510c 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -22,6 +22,7 @@ JobKind, Mockup, MockupList, + Organization, PrintFile, Render, Size, @@ -173,9 +174,11 @@ def test_full_parse(self) -> None: created_at="2025-01-01T00:00:00Z", total_requests=0, ), + organization={"id": "o1", "name": "Acme"}, ) assert info.account.uuid == "u1" assert info.subscription.plan == "free" + assert info.organization == Organization(id="o1", name="Acme") class TestSmartObject: