Skip to content

Commit 2ebfefc

Browse files
tpellissierclaude
andcommitted
Add core result types for fluent API pattern (Phase 1.1)
Introduces foundational types that enable the `.with_detail_response()` fluent API pattern: - RequestMetadata: HTTP request/response metadata for diagnostics (client_request_id, correlation_id, service_request_id, http_status_code, timing_ms) - DataverseResponse[T]: Generic response object with result and telemetry dict - FluentResult[T]: Wrapper enabling fluent pattern - acts like result by default, returns DataverseResponse via .with_detail_response() FluentResult implements magic methods (__iter__, __getitem__, __len__, __eq__, __bool__, __contains__, __hash__) for transparent backward compatibility. Existing OperationResult, CreateResult, UpdateResult, DeleteResult, GetResult, PagedResult types remain unchanged for backward compatibility. Includes comprehensive unit tests (44 tests) covering: - RequestMetadata dataclass behavior - DataverseResponse structure - FluentResult wrapper with all magic methods - Legacy type backward compatibility Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 09ff1fe commit 2ebfefc

3 files changed

Lines changed: 951 additions & 1 deletion

File tree

src/PowerPlatform/Dataverse/core/__init__.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,30 @@
88
configuration, HTTP client, and error handling.
99
"""
1010

11-
__all__ = []
11+
from .results import (
12+
# New fluent API types
13+
RequestMetadata,
14+
DataverseResponse,
15+
FluentResult,
16+
# Legacy types (backward compatible)
17+
OperationResult,
18+
CreateResult,
19+
UpdateResult,
20+
DeleteResult,
21+
GetResult,
22+
PagedResult,
23+
)
24+
25+
__all__ = [
26+
# New fluent API types
27+
"RequestMetadata",
28+
"DataverseResponse",
29+
"FluentResult",
30+
# Legacy types (backward compatible)
31+
"OperationResult",
32+
"CreateResult",
33+
"UpdateResult",
34+
"DeleteResult",
35+
"GetResult",
36+
"PagedResult",
37+
]

0 commit comments

Comments
 (0)