Add single-item convenience wrappers for bulk partial-success APIs#211
Draft
fredvisser wants to merge 6 commits into
Draft
Add single-item convenience wrappers for bulk partial-success APIs#211fredvisser wants to merge 6 commits into
fredvisser wants to merge 6 commits into
Conversation
Introduce singular convenience methods (create_result, create_step, update_result, update_step, create_product, update_product, create_spec, update_spec, create_test_plan, update_test_plan, schedule_test_plan, create_test_plan_template, create_asset, create_work_item, update_work_item, schedule_work_item, create_work_item_template, update_work_item_template) on their respective client classes. Each method wraps the existing bulk API with a one-element list, then uses the shared unwrap_single_item_partial_success() helper to either return the created/updated item or raise ApiException with the server error details. This eliminates repetitive boilerplate for the common single-item use case while keeping the bulk methods available for batch operations.
This reverts commit eb20730.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Several SystemLink client APIs only expose bulk operations that return partial-success envelopes (
items+failed+error). When callers need to create or update a single item — by far the most common case — they must wrap the call in a list, then manually unpack the response and check for partial failures. This PR eliminates that boilerplate by adding singular convenience methods to six client classes.What changed
TestMonitorClientcreate_result,create_step,update_result,update_stepProductClientcreate_product,update_productSpecClientcreate_spec,update_specTestPlanClientcreate_test_plan,update_test_plan,schedule_test_plan,create_test_plan_templateWorkItemClientcreate_work_item,update_work_item,schedule_work_item,create_work_item_template,update_work_item_templateAssetManagementClientcreate_assetA shared helper
unwrap_single_item_partial_success()(innisystemlink/clients/core/helpers/_partial_success.py) centralizes the unwrap-or-raise logic so each wrapper stays minimal.Why this is beneficial
ApiExceptionwith full error context, rather than silently returning empty lists.Testing
poe check(formatting),poe lint,poe types(mypy, 379 source files),poe test(410 tests passed).