Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Batch to graph client #915

Merged
merged 5 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion msgraph/graph_service_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
from azure.core.credentials import TokenCredential
from azure.core.credentials_async import AsyncTokenCredential
from kiota_authentication_azure.azure_identity_authentication_provider import AzureIdentityAuthenticationProvider
from httpx import AsyncClient

from .generated.base_graph_service_client import BaseGraphServiceClient
from .graph_request_adapter import GraphRequestAdapter

if TYPE_CHECKING:
from .generated.users.item.user_item_request_builder import UserItemRequestBuilder
from msgraph_core.requests.batch_request_builder import BatchRequestBuilder


class GraphServiceClient(BaseGraphServiceClient):

def __init__(
self,
credentials: Optional[Union[TokenCredential, AsyncTokenCredential]] = None,
Expand Down Expand Up @@ -60,3 +62,12 @@ def me(self) -> UserItemRequestBuilder:
url_tpl_parameters["user%2Did"] = "me-token-to-replace"

return UserItemRequestBuilder(self.request_adapter, url_tpl_parameters)

@property
def batch(self) -> BatchRequestBuilder:
baywet marked this conversation as resolved.
Show resolved Hide resolved
"""
Returns a BatchRequestBuilder to enable batch requests.
"""
from msgraph_core.requests.batch_request_builder import BatchRequestBuilder

return BatchRequestBuilder(self.request_adapter)
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ microsoft-kiota-serialization-multipart==0.1.0
microsoft-kiota-serialization-text==1.0.0
msal==1.30.0
msal-extensions==1.2.0
msgraph-core==1.1.2
msgraph-core==1.1.5
multidict==6.0.5
mypy==1.11.2
mypy-extensions==1.0.0
Expand Down
Loading