diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md
index 8b990e92..23719087 100644
--- a/.github/copilot-instructions.md
+++ b/.github/copilot-instructions.md
@@ -2,7 +2,7 @@
## Overview
-This repository contains the Python SDK for Azure Connectors. Code must follow Python best practices (PEP 8, PEP 484) and the team's conventions for async/await patterns, type safety, and API design.
+This repository contains the Python SDK for Azure Connectors. Code must follow Python best practices (PEP 8, PEP 484) and the team's conventions for async-only APIs, type safety, and API design.
## Client Refresh and Review
@@ -13,6 +13,9 @@ This repository contains the Python SDK for Azure Connectors. Code must follow P
- Capture known response data directly in semantic variables, without redundant `result` aliases or duplicated conditions. Check the actual returned shape after regeneration; an item list is not a response dictionary.
- Preserve nullable-response guards such as `response and response.get(...)`; they are not duplicate conditions. Test non-pageable consumers with `None`, empty dictionaries, and populated responses separately. Do not simplify conditions by matching text prefixes.
- Execute changed samples with empty and nonempty mocked results and assert their output, including absence of caught-and-printed errors. Pagination tests must exercise continuation requests, later-page items, and termination, including an empty initial page with a next link.
+- Generate one async-only client and its models in `azure.connectors.`. Do not add synchronous mirrors or a duplicate `.aio` catalog.
+- Use unsuffixed operation names. Pageable operations return `AsyncItemPaged`; retained Location-backed long-running operations return `AsyncLROPoller` after awaiting `begin_*`.
+- Keep direct connector imports and lazy package-root client exports. Do not eagerly import every generated module from package `__init__.py`.
## Quick Reference: Coding Style Rules
@@ -397,31 +400,28 @@ When adding a new connector client to the SDK, use the **add-connector** skill (
### Steps
-1. **Create the connector module** in `src/azure/connectors/`:
- - File name should match the connector API name (e.g., `office365.py`, `sharepointonline.py`)
+1. **Generate one async-only root connector** using the live-download procedure in `GENERATION.md`:
+ - `src/azure/connectors/.py` owns the client, models, and trigger metadata
+ - Do not create a synchronous mirror or an `azure.connectors.aio` module
-2. **Implement the client class** following existing patterns:
- ```python
- from azure.connectors.sdk import ConnectorClient
-
- class Office365Client(ConnectorClient):
- """Client for Office 365 connector operations."""
-
- async def send_email(self, ...) -> EmailResponse:
- ...
- ```
+2. **Verify direct imports** from the root connector module:
-3. **Export from `__init__.py`** — add the new client to `src/azure/connectors/__init__.py`
+ ```python
+ from azure.connectors.office365 import Office365Client, SendEmailInput
+ ```
+
+3. **Keep package exports lazy** — regenerate `src/azure/connectors/_client_registry.py` and `src/azure/connectors/__init__.pyi` with the connector inventory. Preserve the lazy loader in `src/azure/connectors/__init__.py`; do not add eager generated-client barrel imports or try/except imports that replace broken clients with `None`.
4. **Update `README.md`** — add the connector to the "Validated Connectors" table with status (`✅ E2E Validated` or `🔄 SDK Generated`) and test count
-5. **Add unit tests** — create `test_.py` in `tests/` following the pattern of existing tests:
- - Constructor tests
- - Method tests with mocked responses
- - Error handling tests
- - Type serialization round-trips
+5. **Add unit tests** — create `test_.py` in `tests/` for the root async client:
+ - Constructor options, `await client.close()`, and `async with` lifecycle
+ - Unsuffixed operations, mocked success and error responses, and serialization round-trips
+ - `AsyncItemPaged` iteration without awaiting construction, including continuation and empty pages
+ - Retained Location-backed operations: await `begin_*` for an `AsyncLROPoller`, then await `poller.result()` while the client remains open
+ - Direct imports and lazy package-root exports agree with the generated registry and type stub
-6. **Create sample usage file** — create `sample_connector_usage_.py` in `samples/sample_connector_usage/` following the pattern of existing samples (port from .NET if available)
+6. **Create one async sample** under `samples/sample_connector_usage/`. Use root connector imports, `azure.identity.aio` credentials, `async with`, and `await`. End the `__main__` guard with `asyncio.run(main())`, not an extra bare `main()` call.
7. **Update `samples/sample_connector_usage/README.md`** — add the new sample to the samples table
@@ -439,10 +439,13 @@ When adding a new connector client to the SDK, use the **add-connector** skill (
- [ ] Client class has proper type hints on all public methods
- [ ] Docstrings present on class and all public methods
- [ ] Existing connector tests still pass (no regressions)
-- [ ] New connector tests cover: constructor, mocked success, mocked error, exception handling
-- [ ] Module exported in `__init__.py`
+- [ ] New connector tests cover constructor options, async lifecycle, mocked responses, exceptions, and serialization
+- [ ] One root module owns the async-only client, models, and trigger metadata; no sync or aio mirror exists
+- [ ] Unsuffixed operations use `AsyncItemPaged` and awaited `AsyncLROPoller` contracts where applicable
+- [ ] Generated client registry and package type stub match; package-root exports remain lazy and import failures propagate
- [ ] README.md connector table updated
-- [ ] Sample file created and compiles without errors
+- [ ] One async sample imports public root types and compiles without errors
+- [ ] Offline sample tests check output for empty and nonempty results and run the actual main guard without unawaited coroutine warnings
- [ ] Samples README updated
- [ ] CHANGELOG.md updated
- [ ] Connection setup skill updated
diff --git a/.github/skills/add-connector/SKILL.md b/.github/skills/add-connector/SKILL.md
index ab9e9e22..e6571c99 100644
--- a/.github/skills/add-connector/SKILL.md
+++ b/.github/skills/add-connector/SKILL.md
@@ -1,6 +1,6 @@
---
name: add-connector
-description: 'Add a new connector to the Azure Connectors Python SDK. USE WHEN: adding a new connector client, scaffolding connector files, creating unit tests, updating __init__.py exports, updating README status table, creating sample usage files. Covers the full workflow from connector file creation through test validation. NOT FOR: modifying existing connectors, connection setup, or trigger registration.'
+description: 'Add a new connector to the Azure Connectors Python SDK. USE WHEN: adding a generated async-only root connector, creating async unit tests and samples, or updating connector documentation. Covers the full workflow from generation through validation. NOT FOR: modifying existing connectors, connection setup, or trigger registration.'
argument-hint: 'Provide the connector name (e.g., "dynamics365", "servicenow")'
---
@@ -17,8 +17,8 @@ Automates the complete workflow for adding a new connector to the Azure Connecto
## Prerequisites
-- The connector module file (e.g., `dynamics365.py`) is provided or needs to be created
-- The connector follows the `ConnectorClientBase` pattern
+- The connector can be generated as one async root module
+- The client follows the async `ConnectorClientBase` runtime patterns
- A .NET sample exists to port to Python (optional)
## Procedure
@@ -39,9 +39,11 @@ Collect the following details from the user:
### Step 2: Create/Verify Connector Module
-Ensure the connector file exists at `src/azure/connectors/{connector_name}.py`.
+Generate one async root module from CodefulSdkGenerator:
-The connector must follow this structure:
+- `src/azure/connectors/{connector_name}.py`
+
+The root connector owns models, metadata, and the async-only client:
```python
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -74,21 +76,22 @@ class {ClientClassName}(ConnectorClientBase):
def connector_name(self) -> str:
return "{connector_name}"
- # ... async methods ...
+ # ... asynchronous unsuffixed methods ...
```
-### Step 3: Update `__init__.py` Exports
-
-Add the connector import to `src/azure/connectors/__init__.py`:
+The module defines models, aliases, enums, and `TRIGGER_OPERATIONS`. Its client
+uses `AsyncTokenCredential` and `AsyncHttpTransport`. Pageable operations return
+`AsyncItemPaged` without awaiting construction. Await `begin_*` operations to
+obtain an `AsyncLROPoller`. Do not create a synchronous mirror.
-```python
-try:
- from .{connector_name} import {ClientClassName}
-except (ImportError, NameError):
- {ClientClassName} = None # type: ignore[assignment,misc]
-```
+### Step 3: Keep Package Initializers Minimal
-Also add to the `__all__` list if present.
+Consumers import clients and models directly from each root connector module.
+Regenerate `src/azure/connectors/_client_registry.py` and
+`src/azure/connectors/__init__.pyi` with the connector inventory; do not hand-edit
+generated package exports. Preserve the lazy loader in
+`src/azure/connectors/__init__.py`. Do not add eager generated-client barrel
+imports or try/except imports that replace failed clients with `None`.
### Step 4: Update README Connector Table
@@ -113,9 +116,9 @@ from unittest.mock import AsyncMock, patch
import pytest
from azure.core.credentials import AzureKeyCredential
+from azure.connectors.{connector_name} import {ClientClassName}
from azure.connectors.{connector_name} import (
- {ClientClassName},
- # Import all public dataclasses from the connector
+ {RequestModelName},
)
from azure.connectors.sdk import ConnectorException
from tests.conftest import MockResponse
@@ -197,7 +200,7 @@ class Test{ClientClassName}Lifecycle:
with patch.object(client._http_client, 'close', new_callable=AsyncMock) as mock_close:
await client.close()
- mock_close.assert_called_once()
+ mock_close.assert_awaited_once()
@pytest.mark.asyncio
async def test_context_manager(self, mock_credential):
@@ -209,14 +212,14 @@ class Test{ClientClassName}Lifecycle:
) as client:
assert isinstance(client, {ClientClassName})
- mock_close.assert_called_once()
+ mock_close.assert_awaited_once()
# Add test classes for each public method in the connector
# Follow the pattern:
#
# class Test{MethodName}:
-# """Tests for {method_name}_async method."""
+# """Tests for {method_name} on the root async client."""
#
# @pytest.mark.asyncio
# async def test_success(self, mock_credential):
@@ -230,16 +233,26 @@ class Test{ClientClassName}Lifecycle:
```
**Required test categories:**
+
1. **Initialization tests** — constructor, URL handling, options, error cases
-2. **Lifecycle tests** — close(), context manager
-3. **Method tests** — one class per public async method with:
- - Success case with mocked response
- - Parameter handling tests
- - Error response handling
+2. **Lifecycle tests** — `await client.close()`, `async with`, and awaited cleanup
+3. **Method tests** — exercise root async operations with:
+ - Success cases with asynchronous mocked responses
+ - Keyword-only optional parameters and request controls
+ - Azure Core error response handling
+ - Models declared in the same root module
+ - `AsyncItemPaged` iteration without awaiting construction, including continuation requests, empty pages, later-page items, and termination
+ - Retained Location-backed operations: await `begin_*` for an `AsyncLROPoller`, then await `poller.result()` while the client remains open
+4. **Export tests** — direct imports and lazy package-root clients match the generated registry and type stub; broken imports raise instead of returning `None`
### Step 6: Create Sample Usage File
-Create `samples/sample_connector_usage/sample_connector_usage_{connector_name}.py`:
+Create one async sample file:
+
+- `samples/sample_connector_usage/sample_connector_usage_{connector_name}.py`
+
+Use `azure.identity.aio.DefaultAzureCredential`, import the client from its root
+connector module, and retain `async with` and `await`:
```python
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -268,9 +281,9 @@ import asyncio
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.{connector_name} import {ClientClassName}
from azure.connectors.{connector_name} import (
- {ClientClassName},
- # Import relevant dataclasses for the examples
+ {RequestModelName},
)
# Connection runtime URL format:
@@ -285,12 +298,12 @@ async def example_1_basic_operation():
"""Example 1: Basic connector operation."""
print("\n=== Example 1: Basic Operation ===")
- credential = DefaultAzureCredential()
-
- async with {ClientClassName}(CONNECTION_RUNTIME_URL, credential) as client:
+ async with DefaultAzureCredential() as credential, {ClientClassName}(
+ CONNECTION_RUNTIME_URL, credential
+ ) as client:
try:
# Call a basic read operation
- result = await client.{example_method}_async()
+ result = await client.{example_method}()
print(f"Result: {{result}}")
@@ -304,12 +317,12 @@ async def example_2_advanced_operation():
"""Example 2: Advanced connector operation."""
print("\n=== Example 2: Advanced Operation ===")
- credential = DefaultAzureCredential()
-
- async with {ClientClassName}(CONNECTION_RUNTIME_URL, credential) as client:
+ async with DefaultAzureCredential() as credential, {ClientClassName}(
+ CONNECTION_RUNTIME_URL, credential
+ ) as client:
try:
# Call a write or complex operation
- # result = await client.{another_method}_async(...)
+ # result = await client.{another_method}(...)
print("Advanced operation completed")
except ConnectorException as ex:
@@ -338,10 +351,11 @@ if __name__ == "__main__":
```
**When porting from .NET:**
+
1. Find the corresponding .NET sample
-2. Translate each example method to Python async/await syntax
+2. Create one asynchronous example under the conventional root sample path
3. Convert C# types to Python dataclasses
-4. Use `async with` for client lifecycle
+4. Use `async with` for client and credential lifecycle
5. Handle exceptions with `ConnectorException`
### Step 7: Update Samples README
@@ -385,16 +399,19 @@ Supported SDK connector names: `arm`, `azuread`, ..., `{connector_name}`, ... (a
### Step 10: Run Tests
-Execute the full test suite to validate:
+Start with focused connector and lazy-export tests from the repository root:
```powershell
-.\.venv\Scripts\python -m pytest tests/test_{connector_name}.py tests/test_code_quality.py -v --tb=short
+$env:PYTHONPATH = (Join-Path $PWD "src")
+.\.venv\Scripts\python -m pytest tests/test_{connector_name}.py tests/test_root_client_exports.py -v --tb=short
```
**Required checks:**
-- [ ] All tests pass
-- [ ] No import errors
-- [ ] Code quality tests pass (imports, structure)
+
+- [ ] Focused tests pass against this checkout, not another editable installation
+- [ ] Direct client/model imports work and resolve under this checkout's `src` directory
+- [ ] Generated registry and type stub agree; package import does not eagerly load connectors
+- [ ] Full tests and code quality checks pass before submitting the connector PR
### Step 11: Validate Sample Syntax
@@ -403,30 +420,40 @@ python -m py_compile samples/sample_connector_usage/sample_connector_usage_{conn
.\.venv\Scripts\python.exe -m flake8 samples/sample_connector_usage/sample_connector_usage_{connector_name}.py --max-line-length=100
```
+Run the sample offline with empty and nonempty mocked responses and assert its
+output contains no caught-and-printed errors. Test its actual parsed `__main__`
+guard with the example functions mocked by `AsyncMock`, leaving `main()` and
+`asyncio.run()` intact. Assert each example is awaited once and no unawaited
+coroutine warning occurs. Keep only `asyncio.run(main())` in the guard.
+
## Checklist
Before completing, verify:
- [ ] `src/azure/connectors/{connector_name}.py` exists with proper structure
-- [ ] `src/azure/connectors/__init__.py` updated with try/except import
+- [ ] One async-only root module owns the client, models, and trigger metadata; no sync or aio mirror exists
+- [ ] Generated `_client_registry.py` and `__init__.pyi` agree with the connector inventory
+- [ ] Package-root exports remain lazy; no eager barrel imports or failed-client `None` placeholders
- [ ] `README.md` connector table updated with correct status and test count
-- [ ] `tests/test_{connector_name}.py` created with comprehensive tests
-- [ ] `samples/sample_connector_usage/sample_connector_usage_{connector_name}.py` created
+- [ ] `tests/test_{connector_name}.py` covers async lifecycle, operations, serialization, and applicable `AsyncItemPaged` / `AsyncLROPoller` behavior
+- [ ] One async sample exists at `samples/sample_connector_usage/sample_connector_usage_{connector_name}.py`
- [ ] `samples/sample_connector_usage/README.md` updated
- [ ] `CHANGELOG.md` updated with new connector in `[Unreleased]` section
- [ ] `.github/skills/connection-setup/SKILL.md` Step 2 updated with connector API name
- [ ] All tests pass
- [ ] Sample file compiles without errors
+- [ ] Offline sample checks cover empty and nonempty output and the actual main guard without unawaited coroutines
## Files Modified
| File | Change |
|------|--------|
-| `src/azure/connectors/{connector_name}.py` | New connector module |
-| `src/azure/connectors/__init__.py` | Add export |
+| `src/azure/connectors/{connector_name}.py` | New async-only root connector module |
+| `src/azure/connectors/_client_registry.py` | Regenerate the lazy client registry |
+| `src/azure/connectors/__init__.pyi` | Regenerate package-root type exports |
| `README.md` | Add to connector table |
| `tests/test_{connector_name}.py` | New test file |
-| `samples/sample_connector_usage/sample_connector_usage_{connector_name}.py` | New sample |
+| `samples/sample_connector_usage/sample_connector_usage_{connector_name}.py` | One async sample |
| `samples/sample_connector_usage/README.md` | Add to samples table |
| `CHANGELOG.md` | Add to `[Unreleased]` section |
| `.github/skills/connection-setup/SKILL.md` | Add connector name to Step 2 |
@@ -435,7 +462,12 @@ Before completing, verify:
### Import Error in `__init__.py`
-If the connector has undefined type references, the try/except wrapper handles it gracefully. The connector will be `None` until fixed.
+The package root loads a client only when requested. Import failures must
+propagate; never hide a broken connector behind a try/except import or assign
+its client to `None`. Check direct connector imports, fix undefined references
+in CodefulSdkGenerator, then regenerate the connector, registry, and type stub.
+Do not hand-edit generated output or eagerly import all clients to bypass the
+lazy loader.
### Test Discovery
diff --git a/.github/skills/connection-setup/SKILL.md b/.github/skills/connection-setup/SKILL.md
index eb3102da..640f8fb5 100644
--- a/.github/skills/connection-setup/SKILL.md
+++ b/.github/skills/connection-setup/SKILL.md
@@ -178,21 +178,29 @@ az rest --method GET --uri "$runtimeUrl/v2/datasets" --resource "https://apihub.
## Next Steps
-- **SDK usage:** Use the connection runtime URL with a caller-owned async Azure credential:
- ```python
- from azure.identity.aio import DefaultAzureCredential
-
- from azure.connectors.office365 import Office365Client, SendEmailInput
-
- async with DefaultAzureCredential() as credential:
- async with Office365Client(runtime_url, credential) as client:
- await client.send_email_async(
- input=SendEmailInput(
- to="recipient@example.com",
- subject="Hello",
- body="Sent with Azure Connectors.",
- )
- )
- ```
+### SDK Usage
+
+Use the connection runtime URL with a caller-owned async Azure credential.
+Root clients are async-only:
+
+```python
+from azure.identity.aio import DefaultAzureCredential
+
+from azure.connectors.office365 import Office365Client, SendEmailInput
+
+async with DefaultAzureCredential() as credential:
+ async with Office365Client(runtime_url, credential) as client:
+ await client.send_email(
+ input=SendEmailInput(
+ to="recipient@example.com",
+ subject="Hello",
+ body="Sent with Azure Connectors.",
+ )
+ )
+```
+
+Clients and models share the root connector module. Use `azure.identity.aio`
+credentials and await unsuffixed operations. No synchronous mirror is provided.
+
- **Azure Functions triggers:** To register connector triggers (e.g., OnNewEmail, OnNewFile) for Azure Functions, use the [trigger-registration skill](../trigger-registration/SKILL.md).
- **Azure Functions signatures:** For a complete mapping of trigger operations to Azure Functions signatures, see [Operations to Functions Signature Match](https://github.com/Azure/azure-functions-connector-extension/blob/main/docs/operations-functions-match.md).
diff --git a/.github/skills/trigger-registration/SKILL.md b/.github/skills/trigger-registration/SKILL.md
index 99b432d0..e3c2e65b 100644
--- a/.github/skills/trigger-registration/SKILL.md
+++ b/.github/skills/trigger-registration/SKILL.md
@@ -295,20 +295,21 @@ az functionapp log tail -g $resourceGroup -n $functionAppName
## Using the SDK for Actions (Beyond Triggers)
-The `azure-connectors` package provides typed async clients for calling connector actions directly from Python applications. Generated clients require a caller-owned asynchronous Azure Identity credential or an `AzureKeyCredential`.
+The `azure-connectors` package provides async-only root clients for calling connector actions directly from Python applications. Clients accept caller-owned `AsyncTokenCredential` or `AzureKeyCredential` credentials; no synchronous mirror is provided.
### Example: Send an email
```python
from azure.identity.aio import DefaultAzureCredential
-from azure.connectors.office365 import Office365Client, SendEmailInput
+from azure.connectors.office365 import Office365Client
+from azure.connectors.office365 import SendEmailInput
async def main(connection_url: str):
async with DefaultAzureCredential() as credential:
async with Office365Client(connection_url, credential) as client:
- await client.send_email_async(
+ await client.send_email(
input=SendEmailInput(
to="recipient@example.com",
subject="Hello from Python SDK",
@@ -330,7 +331,7 @@ async def list_items(connection_url: str):
async with SharepointonlineClient(connection_url, credential) as client:
items = [
item
- async for item in client.get_items_async(
+ async for item in client.list_items(
dataset="https://contoso.sharepoint.com/sites/MySite",
table="MyList",
)
@@ -342,7 +343,8 @@ async def list_items(connection_url: str):
### Authentication Options
-Use `DefaultAzureCredential` or `ManagedIdentityCredential` from `azure.identity.aio` for token authentication. Use `AzureKeyCredential` from `azure.core.credentials` when the connection runtime expects an API key. The caller owns asynchronous credentials and must close them.
+Use credentials from `azure.identity.aio`. Use `AzureKeyCredential` from `azure.core.credentials` when the connection runtime expects an API key. The caller owns async credentials and must close them with `async with` or `await credential.close()`.
+
### E2E Validated Connectors
| Connector | Package | Status |
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f1c823e3..9240b001 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,25 +9,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
+- **Mapping-compatible model inputs** — generated request bodies and nested model fields now accept either generated dataclasses or arbitrary `Mapping` implementations.
+- **Azure Core long-running operations** — generated Kusto and Plumsail operations with an HTTP 202 `Location` polling contract now use awaited `begin_*` methods returning `AsyncLROPoller`. Polling honors `Retry-After` and forwards operation request controls.
- **Generated API documentation site** — adds a MkDocs Material reference for the core SDK and every shipped connector module, strict source-to-site coverage validation, and a GitHub Pages deployment workflow for `main`.
- **Zoho ZeptoMail generated client** — adds five public mail-agent, send-mail, template-mail, and analytics actions. `SendTemplateMailInput.merge_key_detail` remains `List[Dict[str, Any]]` so fixed string fields and arbitrary non-string merge values stay representable. The malformed Swagger type `ReplyToAddresss` is exposed as `ReplyToAddress` without changing the `reply_to` wire field.
### Breaking Changes
-- **Generated clients now use the asynchronous Azure Core pipeline** — every client requires a caller-owned `AsyncTokenCredential` or `AzureKeyCredential`. The legacy token-provider classes and `ConnectorClientOptions` have been removed; retry, timeout, transport, and policy settings are passed directly to the client. Operations also expose keyword-only `timeout`, `headers`, `client_request_id`, and `response_hook` controls.
+- **Swagger-required model fields are now required constructor arguments** — generated dataclasses no longer default required properties to `None`.
+- **Read collection operations now return Azure Core pagers** — bounded read collections without continuation metadata use `AsyncItemPaged`; mutation and action arrays remain eager operation payloads.
+- **Client timeout configuration now uses `timeout`** — generated async
+ client constructors use the same keyword as per-operation request controls.
+- **Location-backed operations now return pollers** — 44 Kusto and Plumsail operations move from immediate operation names to `begin_*`. Await the call and `poller.result()` while the connector client remains open.
+- **Generated operations now use unsuffixed names** — async-only clients remain in `azure.connectors.`. Remove `_async` from operation calls while retaining `await`; no synchronous mirror is provided.
+- **Pageable operations now return Azure Core pagers** — root clients return `AsyncItemPaged`. Pager construction is not awaited; use `async for` or `by_page(continuation_token=...)` for page boundaries.
+- **Generated models have one owner** — import dataclasses, aliases, enums, and `TRIGGER_OPERATIONS` from the root `azure.connectors.` module alongside its async client.
+- **Generated clients now use Azure Core pipelines** — clients require a caller-owned `AsyncTokenCredential` or `AzureKeyCredential`. The legacy token-provider classes and `ConnectorClientOptions` have been removed; retry, timeout, `AsyncHttpTransport`, and policy settings are passed directly to the client. Operations also expose keyword-only `timeout`, `headers`, `client_request_id`, and `response_hook` controls.
- **Automatic retries are now method-safe by default** — `GET`, `HEAD`, `OPTIONS`, and `TRACE` retain configured retries. `POST`, `PUT`, `PATCH`, `DELETE`, and unknown methods make one attempt for transient responses and transport errors. Set `retry_unsafe_http_methods=True` directly on a generated client only when replay is acceptable; retry count, timeout, and backoff settings are also direct client keyword arguments. ([#85](https://github.com/Azure/connectors-python-sdk/issues/85))
-- Jira `list_issues_async` now exposes the live optional `fields` query parameter
+- Jira `list_issues` now exposes the live optional `fields` query parameter
instead of sending an internal `fields=*all` default. Pass `fields` and
`next_page_token` by keyword; `fields` precedes the token in the generated signature.
-- This regeneration propagates the async-iterator paging contract to 32 additional
+- This regeneration propagates the Azure Core paging contract to 32 additional
connectors, extending [Fix Dataverse list pagination (#84)](https://github.com/Azure/connectors-python-sdk/pull/84).
- Pageable operations return items rather than response dictionaries. Consume them
- with `async for`, or collect them with
- `[item async for item in client.get_items_async(...)]`; samples use this contract.
+ Pageable operations return items rather than response dictionaries. Iterate
+ pagers with `async for`; samples use this contract.
- Seismic Planner `CustomPropertyValues.localizations` now exposes `Dict[str, CustomPropertyDataDisplay]` instead of `Dict[str, Any]`. Callers can access typed values directly, such as `localizations["en-US"].name`. ([Azure/Connectors-NET-SDK#262](https://github.com/Azure/Connectors-NET-SDK/issues/262), AzureUX-BPM PR 17131877)
-- Microsoft Dataverse `get_items_async` now returns an `AsyncIterator[dict[str, Any]]`. Callers must use `async for` instead of awaiting a single response dictionary; iteration preserves and follows `@odata.nextLink` until all rows are returned. ([Azure/Connectors-NET-SDK#208](https://github.com/Azure/Connectors-NET-SDK/issues/208), AzureUX-BPM PR 17086991)
+- Microsoft Dataverse collection operations now return `AsyncItemPaged[dict[str, Any]]` from root clients. Iterate instead of awaiting a single response dictionary; paging preserves and follows `@odata.nextLink` until all rows are returned. ([Azure/Connectors-NET-SDK#208](https://github.com/Azure/Connectors-NET-SDK/issues/208), AzureUX-BPM PR 17086991)
- Regenerated all 99 supported connector clients from current live managed connector metadata using the Azure Core contract generator.
- Corrected generated parameter types across connector operations, including pagination values, numeric identifiers, and Boolean options. Callers must now pass the annotated `int` and `bool` values instead of string representations.
@@ -35,6 +44,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+- Generated async operations now document their arguments, return types,
+ connector operation IDs, and `ConnectorException` failure contract.
+- Generated connector clients are available as lazy exports from `azure.connectors`, with matching package type stubs for static analysis. Prefer concrete connector-module imports in applications.
+- Kept async-only root clients, aligned with the .NET connector SDK. This intentionally diverges from the Azure SDK synchronous-client guideline without reverting keyword-only options, Azure Core errors, paging, or polling.
+- Updated the 99 root async samples to use unsuffixed operation names; there is no duplicate synchronous sample catalog.
+- Updated the generated API reference and CI validation for one async client catalog and one core runtime section.
- Made `azure-identity` a required runtime dependency so Azure Identity credentials and the shipped samples work with the default package installation.
- Updated all connector samples to match generated method signatures and added literal-type validation to the sample contract checks.
- Added focused success, route, request-body, response, and error coverage for newly generated operations.
@@ -42,14 +57,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
-- **Request timeout enforcement**: `timeout_seconds` and per-operation `timeout`
- now bound the complete network operation, including retries, response loading,
- and body reads across Azure Core async transports. Zero and negative values
- disable SDK and transport deadlines.
+- **Jira continuation tokens**: Treat next-page tokens as opaque values rather than continuation URLs.
+- **Initial polling URLs**: Resolve relative initial `Location` headers against the initiating request URL.
+- **Sample pager consumption**: Iterate async pagers directly instead of treating them as response envelopes or awaiting pager construction.
+- **Collection response contracts**: Mutation and action arrays execute eagerly and preserve their response envelopes instead of delaying the request behind a pager. Primitive read collections now expose `AsyncItemPaged[str]` rather than dictionary item types.
+- **Finite polling delays**: Non-finite `Retry-After` values such as `Infinity`, `NaN`, and numeric overflow now use the finite default polling interval.
+- **Collection paging classification**: Explicit pageable responses now infer omitted item properties and follow continuation fields present in the response schema. Bounded read envelopes select their primary array over auxiliary array metadata and expose Azure-guideline `list_*` operations returning `AsyncItemPaged`; mutation and action arrays execute eagerly under their action names.
+- **Caller continuation isolation**: Caller-provided `by_page()` continuation URLs now pass through the same origin normalization as service-provided next links, preventing authenticated requests from being sent to an arbitrary host.
+- **HTTP DELETE contracts** — generated operations now preserve declared success payloads and ordinary HTTP 404 errors regardless of verb. Only explicitly curated resource deletions, currently ARM deployment deletion, treat an already absent target as idempotent success.
+- **Orderful transaction responses** — `list_transactions` now preserves and returns the runtime JSON payload despite the managed connector Swagger omitting its response schema.
+- **Relative continuation URLs** — pagers now resolve bare relative continuation links against the current page URL, preserving nested resource paths.
+- **Azure Core exception compatibility**: `ConnectorException` now derives from `HttpResponseError` and exposes the failed response status, reason, headers, and body while preserving connector-specific operation and path details.
+- **Generation provenance**: record the exact generator revision and source metadata for the complete 99-connector async catalog in the pull request.
+- **Request timeout enforcement**: Client-level and per-operation `timeout`
+ configures Azure Core retry and transport deadlines. Async clients bound
+ the complete network operation, including response loading and body reads.
+ Blocking callbacks must bound their own execution. Zero and
+ negative values disable SDK and transport deadlines.
- **Async transport compatibility**: Empty buffered responses now produce normal
snapshots and connector errors without re-reading consumed streams. Injected
transports receive only supported timeout options and close through their
asynchronous lifecycle.
+- **Default transport configuration**: Standard Azure Core transport options,
+ including `connection_verify` and `connection_cert`, now configure the owned
+ aiohttp transport instead of being ignored.
- **Explicit Azure Core policy chains**: `per_call_policies` and
`per_retry_policies` now compose with an explicit `policies` chain instead of
being silently discarded. Per-retry extensions require an `AsyncRetryPolicy`,
@@ -65,7 +96,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Generated caller-supplied and internal-default query values escape reserved
characters, including `/`, so paths, URLs, and collection values remain within
their intended query parameters.
-- **Microsoft Dataverse**: Corrected `create_attachment_async()` to accept GUID/string row IDs instead of integers.
+- **Microsoft Dataverse**: Corrected `create_attachment()` to accept GUID/string row IDs instead of integers.
## [0.5.0b1] - 2026-08-31
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 30d3d110..e6dff9a0 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -99,14 +99,14 @@ This project follows Python best practices documented in [.github/copilot-instru
- **PEP 8** — Standard Python style guide (79 character line limit)
- **Type hints** — All public API signatures must have type hints (PEP 484)
-- **Async/await** — Use async patterns for all I/O operations
+- **Async-only clients** — Use unsuffixed async operations in root connector modules
- **Naming conventions:**
- `snake_case` for functions, methods, variables
- `PascalCase` for classes
- `UPPER_SNAKE_CASE` for constants
- `_snake_case` for private methods/attributes
- **Docstrings** — Google-style docstrings for all public APIs
-- **Context managers** — Use `async with` for client lifecycle management
+- **Context managers** — Use `async with` for clients and caller-owned async credentials
### Automated Enforcement
@@ -121,7 +121,7 @@ Run `flake8 src/ tests/` locally before pushing to catch style issues early.
## Generated Code
-Connector client files in `src/azure/connectors/*.py` (except `sdk/` subpackage) are produced by an internal Microsoft code generator that is not publicly accessible at this time. **Do not submit pull requests that directly modify generated files** — changes will be overwritten the next time the code is regenerated.
+Connector client files in `src/azure/connectors/*.py` are produced by an internal Microsoft code generator. Each root module contains an async client and its models. **Do not submit pull requests that directly modify generated files** — changes will be overwritten the next time the code is regenerated.
If you find a bug or want to suggest an improvement in the generated code:
@@ -132,7 +132,7 @@ If you find a bug or want to suggest an improvement in the generated code:
**Files safe to modify:**
-- `src/azure/connectors/sdk/*.py` — Core SDK infrastructure (not generated)
+- `src/azure/connectors/sdk/*.py` — Async core SDK infrastructure (not generated)
- `tests/*.py` — All test files
- `samples/*.py` — Sample code
- Documentation files (`.md` files)
@@ -237,9 +237,9 @@ See the detailed guide in [.github/copilot-instructions.md](.github/copilot-inst
Quick checklist:
-1. Generate connector code using LogicAppsCompiler with `--python` flag
+1. Generate one async root module using LogicAppsCompiler with `--pythonDirectClient`
2. Copy generated `.py` file to `src/azure/connectors/`
-3. Update `__init__.py` exports
+3. Regenerate the lazy client registry and root package type stubs
4. Add comprehensive unit tests
5. Add sample code to `samples/`
6. Update `README.md` and `ROADMAP.md`
diff --git a/GENERATION.md b/GENERATION.md
index f515862e..070105b1 100644
--- a/GENERATION.md
+++ b/GENERATION.md
@@ -7,9 +7,9 @@ This document describes how to generate typed Python connector clients using the
The **CodefulSdkGenerator** tool generates typed Python clients from managed connector swagger definitions. The generated code provides:
- **Type-safe contracts** - Dataclass models with proper JSON field mappings
-- **Typed client classes** - Async methods for each connector action with comprehensive docstrings
+- **Async-only clients** - One root module per connector with unsuffixed async operations; no synchronous mirror
- **Authentication handling** - Caller-owned Azure Core token or key credentials
-- **Async/await support** - Native asyncio integration through the Azure Core pipeline
+- **Azure Core paging** - `AsyncItemPaged` for collection operations
## Prerequisites
@@ -52,38 +52,39 @@ cd
dotnet build .\src\tools\CodefulSdkGenerator\LogicAppsCompiler.Cli\LogicAppsCompiler.Cli.csproj -c Release
```
-The compiled executable will be at:
+The compiled compiler assembly will be at:
```text
-src\tools\CodefulSdkGenerator\LogicAppsCompiler.Cli\bin\Release\net8.0\LogicAppsCompiler.exe
+src\tools\CodefulSdkGenerator\LogicAppsCompiler.Cli\bin\Release\net8.0\LogicAppsCompiler.dll
```
## Generation Commands
-Use the [live-download workflow](#live-regeneration-and-review) for every refresh
-and review. The examples below show CLI argument forms, not permission to reuse
-responses from an earlier run.
+Fetch live definitions with an explicit subscription and region and a new empty
+temporary response directory, as described below. Do not seed that directory
+with saved responses or fixtures.
### Generate Python Client SDK (Recommended)
-Generates typed async Python clients for calling connectors directly from Azure Functions:
+Generates async-only Python clients in root connector modules:
```powershell
# Generate all connectors
-LogicAppsCompiler.exe --pythonDirectClient
+dotnet LogicAppsCompiler.dll --pythonDirectClient
# Generate specific connectors only
-LogicAppsCompiler.exe --pythonDirectClient --connectors=office365,sharepointonline,teams
+dotnet LogicAppsCompiler.dll --pythonDirectClient --connectors=office365,sharepointonline,teams
# Example: Generate to this SDK repo's src/azure/connectors folder
-LogicAppsCompiler.exe "/src/azure/connectors" --pythonDirectClient --connectors=office365
+dotnet LogicAppsCompiler.dll "/src/azure/connectors" --pythonDirectClient --connectors=office365
```
**Output structure per connector:**
-- `{connector}.py` - Combined dataclass models and client in one file (e.g., `office365.py`, `sharepointonline.py`)
+- `{connector}.py` - Async client plus models, aliases, enums, and trigger metadata
-**Note:** The CLI accepts one positional output directory. Use `--pythonDirectClient` for Python generation.
+The CLI accepts one positional output directory. Use `--pythonDirectClient`
+for Python generation. Do not generate an additional synchronous or aio catalog.
### Generate C# DirectClient SDK
@@ -97,12 +98,12 @@ LogicAppsCompiler.exe --directClient --connectors=office365
LogicAppsCompiler.exe --directClient --language=csharp --connectors=office365
```
-## Live Regeneration and Review
+## Catalog Regeneration
-Refresh existing clients from live managed connector definitions. Set the source
-subscription and region explicitly, and use a new empty temporary `ARMCACHE_PATH`
-for every run. The generator's cache is only a transport implementation detail;
-never seed it from repository fixtures or reuse a previous run's responses.
+To refresh connector contracts, set the source subscription and region
+explicitly and use a new empty temporary `ARMCACHE_PATH`. Generate into an
+isolated output directory so the complete result can be reviewed before it
+replaces the committed client catalog.
```powershell
$env:AZURE_SUBSCRIPTION_ID = ""
@@ -114,7 +115,8 @@ $liveCachePath = Join-Path $env:TEMP ("connector-live-" + [guid]::NewGuid())
New-Item -ItemType Directory -Path $liveCachePath, $outputDirectory -Force | Out-Null
try {
$env:ARMCACHE_PATH = $liveCachePath
- LogicAppsCompiler.exe $outputDirectory --directClient --language=python "--connectors=$connectorNames"
+ dotnet LogicAppsCompiler.dll $outputDirectory --directClient --language=python `
+ "--connectors=$connectorNames"
}
finally {
$env:ARMCACHE_PATH = $previousCachePath
@@ -122,27 +124,39 @@ finally {
}
```
-Check per-connector failures as well as the CLI exit code. Record the exact
-generator revision, linked PR and its status, source subscription, region, and capture time.
-Paired generator/SDK PRs show generated output from the active generator PR before
-it merges. Label that source as unmerged; final SDK merge still requires upstream integration.
-Do not add cache folders or replay scaffolding as part of a client refresh.
-
-Reviewers must fetch live definitions independently using their own new empty
-temporary directory. Do not give the producer's responses to the reviewer as
-generation inputs. Compare generated outputs after normalizing CRLF to LF;
-investigate live differences instead of substituting cached inputs to make them match.
+Record the full AzureUX-BPM generator revision and source metadata in the pull
+request. Validate the complete 99-connector root inventory, the lazy client registry, and
+package type stubs before committing the reviewed output.
### Pageable Results
-Pageable operations expose async iterators. Iteration follows continuation links and
-yields items directly; an empty response yields no items. Do not await a page envelope:
+Read-collection operations return Azure Core pagers, including bounded read
+collections without continuation metadata. Arrays returned by mutations and
+other actions remain eager payloads. Pager iteration follows continuation links
+when the contract provides them and yields items directly; an empty response
+yields no items. Do not await pager construction:
```python
-async for item in client.get_items_async(...):
+async for item in client.list_items(...):
process_item(item)
```
+Root clients return `AsyncItemPaged` and support
+`by_page(continuation_token=...)`. Request controls and response hooks
+apply to every page request.
+
+### Long-Running Operations
+
+Retained operations with an HTTP 202 `Location` polling contract use
+`begin_*` methods. Root clients return `AsyncLROPoller[T]` after the `begin_*`
+call is awaited. Resolve the final payload with `await poller.result()` while
+the connector client remains open.
+
+The generator does not infer polling from HTTP 202 alone. Status-document
+protocols, cancellation, and poller continuation tokens are not currently
+generated. Request controls and response hooks apply to the initial request and
+every polling request.
+
### Consumer Review Checks
- Capture known response collections directly in semantic names, such as
@@ -166,14 +180,14 @@ async for item in client.get_items_async(...):
# office365.py - Auto-generated Python DirectClient SDK
# Do not edit this file directly.
-from dataclasses import dataclass, field
-from typing import Optional, List, Dict, Any
+from dataclasses import dataclass, field as dataclass_field
+from typing import Any, Dict, List, Mapping, Optional
from datetime import datetime
from azure.core.credentials import AzureKeyCredential
from azure.core.credentials_async import AsyncTokenCredential
from azure.core.pipeline.transport import AsyncHttpTransport
-from azure.connectors.sdk import ConnectorClientBase
+from azure.connectors.sdk import ConnectorClientBase, ConnectorResponseHook
# ===== Types =====
@@ -181,13 +195,13 @@ from azure.connectors.sdk import ConnectorClientBase
class GraphCalendarEventClientReceive:
"""Response for calendar event operations."""
- subject: Optional[str] = None
+ subject: Optional[str] = dataclass_field(default=None, kw_only=True)
"""Event subject."""
- start: Optional[str] = None
+ start: Optional[str] = dataclass_field(default=None, kw_only=True)
"""Event start time (ISO 8601)."""
- end: Optional[str] = None
+ end: Optional[str] = dataclass_field(default=None, kw_only=True)
"""Event end time (ISO 8601)."""
# ... other fields
@@ -203,7 +217,7 @@ class Office365Client(ConnectorClientBase):
credential: AsyncTokenCredential | AzureKeyCredential,
*,
max_retry_attempts: int = 3,
- timeout_seconds: float = 30.0,
+ timeout: float = 30.0,
transport: Optional[AsyncHttpTransport] = None,
**kwargs: Any,
):
@@ -214,40 +228,42 @@ class Office365Client(ConnectorClientBase):
super().__init__(
credential,
max_retry_attempts=max_retry_attempts,
- timeout_seconds=timeout_seconds,
+ timeout=timeout,
transport=transport,
**kwargs,
)
self._connection_runtime_url = connection_runtime_url.rstrip("/")
- async def send_email_v2_async(
+ async def send_email(
self,
- to: str,
- subject: str,
- body: str,
- from_address: Optional[str] = None,
- cc: Optional[str] = None,
- bcc: Optional[str] = None,
- importance: Optional[str] = None,
- is_html: bool = True
+ input: SendEmailInput | Mapping[str, Any],
+ *,
+ timeout: Optional[float] = None,
+ headers: Optional[Mapping[str, str]] = None,
+ client_request_id: Optional[str] = None,
+ response_hook: Optional[ConnectorResponseHook] = None,
) -> None:
"""
Send an email.
Args:
- to: Recipient email address(es), semicolon-separated
- subject: Email subject
- body: Email body (HTML or plain text)
- from_address: Sender address (optional, defaults to mailbox owner)
- cc: CC recipients, semicolon-separated
- bcc: BCC recipients, semicolon-separated
- importance: Email importance (Low, Normal, High)
- is_html: Whether body is HTML
+ input: The request body. Mapping keys use serialized Swagger wire
+ names.
+ timeout: The request timeout in seconds.
+ headers: Additional HTTP request headers.
+ client_request_id: A caller-provided request identifier.
+ response_hook: A callback invoked with the connector response.
"""
- # Generated implementation calls self._http_client.send_async(...)
+ # Generated implementation awaits self.http_client.send(...)
# with proper serialization and error handling
```
+The root `office365.py` defines the async client and its models together.
+Async-only intentionally diverges from the Azure SDK synchronous-client guideline,
+aligned with the .NET connector SDK. Keep keyword-only optional parameters,
+unsuffixed async operations, and Azure Core errors, paging, and polling; do not
+restore the earlier preview signatures or add a synchronous mirror.
+
### Key Patterns in Generated Code
#### 1. Root Schema Aliases
@@ -264,19 +280,27 @@ String and integer enums become `Literal` aliases, and array roots become typed
#### 2. Dataclass Models
-Connector object schemas are generated as dataclasses with optional fields:
+Connector object schemas are generated as dataclasses. Swagger-required fields
+are required constructor arguments; optional fields are keyword-only and
+default to `None`:
```python
@dataclass
class FileMetadata:
"""Metadata for a file in SharePoint or OneDrive."""
-
- id: Optional[str] = None
- name: Optional[str] = None
- path: Optional[str] = None
- size: Optional[int] = None
- created_time: Optional[datetime] = None
- modified_time: Optional[datetime] = None
+
+ id: str
+ name: Optional[str] = dataclass_field(default=None, kw_only=True)
+ path: Optional[str] = dataclass_field(default=None, kw_only=True)
+ size: Optional[int] = dataclass_field(default=None, kw_only=True)
+ created_time: Optional[datetime] = dataclass_field(
+ default=None,
+ kw_only=True,
+ )
+ modified_time: Optional[datetime] = dataclass_field(
+ default=None,
+ kw_only=True,
+ )
```
#### 3. Client Inheritance
@@ -297,42 +321,35 @@ class SharepointonlineClient(ConnectorClientBase):
```
This inheritance provides:
+
- HTTP client with retry logic
- Authentication through caller-owned Azure Core credentials
-- Lifecycle management (async context manager, close)
+- Lifecycle management through async context managers
- Error handling with `ConnectorException`
#### 4. Async Method Signatures
-All connector actions are generated as async methods:
+Operations use unsuffixed names and keyword-only optional parameters. Pageable
+methods return their async pager without awaiting construction:
```python
-async def get_items_async(
+def list_items(
self,
dataset: str,
table: str,
+ *,
filter_query: Optional[str] = None,
order_by: Optional[str] = None,
- top: Optional[int] = None
-) -> Dict[str, Any]:
- """
- Get items from a SharePoint list.
-
- Args:
- dataset: SharePoint site URL
- table: List name or ID
- filter_query: OData filter expression
- order_by: OData orderBy expression
- top: Maximum number of items to return
-
- Returns:
- Dictionary with 'value' key containing list of items
- """
+ top: Optional[int] = None,
+) -> AsyncItemPaged[dict[str, Any]]:
+ """Return the asynchronous item pager without awaiting construction."""
+ ...
```
#### 5. Type Hints and Docstrings
The generator produces:
+
- Full type hints for all parameters and return types
- Docstrings from connector metadata
- Optional parameter defaults
@@ -342,22 +359,14 @@ The generator produces:
After generating a new connector client:
-1. **Copy the generated file** to `src/azure/connectors/`:
+1. **Copy the generated module** to `src/azure/connectors/`:
```powershell
Copy-Item "output\office365.py" "src\azure\connectors\office365.py"
```
-2. **Update `src/azure/connectors/__init__.py`** to export the client:
-
- ```python
- from azure.connectors.office365 import Office365Client
-
- __all__ = [
- "Office365Client",
- # ... other clients
- ]
- ```
+2. **Regenerate package-level artifacts.** The helper writes the lazy client
+ registry and root `.pyi` file. Do not edit them manually.
3. **Create unit tests** following the pattern in `tests/`:
@@ -378,7 +387,10 @@ After generating a new connector client:
pytest
```
-5. **Update documentation**:
+5. **Create one async sample** under `samples/sample_connector_usage/` using
+ root connector imports and unsuffixed operation names.
+
+6. **Update documentation**:
- Add connector to README.md validated connectors table
- Update ROADMAP.md status
- Add sample code to `samples/` directory
@@ -463,12 +475,17 @@ Every generated connector client MUST satisfy these invariants before merge:
### 2. Response Status Checking (All Operations)
- Every HTTP operation MUST capture the response and check the status code
-- Non-2xx responses MUST raise `ConnectorException` with status code and message
+- Non-2xx responses MUST raise `ConnectorException`, an Azure Core
+ `HttpResponseError`, with status code and message, except for explicitly
+ curated resource-delete operations whose contract treats HTTP 404 as an
+ idempotent success
+- Operations with a declared 2xx response schema MUST deserialize and return
+ that payload regardless of the HTTP method
- Void operations (DELETE, PATCH, fire-and-forget POST) MUST NOT discard the response unchecked
**Correct pattern:**
```python
-response = await self.http_client.send_async(
+response = await self.http_client.send(
method="DELETE",
url=request_uri,
)
@@ -485,13 +502,20 @@ if not (200 <= response.status < 300):
**Incorrect pattern (MUST NOT pass review):**
```python
-await self.http_client.send_async( # Result discarded - silent failures!
+await self.http_client.send( # Result discarded - silent failures!
method="DELETE",
url=request_uri,
)
```
-**Validation:** The `test_no_unchecked_send_async_calls` test in `tests/test_code_quality.py` scans for unchecked `send_async` calls. Additionally, unit tests for void methods MUST assert that non-2xx responses raise `ConnectorException`.
+The generator owns the narrow allow-list for resource-delete operations that
+accept HTTP 404. Do not infer idempotent success from the `DELETE` verb alone;
+connectors also use that verb for actions whose missing target is an error.
+
+The async root pattern awaits `send`. **Validation:**
+`test_no_unchecked_send_calls` in `tests/test_code_quality.py` scans root
+modules for discarded calls. Unit tests for void methods must also assert that
+non-2xx responses raise `ConnectorException`.
### 3. Test Coverage
@@ -506,7 +530,7 @@ await self.http_client.send_async( # Result discarded - silent failures!
| POST with body | At least 1 test asserting body is forwarded + 1 error test |
| PUT with body | At least 1 test asserting body is forwarded + 1 error test |
| PATCH with body | At least 1 test asserting body is forwarded + 1 error test |
-| DELETE | At least 1 success test + 1 error test verifying exception raised |
+| DELETE | At least 1 success test + 1 error test verifying the exception; cover HTTP 404 as success only for explicitly allow-listed resource-delete operations (currently ARM `Deployments_Delete`) |
**Connectors with >20 public methods** are not required to have a test class per method. Representative coverage — one test group per HTTP verb type used by the connector — satisfies the acceptance criteria, provided the body-forwarding and non-2xx paths are both covered.
@@ -516,7 +540,8 @@ await self.http_client.send_async( # Result discarded - silent failures!
- All public types (dataclasses) referenced by method signatures MUST be defined
- No `# type: ignore` comments unless accompanied by a tracked issue link
-- All optional parameters MUST have `Optional[T]` type hints and default values
+- All optional parameters MUST have `Optional[T]` type hints and default values;
+ Swagger-required model fields MUST remain required constructor arguments
## Generator File Locations (BPM Repository)
@@ -531,7 +556,10 @@ When fixing generator bugs (per the "fix the generator, not generated output" ru
### Key Differences from .NET Generator
-The .NET SDK centralizes error handling in `ConnectorClientBase.CallConnectorAsync()` — this base method auto-throws on non-2xx for both value-returning and void operations. The Python emitter must explicitly generate the status check in each method body because Python's `http_client.send_async()` does not auto-raise.
+The .NET SDK centralizes error handling in
+`ConnectorClientBase.CallConnectorAsync()`. The Python emitter must explicitly
+generate the status check in each async root method body because
+`http_client.send()` does not auto-raise.
**If you find a Python generator bug:**
1. Fix it in `DirectClientPythonCodeGenerator.cs`
@@ -569,6 +597,13 @@ Track known generator issues here to prevent silent recurrence across releases.
| Operation methods corrected Swagger spelling or split acronym letters | Fixed in generator | `docusign`, `github`, `googletasks`, `pdfco`, `salesforce`, `signinghub`, `slack`, `wordonlinebusiness`, `zohosign` | Fixed | Python applies deterministic acronym-aware snake_case and connector-scoped corrections for known malformed operation IDs. |
| Colliding wire names dropped after Python normalization | Fixed in generator | `teams`, `shifts`, `todo` | Fixed | Distinct generated fields preserve both `id` and `@odata.id`; serializer tests set both values together. |
| String-encoded integer enum tokens emitted as string literals | Fixed in generator | `etsy` | Fixed | Python now normalizes quoted enum tokens to the declared integer schema type. All Phase 6 and 7 clients were regenerated; only `etsy` changed. |
+| Pageable item properties and bounded collection envelopes misclassified | Fixed in generator | `azuredigitaltwins`, `insightly`, `jira`, `documentdb`, `sql`, and other collection connectors | Fixed | Explicit pageable operations infer omitted item names and use recognized continuation fields present in the response schema. Bounded read envelopes select conventional primary arrays over auxiliary array metadata and emit `list_*` pagers, while mutation/action arrays remain eager. |
+| Mutation arrays were lazy and primitive pagers used dictionary item types | Fixed in generator | `azuread`, `docusign`, `eventhubs`, `meetingroommap`, `mq`, `msgraphgroupsanduser`, `onedrive`, `powerbi`, `replicon`, `sendgrid`, `servicebus`, `yammer` | Fixed | Bounded mutation responses execute eagerly under action names and preserve response envelopes. Read collections retain primitive item types in async pagers. |
+| Caller continuation URLs bypassed pagination origin normalization | Fixed in generator | All pageable connectors | Fixed | `by_page(continuation_token=...)` now routes caller tokens through the same URL resolver as service-provided next links before transport receives the request. |
+| Typeless dynamic request models omitted mapping inputs | Fixed in generator | `docuware` | Fixed | Dynamic dataclass request annotations now accept either the generated model or `Mapping[str, Any]`. |
+| Operation name used as a proxy for HTTP DELETE semantics | Fixed in generator | `arm`, `zohosign`, and other delete operations | Fixed | The generator uses a narrow operation-ID allow-list for resource-delete contracts that accept HTTP 404 (currently ARM `Deployments_Delete`). Other `DELETE` operations preserve ordinary failure behavior, and non-DELETE operations do so even when their names begin with `delete_`. |
+| Successful response discarded when Swagger omits its schema | Fixed in generator | `orderful` | Fixed | The Python-specific `ListTransactions` override preserves the runtime JSON payload without changing other language emitters. |
+| Bounded collection docs promised continuation URLs | Fixed in generator | 76 connectors, including `rss` and `sharepointonline` | Fixed | Single-page collection docs now match the emitted continuation metadata. URL-backed and opaque-token pager docs retain their distinct contracts; runtime behavior is unchanged. All 99 clients were regenerated. |
| Create/update operations missing request body | [BPM #TBD](https://dev.azure.com/msazure/One/_workitems/edit/TBD) | Varies by connector | Investigation | Some POST/PATCH operations may drop body parameters |
**Adding a new defect:**
diff --git a/README.md b/README.md
index 7aed8893..076d09ae 100644
--- a/README.md
+++ b/README.md
@@ -23,9 +23,9 @@ Type-safe Python clients for [Azure connectors](https://learn.microsoft.com/conn
Azure provides a rich ecosystem of [managed connectors](https://learn.microsoft.com/connectors/connector-reference/) that bridge your code to SaaS services, PaaS resources, and on-premises systems. Originally powering Azure Logic Apps and Power Automate, these connectors are now available as **standalone, strongly-typed Python clients** for any Python application — no workflow service required.
-- **Async/await native** — Built on `aiohttp` with full async support for modern Python applications
-- **Type-safe operations** — Generated async methods with type hints and comprehensive docstrings
-- **Built-in authentication** — Managed identity, Azure Identity, and API key token providers
+- **Async-only clients** — Import clients from `azure.connectors.`; there is no synchronous mirror
+- **Type-safe operations** — Unsuffixed async operations expose type hints and comprehensive docstrings
+- **Built-in authentication** — Async Azure Identity credentials, managed identity, and Azure Core API keys
- **Resilient HTTP** — Configurable retries with exponential backoff for safe HTTP methods; unsafe methods make one attempt by default
- **1,000+ connectors** — Any Azure managed connector available via API Hub can be generated
@@ -44,10 +44,10 @@ Azure provides a rich ecosystem of [managed connectors](https://learn.microsoft.
▼
┌─────────────────────────────────────┐
│ Generated Connector Clients │
-│ (office365.py, teams.py, etc.) │
+│ (async clients in root modules) │
│ │
-│ • Typed async methods per action │
-│ • Dataclass models from Swagger │
+│ • Matching unsuffixed operations │
+│ • Shared models from Swagger │
│ • Docstrings from connector meta │
└──────────────┬──────────────────────┘
│ depends on
@@ -78,11 +78,9 @@ pip install azure-connectors[dev]
## Quick Start
-### Example: Send an email with Office 365
+### Example: Send an email
```python
-import asyncio
-
from azure.identity.aio import DefaultAzureCredential
from azure.connectors.office365 import Office365Client, SendEmailInput
@@ -93,19 +91,16 @@ async def send_email_example():
async with DefaultAzureCredential() as credential:
async with Office365Client(connection_url, credential) as client:
- await client.send_email_async(
+ await client.send_email(
input=SendEmailInput(
to="recipient@example.com",
subject="Hello from Python SDK",
body="Sent with the Azure Connectors Python SDK.
",
)
)
-
-
-asyncio.run(send_email_example())
```
-### Example: List SharePoint items
+### Example: List SharePoint items asynchronously
```python
from azure.identity.aio import DefaultAzureCredential
@@ -120,7 +115,7 @@ async def list_sharepoint_items():
async with SharepointonlineClient(connection_url, credential) as client:
items = [
item
- async for item in client.get_items_async(
+ async for item in client.list_items(
dataset="https://contoso.sharepoint.com/sites/MySite",
table="MyList",
)
@@ -135,7 +130,8 @@ async def list_sharepoint_items():
```python
from azure.identity.aio import DefaultAzureCredential
-from azure.connectors.teams import DynamicPostMessageRequest, TeamsClient
+from azure.connectors.teams import TeamsClient
+from azure.connectors.teams import DynamicPostMessageRequest
async def post_teams_message():
@@ -143,7 +139,7 @@ async def post_teams_message():
async with DefaultAzureCredential() as credential:
async with TeamsClient(connection_url, credential) as client:
- await client.post_message_to_conversation_async(
+ await client.post_message_to_conversation(
input=DynamicPostMessageRequest(
additional_properties={
"body": {
@@ -157,6 +153,36 @@ async def post_teams_message():
)
```
+### Example: Wait for a long-running Kusto query
+
+Long-running operations use an Azure SDK-style `begin_*` method. Keep the
+client open until the poller reaches its terminal response:
+
+```python
+from azure.identity.aio import DefaultAzureCredential
+
+from azure.connectors.kusto import KustoClient, QueryAndListSchema
+
+
+async def run_kusto_query():
+ connection_url = "https://example.azure.com/connections/kusto"
+
+ async with DefaultAzureCredential() as credential:
+ async with KustoClient(connection_url, credential) as client:
+ poller = await client.begin_list_kusto_results(
+ input=QueryAndListSchema(
+ cluster="https://contoso.kusto.windows.net",
+ db="Samples",
+ csl="StormEvents | take 5",
+ )
+ )
+ return await poller.result()
+```
+
+Await the `begin_*` method to create an `AsyncLROPoller`, then
+`await poller.result()` waits for completion. See the
+[long-running operations guide](docs/long-running-operations.md).
+
### Retry safety
By default, `GET`, `HEAD`, `OPTIONS`, and `TRACE` use the configured retry settings. `POST`, `PUT`, `PATCH`, `DELETE`, and other methods make one attempt after a transient response or transport error because the connector may already have completed the side effect.
@@ -181,6 +207,7 @@ async def use_teams_client(connection_url: str):
```
`max_retry_attempts`, timeout, and backoff settings govern eligible retries. This is the same [cross-language retry-safety contract](https://github.com/Azure/Connectors-NET-SDK/blob/main/docs/retry-safety.md) as the .NET and Node.js SDKs.
+
## Validated Connectors
The following connectors have been generated and validated with comprehensive test coverage:
@@ -313,7 +340,7 @@ Pass `client_id="your-client-id"` to `ManagedIdentityCredential` for a user-assi
### Azure Identity Credentials
-Any asynchronous Azure Identity credential can be passed directly:
+Clients accept caller-owned `AsyncTokenCredential` implementations:
```python
from azure.identity.aio import DefaultAzureCredential
@@ -324,7 +351,8 @@ credential = DefaultAzureCredential()
client = Office365Client(connection_url, credential)
```
-The caller owns the credential and must close it. Prefer an `async with` credential context as shown above.
+The caller owns the credential and must close it. Prefer `async with` for both
+the credential and client, as shown in the quick start.
### API Key
@@ -345,29 +373,26 @@ Pass retry, timeout, transport, and Azure Core policy settings directly to the g
client = Office365Client(
connection_url,
credential,
- timeout_seconds=60.0,
+ timeout=60.0,
max_retry_attempts=5,
use_exponential_backoff=True,
initial_retry_delay_seconds=1.0,
)
```
-`timeout_seconds` is one total network budget for each request, including
+The client-level `timeout` sets a total network budget for each request, including
retries, response loading, and body reads. Each generated operation also accepts
keyword-only `timeout`, `headers`, `client_request_id`, and `response_hook`
-request controls; `timeout` overrides that total budget for one operation. Set
-either timeout to zero or a negative value to disable SDK and transport
+request controls; the operation-level `timeout` overrides that total budget for
+one operation. Set either timeout to zero or a negative value to disable SDK and transport
deadlines for the selected requests.
-Generated clients accept any Azure Core `AsyncHttpTransport`. The client closes
-an injected transport through its asynchronous lifecycle; the caller retains
-ownership of the credential. The SDK enforces the total request budget across
-transports and applies transport-specific timeout options only when supported.
-`per_call_policies` and `per_retry_policies` are composed with the default or an
-explicit `policies` chain. An explicit chain using `per_retry_policies` must
-contain an `AsyncRetryPolicy`. Explicit chains without a retry policy remain
-supported; the SDK enforces positive total request deadlines without forwarding
-retry-only options to the transport.
+Clients accept Azure Core `AsyncHttpTransport` implementations and close injected
+transports asynchronously; callers retain ownership of credentials. The SDK
+applies transport-specific timeout options only when supported. Blocking callbacks
+must bound their own execution; the SDK cannot interrupt them. `per_call_policies`
+and `per_retry_policies` compose with the default or an explicit `policies` chain.
+Per-retry extensions require `AsyncRetryPolicy`.
## Project Structure
@@ -379,13 +404,20 @@ azure-connectors/
│ │ ├── http_client.py # Async pipeline and retry policies
│ │ ├── response.py # Immutable response hook contracts
│ │ └── exceptions.py # Exception types
-│ ├── office365.py # Office 365 generated client
+│ ├── office365.py # Async client and models
│ ├── sharepointonline.py # SharePoint generated client
│ └── teams.py # Teams generated client
├── tests/ # Comprehensive test suite
├── samples/ # Usage examples
└── docs/ # Additional documentation
```
+
+See [Migrate to unsuffixed async operations](docs/migration-sync-aio.md) for the
+breaking changes from the earlier preview. Async-only is an intentional
+divergence from the Azure SDK synchronous-client guideline, aligned with the
+.NET connector SDK. This does not restore the old API: keyword-only options,
+Azure Core errors, `AsyncItemPaged`, and `AsyncLROPoller` remain.
+
## SDK-Type Bindings for Azure Functions
The SDK supports **SDK-type bindings** for Python Function apps, allowing functions to bind to and return rich, strongly-typed objects instead of raw JSON payloads. This enables cleaner code and better IDE support with type hints.
diff --git a/ROADMAP.md b/ROADMAP.md
index 0075a94a..c63e2c47 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -12,7 +12,7 @@ This document tracks the development roadmap for the Azure Connectors Python SDK
| Component | Status |
|-----------|--------|
-| Core SDK | ✅ Complete — Token providers, HTTP client, retry logic, async/await |
+| Core SDK | ✅ Complete — Async Azure Core pipelines, credentials, retries, and paging |
| Connectors | ✅ 99 connectors — See [README.md](README.md#validated-connectors) |
| CI/CD | ✅ Complete — GitHub Actions for pytest, flake8, build |
| PyPI Publishing | ✅ Complete — Release workflow ready |
@@ -29,7 +29,7 @@ This document tracks the development roadmap for the Azure Connectors Python SDK
- [x] Core SDK abstractions (`ConnectorClientBase`, `ConnectorHttpClient`)
- [x] Azure Core credentials (async Azure Identity and API key)
- [x] HTTP client with retry logic and exponential backoff
-- [x] Async/await support throughout
+- [x] Async-only root clients, aligned with the .NET connector SDK; no synchronous mirror
- [x] Type hints and dataclass models
- [x] Office 365 Outlook connector
- [x] SharePoint Online connector
@@ -252,7 +252,7 @@ Based on usage data, agentic solution value, and community requests:
| Component | Status | Notes |
|-----------|--------|-------|
-| LogicAppsCompiler with `--python` flag | ✅ Available | BPM PR 15456622 |
+| LogicAppsCompiler with `--pythonDirectClient` flag | ✅ Available | Async-only root connector modules |
| Python output templates | ✅ Complete | Dataclasses, async methods |
| Type hint generation | ✅ Complete | Full Python 3.10+ typing |
| Docstring generation | ✅ Complete | From connector metadata |
diff --git a/docs/api/index.md b/docs/api/index.md
index 8c5da2af..132b3886 100644
--- a/docs/api/index.md
+++ b/docs/api/index.md
@@ -2,13 +2,24 @@
The API reference is generated from the current Python source on every documentation build.
-## Core SDK
+## Async core SDK
-Core modules provide authentication, client lifecycle, HTTP behavior, serialization, options, exceptions, and trigger payload types. These modules are maintained by the SDK team.
+Root core modules provide asynchronous client lifecycle, HTTP behavior,
+serialization, exceptions, and trigger payload types. The root runtime is async-only.
-## Connector modules
+## Connector clients
-Each shipped connector has its own generated module containing an asynchronous client and the request and response models reachable from that connector's contract. Connector pages are discovered automatically, so newly generated modules appear without a separate documentation allow-list.
+Each shipped connector has an asynchronous root module containing its client and
+the shared request and response declarations reachable from that connector's
+contract. No separate aio catalog or synchronous mirror is provided. Import
+clients and models from `azure.connectors.`.
+
+Pageable operations return `AsyncItemPaged` without awaiting construction.
+Location-backed long-running operations return `AsyncLROPoller` from awaited
+`begin_*` methods.
+
+Both API sections are discovered automatically, so new connector modules
+appear without a separate documentation allow-list.
Generated connector source is read-only. Corrections to generated signatures or docstrings must be made in the CodefulSdkGenerator and regenerated into this repository.
diff --git a/docs/azure-sdk-guidelines.md b/docs/azure-sdk-guidelines.md
new file mode 100644
index 00000000..001d93c0
--- /dev/null
+++ b/docs/azure-sdk-guidelines.md
@@ -0,0 +1,51 @@
+# Azure SDK guideline alignment
+
+This SDK follows the Azure SDK Design Guidelines for Python where they fit the
+managed connector execution model. The table records intentional Phase 2
+decisions so future changes preserve the public contract.
+
+| Area | Decision | Status |
+|---|---|---|
+| Synchronous APIs | Provide async-only clients, aligned with the .NET connector SDK. Do not add a synchronous mirror. | Intentional deviation |
+| Method names | Use unsuffixed async operation names. | Follow |
+| Credentials | Accept caller-owned `AsyncTokenCredential` or `AzureKeyCredential`. | Follow |
+| Transports | Accept Azure Core `AsyncHttpTransport` implementations. | Follow |
+| Paging | Return `AsyncItemPaged` and support `by_page(continuation_token=...)`. | Follow |
+| Models | Define wire models in each root connector module. | Project convention |
+| Imports | Export clients lazily from package roots while retaining direct per-connector imports. | Follow |
+| Errors | Derive connector service errors from Azure Core `HttpResponseError`. | Follow |
+| Request options | Expose keyword-only `timeout`, `headers`, `client_request_id`, and `response_hook`. | Follow |
+| Long-running operations | Return `AsyncLROPoller` for retained operations with an HTTP 202 `Location` contract. | Follow |
+| API versions | Use each generated operation's managed-connector Swagger version; do not expose a client-level `api_version` override. | Intentional deviation |
+| Return values | Return connector payloads directly rather than Azure Core `Response[T]` wrappers. | Intentional deviation |
+
+## Namespace shape
+
+```python
+# Async client and models
+from azure.connectors.office365 import Office365Client, SendEmailInput
+
+# Clients are also available as lazy package-root exports
+from azure.connectors import Office365Client
+```
+
+Clients, models, type aliases, enums, and `TRIGGER_OPERATIONS` live in the same
+root connector module. There is no separate aio client catalog.
+
+Location-backed operations use awaited `begin_*` calls. Azure
+status-document protocols, poller continuation tokens, and cancellation are
+not part of the current contract.
+
+Managed connectors can route operations to different service API versions
+within one client. Generated operations therefore retain their Swagger-declared
+internal version defaults instead of accepting one constructor-level
+`api_version` that could override unrelated routes.
+
+## Compatibility policy
+
+Async-only does not restore the old preview API. Operations no longer use
+`_async` suffixes, optional parameters and request controls remain keyword-only,
+and Azure Core credentials, errors, pagers, and pollers remain. Package-root
+exports are lazy so importing `azure.connectors` does not
+load every generated module. See the [migration guide](migration-sync-aio.md)
+for mechanical changes.
diff --git a/docs/connection-setup.md b/docs/connection-setup.md
index 98756e53..8033adf4 100644
--- a/docs/connection-setup.md
+++ b/docs/connection-setup.md
@@ -310,14 +310,24 @@ Add the runtime URL to your application settings:
## Authentication Modes
-The generated connector clients (e.g., `Office365Client`, `TeamsClient`) authenticate to API Hub using Azure credentials. Each client offers two constructors that cover three authentication modes:
+Generated connector clients authenticate to API Hub with caller-owned
+`AsyncTokenCredential` or `AzureKeyCredential` credentials. Python clients are
+async-only; import clients from their root connector modules.
### Mode 1: DefaultAzureCredential (Recommended for Local Development)
-Uses the [DefaultAzureCredential](https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication/?tabs=command-line#defaultazurecredential) chain, which tries multiple sources automatically — Azure CLI, Visual Studio, environment variables, and managed identity.
+Use the [DefaultAzureCredential](https://learn.microsoft.com/python/api/azure-identity/azure.identity.aio.defaultazurecredential) chain for local development and managed identity.
-```csharp
-var client = new Office365Client(connectionRuntimeUrl);
+```python
+from azure.identity.aio import DefaultAzureCredential
+
+from azure.connectors.office365 import Office365Client
+
+
+async def use_connection(connection_runtime_url: str) -> None:
+ async with DefaultAzureCredential() as credential:
+ async with Office365Client(connection_runtime_url, credential) as client:
+ print(client.connector_name)
```
This is the simplest setup. Locally, it authenticates as your Azure CLI identity (`az login`), which must have an [access policy](#step-5-add-access-policy-for-clilocal-testing) on the connection for local testing. When deployed to Azure, it falls through to the app's managed identity, which must have an [access policy](#a5-add-access-policy-for-function-app-msi) on the connection.
@@ -326,22 +336,28 @@ This is the simplest setup. Locally, it authenticates as your Azure CLI identity
Uses `ManagedIdentityCredential` with no client ID, targeting the app's system-assigned identity.
-```csharp
-var client = new Office365Client(
- connectionRuntimeUrl,
- managedIdentityClientId: null);
+```python
+from azure.identity.aio import ManagedIdentityCredential
+
+
+async def use_managed_identity(connection_runtime_url: str) -> None:
+ async with ManagedIdentityCredential() as credential:
+ async with Office365Client(connection_runtime_url, credential) as client:
+ print(client.connector_name)
```
-Pass `null` (or an empty string) for `managedIdentityClientId`. The Function App must have system-assigned managed identity enabled, and the identity must have an [access policy](#a5-add-access-policy-for-function-app-msi) on the connection.
+Omit `client_id` for the system-assigned identity. The Function App must have
+that identity enabled and grant it an [access policy](#a5-add-access-policy-for-function-app-msi).
### Mode 3: User-Assigned Managed Identity
Uses `ManagedIdentityCredential` with a specific client ID, targeting a user-assigned managed identity attached to the app.
-```csharp
-var client = new Office365Client(
- connectionRuntimeUrl,
- managedIdentityClientId: "");
+```python
+async def use_user_assigned_identity(connection_runtime_url: str) -> None:
+ async with ManagedIdentityCredential(client_id="") as credential:
+ async with Office365Client(connection_runtime_url, credential) as client:
+ print(client.connector_name)
```
Use this when multiple apps share a single identity, or when you need the identity to outlive any single app deployment.
@@ -358,14 +374,19 @@ Use this when multiple apps share a single identity, or when you need the identi
### Custom Credentials
-The primary constructor also accepts any `TokenCredential` directly, enabling advanced scenarios (e.g., certificate-based auth, chained credentials):
+The constructor accepts any `AsyncTokenCredential`, including async chained
+credentials. The caller must close the credential:
+
+```python
+from azure.identity.aio import AzureCliCredential, ChainedTokenCredential, ManagedIdentityCredential
-```csharp
-var credential = new ChainedTokenCredential(
- new ManagedIdentityCredential(),
- new AzurePowerShellCredential());
-var client = new Office365Client(connectionRuntimeUrl, credential);
+async def use_chained_credentials(connection_runtime_url: str) -> None:
+ async with ChainedTokenCredential(
+ ManagedIdentityCredential(), AzureCliCredential()
+ ) as credential:
+ async with Office365Client(connection_runtime_url, credential) as client:
+ print(client.connector_name)
```
---
diff --git a/docs/generated-contract.md b/docs/generated-contract.md
new file mode 100644
index 00000000..3b8c89ae
--- /dev/null
+++ b/docs/generated-contract.md
@@ -0,0 +1,61 @@
+# Generated connector contract
+
+Generated connector clients are committed artifacts produced by the BPM
+CodefulSdkGenerator. Do not hand-edit generated files under `src/azure/connectors/`.
+
+## Async-only output
+
+One Python generation request emits one root module for every connector:
+
+```text
+src/azure/connectors/.py # async client, models, and metadata
+```
+
+Each module must come from the recorded generator revision and connector
+contract. There is no synchronous mirror or separate aio catalog.
+
+## Public invariants
+
+- Root operations are asynchronous except that
+ pageable methods construct and return their pager without being awaited.
+- Clients expose unsuffixed operation names and keyword-only optional parameters
+ and request controls.
+- Read-collection operations return `AsyncItemPaged`. This includes bounded read collections
+ without a continuation-link contract. Arrays returned by mutations and other
+ actions remain eager operation payloads.
+- Dataclasses, type aliases, enums, and `TRIGGER_OPERATIONS` are declared in
+ the root connector module alongside the async client.
+- Swagger-required dataclass properties are required constructor arguments;
+ only optional properties default to `None`.
+- Each module defines an explicit `__all__`.
+- Generated clients are available from their connector modules and as lazy
+ package-root exports. The generated registry and `.pyi` files keep runtime
+ discovery and static typing synchronized without eagerly importing every
+ connector module.
+- Retained operations with an HTTP 202 `Location` response contract use
+ `begin_*` and return `AsyncLROPoller[T]` after awaiting the call. LRO classification
+ takes precedence over paging, and bare HTTP 202 responses remain ordinary.
+- `ConnectorException` derives from Azure Core `HttpResponseError` while
+ retaining connector operation, path, status, and response-body details.
+
+Paging must preserve validation, connector error behavior, empty pages,
+continuation links, request controls, and response hooks on every request.
+Service links and caller-provided continuation tokens pass through the same URL
+resolver. Links from a different origin are rebased onto the connection runtime
+origin before the next request.
+
+The shipped catalog contains exactly 44 LRO methods: 5 in Kusto and 39
+in Plumsail. Internal Kusto retrieval helpers and superseded Plumsail revisions
+remain filtered by the existing operation-retention rules.
+
+## Regeneration evidence
+
+Source Swagger files used during generation are not committed to this
+repository. Record the exact generator commit and source metadata in the pull
+request, then use the live-metadata workflow in `GENERATION.md` to refresh the
+complete 99-connector async catalog. Review source metadata changes and generated output
+together before committing regenerated clients.
+
+Before submission, verify the root catalog inventory, compile every generated
+module, run connector and runtime tests, validate all 99 async samples, build
+the documentation, and inspect the wheel and source distribution inventories.
diff --git a/docs/index.md b/docs/index.md
index ee04f986..06c9b05d 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -11,11 +11,11 @@ Build type-safe Python integrations with Azure managed connectors for services s
python -m pip install azure-connectors
```
-The SDK requires Python 3.10 or later and provides asynchronous connector clients, typed request models, generated schema classes, and Azure Identity integration. Connector operation responses are currently returned as dictionaries rather than generated model instances.
+The SDK requires Python 3.10 or later and provides async-only root connector clients, typed models, and Azure Identity integration. Non-pageable responses return payload values; pageable operations return `AsyncItemPaged`. No synchronous mirror is provided, aligned with the .NET connector SDK.
## Create a client
-Generated clients require a caller-owned asynchronous Azure Identity credential or an `AzureKeyCredential`.
+Generated clients require a caller-owned `AsyncTokenCredential` or `AzureKeyCredential`. Import clients and models from the root connector module. Operations do not use an `_async` suffix.
```python
from azure.identity.aio import DefaultAzureCredential
@@ -26,15 +26,16 @@ from azure.connectors.office365 import Office365Client
async def list_messages(connection_url: str) -> None:
async with DefaultAzureCredential() as credential:
async with Office365Client(connection_url, credential) as client:
- messages = await client.get_emails_async(
- folder_path="Inbox",
- )
+ messages = [message async for message in client.list_emails()]
print(messages)
```
+
Connector signatures are generated from their managed connector contracts. Consult the [API reference](api/index.md) for the exact client method and model names in the current branch.
## Next steps
- [Set up a connector connection](connection-setup.md)
+- [Migrate to unsuffixed async operations](migration-sync-aio.md)
- [Browse the API reference](api/index.md)
+- [Review the generated contract](generated-contract.md)
- [Understand Azure Functions SDK-type bindings](sdk-type-bindings.md)
diff --git a/docs/long-running-operations.md b/docs/long-running-operations.md
new file mode 100644
index 00000000..df401f7a
--- /dev/null
+++ b/docs/long-running-operations.md
@@ -0,0 +1,35 @@
+# Long-running operations
+
+Kusto and Plumsail operations that declare an HTTP 202 `Location` polling
+contract use Azure Core pollers. Their generated method names begin with
+`begin_`.
+
+## Asynchronous clients
+
+```python
+from azure.connectors.kusto import KustoClient
+
+
+async with KustoClient(connection_url, credential) as client:
+ poller = await client.begin_list_kusto_results(input=query)
+ result = await poller.result()
+```
+
+`AsyncLROPoller` starts polling when it is awaited through `result()`, `wait()`,
+or the poller itself.
+
+## Polling behavior
+
+- HTTP 202 responses must provide a `Location` header.
+- Polling requests use GET and honor numeric or HTTP-date `Retry-After` values.
+- Relative and connector-backend polling URLs are routed through the
+ authenticated connection runtime origin.
+- `timeout`, `headers`, `client_request_id`, and `response_hook` are forwarded
+ to the initial request and every poll request. `timeout` applies to each
+ network request, not the lifetime of the long-running operation.
+- A non-202 success response completes the poller. Terminal non-success
+ responses raise `ConnectorException`.
+
+Keep the connector client open until polling completes. Poller continuation
+tokens, cancellation, `Azure-AsyncOperation` status documents, and
+`Operation-Location` final-resource protocols are not currently supported.
diff --git a/docs/migration-sync-aio.md b/docs/migration-sync-aio.md
new file mode 100644
index 00000000..2a5f4333
--- /dev/null
+++ b/docs/migration-sync-aio.md
@@ -0,0 +1,84 @@
+# Migrate to unsuffixed async operations
+
+Clients remain asynchronous at `azure.connectors.`, as in the
+earlier preview. The SDK provides no synchronous mirror, an intentional
+divergence from the Azure SDK guideline aligned with the .NET connector SDK.
+Compatibility aliases for `_async` operation names are not provided.
+
+## Choose a client
+
+Import async clients and models from each root connector module.
+
+| Use case | Client import | Credential |
+|---|---|---|
+| Asynchronous code | `azure.connectors.` | `azure.core.credentials_async.AsyncTokenCredential` |
+
+Connections that expect API keys also accept `AzureKeyCredential`.
+
+## Update asynchronous code
+
+Keep the root client import and remove `_async` from operation names:
+
+```python
+from azure.identity.aio import DefaultAzureCredential
+
+from azure.connectors.office365 import Office365Client, SendEmailInput
+
+
+async def send_email(connection_url: str) -> None:
+ async with DefaultAzureCredential() as credential:
+ async with Office365Client(connection_url, credential) as client:
+ await client.send_email(
+ input=SendEmailInput(
+ to="recipient@example.com",
+ subject="Hello",
+ body="Sent with Azure Connectors.",
+ )
+ )
+```
+
+Before this release, the client was imported from
+`azure.connectors.office365` and the operation was named `send_email_async`.
+
+## Keep the new request contract
+
+Async-only is not a return to the old signatures or response shapes:
+
+- Pass optional operation parameters and request controls by keyword.
+- Replace legacy token providers and `ConnectorClientOptions` with caller-owned
+ `AsyncTokenCredential` or `AzureKeyCredential` and direct client options.
+- Inject `AsyncHttpTransport` implementations. Clients close transports;
+ callers close their async credentials.
+- Catch `ConnectorException` or its Azure Core base `HttpResponseError`.
+- If you evaluated the intermediate dual-mode branch, replace
+ `azure.connectors.aio.` imports with `azure.connectors.`;
+ retain `await` and `async with`.
+
+## Migrate pageable operations
+
+Pageable operations no longer return `AsyncIterator`. They return Azure Core `AsyncItemPaged`
+pagers and continue to yield connector items directly.
+
+```python
+# Async: azure.core.async_paging.AsyncItemPaged
+async for item in client.list_items(dataset=site_url, table=list_name):
+ process(item)
+```
+
+Do not await pager construction. Use `by_page(continuation_token=...)` when
+page boundaries or a saved continuation token are required.
+
+## Removed preview forms
+
+- `_async` operation names; root asynchronous clients remain.
+- Awaiting pageable operations as response dictionaries.
+- Treating collected page items as a response envelope with a `value` field.
+
+Generated clients are also available as lazy exports from `azure.connectors`.
+Prefer concrete connector-module imports so clients and models share one import
+location.
+
+Location-backed Kusto and Plumsail operations now use `begin_*` methods. Root
+clients return `AsyncLROPoller` after awaiting
+the `begin_*` call. Resolve the terminal payload with `await poller.result()` and keep
+the connector client open until polling completes.
diff --git a/samples/sample_connector_usage/README.md b/samples/sample_connector_usage/README.md
index a077d8de..961fe3f2 100644
--- a/samples/sample_connector_usage/README.md
+++ b/samples/sample_connector_usage/README.md
@@ -10,7 +10,8 @@ This directory contains samples demonstrating how to use the Azure Connectors SD
## Samples
-Each sample file (`sample_connector_usage_*.py`) demonstrates a specific connector's operations. Run any sample with:
+Each of the 99 connectors has one async sample in this directory. Clients and
+models use root connector imports and unsuffixed operation names. Run a sample with:
```bash
python sample_connector_usage_.py
@@ -128,40 +129,48 @@ $env:OFFICE365_CONNECTION_URL = "https://[region].azure-apihub.net/apim/office36
export OFFICE365_CONNECTION_URL="https://[region].azure-apihub.net/apim/office365/[connection-id]"
```
-## Usage Pattern
+## Usage Patterns
-All connector clients follow the same async context manager pattern:
+Root connector modules provide async-only clients and models. Use async
+credentials and context managers:
```python
import asyncio
+
from azure.identity.aio import DefaultAzureCredential
+
from azure.connectors import ConnectorException
from azure.connectors. import Client
+from azure.connectors. import
CONNECTION_URL = "https://[region].azure-apihub.net/apim//[connection-id]"
+
async def main():
- credential = DefaultAzureCredential()
-
- async with Client(CONNECTION_URL, credential) as client:
- try:
- result = await client._async()
- print(result)
- except ConnectorException as ex:
- print(f"Connector error: {ex}")
+ async with DefaultAzureCredential() as credential:
+ async with Client(CONNECTION_URL, credential) as client:
+ try:
+ result = await client.(())
+ print(result)
+ except ConnectorException as ex:
+ print(f"Connector error: {ex}")
+
asyncio.run(main())
```
+Pageable operations return `AsyncItemPaged`. Consume them with `async for`;
+do not await pager construction. Await `begin_*` operations to obtain an
+`AsyncLROPoller`, then await `poller.result()` while the client remains open.
+
## Error Handling
-The SDK provides structured error handling via `ConnectorException`:
+The SDK provides structured error handling via `ConnectorException`, which
+derives from Azure Core `HttpResponseError`:
```python
-from azure.connectors import ConnectorException
-
try:
- result = await client.some_operation_async()
+ result = await client.some_operation()
except ConnectorException as ex:
print(f"Status: {ex.status_code}, Message: {ex}")
```
@@ -170,12 +179,12 @@ except ConnectorException as ex:
1. Set up a connection in Azure Portal (see [connection-setup.md](../../docs/connection-setup.md))
2. Set the connection runtime URL environment variable
-3. Run the sample for your connector
+3. Run the async sample for your connector
4. Use typed clients in your application
5. Deploy to Azure Functions or run locally
## Reference
-- Python SDK: [PythonSDK/src/azure_workflows_connectors_sdk](../../src/azure_workflows_connectors_sdk)
+- API Reference: [Azure Connectors Python SDK](https://azure.github.io/connectors-python-sdk/)
- Generation Guide: [GENERATION.md](../../GENERATION.md)
-- .NET Sample: [DotnetSDK/samples/SampleConnectorUsage](../../../DotnetSDK/samples/SampleConnectorUsage)
+- Migration Guide: [Unsuffixed async operations](../../docs/migration-sync-aio.md)
diff --git a/samples/sample_connector_usage/sample_connector_usage_arm.py b/samples/sample_connector_usage/sample_connector_usage_arm.py
index c7512550..93322512 100644
--- a/samples/sample_connector_usage/sample_connector_usage_arm.py
+++ b/samples/sample_connector_usage/sample_connector_usage_arm.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure Resource Manager (ARM) Connector SDK Sample
+Azure Resource Manager (ARM) sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the ARM connector SDK to interact
+This sample demonstrates how to use the ARM client from the Azure Connectors Python SDK to interact
with Azure Resource Manager APIs.
Prerequisites:
@@ -48,7 +48,7 @@ async def example_1_list_subscriptions():
async with ArmClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
subscriptions = [
- item async for item in client.subscriptions_list_async()
+ item async for item in client.list_subscriptions()
]
if subscriptions:
@@ -78,7 +78,7 @@ async def example_2_list_subscriptions_with_details():
async with ArmClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
subscriptions = [
- item async for item in client.subscriptions_list_async()
+ item async for item in client.list_subscriptions()
]
if subscriptions:
@@ -121,7 +121,7 @@ async def example_3_filter_enabled_subscriptions():
async with ArmClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
subscriptions = [
- item async for item in client.subscriptions_list_async()
+ item async for item in client.list_subscriptions()
]
if subscriptions:
@@ -158,7 +158,7 @@ async def example_3_filter_enabled_subscriptions():
async def main():
"""Run all examples."""
- print("Azure Resource Manager (ARM) Connector SDK - Sample Usage")
+ print("Azure Resource Manager (ARM) sample usage for the Azure Connectors Python SDK")
print("=" * 60)
if not CONNECTION_RUNTIME_URL:
diff --git a/samples/sample_connector_usage/sample_connector_usage_azuread.py b/samples/sample_connector_usage/sample_connector_usage_azuread.py
index a5f4fc42..be4c873e 100644
--- a/samples/sample_connector_usage/sample_connector_usage_azuread.py
+++ b/samples/sample_connector_usage/sample_connector_usage_azuread.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure AD (Microsoft Entra ID) Connector SDK Sample
+Azure AD (Microsoft Entra ID) sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Azure AD connector SDK.
+This sample demonstrates how to use the Azure AD client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Azure AD connection
@@ -24,8 +24,8 @@
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.azuread import AzureadClient
from azure.connectors.azuread import (
- AzureadClient,
CreateOffice365GroupInput,
CreateSecurityGroupInput,
CreateGroupInput,
@@ -63,7 +63,7 @@ async def example_1_create_office365_group():
mail_enabled=True,
)
- result = await client.create_office365_group_async(input=input_data)
+ result = await client.create_office365_group(input=input_data)
if result:
print("Office 365 group created:")
@@ -102,7 +102,7 @@ async def example_2_create_security_group():
mail_enabled=False,
)
- result = await client.create_security_group_async(input=input_data)
+ result = await client.create_security_group(input=input_data)
if result:
print("Security group created:")
@@ -145,7 +145,7 @@ async def example_3_create_group():
mail_enabled=bool(group_types),
)
- result = await client.create_group_async(input=input_data)
+ result = await client.create_group(input=input_data)
if result:
print("Group created:")
@@ -193,7 +193,7 @@ async def example_4_create_user():
},
)
- result = await client.create_user_async(input=input_data)
+ result = await client.create_user(input=input_data)
if result:
print("User created:")
@@ -227,7 +227,7 @@ async def example_5_remove_member_from_group():
async with AzureadClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- await client.remove_member_from_group_async(
+ await client.remove_member_from_group(
group_id=group_id,
member_id=member_id,
)
@@ -244,7 +244,7 @@ async def example_5_remove_member_from_group():
async def main():
"""Run all examples."""
- print("Azure AD (Microsoft Entra ID) Connector SDK - Sample Usage")
+ print("Azure AD (Microsoft Entra ID) sample usage for the Azure Connectors Python SDK")
print("=" * 60)
if not CONNECTION_RUNTIME_URL:
diff --git a/samples/sample_connector_usage/sample_connector_usage_azureautomation.py b/samples/sample_connector_usage/sample_connector_usage_azureautomation.py
index a476fab1..7995501d 100644
--- a/samples/sample_connector_usage/sample_connector_usage_azureautomation.py
+++ b/samples/sample_connector_usage/sample_connector_usage_azureautomation.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure Automation Connector SDK Sample
+Azure Automation sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Azure Automation connector SDK
+This sample demonstrates how to use the Azure Automation client from the Azure Connectors Python SDK
to interact with Azure Automation accounts, runbooks, and jobs.
Prerequisites:
@@ -34,8 +34,8 @@
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.azureautomation import AzureautomationClient
from azure.connectors.azureautomation import (
- AzureautomationClient,
CreateJobInput,
CreateJobResponse,
Subscription,
@@ -99,7 +99,7 @@ async def example_2_create_job():
) as client:
try:
# Create a new automation job
- result = await client.create_job_async(
+ result = await client.create_job(
input=CreateJobInput(properties={}),
subscription_id=SUBSCRIPTION_ID,
resource_group_name=RESOURCE_GROUP_NAME,
@@ -130,7 +130,7 @@ async def example_3_create_job_and_wait():
) as client:
try:
# Create job with wait parameter to wait for completion
- result = await client.create_job_async(
+ result = await client.create_job(
input=CreateJobInput(properties={}),
subscription_id=SUBSCRIPTION_ID,
resource_group_name=RESOURCE_GROUP_NAME,
@@ -161,7 +161,7 @@ async def example_4_get_job_status():
) as client:
try:
# Get status of a job
- result = await client.get_status_of_job_async(
+ result = await client.get_status_of_job(
subscription_id=SUBSCRIPTION_ID,
resource_group_name=RESOURCE_GROUP_NAME,
automation_account=AUTOMATION_ACCOUNT,
@@ -194,7 +194,7 @@ async def example_5_get_job_output():
) as client:
try:
# Get output from a completed job
- output = await client.get_job_output_async(
+ output = await client.get_job_output(
subscription_id=SUBSCRIPTION_ID,
resource_group_name=RESOURCE_GROUP_NAME,
automation_account=AUTOMATION_ACCOUNT,
diff --git a/samples/sample_connector_usage/sample_connector_usage_azureblob.py b/samples/sample_connector_usage/sample_connector_usage_azureblob.py
index 1b8846e0..999863cb 100644
--- a/samples/sample_connector_usage/sample_connector_usage_azureblob.py
+++ b/samples/sample_connector_usage/sample_connector_usage_azureblob.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure Blob Storage Connector SDK Sample
+Azure Blob Storage sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Azure Blob Storage connector SDK.
+This sample demonstrates how to use the Azure Blob Storage client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Azure Blob Storage connection
@@ -60,7 +60,7 @@ async def example_1_get_blob_metadata():
async with AzureblobClient(CONNECTION_RUNTIME_URL, credential) as client:
- metadata = await client.get_file_metadata_by_path_async(
+ metadata = await client.get_file_metadata_by_path(
dataset=STORAGE_ACCOUNT,
path=blob_path,
)
@@ -90,7 +90,7 @@ async def example_2_download_blob():
async with DefaultAzureCredential() as credential:
async with AzureblobClient(CONNECTION_RUNTIME_URL, credential) as client:
- content = await client.get_file_content_by_path_async(
+ content = await client.get_file_content_by_path(
dataset=STORAGE_ACCOUNT,
path=blob_path,
)
@@ -128,7 +128,7 @@ async def example_3_upload_blob():
async with AzureblobClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- metadata = await client.create_file_async(
+ metadata = await client.create_file(
input=blob_content.encode("utf-8"),
dataset=STORAGE_ACCOUNT,
folder_path=folder_path,
@@ -157,7 +157,7 @@ async def example_4_list_blobs():
if not folder_id:
print("Set TEST_FOLDER_ID environment variable to a folder identifier.")
print("Example: $env:TEST_FOLDER_ID = 'JTJmbXljb250YWluZXI=' (base64 encoded path)")
- print("Or use list_root_folder_async to list root container blobs.")
+ print("Or use list_root_folder to list root container blobs.")
# Try listing root folder instead
print("\nListing root folder blobs instead...")
@@ -165,7 +165,7 @@ async def example_4_list_blobs():
async with AzureblobClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- blobs = [item async for item in client.list_root_folder_async(
+ blobs = [item async for item in client.list_root_folder(
dataset=STORAGE_ACCOUNT,
)]
@@ -190,7 +190,7 @@ async def example_4_list_blobs():
async with AzureblobClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- blobs = [item async for item in client.list_folder_async(
+ blobs = [item async for item in client.list_folder(
dataset=STORAGE_ACCOUNT,
id=folder_id,
)]
@@ -220,14 +220,14 @@ async def example_5_delete_blob():
if not blob_id:
print("Set TEST_BLOB_ID environment variable to a blob identifier.")
print("Example: $env:TEST_BLOB_ID = 'JTJmbXljb250YWluZXIlMmZmaWxlLnR4dA=='")
- print("You can get blob IDs from the list_folder_async response.")
+ print("You can get blob IDs from the list_folder response.")
return
async with DefaultAzureCredential() as credential:
async with AzureblobClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- await client.delete_file_async(
+ await client.delete_file(
dataset=STORAGE_ACCOUNT,
id=blob_id,
)
@@ -242,7 +242,7 @@ async def example_5_delete_blob():
async def main():
"""Run all examples."""
- print("Azure Blob Storage Connector SDK - Sample Usage")
+ print("Azure Blob Storage sample usage for the Azure Connectors Python SDK")
print("=" * 60)
if not CONNECTION_RUNTIME_URL:
diff --git a/samples/sample_connector_usage/sample_connector_usage_azuredatafactory.py b/samples/sample_connector_usage/sample_connector_usage_azuredatafactory.py
index 55c60ac8..5975a1b1 100644
--- a/samples/sample_connector_usage/sample_connector_usage_azuredatafactory.py
+++ b/samples/sample_connector_usage/sample_connector_usage_azuredatafactory.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure Data Factory Connector SDK Sample
+Azure Data Factory sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Azure Data Factory connector SDK
+This sample demonstrates how to use the Azure Data Factory client from the Azure Connectors Python SDK
to create, monitor, and cancel pipeline runs.
Prerequisites:
@@ -30,8 +30,8 @@
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.azuredatafactory import AzuredatafactoryClient
from azure.connectors.azuredatafactory import (
- AzuredatafactoryClient,
ParameterValueSpecification,
CreatePipelineRunResponse,
PipelineRun,
@@ -71,7 +71,7 @@ async def example_1_create_pipeline_run():
)
# Create the pipeline run
- result = await client.create_pipeline_run_async(
+ result = await client.create_pipeline_run(
input=parameters,
subscription_id=SUBSCRIPTION_ID,
resource_group_name=RESOURCE_GROUP,
@@ -111,7 +111,7 @@ async def example_2_get_pipeline_run_status(run_id: str):
) as client:
try:
# Get the pipeline run status
- result = await client.get_pipeline_run_async(
+ result = await client.get_pipeline_run(
subscription_id=SUBSCRIPTION_ID,
resource_group_name=RESOURCE_GROUP,
data_factory_name=DATA_FACTORY_NAME,
@@ -154,7 +154,7 @@ async def example_3_cancel_pipeline_run(run_id: str):
) as client:
try:
# Cancel the pipeline run
- await client.cancel_pipeline_run_async(
+ await client.cancel_pipeline_run(
subscription_id=SUBSCRIPTION_ID,
resource_group_name=RESOURCE_GROUP,
data_factory_name=DATA_FACTORY_NAME,
diff --git a/samples/sample_connector_usage/sample_connector_usage_azuredigitaltwins.py b/samples/sample_connector_usage/sample_connector_usage_azuredigitaltwins.py
index 28d75ac8..672050ac 100644
--- a/samples/sample_connector_usage/sample_connector_usage_azuredigitaltwins.py
+++ b/samples/sample_connector_usage/sample_connector_usage_azuredigitaltwins.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure Digital Twins Connector SDK Sample
+Azure Digital Twins sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Azure Digital Twins connector SDK
+This sample demonstrates how to use the Azure Digital Twins client from the Azure Connectors Python SDK
to manage digital twins, models, relationships, and queries.
Prerequisites:
@@ -32,8 +32,8 @@
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.azuredigitaltwins import AzuredigitaltwinsClient
from azure.connectors.azuredigitaltwins import (
- AzuredigitaltwinsClient,
QueryTwinsInput,
SendTelemetryInput,
TwinRelationship,
@@ -59,7 +59,7 @@ async def example_1_list_models():
) as client:
try:
# List all models
- models = [item async for item in client.list_models_async(
+ models = [item async for item in client.list_models(
include_model_definition="true"
)]
@@ -88,7 +88,7 @@ async def example_2_get_twin():
) as client:
try:
# Get a twin by ID
- result = await client.get_twin_by_id_async(twinid=twin_id)
+ result = await client.get_twin_by_id(twinid=twin_id)
if result:
print(f"Twin ID: {result.get('$dtId', 'Unknown')}")
@@ -122,7 +122,7 @@ async def example_3_query_twins():
query_input = QueryTwinsInput(
query="SELECT * FROM digitaltwins"
)
- result = await client.query_twins_async(input=query_input)
+ result = await client.query_twins(input=query_input)
if result and result.get("value"):
print(f"Query results: {result['value']}")
@@ -151,7 +151,7 @@ async def example_4_list_relationships():
) as client:
try:
# List outgoing relationships
- outgoing = [item async for item in client.list_relationships_async(twinid=twin_id)]
+ outgoing = [item async for item in client.list_relationships(twinid=twin_id)]
if outgoing:
print(f"Outgoing relationships from {twin_id}:")
@@ -162,7 +162,7 @@ async def example_4_list_relationships():
print(f"No outgoing relationships from {twin_id}")
# List incoming relationships
- incoming = [item async for item in client.list_incoming_relationships_async(
+ incoming = [item async for item in client.list_incoming_relationships(
twinid=twin_id
)]
@@ -195,7 +195,7 @@ async def example_5_send_telemetry():
telemetry = SendTelemetryInput(
value='{"temperature": 72.5, "humidity": 45}'
)
- await client.send_telemetry_async(
+ await client.send_telemetry(
input=telemetry,
twinid=twin_id
)
diff --git a/samples/sample_connector_usage/sample_connector_usage_azureeventgrid.py b/samples/sample_connector_usage/sample_connector_usage_azureeventgrid.py
index 2d7c0bbc..5dbb0a34 100644
--- a/samples/sample_connector_usage/sample_connector_usage_azureeventgrid.py
+++ b/samples/sample_connector_usage/sample_connector_usage_azureeventgrid.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure Event Grid Connector SDK Sample
+Azure Event Grid sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Azure Event Grid connector SDK.
+This sample demonstrates how to use the Azure Event Grid client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with an Azure Event Grid connection
@@ -26,8 +26,8 @@
import os
from azure.identity.aio import DefaultAzureCredential
+from azure.connectors.azureeventgrid import AzureeventgridClient
from azure.connectors.azureeventgrid import (
- AzureeventgridClient,
EventRequest,
)
@@ -46,8 +46,8 @@ async def example_1_list_subscriptions():
async with DefaultAzureCredential() as credential:
async with AzureeventgridClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.subscriptions_list_async()
- subscriptions = result.get("value", []) if result else []
+ items = [item async for item in client.list_subscriptions()]
+ subscriptions = items
print(f"Found {len(subscriptions)} subscription(s).")
for subscription in subscriptions[:10]:
@@ -63,8 +63,8 @@ async def example_2_list_topic_types():
async with DefaultAzureCredential() as credential:
async with AzureeventgridClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.topic_types_list_async()
- topic_types = result.get("value", []) if result else []
+ items = [item async for item in client.list_topic_types()]
+ topic_types = items
print(f"Found {len(topic_types)} topic type(s).")
for topic_type in topic_types[:10]:
diff --git a/samples/sample_connector_usage/sample_connector_usage_azureiotcentral.py b/samples/sample_connector_usage/sample_connector_usage_azureiotcentral.py
index 6ad184e5..f5e9b155 100644
--- a/samples/sample_connector_usage/sample_connector_usage_azureiotcentral.py
+++ b/samples/sample_connector_usage/sample_connector_usage_azureiotcentral.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure IoT Central Connector SDK Sample
+Azure IoT Central sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Azure IoT Central connector SDK.
+This sample demonstrates how to use the Azure IoT Central client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with an Azure IoT Central connection
@@ -28,8 +28,8 @@
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.azureiotcentral import AzureiotcentralClient
from azure.connectors.azureiotcentral import (
- AzureiotcentralClient,
DeviceGroup,
)
@@ -52,7 +52,7 @@ async def example_1_list_devices():
async with AzureiotcentralClient(CONNECTION_RUNTIME_URL, credential) as client:
devices = [
- item async for item in client.devices_list_async(
+ item async for item in client.list_devices(
application=APPLICATION
)
]
@@ -72,7 +72,7 @@ async def example_2_list_device_groups():
async with AzureiotcentralClient(CONNECTION_RUNTIME_URL, credential) as client:
device_groups = [
- item async for item in client.device_groups_list_async(
+ item async for item in client.list_device_groups(
application=APPLICATION
)
]
@@ -98,8 +98,11 @@ async def example_3_create_device_group():
async with AzureiotcentralClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.device_groups_set_async(
- input=DeviceGroup(display_name="SDK sample group"),
+ result = await client.device_groups_set(
+ input=DeviceGroup(
+ display_name="SDK sample group",
+ filter="status = 'registered'",
+ ),
device_group_id=device_group_id,
application=APPLICATION,
)
diff --git a/samples/sample_connector_usage/sample_connector_usage_azuremonitorlogs.py b/samples/sample_connector_usage/sample_connector_usage_azuremonitorlogs.py
index 65c05518..94280c4c 100644
--- a/samples/sample_connector_usage/sample_connector_usage_azuremonitorlogs.py
+++ b/samples/sample_connector_usage/sample_connector_usage_azuremonitorlogs.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure Monitor Logs Connector SDK Sample
+Azure Monitor Logs sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Azure Monitor Logs connector SDK.
+This sample demonstrates how to use the Azure Monitor Logs client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Azure Monitor Logs access
@@ -29,8 +29,8 @@
try:
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+ from azure.connectors.azuremonitorlogs import AzuremonitorlogsClient
from azure.connectors.azuremonitorlogs import (
- AzuremonitorlogsClient,
QueryDataInput,
VisualizeQueryInput,
)
@@ -71,11 +71,11 @@ async def example_list_discovery_values():
async with AzuremonitorlogsClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- subscriptions = [item async for item in client.list_subscriptions_async()]
+ subscriptions = [item async for item in client.list_subscriptions()]
count = len(subscriptions) if subscriptions else 0
print(f"Found {count} subscriptions.")
- resource_groups = [item async for item in client.list_resource_groups_async(
+ resource_groups = [item async for item in client.list_resource_groups(
subscriptions=SUBSCRIPTION_ID
)]
rg_count = len(resource_groups) if resource_groups else 0
@@ -98,9 +98,10 @@ async def example_run_query():
request = QueryDataInput(
query="Heartbeat | take 5",
timerangetype="SetInQuery",
+ timerange={},
)
- result = await client.query_data_async(
+ result = await client.query_data(
input=request,
subscriptions=SUBSCRIPTION_ID,
resourcegroups=RESOURCE_GROUP,
@@ -134,9 +135,10 @@ async def example_visualize_query():
"| order by TimeGenerated asc"
),
timerangetype="SetInQuery",
+ timerange={},
)
- result = await client.visualize_query_async(
+ result = await client.visualize_query(
input=request,
subscriptions=SUBSCRIPTION_ID,
resourcegroups=RESOURCE_GROUP,
diff --git a/samples/sample_connector_usage/sample_connector_usage_azurequeues.py b/samples/sample_connector_usage/sample_connector_usage_azurequeues.py
index cf091bdf..ccc753a9 100644
--- a/samples/sample_connector_usage/sample_connector_usage_azurequeues.py
+++ b/samples/sample_connector_usage/sample_connector_usage_azurequeues.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure Storage Queues Connector SDK Sample
+Azure Storage Queues sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Azure Storage Queues connector SDK
+This sample demonstrates how to use the Azure Storage Queues client from the Azure Connectors Python SDK
to interact with Azure Storage Queue messages.
Prerequisites:
@@ -57,21 +57,17 @@ async def example_1_list_queues():
async with AzurequeuesClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.list_queues_async(
+ items = [item async for item in client.list_queues(
storage_account_name=STORAGE_ACCOUNT
- )
+ )]
- if result:
+ if items:
print(f"Queues in storage account '{STORAGE_ACCOUNT}':")
- # Result may be a list or dict with queue names
- if isinstance(result, list):
- for queue in result:
- if isinstance(queue, dict):
- print(f" - {queue.get('name', queue)}")
- else:
- print(f" - {queue}")
- elif isinstance(result, dict):
- print(f" Response: {result}")
+ for queue in items:
+ if isinstance(queue, dict):
+ print(f" - {queue.get('name', queue)}")
+ else:
+ print(f" - {queue}")
else:
print("No queues found or empty response.")
@@ -96,7 +92,7 @@ async def example_2_create_queue():
async with AzurequeuesClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.put_queue_async(
+ result = await client.put_queue(
storage_account_name=STORAGE_ACCOUNT,
queue_name=new_queue_name
)
@@ -127,7 +123,7 @@ async def example_3_put_message():
try:
message_input = "Hello from Azure Connectors SDK for Python!"
- await client.put_message_async(
+ await client.put_message(
input=message_input,
storage_account_name=STORAGE_ACCOUNT,
queue_name=QUEUE_NAME
@@ -156,7 +152,7 @@ async def example_4_get_messages():
async with AzurequeuesClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_messages_async(
+ result = await client.get_messages(
storage_account_name=STORAGE_ACCOUNT,
queue_name=QUEUE_NAME,
numofmessages="5", # Get up to 5 messages
@@ -206,7 +202,7 @@ async def example_5_delete_message():
async with AzurequeuesClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- await client.delete_message_async(
+ await client.delete_message(
storage_account_name=STORAGE_ACCOUNT,
queue_name=QUEUE_NAME,
message_id=message_id,
@@ -223,7 +219,7 @@ async def example_5_delete_message():
async def main():
"""Run all examples."""
- print("Azure Storage Queues Connector SDK - Sample Usage")
+ print("Azure Storage Queues sample usage for the Azure Connectors Python SDK")
print("=" * 60)
if not CONNECTION_RUNTIME_URL:
diff --git a/samples/sample_connector_usage/sample_connector_usage_azuretables.py b/samples/sample_connector_usage/sample_connector_usage_azuretables.py
index b3ff375a..97963383 100644
--- a/samples/sample_connector_usage/sample_connector_usage_azuretables.py
+++ b/samples/sample_connector_usage/sample_connector_usage_azuretables.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure Storage Tables Connector SDK Sample
+Azure Storage Tables sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Azure Storage Tables connector SDK
+This sample demonstrates how to use the Azure Storage Tables client from the Azure Connectors Python SDK
to interact with Azure Table Storage.
Prerequisites:
@@ -28,9 +28,8 @@
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.azuretables import AzuretablesClient
from azure.connectors.azuretables import (
- AzuretablesClient,
- CreateTableInput,
CreateEntityInput,
)
@@ -61,20 +60,18 @@ async def example_1_list_tables():
async with AzuretablesClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_tables_async(
- storage_account_name=STORAGE_ACCOUNT
- )
-
- if result:
+ tables = [
+ table
+ async for table in client.list_tables(
+ storage_account_name=STORAGE_ACCOUNT
+ )
+ ]
+
+ if tables:
print(f"Tables in storage account '{STORAGE_ACCOUNT}':")
- # Response contains 'value' with list of tables
- tables = result.get("value", [])
- if tables:
- for table in tables:
- table_name = table.get("TableName", table)
- print(f" - {table_name}")
- else:
- print(" No tables found.")
+ for table in tables:
+ table_name = table.get("TableName", table)
+ print(f" - {table_name}")
else:
print("No tables found or empty response.")
@@ -99,14 +96,9 @@ async def example_2_create_table():
async with AzuretablesClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- # Create table input with table name in additional_properties
- table_input = CreateTableInput(
- additional_properties={"TableName": new_table_name}
- )
-
- result = await client.create_table_async(
- input=table_input,
- storage_account_name=STORAGE_ACCOUNT
+ result = await client.create_table(
+ input=new_table_name,
+ storage_account_name=STORAGE_ACCOUNT,
)
print(f"Table '{new_table_name}' created successfully.")
@@ -146,7 +138,7 @@ async def example_3_create_entity():
}
)
- result = await client.create_entity_async(
+ result = await client.create_entity(
input=entity_input,
storage_account_name=STORAGE_ACCOUNT,
table_name=TABLE_NAME
@@ -180,7 +172,7 @@ async def example_4_get_entities():
async with AzuretablesClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
# Query entities with optional filter
- entities = [item async for item in client.get_entities_async(
+ entities = [item async for item in client.list_entities(
storage_account_name=STORAGE_ACCOUNT,
table_name=TABLE_NAME,
# Optional: filter entities
@@ -226,7 +218,7 @@ async def example_5_get_entity():
async with AzuretablesClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_entity_async(
+ result = await client.get_entity(
storage_account_name=STORAGE_ACCOUNT,
table_name=TABLE_NAME,
partition_key=partition_key,
@@ -260,7 +252,7 @@ async def example_5_get_entity():
async def main():
"""Run all examples."""
- print("Azure Storage Tables Connector SDK - Sample Usage")
+ print("Azure Storage Tables sample usage for the Azure Connectors Python SDK")
print("=" * 60)
if not CONNECTION_RUNTIME_URL:
diff --git a/samples/sample_connector_usage/sample_connector_usage_azurevm.py b/samples/sample_connector_usage/sample_connector_usage_azurevm.py
index 1b222a53..3025d63b 100644
--- a/samples/sample_connector_usage/sample_connector_usage_azurevm.py
+++ b/samples/sample_connector_usage/sample_connector_usage_azurevm.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure VM Connector SDK Sample
+Azure VM sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Azure VM connector SDK to manage
+This sample demonstrates how to use the Azure VM client from the Azure Connectors Python SDK to manage
virtual machines and VM scale sets.
Prerequisites:
@@ -50,7 +50,7 @@ async def example_1_get_virtual_machine():
async with AzurevmClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.virtual_machine_get_async(
+ result = await client.virtual_machine_get(
subscription_id=SUBSCRIPTION_ID,
resource_group_name=RESOURCE_GROUP,
virtual_machine_name=VM_NAME
@@ -78,7 +78,7 @@ async def example_2_start_virtual_machine():
async with AzurevmClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- await client.virtual_machine_start_async(
+ await client.virtual_machine_start(
subscription_id=SUBSCRIPTION_ID,
resource_group_name=RESOURCE_GROUP,
virtual_machine_name=VM_NAME
@@ -101,7 +101,7 @@ async def example_3_deallocate_virtual_machine():
async with AzurevmClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- await client.virtual_machine_deallocate_async(
+ await client.virtual_machine_deallocate(
subscription_id=SUBSCRIPTION_ID,
resource_group_name=RESOURCE_GROUP,
virtual_machine_name=VM_NAME
@@ -124,7 +124,7 @@ async def example_4_restart_virtual_machine():
async with AzurevmClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- await client.virtual_machine_restart_async(
+ await client.virtual_machine_restart(
subscription_id=SUBSCRIPTION_ID,
resource_group_name=RESOURCE_GROUP,
virtual_machine_name=VM_NAME
@@ -146,7 +146,7 @@ async def example_5_get_vm_in_scale_set():
async with AzurevmClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.virtual_machine_in_scale_set_get_async(
+ result = await client.virtual_machine_in_scale_set_get(
subscription_id=SUBSCRIPTION_ID,
resource_group_name=RESOURCE_GROUP,
virtual_machine_scale_set_name=VMSS_NAME,
@@ -177,7 +177,7 @@ async def example_6_scale_set_operations():
try:
# Start VM in scale set
print(f"Starting VMSS instance {VMSS_INSTANCE_ID}...")
- await client.virtual_machine_in_scale_set_start_async(
+ await client.virtual_machine_in_scale_set_start(
subscription_id=SUBSCRIPTION_ID,
resource_group_name=RESOURCE_GROUP,
virtual_machine_scale_set_name=VMSS_NAME,
@@ -186,11 +186,11 @@ async def example_6_scale_set_operations():
print("Start command sent")
# Other available operations (commented out):
- # - virtual_machine_in_scale_set_deallocate_async
- # - virtual_machine_in_scale_set_power_off_async
- # - virtual_machine_in_scale_set_restart_async
- # - virtual_machine_in_scale_set_redeploy_async
- # - virtual_machine_in_scale_set_reimage_async
+ # - virtual_machine_in_scale_set_deallocate
+ # - virtual_machine_in_scale_set_power_off
+ # - virtual_machine_in_scale_set_restart
+ # - virtual_machine_in_scale_set_redeploy
+ # - virtual_machine_in_scale_set_reimage
except ConnectorException as ex:
print(f"Connector error: {ex}")
diff --git a/samples/sample_connector_usage/sample_connector_usage_box.py b/samples/sample_connector_usage/sample_connector_usage_box.py
index c0d3db71..7f12678d 100644
--- a/samples/sample_connector_usage/sample_connector_usage_box.py
+++ b/samples/sample_connector_usage/sample_connector_usage_box.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Box Connector SDK Sample
+Box sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Box connector SDK.
+This sample demonstrates how to use the Box client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Box connection
@@ -42,11 +42,11 @@ async def example_1_list_root_folder():
async with DefaultAzureCredential() as credential:
async with BoxClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.list_root_folder_async()
+ items = [item async for item in client.list_root_folder()]
- if result and "value" in result:
- print(f"Found {len(result['value'])} items in root folder:")
- for item in result["value"][:10]:
+ if items:
+ print(f"Found {len(items)} items in root folder:")
+ for item in items[:10]:
icon = "[DIR]" if item.get("IsFolder") else "[FILE]"
print(f" {icon} {item.get('Name', 'N/A')}")
else:
@@ -66,7 +66,7 @@ async def example_2_get_file_metadata_by_path():
async with BoxClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- metadata = await client.get_file_metadata_by_path_async(path=file_path)
+ metadata = await client.get_file_metadata_by_path(path=file_path)
if metadata:
print(f"Name: {metadata.get('Name', 'N/A')}")
@@ -89,7 +89,7 @@ async def example_3_create_file():
async with BoxClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.create_file_async(
+ result = await client.create_file(
input=b"Hello from azure-connectors Box sample!",
folder_path=destination_folder,
name=destination_name,
@@ -116,8 +116,7 @@ async def example_4_list_folder_for_polling():
async with BoxClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.list_folder_async(id=folder_id)
- items = result.get("value", []) if result else []
+ items = [item async for item in client.list_folder(id=folder_id)]
print(f"Folder listing returned {len(items)} item(s).")
print("Persist item IDs or timestamps to implement polling with this action client.")
except ConnectorException as ex:
diff --git a/samples/sample_connector_usage/sample_connector_usage_campfire.py b/samples/sample_connector_usage/sample_connector_usage_campfire.py
index 40e68e06..e8f73fc5 100644
--- a/samples/sample_connector_usage/sample_connector_usage_campfire.py
+++ b/samples/sample_connector_usage/sample_connector_usage_campfire.py
@@ -1,7 +1,7 @@
"""
-Campfire Connector SDK Sample
+Campfire sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Campfire connector SDK.
+This sample demonstrates how to use the Campfire client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with a Campfire connection
@@ -38,7 +38,7 @@ async def example_1_list_accounts() -> None:
async with DefaultAzureCredential() as credential:
async with CampfireClient(CONNECTION_RUNTIME_URL, credential) as client:
- accounts = await client.list_accounts_async()
+ accounts = [item async for item in client.list_accounts()]
print(f"Accounts: {accounts}")
@@ -48,7 +48,7 @@ async def example_2_list_rooms() -> None:
async with DefaultAzureCredential() as credential:
async with CampfireClient(CONNECTION_RUNTIME_URL, credential) as client:
- rooms = await client.list_rooms_async(account="ACCOUNT_ID")
+ rooms = [item async for item in client.list_rooms(account="ACCOUNT_ID")]
print(f"Rooms: {rooms}")
@@ -58,10 +58,10 @@ async def example_3_create_message() -> None:
async with DefaultAzureCredential() as credential:
async with CampfireClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.create_message_async(
+ result = await client.create_message(
room_id="ROOM_ID",
account="ACCOUNT_ID",
- message="Hello from the Campfire connector SDK.",
+ message="Hello from the Campfire client in the Azure Connectors Python SDK.",
)
print(f"Create message result: {result}")
@@ -72,7 +72,7 @@ async def example_4_get_user() -> None:
async with DefaultAzureCredential() as credential:
async with CampfireClient(CONNECTION_RUNTIME_URL, credential) as client:
- user = await client.get_user_async(user_id=12345, account="ACCOUNT_ID")
+ user = await client.get_user(user_id=12345, account="ACCOUNT_ID")
print(f"User: {user}")
@@ -83,7 +83,7 @@ async def main() -> None:
print("Set it to your connection runtime URL from Azure Portal.")
return
- print("Campfire Connector SDK - Sample Usage")
+ print("Campfire sample usage for the Azure Connectors Python SDK")
print("=" * 50)
try:
diff --git a/samples/sample_connector_usage/sample_connector_usage_clicksendsms.py b/samples/sample_connector_usage/sample_connector_usage_clicksendsms.py
index d0983e2e..fc0bda18 100644
--- a/samples/sample_connector_usage/sample_connector_usage_clicksendsms.py
+++ b/samples/sample_connector_usage/sample_connector_usage_clicksendsms.py
@@ -1,7 +1,7 @@
"""
-ClickSend SMS Connector SDK Sample
+ClickSend SMS sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the ClickSend SMS connector SDK.
+This sample demonstrates how to use the ClickSend SMS client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with a ClickSend SMS connection
@@ -24,8 +24,8 @@
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.clicksendsms import ClicksendsmsClient
from azure.connectors.clicksendsms import (
- ClicksendsmsClient,
CreateListInput,
SmsSendInput,
)
@@ -42,12 +42,12 @@ async def example_1_send_sms() -> None:
async with DefaultAzureCredential() as credential:
async with ClicksendsmsClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.sms_send_async(
+ result = await client.sms_send(
input=SmsSendInput(
messages=[
{
"to": "+61411111111",
- "body": "Hello from the ClickSend SMS connector SDK.",
+ "body": "Hello from the ClickSend SMS client in the Azure Connectors Python SDK.",
}
],
),
@@ -61,7 +61,7 @@ async def example_2_get_contact_lists() -> None:
async with DefaultAzureCredential() as credential:
async with ClicksendsmsClient(CONNECTION_RUNTIME_URL, credential) as client:
- lists = await client.get_contact_lists_async(page=1, limit=10)
+ lists = await client.get_contact_lists(page=1, limit=10)
print(f"Contact lists: {lists}")
@@ -71,7 +71,7 @@ async def example_3_create_list() -> None:
async with DefaultAzureCredential() as credential:
async with ClicksendsmsClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.create_list_async(
+ result = await client.create_list(
input=CreateListInput(list_name="My New List"),
)
print(f"Created list: {result}")
@@ -83,7 +83,7 @@ async def example_4_search_contact_lists() -> None:
async with DefaultAzureCredential() as credential:
async with ClicksendsmsClient(CONNECTION_RUNTIME_URL, credential) as client:
- results = await client.search_contact_list_async(q="friends")
+ results = await client.search_contact_list(q="friends")
print(f"Search results: {results}")
@@ -94,7 +94,7 @@ async def main() -> None:
print("Set it to your connection runtime URL from Azure Portal.")
return
- print("ClickSend SMS Connector SDK - Sample Usage")
+ print("ClickSend SMS sample usage for the Azure Connectors Python SDK")
print("=" * 50)
try:
diff --git a/samples/sample_connector_usage/sample_connector_usage_cloudconvert.py b/samples/sample_connector_usage/sample_connector_usage_cloudconvert.py
index 1530954f..7f32b69e 100644
--- a/samples/sample_connector_usage/sample_connector_usage_cloudconvert.py
+++ b/samples/sample_connector_usage/sample_connector_usage_cloudconvert.py
@@ -1,4 +1,4 @@
-"""CloudConvert connector SDK sample."""
+"""CloudConvert sample for the Azure Connectors Python SDK."""
import asyncio
import os
@@ -21,7 +21,7 @@ async def main() -> None:
async with DefaultAzureCredential() as credential:
try:
async with CloudconvertClient(CONNECTION_RUNTIME_URL, credential) as client:
- options = await client.get_convert_options_async()
+ options = await client.get_convert_options()
print(f"Conversion options: {options}")
except ConnectorException as ex:
print(f"Connector error: {ex}")
diff --git a/samples/sample_connector_usage/sample_connector_usage_cloudmersiveconvert.py b/samples/sample_connector_usage/sample_connector_usage_cloudmersiveconvert.py
index 55f9be37..0c8f2e71 100644
--- a/samples/sample_connector_usage/sample_connector_usage_cloudmersiveconvert.py
+++ b/samples/sample_connector_usage/sample_connector_usage_cloudmersiveconvert.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Cloudmersive Convert Connector SDK Sample
+Cloudmersive Convert sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Cloudmersive Convert connector SDK.
+This sample demonstrates how to use the Cloudmersive Convert client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with a Cloudmersive Convert connection
@@ -27,8 +27,8 @@
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.cloudmersiveconvert import CloudmersiveconvertClient
from azure.connectors.cloudmersiveconvert import (
- CloudmersiveconvertClient,
GetDocxBodyRequest,
ScreenshotRequest,
)
@@ -50,7 +50,7 @@ async def example_1_convert_url_to_pdf():
url="https://www.example.com",
)
- result = await client.convert_web_url_to_pdf_async(input=request)
+ result = await client.convert_web_url_to_pdf(input=request)
print(f"Converted PDF byte length: {len(result) if result else 0}")
@@ -72,7 +72,7 @@ async def example_2_get_docx_body():
input_file_url="https://example.com/document.docx",
)
- result = await client.edit_document_docx_body_async(input=request)
+ result = await client.edit_document_docx_body(input=request)
print(f"DOCX body result: {result}")
diff --git a/samples/sample_connector_usage/sample_connector_usage_commondataservice.py b/samples/sample_connector_usage/sample_connector_usage_commondataservice.py
index 28f2a7ac..03af2dda 100644
--- a/samples/sample_connector_usage/sample_connector_usage_commondataservice.py
+++ b/samples/sample_connector_usage/sample_connector_usage_commondataservice.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Microsoft Dataverse (Common Data Service) Connector SDK Sample
+Microsoft Dataverse (Common Data Service) sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Microsoft Dataverse connector SDK.
+This sample demonstrates how to use the Microsoft Dataverse client from the Azure Connectors Python SDK.
This connector was formerly known as Common Data Service (legacy).
Prerequisites:
@@ -31,8 +31,8 @@
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.commondataservice import CommondataserviceClient
from azure.connectors.commondataservice import (
- CommondataserviceClient,
PostItemInput,
PatchItemInput,
)
@@ -61,11 +61,11 @@ async def example_1_list_datasets():
async with CommondataserviceClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_data_sets_async()
+ items = [item async for item in client.list_data_sets()]
- if result and result.get("value"):
- print(f"Found {len(result['value'])} datasets:")
- for dataset in result["value"][:5]:
+ if items:
+ print(f"Found {len(items)} datasets:")
+ for dataset in items[:5]:
print(f" - {dataset.get('Name', dataset.get('DisplayName', 'N/A'))}")
else:
print("No datasets found")
@@ -89,7 +89,7 @@ async def example_2_list_accounts():
try:
accounts = [
account
- async for account in client.get_items_async(
+ async for account in client.list_items(
dataset=DATASET,
table="accounts",
filter="statecode eq 0", # Active accounts only
@@ -122,7 +122,7 @@ async def example_3_get_account_by_id():
async with CommondataserviceClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_item_async(
+ result = await client.get_item(
dataset=DATASET,
table="accounts",
id=account_id,
@@ -157,7 +157,7 @@ async def example_4_create_account():
}
)
- result = await client.post_item_async(
+ result = await client.post_item(
input=new_account,
dataset=DATASET,
table="accounts",
@@ -192,7 +192,7 @@ async def example_5_update_account():
}
)
- await client.patch_item_async(
+ await client.patch_item(
input=update_data,
dataset=DATASET,
table="accounts",
@@ -218,7 +218,7 @@ async def example_6_create_attachment():
async with CommondataserviceClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.create_attachment_async(
+ result = await client.create_attachment(
input=b"Sample attachment content",
dataset=DATASET,
table="accounts",
@@ -245,7 +245,7 @@ async def example_7_get_table_metadata():
async with CommondataserviceClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_table_async(
+ result = await client.get_table(
dataset=DATASET,
table="accounts",
)
diff --git a/samples/sample_connector_usage/sample_connector_usage_documentdb.py b/samples/sample_connector_usage/sample_connector_usage_documentdb.py
index 66891a9e..9ba54339 100644
--- a/samples/sample_connector_usage/sample_connector_usage_documentdb.py
+++ b/samples/sample_connector_usage/sample_connector_usage_documentdb.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure Cosmos DB (DocumentDB) Connector SDK Sample
+Azure Cosmos DB (DocumentDB) sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Azure Cosmos DB connector SDK
+This sample demonstrates how to use the Azure Cosmos DB client from the Azure Connectors Python SDK
to query documents in Cosmos DB containers.
Note: The connector name "documentdb" reflects the original Azure DocumentDB
@@ -66,7 +66,7 @@ async def example_1_query_all_documents():
async with DocumentdbClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- documents = [item async for item in client.query_documents_async(
+ documents = [item async for item in client.list_query_documents(
cosmos_db_account_name=COSMOS_DB_ACCOUNT,
database_id=DATABASE_ID,
container_id=CONTAINER_ID,
@@ -103,7 +103,7 @@ async def example_2_query_with_filter():
async with DocumentdbClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
# Query with WHERE clause - adjust field names for your schema
- documents = [item async for item in client.query_documents_async(
+ documents = [item async for item in client.list_query_documents(
cosmos_db_account_name=COSMOS_DB_ACCOUNT,
database_id=DATABASE_ID,
container_id=CONTAINER_ID,
@@ -139,7 +139,7 @@ async def example_3_query_with_pagination():
async with DocumentdbClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
# The iterator follows continuation links until all pages are consumed.
- documents = [item async for item in client.query_documents_async(
+ documents = [item async for item in client.list_query_documents(
cosmos_db_account_name=COSMOS_DB_ACCOUNT,
database_id=DATABASE_ID,
container_id=CONTAINER_ID,
@@ -180,7 +180,7 @@ async def example_4_query_with_partition_key():
async with DocumentdbClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
# Query within a specific partition
- documents = [item async for item in client.query_documents_async(
+ documents = [item async for item in client.list_query_documents(
cosmos_db_account_name=COSMOS_DB_ACCOUNT,
database_id=DATABASE_ID,
container_id=CONTAINER_ID,
@@ -215,7 +215,7 @@ async def example_5_query_with_consistency():
try:
# Query with Session consistency (common for read-your-writes)
# Valid levels: Strong, BoundedStaleness, Session, Eventual
- documents = [item async for item in client.query_documents_async(
+ documents = [item async for item in client.list_query_documents(
cosmos_db_account_name=COSMOS_DB_ACCOUNT,
database_id=DATABASE_ID,
container_id=CONTAINER_ID,
@@ -240,7 +240,7 @@ async def example_5_query_with_consistency():
async def main():
"""Run all examples."""
- print("Azure Cosmos DB (DocumentDB) Connector SDK - Sample Usage")
+ print("Azure Cosmos DB (DocumentDB) sample usage for the Azure Connectors Python SDK")
print("=" * 60)
if not CONNECTION_RUNTIME_URL:
diff --git a/samples/sample_connector_usage/sample_connector_usage_docusign.py b/samples/sample_connector_usage/sample_connector_usage_docusign.py
index 64f5d521..dd3d7f67 100644
--- a/samples/sample_connector_usage/sample_connector_usage_docusign.py
+++ b/samples/sample_connector_usage/sample_connector_usage_docusign.py
@@ -1,7 +1,7 @@
"""
-DocuSign Connector SDK Sample
+DocuSign sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the DocuSign connector SDK.
+This sample demonstrates how to use the DocuSign client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with DocuSign connection
@@ -38,8 +38,8 @@ async def example_1_get_login_accounts() -> list[dict]:
async with DefaultAzureCredential() as credential:
async with DocusignClient(CONNECTION_RUNTIME_URL, credential) as client:
- accounts_response = await client.get_login_accounts_async()
- accounts = accounts_response.get("accounts", []) if accounts_response else []
+ accounts_response = [item async for item in client.list_login_accounts()]
+ accounts = accounts_response
print(f"Found {len(accounts)} accounts")
for account in accounts[:10]:
@@ -54,12 +54,14 @@ async def example_2_search_envelopes(account_id: str) -> None:
async with DefaultAzureCredential() as credential:
async with DocusignClient(CONNECTION_RUNTIME_URL, credential) as client:
- envelopes_response = await client.search_list_envelopes_async(
+ envelopes_response = await client.search_list_envelopes(
account_id=account_id,
top=5,
)
- envelopes = envelopes_response.get("value", []) if envelopes_response else []
+ envelopes = (
+ envelopes_response.get("value", []) if envelopes_response else []
+ )
print(f"Found {len(envelopes)} envelopes")
for envelope in envelopes[:5]:
print(f" - {envelope.get('envelopeId')} ({envelope.get('status')})")
@@ -72,7 +74,7 @@ async def main() -> None:
print("Set it to your connection runtime URL from Azure Portal.")
return
- print("DocuSign Connector SDK - Sample Usage")
+ print("DocuSign sample usage for the Azure Connectors Python SDK")
print("=" * 50)
try:
diff --git a/samples/sample_connector_usage/sample_connector_usage_docuware.py b/samples/sample_connector_usage/sample_connector_usage_docuware.py
index d3789bea..593300a2 100644
--- a/samples/sample_connector_usage/sample_connector_usage_docuware.py
+++ b/samples/sample_connector_usage/sample_connector_usage_docuware.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-DocuWare Connector SDK Sample
+DocuWare sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the DocuWare connector SDK.
+This sample demonstrates how to use the DocuWare client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with a DocuWare connection
@@ -27,8 +27,8 @@
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.docuware import DocuwareClient
from azure.connectors.docuware import (
- DocuwareClient,
SearchForDocumentsInFileCabinetInput,
)
@@ -45,11 +45,11 @@ async def example_1_get_file_cabinets():
async with DocuwareClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_file_cabinets_async(
+ items = [item async for item in client.list_file_cabinets(
file_cabinet_type="",
- )
+ )]
- print(f"File cabinets result: {result}")
+ print(f"File cabinets result: {items}")
except ConnectorException as ex:
print(f"Connector error: {ex}")
@@ -67,7 +67,7 @@ async def example_2_search_documents():
try:
request = SearchForDocumentsInFileCabinetInput()
- result = await client.search_for_documents_in_file_cabinet_async(
+ result = await client.search_for_documents_in_file_cabinet(
input=request,
file_cabinet="",
search_dialog_id="",
diff --git a/samples/sample_connector_usage/sample_connector_usage_dropbox.py b/samples/sample_connector_usage/sample_connector_usage_dropbox.py
index 04c3cf77..7f5c075d 100644
--- a/samples/sample_connector_usage/sample_connector_usage_dropbox.py
+++ b/samples/sample_connector_usage/sample_connector_usage_dropbox.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Dropbox Connector SDK Sample
+Dropbox sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Dropbox connector SDK.
+This sample demonstrates how to use the Dropbox client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Dropbox connection
@@ -42,11 +42,11 @@ async def example_1_list_root_folder():
async with DefaultAzureCredential() as credential:
async with DropboxClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.list_root_folder_async()
+ items = [item async for item in client.list_root_folder()]
- if result and "value" in result:
- print(f"Found {len(result['value'])} items in root folder:")
- for item in result["value"][:10]:
+ if items:
+ print(f"Found {len(items)} items in root folder:")
+ for item in items[:10]:
icon = "[DIR]" if item.get("IsFolder") else "[FILE]"
print(f" {icon} {item.get('Name', 'N/A')}")
else:
@@ -66,7 +66,7 @@ async def example_2_get_file_metadata_by_path():
async with DropboxClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- metadata = await client.get_file_metadata_by_path_async(path=file_path)
+ metadata = await client.get_file_metadata_by_path(path=file_path)
if metadata:
print(f"Name: {metadata.get('Name', 'N/A')}")
@@ -89,7 +89,7 @@ async def example_3_create_file():
async with DropboxClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.create_file_async(
+ result = await client.create_file(
input=b"Hello from azure-connectors Dropbox sample!",
folder_path=destination_folder,
name=destination_name,
@@ -116,8 +116,7 @@ async def example_4_list_folder_for_polling():
async with DropboxClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.list_folder_async(id=folder_id)
- items = result.get("value", []) if result else []
+ items = [item async for item in client.list_folder(id=folder_id)]
print(f"Folder listing returned {len(items)} item(s).")
print("Persist item IDs or timestamps to implement polling with this action client.")
except ConnectorException as ex:
diff --git a/samples/sample_connector_usage/sample_connector_usage_dynamicsax.py b/samples/sample_connector_usage/sample_connector_usage_dynamicsax.py
index c57d10f3..1db28a73 100644
--- a/samples/sample_connector_usage/sample_connector_usage_dynamicsax.py
+++ b/samples/sample_connector_usage/sample_connector_usage_dynamicsax.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Dynamics 365 for Finance and Operations (Dynamics AX) Connector SDK Sample
+Dynamics 365 for Finance and Operations (Dynamics AX) sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Dynamics AX connector SDK.
+This sample demonstrates how to use the Dynamics AX client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with a Dynamics AX connection
@@ -28,8 +28,8 @@
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.dynamicsax import DynamicsaxClient
from azure.connectors.dynamicsax import (
- DynamicsaxClient,
PostItemInput,
)
@@ -51,8 +51,8 @@ async def example_1_list_instances():
async with DefaultAzureCredential() as credential:
async with DynamicsaxClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.get_data_sets_async()
- datasets = result.get("value", []) if result else []
+ items = [item async for item in client.list_data_sets()]
+ datasets = items
print(f"Found {len(datasets)} instance(s).")
for dataset in datasets[:10]:
@@ -70,8 +70,8 @@ async def example_2_list_tables():
async with DefaultAzureCredential() as credential:
async with DynamicsaxClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.get_tables_async(dataset=DATASET)
- tables = result.get("value", []) if result else []
+ items = [item async for item in client.list_tables(dataset=DATASET)]
+ tables = items
print(f"Found {len(tables)} table(s).")
for table in tables[:10]:
@@ -94,7 +94,7 @@ async def example_3_create_record():
try:
record = PostItemInput()
record.additional_properties = {"Name": "SDK Sample"}
- result = await client.post_item_async(
+ result = await client.post_item(
input=record,
dataset=DATASET,
table=table,
diff --git a/samples/sample_connector_usage/sample_connector_usage_elfsquaddata.py b/samples/sample_connector_usage/sample_connector_usage_elfsquaddata.py
index bfbaa6c9..dc602c44 100644
--- a/samples/sample_connector_usage/sample_connector_usage_elfsquaddata.py
+++ b/samples/sample_connector_usage/sample_connector_usage_elfsquaddata.py
@@ -1,4 +1,4 @@
-"""Elfsquad Data connector SDK sample."""
+"""Elfsquad Data sample for the Azure Connectors Python SDK."""
import asyncio
import os
@@ -28,7 +28,7 @@ async def main() -> None:
CONNECTION_RUNTIME_URL,
credential,
) as client:
- entities = [item async for item in client.get_entities_async(
+ entities = [item async for item in client.list_entities(
entity_name=ENTITY_NAME,
top=10,
)]
diff --git a/samples/sample_connector_usage/sample_connector_usage_etsy.py b/samples/sample_connector_usage/sample_connector_usage_etsy.py
index c31a6b9f..a3bc4f78 100644
--- a/samples/sample_connector_usage/sample_connector_usage_etsy.py
+++ b/samples/sample_connector_usage/sample_connector_usage_etsy.py
@@ -1,4 +1,4 @@
-"""Etsy connector SDK sample."""
+"""Etsy sample for the Azure Connectors Python SDK."""
import asyncio
import os
@@ -21,7 +21,7 @@ async def main() -> None:
async with DefaultAzureCredential() as credential:
try:
async with EtsyClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.ping_async()
+ result = await client.ping()
print(f"Result: {result}")
except ConnectorException as ex:
print(f"Connector error: {ex}")
diff --git a/samples/sample_connector_usage/sample_connector_usage_eventbrite.py b/samples/sample_connector_usage/sample_connector_usage_eventbrite.py
index bf251561..68c7ffd8 100644
--- a/samples/sample_connector_usage/sample_connector_usage_eventbrite.py
+++ b/samples/sample_connector_usage/sample_connector_usage_eventbrite.py
@@ -1,4 +1,4 @@
-"""Eventbrite connector SDK sample."""
+"""Eventbrite sample for the Azure Connectors Python SDK."""
import asyncio
import os
@@ -21,7 +21,7 @@ async def main() -> None:
async with DefaultAzureCredential() as credential:
try:
async with EventbriteClient(CONNECTION_RUNTIME_URL, credential) as client:
- categories = await client.get_categories_async()
+ categories = [item async for item in client.list_categories()]
print(f"Categories: {categories}")
except ConnectorException as ex:
print(f"Connector error: {ex}")
diff --git a/samples/sample_connector_usage/sample_connector_usage_eventhubs.py b/samples/sample_connector_usage/sample_connector_usage_eventhubs.py
index 9d5bc0ef..d4c23c8a 100644
--- a/samples/sample_connector_usage/sample_connector_usage_eventhubs.py
+++ b/samples/sample_connector_usage/sample_connector_usage_eventhubs.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure Event Hubs Connector SDK Sample
+Azure Event Hubs sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Azure Event Hubs connector SDK
+This sample demonstrates how to use the Azure Event Hubs client from the Azure Connectors Python SDK
to send and receive events from Azure Event Hubs.
Prerequisites:
@@ -28,10 +28,9 @@
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.eventhubs import EventhubsClient
from azure.connectors.eventhubs import (
- EventhubsClient,
SendEvent,
- SendEventsInput,
)
# Connection runtime URL format:
@@ -71,7 +70,7 @@ async def example_1_send_event():
}
)
- await client.send_event_async(
+ await client.send_event(
input=event,
event_hub_name=EVENT_HUB_NAME
)
@@ -110,7 +109,7 @@ async def example_2_send_event_with_partition_key():
}
)
- await client.send_event_async(
+ await client.send_event(
input=event,
event_hub_name=EVENT_HUB_NAME,
partition_key=partition_key
@@ -138,35 +137,30 @@ async def example_3_send_batch_events():
async with EventhubsClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
# Create batch with multiple events
- batch_input = SendEventsInput(
- additional_properties={
- "events": [
- {
- "contentData": json.dumps({"id": 1, "name": "Event 1"}),
- "properties": {"index": "1"}
- },
- {
- "contentData": json.dumps({"id": 2, "name": "Event 2"}),
- "properties": {"index": "2"}
- },
- {
- "contentData": json.dumps({"id": 3, "name": "Event 3"}),
- "properties": {"index": "3"}
- }
- ]
- }
- )
-
- await client.send_events_async(
+ batch_input = [
+ SendEvent(
+ content_data=json.dumps({"id": 1, "name": "Event 1"}),
+ properties={"index": "1"},
+ ),
+ SendEvent(
+ content_data=json.dumps({"id": 2, "name": "Event 2"}),
+ properties={"index": "2"},
+ ),
+ SendEvent(
+ content_data=json.dumps({"id": 3, "name": "Event 3"}),
+ properties={"index": "3"},
+ ),
+ ]
+
+ await client.send_events(
input=batch_input,
event_hub_name=EVENT_HUB_NAME,
partition_key=os.environ.get("EVENTHUBS_PARTITION_KEY", "partition-1")
)
- events = batch_input.additional_properties.get("events", [])
- print(f"Batch of {len(events)} events sent to '{EVENT_HUB_NAME}':")
- for i, evt in enumerate(events, 1):
- print(f" {i}. {evt.get('contentData', 'N/A')[:40]}...")
+ print(f"Batch of {len(batch_input)} events sent to '{EVENT_HUB_NAME}':")
+ for i, event in enumerate(batch_input, 1):
+ print(f" {i}. {event.content_data[:40]}...")
except ConnectorException as ex:
print(f"Connector error (status {ex.status_code}): {ex}")
@@ -182,8 +176,8 @@ async def example_4_list_event_hubs():
async with EventhubsClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_event_hubs_async()
- print(f"Event Hubs: {result}")
+ items = [item async for item in client.list_event_hubs()]
+ print(f"Event Hubs: {items}")
except ConnectorException as ex:
print(f"Connector error (status {ex.status_code}): {ex}")
@@ -203,10 +197,10 @@ async def example_5_list_consumer_groups():
async with EventhubsClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_consumer_groups_async(
+ items = [item async for item in client.list_consumer_groups(
event_hub_name=EVENT_HUB_NAME
- )
- print(f"Consumer groups for '{EVENT_HUB_NAME}': {result}")
+ )]
+ print(f"Consumer groups for '{EVENT_HUB_NAME}': {items}")
except ConnectorException as ex:
print(f"Connector error (status {ex.status_code}): {ex}")
@@ -216,7 +210,7 @@ async def example_5_list_consumer_groups():
async def main():
"""Run all examples."""
- print("Azure Event Hubs Connector SDK - Sample Usage")
+ print("Azure Event Hubs sample usage for the Azure Connectors Python SDK")
print("=" * 60)
if not CONNECTION_RUNTIME_URL:
diff --git a/samples/sample_connector_usage/sample_connector_usage_excelonline.py b/samples/sample_connector_usage/sample_connector_usage_excelonline.py
index 4d0e6a22..e3475c30 100644
--- a/samples/sample_connector_usage/sample_connector_usage_excelonline.py
+++ b/samples/sample_connector_usage/sample_connector_usage_excelonline.py
@@ -7,9 +7,9 @@
from azure.identity.aio import DefaultAzureCredential
+from azure.connectors.excelonline import ExcelonlineClient
from azure.connectors.excelonline import (
CreateWorksheetInput,
- ExcelonlineClient,
Item,
)
@@ -26,26 +26,26 @@ async def main() -> None:
async with DefaultAzureCredential() as credential:
async with ExcelonlineClient(connection_url, credential) as client:
- worksheets = await client.get_all_worksheets_async(
+ worksheets = [item async for item in client.list_all_worksheets(
drive=drive_id,
file=file_id,
- )
+ )]
print("worksheets", worksheets)
- tables = await client.get_tables_async(
+ tables = [item async for item in client.list_tables(
drive=drive_id,
file=file_id,
- )
+ )]
print("tables", tables)
- new_sheet = await client.create_worksheet_async(
+ new_sheet = await client.create_worksheet(
input=CreateWorksheetInput(name="SampleSheet"),
drive=drive_id,
file=file_id,
)
print("created worksheet", new_sheet)
- row = await client.add_row_async(
+ row = await client.add_row(
input=Item(dynamic_properties={"Name": "Sample Item", "Value": 100}),
drive=drive_id,
file=file_id,
diff --git a/samples/sample_connector_usage/sample_connector_usage_excelonlinebusiness.py b/samples/sample_connector_usage/sample_connector_usage_excelonlinebusiness.py
index 0cb93ce9..048cbe3c 100644
--- a/samples/sample_connector_usage/sample_connector_usage_excelonlinebusiness.py
+++ b/samples/sample_connector_usage/sample_connector_usage_excelonlinebusiness.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Excel Online (Business) Connector SDK Sample
+Excel Online (Business) sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Excel Online Business connector SDK
+This sample demonstrates how to use the Excel Online Business client from the Azure Connectors Python SDK
to work with Excel files stored in SharePoint document libraries.
Prerequisites:
@@ -29,8 +29,8 @@
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.excelonlinebusiness import ExcelonlinebusinessClient
from azure.connectors.excelonlinebusiness import (
- ExcelonlinebusinessClient,
TableToCreate,
Item,
)
@@ -71,7 +71,7 @@ async def example_1_list_table_rows():
async with ExcelonlinebusinessClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- rows = [item async for item in client.get_items_async(
+ rows = [item async for item in client.list_items(
drive=DRIVE_ID,
file=FILE_ID,
table=TABLE_NAME,
@@ -114,7 +114,7 @@ async def example_2_get_specific_row():
async with ExcelonlinebusinessClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_item_async(
+ result = await client.get_item(
drive=DRIVE_ID,
file=FILE_ID,
table=TABLE_NAME,
@@ -151,14 +151,14 @@ async def example_3_list_workbook_comments():
async with ExcelonlinebusinessClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_comments_async(
+ items = [item async for item in client.list_comments(
drive=DRIVE_ID,
file=FILE_ID,
source=SOURCE_URL if SOURCE_URL else None,
- )
+ )]
- if result and "value" in result:
- comments = result["value"]
+ if items:
+ comments = items
print(f"Found {len(comments)} comment(s):")
for comment in comments[:5]:
comment_id = comment.get("id", "N/A")
@@ -202,7 +202,7 @@ async def example_4_create_table():
columns_names=column_names if column_names else None,
)
- result = await client.create_table_async(
+ result = await client.create_table(
input=table_input,
drive=DRIVE_ID,
file=FILE_ID,
@@ -251,7 +251,7 @@ async def example_5_update_row():
}
)
- result = await client.patch_item_async(
+ result = await client.patch_item(
input=update_data,
drive=DRIVE_ID,
file=FILE_ID,
@@ -277,7 +277,7 @@ async def example_5_update_row():
async def main():
"""Run all examples."""
- print("Excel Online (Business) Connector SDK - Sample Usage")
+ print("Excel Online (Business) sample usage for the Azure Connectors Python SDK")
print("=" * 60)
if not CONNECTION_RUNTIME_URL:
diff --git a/samples/sample_connector_usage/sample_connector_usage_formstackforms.py b/samples/sample_connector_usage/sample_connector_usage_formstackforms.py
index 6d4c6c43..d486acbb 100644
--- a/samples/sample_connector_usage/sample_connector_usage_formstackforms.py
+++ b/samples/sample_connector_usage/sample_connector_usage_formstackforms.py
@@ -1,4 +1,4 @@
-"""Formstack Forms connector SDK sample."""
+"""Formstack Forms sample for the Azure Connectors Python SDK."""
import asyncio
import os
@@ -24,7 +24,7 @@ async def main() -> None:
CONNECTION_RUNTIME_URL,
credential,
) as client:
- forms = await client.get_available_forms_async()
+ forms = await client.get_available_forms()
print(f"Forms: {forms}")
except ConnectorException as ex:
print(f"Connector error: {ex}")
diff --git a/samples/sample_connector_usage/sample_connector_usage_freshservice.py b/samples/sample_connector_usage/sample_connector_usage_freshservice.py
index 0c81eb30..ed672658 100644
--- a/samples/sample_connector_usage/sample_connector_usage_freshservice.py
+++ b/samples/sample_connector_usage/sample_connector_usage_freshservice.py
@@ -1,7 +1,7 @@
"""
-Freshservice Connector SDK Sample
+Freshservice sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Freshservice connector SDK.
+This sample demonstrates how to use the Freshservice client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Freshservice connection
@@ -24,10 +24,10 @@
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.freshservice import FreshserviceClient
from azure.connectors.freshservice import (
AddNoteRequest,
CreateTicketRequest,
- FreshserviceClient,
UpdateTicketRequest,
)
@@ -51,7 +51,7 @@ async def example_1_create_ticket() -> None:
status="2",
)
- created = await client.create_ticket_async(input=request)
+ created = await client.create_ticket(input=request)
ticket = created.get("ticket", {}) if created else {}
print(f"Created ticket: {ticket.get('id')}")
@@ -64,7 +64,7 @@ async def example_2_update_ticket() -> None:
async with FreshserviceClient(CONNECTION_RUNTIME_URL, credential) as client:
request = UpdateTicketRequest(priority="3", status="3")
- updated = await client.update_ticket_async(input=request, ticket_id=1)
+ updated = await client.update_ticket(input=request, ticket_id=1)
ticket = updated.get("ticket", {}) if updated else {}
print(f"Updated ticket: {ticket.get('id')}")
@@ -80,7 +80,7 @@ async def example_3_add_note() -> None:
private=True,
)
- note = await client.add_note_async(input=request, ticket_id=1)
+ note = await client.add_note(input=request, ticket_id=1)
conversation = note.get("conversation", {}) if note else {}
print(f"Added note: {conversation.get('id')}")
@@ -92,7 +92,7 @@ async def main() -> None:
print("Set it to your connection runtime URL from Azure Portal.")
return
- print("Freshservice Connector SDK - Sample Usage")
+ print("Freshservice sample usage for the Azure Connectors Python SDK")
print("=" * 50)
try:
diff --git a/samples/sample_connector_usage/sample_connector_usage_ftp.py b/samples/sample_connector_usage/sample_connector_usage_ftp.py
index a2ada01b..a1fa0ba0 100644
--- a/samples/sample_connector_usage/sample_connector_usage_ftp.py
+++ b/samples/sample_connector_usage/sample_connector_usage_ftp.py
@@ -21,17 +21,17 @@ async def main() -> None:
async with DefaultAzureCredential() as credential:
async with FtpClient(connection_url, credential) as client:
- root_listing = await client.list_root_folder_async()
+ root_listing = [item async for item in client.list_root_folder()]
print("root listing", root_listing)
- created = await client.create_file_async(
+ created = await client.create_file(
input=b"hello from azure-connectors ftp sample",
folder_path=folder_path,
name=file_name,
)
print("created file", created)
- folder_items = await client.list_folder_async(id=folder_path)
+ folder_items = [item async for item in client.list_folder(id=folder_path)]
print("folder items available for polling", folder_items)
diff --git a/samples/sample_connector_usage/sample_connector_usage_github.py b/samples/sample_connector_usage/sample_connector_usage_github.py
index 7cb5fdfb..2d6cf96c 100644
--- a/samples/sample_connector_usage/sample_connector_usage_github.py
+++ b/samples/sample_connector_usage/sample_connector_usage_github.py
@@ -1,7 +1,7 @@
"""
-GitHub Connector SDK Sample
+GitHub sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the GitHub connector SDK.
+This sample demonstrates how to use the GitHub client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with GitHub connection
@@ -24,7 +24,8 @@
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
-from azure.connectors.github import GithubClient, IssueBasicDetailsModel
+from azure.connectors.github import GithubClient
+from azure.connectors.github import IssueBasicDetailsModel
# Connection runtime URL format:
@@ -38,7 +39,7 @@ async def example_1_get_authenticated_user() -> None:
async with DefaultAzureCredential() as credential:
async with GithubClient(CONNECTION_RUNTIME_URL, credential) as client:
- user = await client.get_user_async()
+ user = await client.get_user()
print(f"Authenticated as: {user.get('login') if user else 'unknown'}")
@@ -48,14 +49,14 @@ async def example_2_list_issues(repository_owner: str, repository_name: str) ->
async with DefaultAzureCredential() as credential:
async with GithubClient(CONNECTION_RUNTIME_URL, credential) as client:
- issues = await client.get_issues_async(
+ issues = [item async for item in client.list_issues(
repository_owner=repository_owner,
repository_name=repository_name,
state="open",
per_page=5,
- )
+ )]
- issue_list = issues if isinstance(issues, list) else []
+ issue_list = issues
print(f"Found {len(issue_list)} issues")
for issue in issue_list[:5]:
print(f" - #{issue.get('number')}: {issue.get('title')}")
@@ -71,7 +72,7 @@ async def example_3_create_issue(repository_owner: str, repository_name: str) ->
title="SDK sample issue",
body="Created from github Python SDK sample.",
)
- created = await client.create_issue_async(
+ created = await client.create_issue(
input=request,
repository_owner=repository_owner,
repository_name=repository_name,
@@ -91,7 +92,7 @@ async def main() -> None:
repository_owner = "octocat"
repository_name = "hello-world"
- print("GitHub Connector SDK - Sample Usage")
+ print("GitHub sample usage for the Azure Connectors Python SDK")
print("=" * 50)
try:
diff --git a/samples/sample_connector_usage/sample_connector_usage_googlecalendar.py b/samples/sample_connector_usage/sample_connector_usage_googlecalendar.py
index 1d91b4e5..11c9df76 100644
--- a/samples/sample_connector_usage/sample_connector_usage_googlecalendar.py
+++ b/samples/sample_connector_usage/sample_connector_usage_googlecalendar.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Google Calendar Connector SDK Sample
+Google Calendar sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Google Calendar connector SDK.
+This sample demonstrates how to use the Google Calendar client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Google Calendar connection
@@ -27,8 +27,8 @@
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.googlecalendar import GooglecalendarClient
from azure.connectors.googlecalendar import (
- GooglecalendarClient,
RequestEvent,
)
@@ -47,9 +47,8 @@ async def example_1_list_calendars():
async with DefaultAzureCredential() as credential:
async with GooglecalendarClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.list_calendars_async(min_access_role="reader")
+ items = [item async for item in client.list_calendars(min_access_role="reader")]
- items = result.get("items", []) if result else []
print(f"Found {len(items)} calendar(s).")
for calendar in items[:10]:
print(f" - {calendar.get('summary', 'N/A')} ({calendar.get('id', 'N/A')})")
@@ -67,9 +66,9 @@ async def example_2_list_events():
async with DefaultAzureCredential() as credential:
async with GooglecalendarClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.list_events_async(calendar_id=calendar_id)
+ items = [item async for item in client.list_events(calendar_id=calendar_id)]
- events = result.get("items", []) if result else []
+ events = items
print(f"Found {len(events)} event(s) in calendar '{calendar_id}'.")
for event in events[:10]:
print(f" - {event.get('summary', 'N/A')} ({event.get('id', 'N/A')})")
@@ -97,7 +96,7 @@ async def example_3_create_event():
status="confirmed",
)
- created = await client.create_event_async(input=payload, calendar_id=calendar_id)
+ created = await client.create_event(input=payload, calendar_id=calendar_id)
if created:
print(f"Created event id: {created.get('id', 'N/A')}")
else:
@@ -119,13 +118,12 @@ async def example_4_list_events_for_polling():
async with GooglecalendarClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.list_events_async(
+ items = [item async for item in client.list_events(
calendar_id=calendar_id,
time_min="2026-07-09T00:00:00Z",
time_max="2026-07-10T00:00:00Z",
- )
- events = result.get("items", []) if result else []
- print(f"Time-window query returned {len(events)} event(s).")
+ )]
+ print(f"Time-window query returned {len(items)} event(s).")
print("Persist event IDs and update times to implement change polling.")
except ConnectorException as ex:
print(f"Connector error: {ex}")
diff --git a/samples/sample_connector_usage/sample_connector_usage_googledrive.py b/samples/sample_connector_usage/sample_connector_usage_googledrive.py
index bf648757..0e50eb53 100644
--- a/samples/sample_connector_usage/sample_connector_usage_googledrive.py
+++ b/samples/sample_connector_usage/sample_connector_usage_googledrive.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Google Drive Connector SDK Sample
+Google Drive sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Google Drive connector SDK.
+This sample demonstrates how to use the Google Drive client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Google Drive connection
@@ -44,11 +44,11 @@ async def example_1_list_root_folder():
async with DefaultAzureCredential() as credential:
async with GoogledriveClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.list_root_folder_async()
+ items = [item async for item in client.list_root_folder()]
- if result and "value" in result:
- print(f"Found {len(result['value'])} items in root folder:")
- for item in result["value"][:10]:
+ if items:
+ print(f"Found {len(items)} items in root folder:")
+ for item in items[:10]:
icon = "[DIR]" if item.get("IsFolder") else "[FILE]"
print(f" {icon} {item.get('Name', 'N/A')}")
else:
@@ -68,7 +68,7 @@ async def example_2_get_file_metadata_by_path():
async with GoogledriveClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- metadata = await client.get_file_metadata_by_path_async(path=file_path)
+ metadata = await client.get_file_metadata_by_path(path=file_path)
if metadata:
print(f"Name: {metadata.get('Name', 'N/A')}")
@@ -91,7 +91,7 @@ async def example_3_create_file():
async with GoogledriveClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.create_file_async(
+ result = await client.create_file(
input=b"Hello from azure-connectors Google Drive sample!",
folder_id=destination_folder,
name=destination_name,
@@ -118,11 +118,11 @@ async def example_4_list_drive_items_for_sheet_selection():
async with GoogledriveClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.list_folder_async(id=folder_id)
+ items = [item async for item in client.list_folder(id=folder_id)]
- if result and "value" in result:
- print(f"Found {len(result['value'])} Drive item(s):")
- for item in result["value"]:
+ if items:
+ print(f"Found {len(items)} Drive item(s):")
+ for item in items:
print(f" - {item.get('Name', 'N/A')}")
else:
print("No Drive items returned.")
diff --git a/samples/sample_connector_usage/sample_connector_usage_googletasks.py b/samples/sample_connector_usage/sample_connector_usage_googletasks.py
index 9e2258a7..26a7927e 100644
--- a/samples/sample_connector_usage/sample_connector_usage_googletasks.py
+++ b/samples/sample_connector_usage/sample_connector_usage_googletasks.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Google Tasks Connector SDK Sample
+Google Tasks sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Google Tasks connector SDK.
+This sample demonstrates how to use the Google Tasks client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Google Tasks connection
@@ -27,8 +27,8 @@
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.googletasks import GoogletasksClient
from azure.connectors.googletasks import (
- GoogletasksClient,
TRIGGER_OPERATIONS,
TaskCreate,
TaskListCreate,
@@ -49,8 +49,7 @@ async def example_1_list_task_lists():
async with DefaultAzureCredential() as credential:
async with GoogletasksClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.list_task_lists_async()
- items = result.get("items", []) if result else []
+ items = [item async for item in client.list_task_lists()]
print(f"Found {len(items)} task list(s).")
for task_list in items[:10]:
@@ -65,7 +64,7 @@ async def example_2_create_task_list_and_task():
async with GoogletasksClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- list_result = await client.create_task_list_async(
+ list_result = await client.create_task_list(
input=TaskListCreate(title="SDK Sample List"),
)
task_list_id = list_result.get("id") if list_result else None
@@ -74,7 +73,7 @@ async def example_2_create_task_list_and_task():
print("Task list creation returned no id.")
return
- task_result = await client.create_task_async(
+ task_result = await client.create_task(
input=TaskCreate(
title="Follow up sample",
notes="Created by azure-connectors sample.",
diff --git a/samples/sample_connector_usage/sample_connector_usage_impexium.py b/samples/sample_connector_usage/sample_connector_usage_impexium.py
index e524b739..6dded305 100644
--- a/samples/sample_connector_usage/sample_connector_usage_impexium.py
+++ b/samples/sample_connector_usage/sample_connector_usage_impexium.py
@@ -1,4 +1,4 @@
-"""Impexium connector SDK sample."""
+"""Impexium sample for the Azure Connectors Python SDK."""
import asyncio
import os
@@ -21,7 +21,10 @@ async def main() -> None:
async with DefaultAzureCredential() as credential:
try:
async with ImpexiumClient(CONNECTION_RUNTIME_URL, credential) as client:
- countries = await client.list_all_countries_async(page_number=1)
+ countries = [
+ country
+ async for country in client.list_all_countries(page_number=1)
+ ]
print(f"Countries: {countries}")
except ConnectorException as ex:
print(f"Connector error: {ex}")
diff --git a/samples/sample_connector_usage/sample_connector_usage_infusionsoft.py b/samples/sample_connector_usage/sample_connector_usage_infusionsoft.py
index 38b42270..2eff34eb 100644
--- a/samples/sample_connector_usage/sample_connector_usage_infusionsoft.py
+++ b/samples/sample_connector_usage/sample_connector_usage_infusionsoft.py
@@ -1,7 +1,7 @@
"""
-Infusionsoft (Keap) Connector SDK Sample
+Infusionsoft (Keap) sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Infusionsoft connector SDK.
+This sample demonstrates how to use the Infusionsoft client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Infusionsoft connection
@@ -24,7 +24,8 @@
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
-from azure.connectors.infusionsoft import CreateTaskRequest, InfusionsoftClient
+from azure.connectors.infusionsoft import InfusionsoftClient
+from azure.connectors.infusionsoft import CreateTaskRequest
# Connection runtime URL format:
@@ -38,8 +39,8 @@ async def example_1_list_tasks() -> None:
async with DefaultAzureCredential() as credential:
async with InfusionsoftClient(CONNECTION_RUNTIME_URL, credential) as client:
- response = await client.list_tasks_async()
- tasks = response.get("tasks", []) if response else []
+ response = [item async for item in client.list_tasks()]
+ tasks = response
print(f"Found {len(tasks)} tasks")
for task in tasks[:5]:
@@ -58,7 +59,7 @@ async def example_2_create_task() -> None:
priority=1,
)
- created = await client.create_task_async(input=request)
+ created = await client.create_task(input=request)
print(f"Created task: {created.get('id') if created else 'n/a'}")
@@ -73,7 +74,7 @@ async def example_3_update_task() -> None:
description="Updated from the infusionsoft SDK sample.",
)
- updated = await client.update_task_async(input=request, id=1)
+ updated = await client.update_task(input=request, id=1)
print(f"Updated task: {updated.get('id') if updated else 'n/a'}")
@@ -84,7 +85,7 @@ async def main() -> None:
print("Set it to your connection runtime URL from Azure Portal.")
return
- print("Infusionsoft (Keap) Connector SDK - Sample Usage")
+ print("Infusionsoft (Keap) sample usage for the Azure Connectors Python SDK")
print("=" * 50)
try:
diff --git a/samples/sample_connector_usage/sample_connector_usage_insightly.py b/samples/sample_connector_usage/sample_connector_usage_insightly.py
index 15aa4fd0..c28adc8e 100644
--- a/samples/sample_connector_usage/sample_connector_usage_insightly.py
+++ b/samples/sample_connector_usage/sample_connector_usage_insightly.py
@@ -1,7 +1,7 @@
"""
-Insightly Connector SDK Sample
+Insightly sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Insightly connector SDK.
+This sample demonstrates how to use the Insightly client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Insightly connection
@@ -24,7 +24,8 @@
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
-from azure.connectors.insightly import InsightlyClient, TaskRequest
+from azure.connectors.insightly import InsightlyClient
+from azure.connectors.insightly import TaskRequest
# Connection runtime URL format:
@@ -38,8 +39,8 @@ async def example_1_list_tasks() -> None:
async with DefaultAzureCredential() as credential:
async with InsightlyClient(CONNECTION_RUNTIME_URL, credential) as client:
- response = await client.list_tasks_async()
- tasks = response.get("tasks", []) if response else []
+ response = [item async for item in client.list_tasks()]
+ tasks = response
print(f"Found {len(tasks)} tasks")
for task in tasks[:5]:
@@ -52,8 +53,8 @@ async def example_2_list_contacts() -> None:
async with DefaultAzureCredential() as credential:
async with InsightlyClient(CONNECTION_RUNTIME_URL, credential) as client:
- response = await client.list_contacts_async()
- contacts = response.get("contacts", []) if response else []
+ response = [item async for item in client.list_contacts()]
+ contacts = response
print(f"Found {len(contacts)} contacts")
for contact in contacts[:5]:
@@ -72,9 +73,11 @@ async def example_3_add_task() -> None:
t_i_t_l_e="SDK sample task",
d_e_t_a_i_l_s="Created from insightly SDK sample.",
s_t_a_t_u_s="NOT STARTED",
+ c_o_m_p_l_e_t_e_d=False,
+ p_u_b_l_i_c_l_y_v_i_s_i_b_l_e=False,
)
- created = await client.add_task_async(input=request)
+ created = await client.add_task(input=request)
print(f"Created task: {created.get('TASK_ID') if created else 'n/a'}")
@@ -85,7 +88,7 @@ async def main() -> None:
print("Set it to your connection runtime URL from Azure Portal.")
return
- print("Insightly Connector SDK - Sample Usage")
+ print("Insightly sample usage for the Azure Connectors Python SDK")
print("=" * 50)
try:
diff --git a/samples/sample_connector_usage/sample_connector_usage_jedoxodatahub.py b/samples/sample_connector_usage/sample_connector_usage_jedoxodatahub.py
index 8c82d180..2b9d38b8 100644
--- a/samples/sample_connector_usage/sample_connector_usage_jedoxodatahub.py
+++ b/samples/sample_connector_usage/sample_connector_usage_jedoxodatahub.py
@@ -1,4 +1,4 @@
-"""Jedox OData Hub connector SDK sample."""
+"""Jedox OData Hub sample for the Azure Connectors Python SDK."""
import asyncio
import os
@@ -24,7 +24,7 @@ async def main() -> None:
CONNECTION_RUNTIME_URL,
credential,
) as client:
- databases = await client.databases_async()
+ databases = [item async for item in client.list_databases()]
print(f"Databases: {databases}")
except ConnectorException as ex:
print(f"Connector error: {ex}")
diff --git a/samples/sample_connector_usage/sample_connector_usage_jira.py b/samples/sample_connector_usage/sample_connector_usage_jira.py
index 48dafddb..07567cf4 100644
--- a/samples/sample_connector_usage/sample_connector_usage_jira.py
+++ b/samples/sample_connector_usage/sample_connector_usage_jira.py
@@ -1,7 +1,7 @@
"""
-Jira Connector SDK Sample
+Jira sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Jira connector SDK.
+This sample demonstrates how to use the Jira client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Jira connection
@@ -24,7 +24,8 @@
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
-from azure.connectors.jira import JiraClient, CreateIssueInput
+from azure.connectors.jira import JiraClient
+from azure.connectors.jira import CreateIssueInput
# Connection runtime URL format:
@@ -38,12 +39,8 @@ async def example_1_list_resources() -> list[dict]:
async with DefaultAzureCredential() as credential:
async with JiraClient(CONNECTION_RUNTIME_URL, credential) as client:
- resources_response = await client.list_resources_async()
- resources = (
- resources_response
- if isinstance(resources_response, list)
- else resources_response.get("value", []) if resources_response else []
- )
+ resources_response = [item async for item in client.list_resources()]
+ resources = resources_response
print(f"Found {len(resources)} resources")
for resource in resources[:5]:
@@ -60,9 +57,9 @@ async def example_2_list_issues(cloud_id: str) -> None:
async with JiraClient(CONNECTION_RUNTIME_URL, credential) as client:
del cloud_id
- issues_response = await client.list_issues_async()
+ issues_response = [item async for item in client.list_issues()]
- issues = issues_response.get("issues", []) if issues_response else []
+ issues = issues_response
print(f"Found {len(issues)} issues")
for issue in issues[:5]:
print(f" - {issue.get('key')}: {issue.get('fields', {}).get('summary')}")
@@ -97,7 +94,7 @@ async def example_3_create_issue(cloud_id: str) -> None:
}
)
- created = await client.create_issue_async(
+ created = await client.create_issue(
input=request,
project_key="PROJ",
issue_type_ids="10001",
@@ -112,7 +109,7 @@ async def main() -> None:
print("Set it to your connection runtime URL from Azure Portal.")
return
- print("Jira Connector SDK - Sample Usage")
+ print("Jira sample usage for the Azure Connectors Python SDK")
print("=" * 50)
try:
diff --git a/samples/sample_connector_usage/sample_connector_usage_keyvault.py b/samples/sample_connector_usage/sample_connector_usage_keyvault.py
index 4886dced..1d934064 100644
--- a/samples/sample_connector_usage/sample_connector_usage_keyvault.py
+++ b/samples/sample_connector_usage/sample_connector_usage_keyvault.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Azure Key Vault Connector SDK Sample
+Azure Key Vault sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Azure Key Vault connector SDK to
+This sample demonstrates how to use the Azure Key Vault client from the Azure Connectors Python SDK to
manage keys and secrets.
Prerequisites:
@@ -25,8 +25,8 @@
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.keyvault import KeyvaultClient
from azure.connectors.keyvault import (
- KeyvaultClient,
KeyEncryptInput,
KeyDecryptInput,
)
@@ -51,10 +51,9 @@ async def example_1_list_keys():
async with KeyvaultClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.list_keys_async()
+ keys = [key async for key in client.list_keys()]
- if result and result.get("value"):
- keys = result["value"]
+ if keys:
print(f"Found {len(keys)} keys:")
for key in keys:
print(f" - {key.get('name')} (enabled: {key.get('is_enabled')})")
@@ -75,7 +74,7 @@ async def example_2_get_key_metadata():
async with KeyvaultClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_key_metadata_async(key_name=KEY_NAME)
+ result = await client.get_key_metadata(key_name=KEY_NAME)
if result:
print(f"Key Name: {result.get('name')}")
@@ -110,7 +109,7 @@ async def example_3_encrypt_decrypt():
algorithm="RSA-OAEP",
raw_data=plaintext
)
- encrypt_result = await client.encrypt_data_async(
+ encrypt_result = await client.encrypt_data(
input=encrypt_input,
key_name=KEY_NAME
)
@@ -124,7 +123,7 @@ async def example_3_encrypt_decrypt():
algorithm="RSA-OAEP",
encrypted_data=encrypted
)
- decrypt_result = await client.decrypt_data_async(
+ decrypt_result = await client.decrypt_data(
input=decrypt_input,
key_name=KEY_NAME
)
@@ -147,10 +146,9 @@ async def example_4_list_secrets():
async with KeyvaultClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.list_secrets_async()
+ secrets = [secret async for secret in client.list_secrets()]
- if result and result.get("value"):
- secrets = result["value"]
+ if secrets:
print(f"Found {len(secrets)} secrets:")
for _ in secrets:
print(" - [REDACTED]")
@@ -171,7 +169,7 @@ async def example_5_get_secret():
async with KeyvaultClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_secret_async(secret_name=SECRET_NAME)
+ result = await client.get_secret(secret_name=SECRET_NAME)
if result:
print(f"Secret Name: {result.get('name')}")
@@ -197,7 +195,7 @@ async def example_6_get_secret_metadata():
async with KeyvaultClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_secret_metadata_async(
+ result = await client.get_secret_metadata(
secret_name=SECRET_NAME
)
diff --git a/samples/sample_connector_usage/sample_connector_usage_kusto.py b/samples/sample_connector_usage/sample_connector_usage_kusto.py
index 8c83ef4c..cb0dd950 100644
--- a/samples/sample_connector_usage/sample_connector_usage_kusto.py
+++ b/samples/sample_connector_usage/sample_connector_usage_kusto.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Kusto (Azure Data Explorer) Connector SDK Sample
+Kusto (Azure Data Explorer) sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Kusto connector SDK.
+This sample demonstrates how to use the Kusto client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Kusto (Azure Data Explorer) cluster
@@ -29,8 +29,8 @@
try:
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+ from azure.connectors.kusto import KustoClient
from azure.connectors.kusto import (
- KustoClient,
QueryAndListSchema,
ControlCommandAndListSchema,
QueryAndVisualizeSchema,
@@ -82,7 +82,8 @@ async def example_1_simple_kql_query():
csl=query,
)
- results = await client.list_kusto_results_async(input=query_request)
+ poller = await client.begin_list_kusto_results(input=query_request)
+ results = await poller.result()
if results and 'value' in results:
print(f"Query executed successfully. Found {len(results['value'])} rows:")
@@ -117,7 +118,8 @@ async def example_2_aggregation_query():
csl=query,
)
- results = await client.list_kusto_results_async(input=query_request)
+ poller = await client.begin_list_kusto_results(input=query_request)
+ results = await poller.result()
if results and 'value' in results:
print("Top 5 states by event count:")
@@ -156,7 +158,8 @@ async def example_3_time_based_filtering():
csl=query,
)
- results = await client.list_kusto_results_async(input=query_request)
+ poller = await client.begin_list_kusto_results(input=query_request)
+ results = await poller.result()
if results and 'value' in results:
print("Top 5 event types in the last year:")
@@ -194,9 +197,10 @@ async def example_4_visualize_results():
chart_type="Time Chart",
)
- chart = await client.run_kusto_query_and_visualize_results_async(
+ poller = await client.begin_run_kusto_query_and_visualize_results(
input=visualize_request
)
+ chart = await poller.result()
if chart:
print("Chart data generated successfully")
@@ -231,9 +235,10 @@ async def example_5_control_command():
csl=command,
)
- results = await client.list_kusto_show_command_results_async(
+ poller = await client.begin_list_kusto_show_command_results(
input=command_request
)
+ results = await poller.result()
if results and 'value' in results:
print(f"Found {len(results['value'])} tables in database '{KUSTO_DATABASE}':")
@@ -266,9 +271,10 @@ async def example_6_table_schema():
csl=command,
)
- results = await client.list_kusto_show_command_results_async(
+ poller = await client.begin_list_kusto_show_command_results(
input=command_request
)
+ results = await poller.result()
if results and 'value' in results and len(results['value']) > 0:
print(f"Schema for table '{KUSTO_TABLE}':")
@@ -316,7 +322,8 @@ async def example_7_statistical_analysis():
csl=query,
)
- results = await client.list_kusto_results_async(input=query_request)
+ poller = await client.begin_list_kusto_results(input=query_request)
+ results = await poller.result()
if results and 'value' in results and len(results['value']) > 0:
stats = results['value'][0]
@@ -351,7 +358,8 @@ async def example_8_error_handling():
csl=query,
)
- results = await client.list_kusto_results_async(input=query_request)
+ poller = await client.begin_list_kusto_results(input=query_request)
+ results = await poller.result()
print(f"Unexpected success: {results}")
except ConnectorException as ex:
@@ -364,7 +372,7 @@ async def example_8_error_handling():
async def main():
"""Run all examples."""
- print("Kusto (Azure Data Explorer) Connector SDK - Sample Usage")
+ print("Kusto (Azure Data Explorer) sample usage for the Azure Connectors Python SDK")
print("=" * 60)
print()
diff --git a/samples/sample_connector_usage/sample_connector_usage_mailchimp.py b/samples/sample_connector_usage/sample_connector_usage_mailchimp.py
index 0fa27e4e..5e145e78 100644
--- a/samples/sample_connector_usage/sample_connector_usage_mailchimp.py
+++ b/samples/sample_connector_usage/sample_connector_usage_mailchimp.py
@@ -1,7 +1,7 @@
"""
-Mailchimp Connector SDK Sample
+Mailchimp sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Mailchimp connector SDK.
+This sample demonstrates how to use the Mailchimp client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with a Mailchimp connection
@@ -24,8 +24,10 @@
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.mailchimp import MailchimpClient
from azure.connectors.mailchimp import (
- MailchimpClient,
+ CampaignDefaults,
+ Contact,
NewListRequest,
NewMemberInListRequest,
)
@@ -42,7 +44,7 @@ async def example_1_list_campaigns() -> None:
async with DefaultAzureCredential() as credential:
async with MailchimpClient(CONNECTION_RUNTIME_URL, credential) as client:
- campaigns = await client.get_campaigns_async()
+ campaigns = [item async for item in client.list_campaigns()]
print(f"Campaigns: {campaigns}")
@@ -52,7 +54,7 @@ async def example_2_get_lists() -> None:
async with DefaultAzureCredential() as credential:
async with MailchimpClient(CONNECTION_RUNTIME_URL, credential) as client:
- lists = await client.get_lists_async(count=10, offset=0)
+ lists = await client.get_lists(count=10, offset=0)
print(f"Lists: {lists}")
@@ -62,10 +64,26 @@ async def example_3_new_list() -> None:
async with DefaultAzureCredential() as credential:
async with MailchimpClient(CONNECTION_RUNTIME_URL, credential) as client:
- new_list = await client.newlist_async(
+ new_list = await client.newlist(
input=NewListRequest(
name="SDK sample list",
permission_reminder="You signed up via the SDK sample.",
+ contact=Contact(
+ company="Contoso",
+ address1="1 Microsoft Way",
+ city="Redmond",
+ state="WA",
+ zip="98052",
+ country="US",
+ phone="425-555-0100",
+ ),
+ campaign_defaults=CampaignDefaults(
+ from_name="SDK Sample",
+ from_email="sample@example.com",
+ subject="Welcome",
+ language="en",
+ ),
+ email_type_option=True,
),
)
print(f"Created list: {new_list}")
@@ -77,7 +95,7 @@ async def example_4_add_member() -> None:
async with DefaultAzureCredential() as credential:
async with MailchimpClient(CONNECTION_RUNTIME_URL, credential) as client:
- member = await client.addmember_async(
+ member = await client.addmember(
input=NewMemberInListRequest(
email_address="sample.user@example.com",
status="subscribed",
@@ -94,7 +112,7 @@ async def main() -> None:
print("Set it to your connection runtime URL from Azure Portal.")
return
- print("Mailchimp Connector SDK - Sample Usage")
+ print("Mailchimp sample usage for the Azure Connectors Python SDK")
print("=" * 50)
try:
diff --git a/samples/sample_connector_usage/sample_connector_usage_meetingroommap.py b/samples/sample_connector_usage/sample_connector_usage_meetingroommap.py
index edc113de..9a8b6de1 100644
--- a/samples/sample_connector_usage/sample_connector_usage_meetingroommap.py
+++ b/samples/sample_connector_usage/sample_connector_usage_meetingroommap.py
@@ -1,4 +1,4 @@
-"""Meeting Room Map connector SDK sample."""
+"""Meeting Room Map sample for the Azure Connectors Python SDK."""
import asyncio
import os
@@ -24,7 +24,7 @@ async def main() -> None:
CONNECTION_RUNTIME_URL,
credential,
) as client:
- categories = await client.get_categories_async()
+ categories = [item async for item in client.list_categories()]
print(f"Categories: {categories}")
except ConnectorException as ex:
print(f"Connector error: {ex}")
diff --git a/samples/sample_connector_usage/sample_connector_usage_microsoftbookings.py b/samples/sample_connector_usage/sample_connector_usage_microsoftbookings.py
index ac6fbc91..cea9f0eb 100644
--- a/samples/sample_connector_usage/sample_connector_usage_microsoftbookings.py
+++ b/samples/sample_connector_usage/sample_connector_usage_microsoftbookings.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Microsoft Bookings Connector SDK Sample
+Microsoft Bookings sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Microsoft Bookings connector SDK to
+This sample demonstrates how to use the Microsoft Bookings client from the Azure Connectors Python SDK to
manage booking businesses and appointment webhooks.
Prerequisites:
@@ -25,8 +25,8 @@
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.microsoftbookings import MicrosoftbookingsClient
from azure.connectors.microsoftbookings import (
- MicrosoftbookingsClient,
CreateAppointmentInput,
UpdateAppointmentInput,
CancelAppointmentInput,
@@ -60,10 +60,10 @@ async def example_1_list_booking_businesses():
async with MicrosoftbookingsClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.list_bookings_business_user_as_admin_async()
+ items = [item async for item in client.list_bookings_business_user_as_admin()]
- if result and result.get("mailboxes"):
- mailboxes = result["mailboxes"]
+ if items:
+ mailboxes = items
print(f"Found {len(mailboxes)} booking business(es):")
for mailbox in mailboxes:
print(f" - {mailbox.get('display_name')}")
diff --git a/samples/sample_connector_usage/sample_connector_usage_microsoftforms.py b/samples/sample_connector_usage/sample_connector_usage_microsoftforms.py
index 35f71912..50547985 100644
--- a/samples/sample_connector_usage/sample_connector_usage_microsoftforms.py
+++ b/samples/sample_connector_usage/sample_connector_usage_microsoftforms.py
@@ -1,7 +1,7 @@
"""
-Microsoft Forms Connector SDK Sample
+Microsoft Forms sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Microsoft Forms connector SDK.
+This sample demonstrates how to use the Microsoft Forms client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Microsoft Forms connection
@@ -40,8 +40,7 @@ async def example_1_list_forms() -> list[dict]:
async with DefaultAzureCredential() as credential:
async with MicrosoftformsClient(CONNECTION_RUNTIME_URL, credential) as client:
- forms_response = await client.list_forms_async()
- forms = forms_response.get("value", []) if forms_response else []
+ forms = [form async for form in client.list_forms()]
print(f"Found {len(forms)} forms")
for form in forms[:5]:
@@ -56,7 +55,7 @@ async def example_2_get_form_details(form_id: str) -> None:
async with DefaultAzureCredential() as credential:
async with MicrosoftformsClient(CONNECTION_RUNTIME_URL, credential) as client:
- details = await client.get_form_details_by_id_async(form_id=form_id)
+ details = await client.get_form_details_by_id(form_id=form_id)
if not details:
print("No details returned")
@@ -74,7 +73,7 @@ async def example_3_get_questions(form_id: str) -> None:
async with DefaultAzureCredential() as credential:
async with MicrosoftformsClient(CONNECTION_RUNTIME_URL, credential) as client:
- await client.get_questions_async(form_id=form_id)
+ await client.get_questions(form_id=form_id)
print("Question metadata request completed.")
@@ -85,7 +84,7 @@ async def main() -> None:
print("Set it to your connection runtime URL from Azure Portal.")
return
- print("Microsoft Forms Connector SDK - Sample Usage")
+ print("Microsoft Forms sample usage for the Azure Connectors Python SDK")
print("=" * 50)
try:
diff --git a/samples/sample_connector_usage/sample_connector_usage_monday.py b/samples/sample_connector_usage/sample_connector_usage_monday.py
index 7ffe7bdc..bb308d07 100644
--- a/samples/sample_connector_usage/sample_connector_usage_monday.py
+++ b/samples/sample_connector_usage/sample_connector_usage_monday.py
@@ -1,7 +1,7 @@
"""
-Monday.com Connector SDK Sample
+Monday.com sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Monday.com connector SDK.
+This sample demonstrates how to use the Monday.com client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with a Monday.com connection
@@ -24,11 +24,11 @@
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.monday import MondayClient
from azure.connectors.monday import (
CreateBoardInput,
CreateItemInput,
DynamicResponseGetSingleColumnSchema,
- MondayClient,
UpdateItemColumnInput,
)
@@ -44,7 +44,7 @@ async def example_1_create_board() -> None:
async with DefaultAzureCredential() as credential:
async with MondayClient(CONNECTION_RUNTIME_URL, credential) as client:
- board = await client.create_board_async(
+ board = await client.create_board(
input=CreateBoardInput(
workspace_id="123456",
board_name="SDK sample board",
@@ -60,7 +60,7 @@ async def example_2_create_item() -> None:
async with DefaultAzureCredential() as credential:
async with MondayClient(CONNECTION_RUNTIME_URL, credential) as client:
- item = await client.create_item_async(
+ item = await client.create_item(
input=CreateItemInput(
workspace_id="123456",
board_id="789012",
@@ -78,7 +78,7 @@ async def example_3_update_item_column() -> None:
async with DefaultAzureCredential() as credential:
async with MondayClient(CONNECTION_RUNTIME_URL, credential) as client:
- updated = await client.update_item_column_async(
+ updated = await client.update_item_column(
input=UpdateItemColumnInput(
workspace_id="123456",
board_id="789012",
@@ -99,7 +99,7 @@ async def example_4_list_workspaces() -> None:
async with DefaultAzureCredential() as credential:
async with MondayClient(CONNECTION_RUNTIME_URL, credential) as client:
- workspaces = await client.get_workspaces_async()
+ workspaces = await client.get_workspaces()
print(f"Workspaces: {workspaces}")
@@ -110,7 +110,7 @@ async def main() -> None:
print("Set it to your connection runtime URL from Azure Portal.")
return
- print("Monday.com Connector SDK - Sample Usage")
+ print("Monday.com sample usage for the Azure Connectors Python SDK")
print("=" * 50)
try:
diff --git a/samples/sample_connector_usage/sample_connector_usage_mq.py b/samples/sample_connector_usage/sample_connector_usage_mq.py
index c444da11..8efd7ff3 100644
--- a/samples/sample_connector_usage/sample_connector_usage_mq.py
+++ b/samples/sample_connector_usage/sample_connector_usage_mq.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-IBM MQ Connector SDK Sample
+IBM MQ sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the IBM MQ connector SDK.
+This sample demonstrates how to use the IBM MQ client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with IBM MQ connection
@@ -27,8 +27,8 @@
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.mq import MqClient
from azure.connectors.mq import (
- MqClient,
SendValidDataOptions,
SingleGetValidOptions,
MultipleGetValidOptions,
@@ -63,7 +63,7 @@ async def example_1_send_message():
queue=DEFAULT_QUEUE,
)
- result = await client.send_async(input=options)
+ result = await client.send(input=options)
if result:
print("Message sent successfully:")
@@ -91,7 +91,7 @@ async def example_2_browse_message():
include_info="true",
)
- result = await client.read_async(input=options)
+ result = await client.read(input=options)
if result:
print("Browsed message:")
@@ -125,11 +125,12 @@ async def example_3_browse_messages_batch():
include_info="true",
)
- result = await client.read_all_async(input=options)
+ result = await client.read_all(input=options)
+ items = result.get("value", []) if result else []
- if result and isinstance(result, list):
- print(f"Browsed {len(result)} messages:")
- for i, msg in enumerate(result[:5]): # Show first 5
+ if items:
+ print(f"Browsed {len(items)} messages:")
+ for i, msg in enumerate(items[:5]): # Show first 5
msg_id = msg.get("messageId", "N/A")
data = msg.get("messageData", "")
preview = data[:50] if data else "(empty)"
@@ -156,7 +157,7 @@ async def example_4_receive_message():
include_info="true",
)
- result = await client.receive_async(input=options)
+ result = await client.receive(input=options)
if result:
print("Received message (removed from queue):")
@@ -186,7 +187,7 @@ async def example_5_delete_message():
queue=DEFAULT_QUEUE,
)
- result = await client.delete_async(input=options)
+ result = await client.delete(input=options)
if result:
print("Deleted message:")
@@ -203,7 +204,7 @@ async def example_5_delete_message():
async def main():
"""Run all examples."""
- print("IBM MQ Connector SDK - Sample Usage")
+ print("IBM MQ sample usage for the Azure Connectors Python SDK")
print("=" * 60)
if not CONNECTION_RUNTIME_URL:
diff --git a/samples/sample_connector_usage/sample_connector_usage_msgraphgroupsanduser.py b/samples/sample_connector_usage/sample_connector_usage_msgraphgroupsanduser.py
index e987426a..455c4a93 100644
--- a/samples/sample_connector_usage/sample_connector_usage_msgraphgroupsanduser.py
+++ b/samples/sample_connector_usage/sample_connector_usage_msgraphgroupsanduser.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-MS Graph Groups & Users Connector SDK Sample
+MS Graph Groups & Users sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the MS Graph Groups & Users connector SDK.
+This sample demonstrates how to use the MS Graph Groups & Users client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with MS Graph Groups & Users connection
@@ -44,11 +44,11 @@ async def example_1_list_users():
async with MsgraphgroupsanduserClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- users = await client.list_users_async()
+ users = [user async for user in client.list_users()]
- if users and "value" in users:
- print(f"Found {len(users['value'])} users:")
- for user in users["value"][:5]: # Show first 5
+ if users:
+ print(f"Found {len(users)} users:")
+ for user in users[:5]: # Show first 5
display_name = user.get("displayName", "Unknown")
user_principal = user.get("userPrincipalName", "N/A")
print(f" - {display_name} ({user_principal})")
@@ -71,15 +71,18 @@ async def example_2_list_groups():
async with MsgraphgroupsanduserClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- groups = await client.list_groups_by_display_name_search_async(
- search=search_term,
- )
+ groups = [
+ group
+ async for group in client.list_groups_by_display_name_search(
+ search=search_term,
+ )
+ ]
search_display = search_term or "(all)"
- if groups and "value" in groups:
+ if groups:
print(f"Search: {search_display}")
- print(f"Found {len(groups['value'])} groups:")
- for group in groups["value"][:5]: # Show first 5
+ print(f"Found {len(groups)} groups:")
+ for group in groups[:5]: # Show first 5
display_name = group.get("displayName", "Unknown")
group_id = group.get("id", "N/A")
mail = group.get("mail", "No email")
@@ -109,7 +112,7 @@ async def example_3_get_group_properties():
async with MsgraphgroupsanduserClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- group = await client.get_group_properties_async(group_id=group_id)
+ group = await client.get_group_properties(group_id=group_id)
if group:
print(f"Group properties for '{group.get('displayName', 'Unknown')}':")
@@ -142,13 +145,16 @@ async def example_4_list_group_members():
async with MsgraphgroupsanduserClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- members = await client.list_direct_group_members_async(
- group_id=group_id,
- )
-
- if members and "value" in members:
- print(f"Found {len(members['value'])} members:")
- for member in members["value"][:5]: # Show first 5
+ members = [
+ member
+ async for member in client.list_direct_group_members(
+ group_id=group_id,
+ )
+ ]
+
+ if members:
+ print(f"Found {len(members)} members:")
+ for member in members[:5]: # Show first 5
display_name = member.get("displayName", "Unknown")
member_type = member.get("@odata.type", "Unknown type")
print(f" - {display_name} ({member_type})")
@@ -169,11 +175,11 @@ async def example_5_list_subscribed_skus():
async with MsgraphgroupsanduserClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- skus = await client.list_subscribed_skus_async()
+ skus = [sku async for sku in client.list_subscribed_skus()]
- if skus and "value" in skus:
- print(f"Found {len(skus['value'])} subscribed SKUs:")
- for sku in skus["value"][:5]: # Show first 5
+ if skus:
+ print(f"Found {len(skus)} subscribed SKUs:")
+ for sku in skus[:5]: # Show first 5
sku_part_number = sku.get("skuPartNumber", "Unknown")
consumed = sku.get("consumedUnits", 0)
print(f" - {sku_part_number} (Consumed: {consumed} units)")
@@ -188,7 +194,7 @@ async def example_5_list_subscribed_skus():
async def main():
"""Run all examples."""
- print("MS Graph Groups & Users Connector SDK - Sample Usage")
+ print("MS Graph Groups & Users sample usage for the Azure Connectors Python SDK")
print("=" * 60)
if not CONNECTION_RUNTIME_URL:
diff --git a/samples/sample_connector_usage/sample_connector_usage_office365.py b/samples/sample_connector_usage/sample_connector_usage_office365.py
index d1da234a..02cc0a4c 100644
--- a/samples/sample_connector_usage/sample_connector_usage_office365.py
+++ b/samples/sample_connector_usage/sample_connector_usage_office365.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Office365 Connector SDK Sample
+Office365 sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Office365 connector SDK.
+This sample demonstrates how to use the Office365 client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Office365 connection
@@ -26,9 +26,9 @@
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.office365 import Office365Client
from azure.connectors.office365 import (
DraftEmailInput,
- Office365Client,
SendEmailInput,
)
@@ -48,16 +48,16 @@ async def example_1_get_outlook_categories():
async with Office365Client(CONNECTION_RUNTIME_URL, credential) as client:
try:
- categories = await client.get_outlook_category_names_async()
+ categories = [item async for item in client.list_outlook_category_names()]
- if categories and 'value' in categories:
- print(f"Found {len(categories['value'])} Outlook categories:")
- for category in categories['value'][:5]:
+ if categories:
+ print(f"Found {len(categories)} Outlook categories:")
+ for category in categories[:5]:
display_name = category.get('DisplayName', 'Unknown')
color = category.get('Color', 'N/A')
print(f" - {display_name} (Color: {color})")
else:
- print("No categories found or unexpected response format.")
+ print("No categories found.")
except ConnectorException as ex:
print(f"Connector error: {ex}")
@@ -77,14 +77,14 @@ async def example_2_send_email():
try:
email = SendEmailInput(
to=to_address,
- subject="Test Email from Office365 Connector SDK",
+ subject="Test Email from the Azure Connectors Python SDK",
body=(
"This is a test email sent from the "
- "Python Office365 Connector SDK.
"
+ "Azure Connectors Python SDK.
"
),
)
- await client.send_email_async(email)
+ await client.send_email(email)
print(f"Email sent successfully to {to_address}")
print("Note: Set TEST_EMAIL_TO environment variable to send to a real address")
@@ -102,11 +102,11 @@ async def example_3_get_emails():
async with Office365Client(CONNECTION_RUNTIME_URL, credential) as client:
try:
- emails = await client.get_emails_async()
+ emails = [item async for item in client.list_emails()]
- if emails and 'value' in emails:
- print(f"Found {len(emails['value'])} emails:")
- for email in emails['value']:
+ if emails:
+ print(f"Found {len(emails)} emails:")
+ for email in emails:
subject = email.get('Subject', 'No Subject')
from_addr = email.get('From', 'Unknown')
received = email.get('DateTimeReceived', 'Unknown')
@@ -114,7 +114,7 @@ async def example_3_get_emails():
print(f" From: {from_addr}")
print(f" Received: {received}")
else:
- print("No emails found or unexpected response format.")
+ print("No emails found.")
except ConnectorException as ex:
print(f"Connector error: {ex}")
@@ -138,14 +138,14 @@ async def example_4_draft_and_send_email():
body="This email was created as a draft first.
",
)
- draft_response = await client.draft_email_async(draft)
+ draft_response = await client.draft_email(draft)
print("Draft created successfully")
if draft_response and 'Id' in draft_response:
message_id = draft_response['Id']
print(f"Draft message ID: {message_id}")
- await client.send_draft_email_async(message_id=message_id)
+ await client.send_draft_email(message_id=message_id)
print(f"Draft email sent successfully to {to_address}")
else:
print("Draft created but no ID returned.")
@@ -166,7 +166,7 @@ async def example_5_error_handling():
try:
# Attempt to get an email with an invalid ID
invalid_message_id = "invalid-message-id-12345"
- email = await client.get_email_async(message_id=invalid_message_id)
+ email = await client.get_email(message_id=invalid_message_id)
print(f"Unexpected success: {email}")
except ConnectorException as ex:
@@ -179,7 +179,7 @@ async def example_5_error_handling():
async def main():
"""Run all examples."""
- print("Office365 Connector SDK - Sample Usage")
+ print("Office365 sample usage for the Azure Connectors Python SDK")
print("=" * 50)
print()
diff --git a/samples/sample_connector_usage/sample_connector_usage_office365groups.py b/samples/sample_connector_usage/sample_connector_usage_office365groups.py
index d504ec30..a9755cb6 100644
--- a/samples/sample_connector_usage/sample_connector_usage_office365groups.py
+++ b/samples/sample_connector_usage/sample_connector_usage_office365groups.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Office 365 Groups Connector SDK Sample
+Office 365 Groups sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Office 365 Groups connector SDK
+This sample demonstrates how to use the Office 365 Groups client from the Azure Connectors Python SDK
for group management and calendar operations.
Prerequisites:
@@ -25,8 +25,8 @@
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.office365groups import Office365groupsClient
from azure.connectors.office365groups import (
- Office365groupsClient,
UpdateCalendarEventHTMLRequest,
)
@@ -46,7 +46,7 @@ async def example_1_list_groups():
async with Office365groupsClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- groups = [item async for item in client.list_groups_async(top=10)]
+ groups = [item async for item in client.list_groups(top=10)]
if groups:
print(f"Found {len(groups)} groups:")
@@ -73,7 +73,7 @@ async def example_2_list_group_members():
async with Office365groupsClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
members = [
- item async for item in client.list_group_members_async(
+ item async for item in client.list_group_members(
group_id=GROUP_ID
)
]
@@ -99,10 +99,9 @@ async def example_3_list_owned_groups():
async with Office365groupsClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.list_owned_groups_async()
+ groups = [group async for group in client.list_owned_groups()]
- if result and "value" in result:
- groups = result["value"]
+ if groups:
print(f"You own or belong to {len(groups)} groups:")
for group in groups[:5]:
print(f" - {group.get('displayName', 'N/A')}")
@@ -146,7 +145,7 @@ async def example_4_create_group_event():
}
)
- result = await client.create_calendar_event_async(
+ result = await client.create_calendar_event(
input=event_input,
group_id=GROUP_ID
)
@@ -176,7 +175,7 @@ async def example_5_add_member_to_group():
async with Office365groupsClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- await client.add_member_to_group_async(
+ await client.add_member_to_group(
group_id=GROUP_ID,
user_upn=USER_UPN
)
@@ -198,7 +197,7 @@ async def example_6_list_deleted_groups():
async with Office365groupsClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
groups = [
- item async for item in client.list_deleted_groups_async()
+ item async for item in client.list_deleted_groups()
]
if groups:
diff --git a/samples/sample_connector_usage/sample_connector_usage_office365groupsmail.py b/samples/sample_connector_usage/sample_connector_usage_office365groupsmail.py
index 8ecced12..22150a3e 100644
--- a/samples/sample_connector_usage/sample_connector_usage_office365groupsmail.py
+++ b/samples/sample_connector_usage/sample_connector_usage_office365groupsmail.py
@@ -24,15 +24,15 @@ async def main() -> None:
async with Office365groupsmailClient(connection_url, credential) as client:
conversations = [
conversation
- async for conversation in client.list_conversations_async(
+ async for conversation in client.list_conversations(
group_id=group_id
)
]
conversation_count = len(conversations)
print(f"Found {conversation_count} conversation(s) in group '{group_id}'.")
- groups = await client.list_groups_async()
- group_count = len((groups or {}).get("value", []))
+ groups = [group async for group in client.list_groups()]
+ group_count = len(groups)
print(f"Current user is in {group_count} Office 365 group(s).")
diff --git a/samples/sample_connector_usage/sample_connector_usage_office365users.py b/samples/sample_connector_usage/sample_connector_usage_office365users.py
index 064b7331..d51078e5 100644
--- a/samples/sample_connector_usage/sample_connector_usage_office365users.py
+++ b/samples/sample_connector_usage/sample_connector_usage_office365users.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-Office 365 Users Connector SDK Sample
+Office 365 Users sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the Office 365 Users connector SDK.
+This sample demonstrates how to use the Office 365 Users client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with Office 365 Users connection
@@ -44,7 +44,7 @@ async def example_1_get_my_profile():
async with Office365usersClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- profile = await client.my_profile_async()
+ profile = await client.my_profile()
if profile:
print("My Profile:")
@@ -76,7 +76,7 @@ async def example_2_get_user_profile():
async with Office365usersClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- profile = await client.user_profile_async(id=user_id)
+ profile = await client.user_profile(id=user_id)
if profile:
print(f"User Profile for '{user_id}':")
@@ -108,7 +108,7 @@ async def example_3_get_manager():
async with Office365usersClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- manager = await client.manager_async(id=user_id)
+ manager = await client.manager(id=user_id)
if manager:
print(f"Manager for '{user_id}':")
@@ -138,12 +138,12 @@ async def example_4_get_direct_reports():
async with Office365usersClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- reports = await client.direct_reports_async(id=user_id)
+ reports = [item async for item in client.list_direct_reports(id=user_id)]
- if reports and "value" in reports:
+ if reports:
print(f"Direct reports for '{user_id}':")
- print(f" Found {len(reports['value'])} reports")
- for report in reports["value"][:5]: # Show first 5
+ print(f" Found {len(reports)} reports")
+ for report in reports[:5]: # Show first 5
display_name = report.get("displayName", "N/A")
job_title = report.get("jobTitle", "N/A")
print(f" - {display_name} ({job_title})")
@@ -170,7 +170,7 @@ async def example_5_search_users():
async with Office365usersClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- results = [item async for item in client.search_user_async(
+ results = [item async for item in client.list_search_user(
search_term=search_term,
top=10,
)]
@@ -193,7 +193,7 @@ async def example_5_search_users():
async def main():
"""Run all examples."""
- print("Office 365 Users Connector SDK - Sample Usage")
+ print("Office 365 Users sample usage for the Azure Connectors Python SDK")
print("=" * 60)
if not CONNECTION_RUNTIME_URL:
diff --git a/samples/sample_connector_usage/sample_connector_usage_onedrive.py b/samples/sample_connector_usage/sample_connector_usage_onedrive.py
index 68cc2839..b0bd6998 100644
--- a/samples/sample_connector_usage/sample_connector_usage_onedrive.py
+++ b/samples/sample_connector_usage/sample_connector_usage_onedrive.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-OneDrive Connector SDK Sample
+OneDrive sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the OneDrive connector SDK.
+This sample demonstrates how to use the OneDrive client from the Azure Connectors Python SDK.
Prerequisites:
1. Azure subscription with OneDrive connection
@@ -41,11 +41,11 @@ async def example_1_list_root_folder():
async with DefaultAzureCredential() as credential:
async with OnedriveClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.list_root_folder_async()
+ items = [item async for item in client.list_root_folder()]
- if result and "value" in result:
- print(f"Found {len(result['value'])} items in root folder:")
- for item in result["value"][:10]: # Show first 10
+ if items:
+ print(f"Found {len(items)} items in root folder:")
+ for item in items[:10]: # Show first 10
item_type = "📁" if item.get("IsFolder") else "📄"
print(f" {item_type} {item.get('Name', 'N/A')}")
else:
@@ -66,7 +66,7 @@ async def example_2_get_file_metadata():
async with OnedriveClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- metadata = await client.get_file_metadata_by_path_async(path=file_path)
+ metadata = await client.get_file_metadata_by_path(path=file_path)
if metadata:
print(f"File Metadata for '{file_path}':")
@@ -94,7 +94,7 @@ async def example_3_download_file():
async with OnedriveClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- content = await client.get_file_content_by_path_async(path=file_path)
+ content = await client.get_file_content_by_path(path=file_path)
if content:
print(f"Downloaded {len(content)} bytes")
@@ -117,7 +117,7 @@ async def example_4_list_folder():
folder_id = os.environ.get("TEST_FOLDER_ID", "")
if not folder_id:
print("Set TEST_FOLDER_ID environment variable to a folder ID.")
- print("You can get folder IDs from list_root_folder_async results.")
+ print("You can get folder IDs from list_root_folder results.")
return
async with DefaultAzureCredential() as credential:
@@ -125,7 +125,7 @@ async def example_4_list_folder():
async with OnedriveClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
entries = [
- item async for item in client.list_folder_async(id=folder_id)
+ item async for item in client.list_folder(id=folder_id)
]
if entries:
@@ -155,15 +155,15 @@ async def example_5_search_files():
async with OnedriveClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.find_files_async(
+ items = [item async for item in client.list_find_files(
id=folder_id,
query=search_query,
find_mode="search"
- )
+ )]
- if result and "value" in result:
- print(f"Found {len(result['value'])} files matching '{search_query}':")
- for item in result["value"]:
+ if items:
+ print(f"Found {len(items)} files matching '{search_query}':")
+ for item in items:
print(f" 📄 {item.get('Name', 'N/A')}")
else:
print(f"No files found matching '{search_query}'.")
@@ -184,7 +184,7 @@ async def example_6_create_share_link():
async with OnedriveClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.create_share_link_async(
+ result = await client.create_share_link(
id=file_id,
type_="view" # "view" or "edit"
)
@@ -212,21 +212,23 @@ async def example_7_file_tags():
async with OnedriveClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
# Get existing tags
- tags_result = await client.get_file_tags_async(id=file_id)
+ tags_items = [item async for item in client.list_file_tags(id=file_id)]
- if tags_result and "tags" in tags_result:
- print(f"Current tags: {', '.join(tags_result['tags'])}")
+ if tags_items:
+ print(f"Current tags: {tags_items}")
else:
print("No tags found on file.")
# Add a new tag
print("Adding tag 'sdk-sample'...")
- await client.add_file_tag_async(id=file_id, tag="sdk-sample")
+ added_tags = await client.add_file_tag(id=file_id, tag="sdk-sample")
+ if added_tags:
+ print(f"Add tag result: {added_tags}")
# Get updated tags
- tags_result = await client.get_file_tags_async(id=file_id)
- if tags_result and "tags" in tags_result:
- print(f"Updated tags: {', '.join(tags_result['tags'])}")
+ tags_items = [item async for item in client.list_file_tags(id=file_id)]
+ if tags_items:
+ print(f"Updated tags: {tags_items}")
except ConnectorException as e:
print(f"Error managing tags: {e}")
@@ -246,7 +248,7 @@ async def example_8_copy_file():
async with OnedriveClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.copy_drive_file_async(
+ result = await client.copy_drive_file(
id=file_id,
destination=dest_folder,
overwrite=False
@@ -275,7 +277,7 @@ async def main():
print(f"$env:ONEDRIVE_CONNECTION_URL = '{url_example}'")
return
- print("OneDrive Connector SDK Sample")
+ print("OneDrive sample for the Azure Connectors Python SDK")
print("=" * 50)
print(f"Connection URL: {CONNECTION_RUNTIME_URL[:50]}...")
diff --git a/samples/sample_connector_usage/sample_connector_usage_onedriveforbusiness.py b/samples/sample_connector_usage/sample_connector_usage_onedriveforbusiness.py
index eac3ba7a..2ce7d230 100644
--- a/samples/sample_connector_usage/sample_connector_usage_onedriveforbusiness.py
+++ b/samples/sample_connector_usage/sample_connector_usage_onedriveforbusiness.py
@@ -1,6 +1,6 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
-"""OneDrive for Business Connector SDK sample."""
+"""OneDrive for Business sample for the Azure Connectors Python SDK."""
import asyncio
import os
@@ -19,8 +19,8 @@ async def example_list_root_folder() -> None:
async with DefaultAzureCredential() as credential:
async with OnedriveforbusinessClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.list_root_folder_async()
- values = result.get("value", []) if result else []
+ items = [item async for item in client.list_root_folder()]
+ values = items
print(f"Found {len(values)} items in root folder.")
@@ -30,7 +30,7 @@ async def example_get_file_metadata() -> None:
async with DefaultAzureCredential() as credential:
async with OnedriveforbusinessClient(CONNECTION_RUNTIME_URL, credential) as client:
- metadata = await client.get_file_metadata_by_path_async(path=file_path)
+ metadata = await client.get_file_metadata_by_path(path=file_path)
if metadata:
print(f"Name: {metadata.get('name')}, Size: {metadata.get('size')} bytes")
else:
@@ -47,7 +47,7 @@ async def example_create_share_link() -> None:
async with DefaultAzureCredential() as credential:
async with OnedriveforbusinessClient(CONNECTION_RUNTIME_URL, credential) as client:
- result = await client.create_share_link_async(id=file_id, type_="view")
+ result = await client.create_share_link(id=file_id, type_="view")
if result:
print(f"Share URL: {result.get('webUrl')}")
else:
diff --git a/samples/sample_connector_usage/sample_connector_usage_onenote.py b/samples/sample_connector_usage/sample_connector_usage_onenote.py
index a625e651..8b569233 100644
--- a/samples/sample_connector_usage/sample_connector_usage_onenote.py
+++ b/samples/sample_connector_usage/sample_connector_usage_onenote.py
@@ -1,9 +1,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
"""
-OneNote Connector SDK Sample
+OneNote sample for the Azure Connectors Python SDK
-This sample demonstrates how to use the OneNote connector SDK
+This sample demonstrates how to use the OneNote client from the Azure Connectors Python SDK
for notebook, section, and page operations.
Prerequisites:
@@ -25,8 +25,8 @@
import os
from azure.identity.aio import DefaultAzureCredential
from azure.connectors import ConnectorException
+from azure.connectors.onenote import OnenoteClient
from azure.connectors.onenote import (
- OnenoteClient,
CreateSectionRequest,
)
@@ -46,10 +46,10 @@ async def example_1_list_notebooks():
async with OnenoteClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_notebooks_async()
+ items = [item async for item in client.list_notebooks()]
- if result and "value" in result:
- notebooks = result["value"]
+ if items:
+ notebooks = items
print(f"Found {len(notebooks)} notebooks:")
for nb in notebooks[:5]:
print(f" - {nb.get('fileName', 'N/A')} (key: {nb.get('key', 'N/A')})")
@@ -73,12 +73,12 @@ async def example_2_list_sections():
async with OnenoteClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- result = await client.get_sections_in_notebook_async(
+ items = [item async for item in client.list_sections_in_notebook(
notebook_key=NOTEBOOK_KEY
- )
+ )]
- if result and "value" in result:
- sections = result["value"]
+ if items:
+ sections = items
print(f"Found {len(sections)} sections:")
for section in sections[:5]:
print(f" - {section.get('name', 'N/A')} (id: {section.get('id', 'N/A')})")
@@ -103,7 +103,7 @@ async def example_3_get_pages_in_section():
async with OnenoteClient(CONNECTION_RUNTIME_URL, credential) as client:
try:
- pages = [item async for item in client.get_pages_in_section_async(
+ pages = [item async for item in client.list_pages_in_section(
notebook_key=NOTEBOOK_KEY,
section_id=SECTION_ID
)]
@@ -134,7 +134,7 @@ async def example_4_create_section():
try:
section_request = CreateSectionRequest(name="SDK Test Section")
- result = await client.create_section_in_notebook_async(
+ result = await client.create_section_in_notebook(
input=section_request,
notebook_key=NOTEBOOK_KEY
)
@@ -165,7 +165,7 @@ async def example_5_create_quick_note():
"Created via Azure Connectors Python SDK