Skip to content

Release 2.25.0#157

Merged
btoron merged 9 commits intomasterfrom
release/2.25.0
Mar 5, 2026
Merged

Release 2.25.0#157
btoron merged 9 commits intomasterfrom
release/2.25.0

Conversation

@btoron
Copy link
Owner

@btoron btoron commented Mar 5, 2026

Release 2.25.0 (minor)

This release adds async generator support for lazy iteration over large collections in both the metadata and core APIs, and refactors async_client/capacity.py to reduce code duplication.

Changes

Async Generator: get_all_workzonesAsyncOFSMetadata (#112)

Adds get_all_workzones(limit: int = 100) -> AsyncGenerator[Workzone, None] to AsyncOFSMetadata. Lazily paginates all workzones, yielding individual Workzone objects one by one — no need to load the entire list into memory.

async with AsyncOFSC(...) as client:
    async for workzone in client.metadata.get_all_workzones():
        print(workzone.workZoneLabel)

Async Generator: get_all_resourcesAsyncOFSCore (#158)

Applies the same lazy-iteration pattern to resources. Adds get_all_resources(limit, fields, expand_*) to AsyncOFSCoreResourcesMixin. Supports all filter/expand parameters of the underlying get_resources call and handles pagination automatically.

async with AsyncOFSC(...) as client:
    async for resource in client.core.get_all_resources(fields="resourceId,name"):
        process(resource)

Refactor: async_client/capacity.py code deduplication (#152)

Extracts a _to_csv_param() helper to eliminate repeated list-to-CSV conversions across ~10 methods, standardizes model_dump() usage, and cleans up cross-module import of the sync _convert_model_to_api_params().

Closes

Checklist

  • All changes merged into this branch
  • Tests passing
  • Documentation updated
  • CHANGELOG updated

🤖 Generated with Claude Code

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@btoron btoron added the release:minor Triggers minor version tag on merge label Mar 5, 2026
btoron and others added 5 commits March 5, 2026 16:06
Add get_all_workzones(limit=100) async generator that yields individual
Workzone objects one by one, fetching pages on demand via get_workzones().

Implements lazy pagination using a true Python async generator with yield,
reusing existing get_workzones() for consistent error handling.

- Add AsyncGenerator import from collections.abc
- Add 4 mocked tests in TestAsyncGetAllWorkzones
- Regenerate docs/ENDPOINTS.md
- Update README with async generator feature note

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add `_to_csv_param()` static helper to AsyncClientBase supporting CsvList, list[str], and str
- Remove cross-module import of `_convert_model_to_api_params` from sync capacity.py
- Replace 8+ inline isinstance(x, list) CSV conversions with `self._to_csv_param()`
- Migrate update_quota, update_booking_closing_schedule, update_booking_statuses to `_patch_item()`
- Migrate show_booking_grid to `_post_item()`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…plication

Closes #152

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@btoron
Copy link
Owner Author

btoron commented Mar 5, 2026

Closes #152 — refactored async_client/capacity.py to reduce code duplication: extracted _to_csv_param() helper, removed cross-module import from sync capacity.py, and migrated PATCH/POST methods to base class helpers.

btoron and others added 3 commits March 5, 2026 18:48
Implements lazy pagination of all resources using an async generator,
following the same pattern as get_all_workzones (#112).

- Add get_all_resources() to AsyncOFSCoreResourcesMixin in
  ofsc/async_client/core/resources.py, delegating to get_resources()
  with hasMore + offset loop, yielding individual Resource objects
- Pass through all get_resources() params: fields, expand_inventories,
  expand_workskills, expand_workzones, expand_workschedules
- Add TestAsyncGetAllResources (4 mocked tests) to
  tests/async/test_async_resources_get.py
- Update README to mention get_all_resources in async generators section

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…SCore

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@btoron btoron marked this pull request as ready for review March 5, 2026 23:53
@btoron btoron merged commit cc04f22 into master Mar 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:minor Triggers minor version tag on merge

Projects

None yet

1 participant