Skip to content

Commit f0e8987

Browse files
author
Max Wang
committed
sphinx doc string
1 parent c7daa5e commit f0e8987

12 files changed

Lines changed: 116 additions & 116 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ from azure.identity import (
7676
ClientCertificateCredential,
7777
AzureCliCredential
7878
)
79-
from PowerPlatform.Dataverse import DataverseClient
79+
from PowerPlatform.Dataverse.client import DataverseClient
8080

8181
# Development options
8282
credential = InteractiveBrowserCredential() # Browser authentication
@@ -111,7 +111,7 @@ The SDK provides a simple, pythonic interface for Dataverse operations:
111111

112112
```python
113113
from azure.identity import InteractiveBrowserCredential
114-
from PowerPlatform.Dataverse import DataverseClient
114+
from PowerPlatform.Dataverse.client import DataverseClient
115115

116116
# Connect to Dataverse
117117
credential = InteractiveBrowserCredential()
@@ -285,7 +285,7 @@ For comprehensive information on Microsoft Dataverse and related technologies:
285285
The client raises structured exceptions for different error scenarios:
286286

287287
```python
288-
from PowerPlatform.Dataverse import DataverseClient
288+
from PowerPlatform.Dataverse.client import DataverseClient
289289
from PowerPlatform.Dataverse._core.errors import HttpError, ValidationError
290290

291291
try:

examples/advanced/file_upload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# Uncomment for local development from source
2525
# sys.path.append(str(Path(__file__).resolve().parents[2] / "src"))
2626

27-
from PowerPlatform.Dataverse import DataverseClient
27+
from PowerPlatform.Dataverse.client import DataverseClient
2828
from azure.identity import InteractiveBrowserCredential # type: ignore
2929
import requests
3030

examples/basic/functional_testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from datetime import datetime
3131

3232
# Import SDK components (assumes installation is already validated)
33-
from PowerPlatform.Dataverse import DataverseClient
33+
from PowerPlatform.Dataverse.client import DataverseClient
3434
from PowerPlatform.Dataverse._core.errors import HttpError, MetadataError
3535
from azure.identity import InteractiveBrowserCredential
3636

examples/basic/installation_example.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ def validate_imports():
6767
print("-" * 50)
6868

6969
try:
70-
# Test main namespace import
71-
from PowerPlatform.Dataverse import DataverseClient, __version__
70+
# Test main namespace and client import
71+
from PowerPlatform.Dataverse import __version__
72+
from PowerPlatform.Dataverse.client import DataverseClient
7273

73-
print(f" ✅ Main namespace: PowerPlatform.Dataverse")
74+
print(f" ✅ Namespace: PowerPlatform.Dataverse")
7475
print(f" ✅ Package version: {__version__}")
75-
print(f" ✅ DataverseClient class: {DataverseClient}")
76+
print(f" ✅ Client class: PowerPlatform.Dataverse.client.DataverseClient")
7677

7778
# Test submodule imports
7879
from PowerPlatform.Dataverse._core.errors import HttpError, MetadataError
@@ -176,7 +177,7 @@ def show_usage_examples():
176177
"""
177178
🔧 Basic Setup:
178179
```python
179-
from PowerPlatform.Dataverse import DataverseClient
180+
from PowerPlatform.Dataverse.client import DataverseClient
180181
from azure.identity import InteractiveBrowserCredential
181182
182183
# Set up authentication
@@ -271,7 +272,7 @@ def interactive_test():
271272
return
272273

273274
try:
274-
from PowerPlatform.Dataverse import DataverseClient
275+
from PowerPlatform.Dataverse.client import DataverseClient
275276
from azure.identity import InteractiveBrowserCredential
276277

277278
print(" 🔐 Setting up authentication...")

src/PowerPlatform/Dataverse/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
# Licensed under the MIT license.
33

44
from .__version__ import __version__
5-
from .client import DataverseClient
65

7-
__all__ = ["DataverseClient", "__version__"]
6+
__all__ = ["__version__"]

src/PowerPlatform/Dataverse/_core/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def acquire_token(self, scope: str) -> TokenPair:
5050
Acquire an access token for the specified OAuth2 scope.
5151
5252
:param scope: OAuth2 scope string, typically ``"https://<org>.crm.dynamics.com/.default"``.
53-
:type scope: ``str``
53+
:type scope: :class:`str`
5454
:return: Token pair containing the scope and access token.
5555
:rtype: ~PowerPlatform.Dataverse._core.auth.TokenPair
5656
:raises ~azure.core.exceptions.ClientAuthenticationError: If token acquisition fails.

src/PowerPlatform/Dataverse/_core/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ class DataverseConfig:
2121
Configuration settings for Dataverse client operations.
2222
2323
:param language_code: LCID (Locale ID) for localized labels and messages. Default is 1033 (English - United States).
24-
:type language_code: ``int``
24+
:type language_code: :class:`int`
2525
:param http_retries: Optional maximum number of retry attempts for transient HTTP errors. Reserved for future use.
26-
:type http_retries: ``int`` | ``None``
26+
:type http_retries: :class:`int` or None
2727
:param http_backoff: Optional backoff multiplier (in seconds) between retry attempts. Reserved for future use.
28-
:type http_backoff: ``float`` | ``None``
28+
:type http_backoff: :class:`float` or None
2929
:param http_timeout: Optional request timeout in seconds. Reserved for future use.
30-
:type http_timeout: ``float`` | ``None``
30+
:type http_timeout: :class:`float` or None
3131
"""
3232

3333
language_code: int = 1033

src/PowerPlatform/Dataverse/_core/error_codes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ def http_subcode(status: int) -> str:
8282
Convert HTTP status code to error subcode string.
8383
8484
:param status: HTTP status code (e.g., 400, 404, 500).
85-
:type status: ``int``
85+
:type status: :class:`int`
8686
:return: Error subcode string (e.g., "http_400", "http_404").
87-
:rtype: ``str``
87+
:rtype: :class:`str`
8888
"""
8989
return HTTP_STATUS_TO_SUBCODE.get(status, f"http_{status}")
9090

@@ -97,8 +97,8 @@ def is_transient_status(status: int) -> bool:
9797
503 (Service Unavailable), and 504 (Gateway Timeout).
9898
9999
:param status: HTTP status code to check.
100-
:type status: ``int``
100+
:type status: :class:`int`
101101
:return: True if the status code is considered transient.
102-
:rtype: ``bool``
102+
:rtype: :class:`bool`
103103
"""
104104
return status in TRANSIENT_STATUS

src/PowerPlatform/Dataverse/_core/errors.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ class DataverseError(Exception):
2222
Base structured exception for the Dataverse SDK.
2323
2424
:param message: Human-readable error message.
25-
:type message: ``str``
25+
:type message: :class:`str`
2626
:param code: Error category code (e.g. ``"validation_error"``, ``"http_error"``).
27-
:type code: ``str``
27+
:type code: :class:`str`
2828
:param subcode: Optional subcategory or specific error identifier.
29-
:type subcode: ``str`` | ``None``
29+
:type subcode: :class:`str` | None
3030
:param status_code: Optional HTTP status code if the error originated from an HTTP response.
31-
:type status_code: ``int`` | ``None``
31+
:type status_code: :class:`int` | None
3232
:param details: Optional dictionary containing additional diagnostic information.
33-
:type details: ``dict`` | ``None``
33+
:type details: :class:`dict` | None
3434
:param source: Error source, either ``"client"`` or ``"server"``.
35-
:type source: ``str``
35+
:type source: :class:`str`
3636
:param is_transient: Whether the error is potentially transient and may succeed on retry.
37-
:type is_transient: ``bool``
37+
:type is_transient: :class:`bool`
3838
"""
3939

4040
def __init__(
@@ -62,7 +62,7 @@ def to_dict(self) -> Dict[str, Any]:
6262
Convert the error to a dictionary representation.
6363
6464
:return: Dictionary containing all error properties.
65-
:rtype: ``dict``
65+
:rtype: :class:`dict`
6666
"""
6767
return {
6868
"message": self.message,
@@ -84,11 +84,11 @@ class ValidationError(DataverseError):
8484
Exception raised for client-side validation failures.
8585
8686
:param message: Human-readable validation error message.
87-
:type message: ``str``
87+
:type message: :class:`str`
8888
:param subcode: Optional specific validation error identifier.
89-
:type subcode: ``str`` | ``None``
89+
:type subcode: :class:`str` | None
9090
:param details: Optional dictionary with additional validation context.
91-
:type details: ``dict`` | ``None``
91+
:type details: :class:`dict` | None
9292
"""
9393

9494
def __init__(self, message: str, *, subcode: Optional[str] = None, details: Optional[Dict[str, Any]] = None):
@@ -100,11 +100,11 @@ class MetadataError(DataverseError):
100100
Exception raised for metadata operation failures.
101101
102102
:param message: Human-readable metadata error message.
103-
:type message: ``str``
103+
:type message: :class:`str`
104104
:param subcode: Optional specific metadata error identifier.
105-
:type subcode: ``str`` | ``None``
105+
:type subcode: :class:`str` | None
106106
:param details: Optional dictionary with additional metadata context.
107-
:type details: ``dict`` | ``None``
107+
:type details: :class:`dict` | None
108108
"""
109109

110110
def __init__(self, message: str, *, subcode: Optional[str] = None, details: Optional[Dict[str, Any]] = None):
@@ -116,11 +116,11 @@ class SQLParseError(DataverseError):
116116
Exception raised for SQL query parsing failures.
117117
118118
:param message: Human-readable SQL parsing error message.
119-
:type message: ``str``
119+
:type message: :class:`str`
120120
:param subcode: Optional specific SQL parsing error identifier.
121-
:type subcode: ``str`` | ``None``
121+
:type subcode: :class:`str` | None
122122
:param details: Optional dictionary with SQL query context and parse information.
123-
:type details: ``dict`` | ``None``
123+
:type details: :class:`dict` | None
124124
"""
125125

126126
def __init__(self, message: str, *, subcode: Optional[str] = None, details: Optional[Dict[str, Any]] = None):
@@ -132,27 +132,27 @@ class HttpError(DataverseError):
132132
Exception raised for HTTP request failures from the Dataverse Web API.
133133
134134
:param message: Human-readable HTTP error message, typically from the API error response.
135-
:type message: ``str``
135+
:type message: :class:`str`
136136
:param status_code: HTTP status code (e.g. 400, 404, 500).
137-
:type status_code: ``int``
137+
:type status_code: :class:`int`
138138
:param is_transient: Whether the error is transient (429, 503, 504) and may succeed on retry.
139-
:type is_transient: ``bool``
139+
:type is_transient: :class:`bool`
140140
:param subcode: Optional HTTP status category (e.g. ``"4xx"``, ``"5xx"``).
141-
:type subcode: ``str`` | ``None``
141+
:type subcode: :class:`str` | None
142142
:param service_error_code: Optional Dataverse-specific error code from the API response.
143-
:type service_error_code: ``str`` | ``None``
143+
:type service_error_code: :class:`str` | None
144144
:param correlation_id: Optional correlation ID for tracking requests across services.
145-
:type correlation_id: ``str`` | ``None``
145+
:type correlation_id: :class:`str` | None
146146
:param request_id: Optional request ID from the API response headers.
147-
:type request_id: ``str`` | ``None``
147+
:type request_id: :class:`str` | None
148148
:param traceparent: Optional W3C trace context for distributed tracing.
149-
:type traceparent: ``str`` | ``None``
149+
:type traceparent: :class:`str` | None
150150
:param body_excerpt: Optional excerpt of the response body for diagnostics.
151-
:type body_excerpt: ``str`` | ``None``
151+
:type body_excerpt: :class:`str` | None
152152
:param retry_after: Optional number of seconds to wait before retrying (from Retry-After header).
153-
:type retry_after: ``int`` | ``None``
153+
:type retry_after: :class:`int` | None
154154
:param details: Optional additional diagnostic details.
155-
:type details: ``dict`` | ``None``
155+
:type details: :class:`dict` | None
156156
"""
157157

158158
def __init__(

src/PowerPlatform/Dataverse/_core/http.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ class HttpClient:
2525
management for different HTTP methods.
2626
2727
:param retries: Maximum number of retry attempts for transient errors. Default is 5.
28-
:type retries: ``int`` | ``None``
28+
:type retries: :class:`int` | None
2929
:param backoff: Base delay in seconds between retry attempts. Default is 0.5.
30-
:type backoff: ``float`` | ``None``
30+
:type backoff: :class:`float` | None
3131
:param timeout: Default request timeout in seconds. If None, uses per-method defaults.
32-
:type timeout: ``float`` | ``None``
32+
:type timeout: :class:`float` | None
3333
"""
3434

3535
def __init__(
@@ -50,12 +50,12 @@ def request(self, method: str, url: str, **kwargs: Any) -> requests.Response:
5050
and retries on network errors with exponential backoff.
5151
5252
:param method: HTTP method (GET, POST, PUT, DELETE, etc.).
53-
:type method: ``str``
53+
:type method: :class:`str`
5454
:param url: Target URL for the request.
55-
:type url: ``str``
55+
:type url: :class:`str`
5656
:param kwargs: Additional arguments passed to ``requests.request()``, including headers, data, etc.
5757
:return: HTTP response object.
58-
:rtype: ``requests.Response``
58+
:rtype: :class:`requests.Response`
5959
:raises requests.exceptions.RequestException: If all retry attempts fail.
6060
"""
6161
# If no timeout is provided, use the user-specified default timeout if set;

0 commit comments

Comments
 (0)