microsoft-agents-m365copilot 0.1.0rc2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- microsoft_agents_m365copilot-0.1.0rc2/PKG-INFO +169 -0
- microsoft_agents_m365copilot-0.1.0rc2/README.md +137 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/__init__.py +17 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/_version.py +9 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/agents_m365_copilot_request_adapter.py +27 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/agents_m365_copilot_service_client.py +55 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/base_agents_m365_copilot_service_client.py +53 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/admin/admin_request_builder.py +198 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/admin/settings/limited_mode/limited_mode_request_builder.py +188 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/admin/settings/settings_request_builder.py +198 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/copilot_request_builder.py +63 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/interaction_history/get_all_enterprise_interactions/get_all_enterprise_interactions_get_response.py +58 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/interaction_history/get_all_enterprise_interactions/get_all_enterprise_interactions_request_builder.py +137 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/interaction_history/interaction_history_request_builder.py +198 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/retrieval/retrieval_post_request_body.py +77 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/retrieval/retrieval_request_builder.py +92 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/users/count/count_request_builder.py +104 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/users/item/ai_user_item_request_builder.py +198 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/users/item/interaction_history/get_all_enterprise_interactions/get_all_enterprise_interactions_get_response.py +58 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/users/item/interaction_history/get_all_enterprise_interactions/get_all_enterprise_interactions_request_builder.py +137 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/users/item/interaction_history/interaction_history_request_builder.py +198 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/copilot/users/users_request_builder.py +208 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/kiota-dom-export.txt +899 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/kiota-lock.json +36 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/ai_interaction.py +131 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/ai_interaction_attachment.py +67 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/ai_interaction_context.py +59 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/ai_interaction_history.py +53 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/ai_interaction_link.py +59 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/ai_interaction_mention.py +66 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/ai_interaction_mentioned_identity_set.py +67 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/ai_interaction_type.py +7 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/ai_user.py +60 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/ai_user_collection_response.py +58 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/azure_communication_services_user_identity.py +57 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/base_collection_pagination_count_response.py +51 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/body_type.py +6 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/call_records/user_identity.py +57 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/chat_message_from_identity_set.py +53 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/chat_message_mentioned_identity_set.py +60 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/chat_message_reaction_identity_set.py +53 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/communications_application_identity.py +61 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/communications_application_instance_identity.py +61 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/communications_encrypted_identity.py +53 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/communications_guest_identity.py +53 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/communications_identity_set.py +91 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/communications_phone_identity.py +53 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/communications_user_identity.py +57 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/connection_item.py +51 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/copilot_admin.py +60 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/copilot_admin_limited_mode.py +61 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/copilot_admin_setting.py +60 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/data_source_configuration.py +58 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/details_info.py +47 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/dictionaries.py +63 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/email_identity.py +57 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/endpoint_type.py +9 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/engagement_identity_set.py +67 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/entity.py +102 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/external_item_configuration.py +58 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/identity.py +206 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/identity_set.py +120 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/initiator.py +60 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/initiator_type.py +8 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/item_body.py +62 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/o_data_errors/error_details.py +55 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/o_data_errors/inner_error.py +60 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/o_data_errors/main_error.py +73 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/o_data_errors/o_data_error.py +63 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/provisioned_identity.py +64 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/provisioning_service_principal.py +53 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/provisioning_system.py +60 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/retrieval_data_source.py +8 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/retrieval_entity_type.py +11 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/retrieval_extract.py +55 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/retrieval_hit.py +83 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/retrieval_response.py +58 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/search_resource_metadata_dictionary.py +53 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/sensitivity_label_info.py +67 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/service_principal_identity.py +57 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/share_point_identity.py +57 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/share_point_identity_set.py +71 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/teamwork_application_identity.py +60 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/teamwork_application_identity_type.py +10 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/teamwork_conversation_identity.py +60 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/teamwork_conversation_identity_type.py +8 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/teamwork_tag_identity.py +53 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/teamwork_user_identity.py +60 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/teamwork_user_identity_type.py +13 -0
- microsoft_agents_m365copilot-0.1.0rc2/microsoft_agents_m365copilot/generated/models/user_identity.py +61 -0
- microsoft_agents_m365copilot-0.1.0rc2/pyproject.toml +76 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: microsoft-agents-m365copilot
|
|
3
|
+
Version: 0.1.0rc2
|
|
4
|
+
Summary: Microsoft Agents M365 Copilot Python SDK (V1.0)
|
|
5
|
+
License: MIT
|
|
6
|
+
Keywords: copilot,openAPI,Microsoft,M365,V1.0
|
|
7
|
+
Author: Microsoft
|
|
8
|
+
Author-email: graphtooling+ccspython@microsoft.com
|
|
9
|
+
Maintainer: Microsoft
|
|
10
|
+
Maintainer-email: graphtooling+ccspython@microsoft.com
|
|
11
|
+
Requires-Python: >=3.9,<4.0
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Dist: httpx[http2] (>=0.23.0)
|
|
25
|
+
Requires-Dist: microsoft-agents-m365copilot-core (>=1.0.0rc1)
|
|
26
|
+
Requires-Dist: microsoft-kiota-authentication-azure (>=1.8.0,<2.0.0)
|
|
27
|
+
Requires-Dist: microsoft-kiota-bundle (>=1.8.0,<2.0.0)
|
|
28
|
+
Project-URL: Documentation, https://github.com/microsoft/Agents-M365Copilot/tree/main/python/packages/microsoft_agents_m365copilot#readme
|
|
29
|
+
Project-URL: Homepage, https://github.com/microsoft/Agents-M365Copilot/tree/main/python
|
|
30
|
+
Project-URL: Repository, https://github.com/microsoft/Agents-M365Copilot
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# Microsoft 365 Copilot APIs V1 Python Client Library
|
|
34
|
+
|
|
35
|
+
Integrate the Microsoft 365 Copilot APIs into your Python application!
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
To install the client libraries via PyPi:
|
|
40
|
+
|
|
41
|
+
```py
|
|
42
|
+
pip install microsoft-agents-m365copilot
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Create a Copilot APIs client and make an API call
|
|
46
|
+
|
|
47
|
+
The following code example shows how to create an instance of a Microsoft 365 Copilot APIs client with an authentication provider in the supported languages. The authentication provider handles acquiring access tokens for the application. Many different authentication providers are available for each language and platform. The different authentication providers support different client scenarios. For details about which provider and options are appropriate for your scenario, see [Choose an Authentication Provider](https://learn.microsoft.com/graph/sdks/choose-authentication-providers).
|
|
48
|
+
|
|
49
|
+
The example also shows how to make a call to the Microsoft 365 Copilot Retrieval API. To call this API, you first need to create a request object and then run the POST method on the request.
|
|
50
|
+
|
|
51
|
+
The client ID is the app registration ID that is generated when you [register your app in the Azure portal](https://learn.microsoft.com/graph/auth-register-app-v2).
|
|
52
|
+
|
|
53
|
+
1. Create a `.env` file with the following values:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
TENANT_ID = "YOUR_TENANT_ID"
|
|
57
|
+
CLIENT_ID = "YOUR_CLIENT_ID"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
>**Note:**
|
|
61
|
+
>
|
|
62
|
+
> Your tenant must have a Microsoft 365 Copilot license.
|
|
63
|
+
|
|
64
|
+
2. Create a `main.py` file with the following snippet:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
import asyncio
|
|
68
|
+
import os
|
|
69
|
+
from datetime import datetime
|
|
70
|
+
|
|
71
|
+
from azure.identity import DeviceCodeCredential
|
|
72
|
+
from dotenv import load_dotenv
|
|
73
|
+
from kiota_abstractions.api_error import APIError
|
|
74
|
+
|
|
75
|
+
from microsoft_agents_m365copilot import AgentsM365CopilotServiceClient
|
|
76
|
+
from microsoft_agents_m365copilot.generated.copilot.retrieval.retrieval_post_request_body import (
|
|
77
|
+
RetrievalPostRequestBody,
|
|
78
|
+
)
|
|
79
|
+
from microsoft_agents_m365copilot.generated.models.retrieval_data_source import RetrievalDataSource
|
|
80
|
+
|
|
81
|
+
load_dotenv()
|
|
82
|
+
|
|
83
|
+
TENANT_ID = os.getenv("TENANT_ID")
|
|
84
|
+
CLIENT_ID = os.getenv("CLIENT_ID")
|
|
85
|
+
|
|
86
|
+
# Define a proper callback function that accepts all three parameters
|
|
87
|
+
def auth_callback(verification_uri: str, user_code: str, expires_on: datetime):
|
|
88
|
+
print(f"\nTo sign in, use a web browser to open the page {verification_uri}")
|
|
89
|
+
print(f"Enter the code {user_code} to authenticate.")
|
|
90
|
+
print(f"The code will expire at {expires_on}")
|
|
91
|
+
|
|
92
|
+
# Create device code credential with correct callback
|
|
93
|
+
credentials = DeviceCodeCredential(
|
|
94
|
+
client_id=CLIENT_ID,
|
|
95
|
+
tenant_id=TENANT_ID,
|
|
96
|
+
prompt_callback=auth_callback
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
# Use the Graph API V1 endpoint explicitly
|
|
100
|
+
scopes = ['https://graph.microsoft.com/.default']
|
|
101
|
+
client = AgentsM365CopilotBetaServiceClient(credentials=credentials, scopes=scopes)
|
|
102
|
+
|
|
103
|
+
# Make sure the base URL is set to V1
|
|
104
|
+
client.request_adapter.base_url = "https://graph.microsoft.com/v1.0"
|
|
105
|
+
|
|
106
|
+
async def retrieve():
|
|
107
|
+
try:
|
|
108
|
+
# Print the URL being used
|
|
109
|
+
print(f"Using API base URL: {client.request_adapter.base_url}\n")
|
|
110
|
+
|
|
111
|
+
# Create the retrieval request body
|
|
112
|
+
retrieval_body = RetrievalPostRequestBody()
|
|
113
|
+
retrieval_body.data_source = RetrievalDataSource.SharePoint
|
|
114
|
+
retrieval_body.query_string = "What is the latest in my organization?"
|
|
115
|
+
|
|
116
|
+
# Try more parameters that might be required
|
|
117
|
+
# retrieval_body.maximum_number_of_results = 10
|
|
118
|
+
|
|
119
|
+
# Make the API call
|
|
120
|
+
print("Making retrieval API request...")
|
|
121
|
+
retrieval = await client.copilot.retrieval.post(retrieval_body)
|
|
122
|
+
|
|
123
|
+
# Process the results
|
|
124
|
+
if retrieval and hasattr(retrieval, "retrieval_hits"):
|
|
125
|
+
print(f"Received {len(retrieval.retrieval_hits)} hits")
|
|
126
|
+
for r in retrieval.retrieval_hits:
|
|
127
|
+
print(f"Web URL: {r.web_url}\n")
|
|
128
|
+
for extract in r.extracts:
|
|
129
|
+
print(f"Text:\n{extract.text}\n")
|
|
130
|
+
else:
|
|
131
|
+
print(f"Retrieval response structure: {dir(retrieval)}")
|
|
132
|
+
except APIError as e:
|
|
133
|
+
print(f"Error: {e.error.code}: {e.error.message}")
|
|
134
|
+
if hasattr(e, 'error') and hasattr(e.error, 'inner_error'):
|
|
135
|
+
print(f"Inner error details: {e.error.inner_error}")
|
|
136
|
+
raise e
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
# Run the async function
|
|
140
|
+
asyncio.run(retrieve())
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
3. If successful, you should get a list of `retrievalHits` collection.
|
|
144
|
+
|
|
145
|
+
## Issues
|
|
146
|
+
|
|
147
|
+
To view or log issues, see [issues](https://github.com/microsoft/Agents-M365Copilot/issues).
|
|
148
|
+
|
|
149
|
+
## Contributing
|
|
150
|
+
|
|
151
|
+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
|
152
|
+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
|
153
|
+
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
|
|
154
|
+
|
|
155
|
+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
|
|
156
|
+
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
|
|
157
|
+
provided by the bot. You will only need to do this once across all repos using our CLA.
|
|
158
|
+
|
|
159
|
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
|
160
|
+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
|
161
|
+
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
|
162
|
+
|
|
163
|
+
## Trademarks
|
|
164
|
+
|
|
165
|
+
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
|
|
166
|
+
trademarks or logos is subject to and must follow
|
|
167
|
+
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
168
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
169
|
+
Any use of third-party trademarks or logos are subject to those third-party's policies.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Microsoft 365 Copilot APIs V1 Python Client Library
|
|
2
|
+
|
|
3
|
+
Integrate the Microsoft 365 Copilot APIs into your Python application!
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
To install the client libraries via PyPi:
|
|
8
|
+
|
|
9
|
+
```py
|
|
10
|
+
pip install microsoft-agents-m365copilot
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Create a Copilot APIs client and make an API call
|
|
14
|
+
|
|
15
|
+
The following code example shows how to create an instance of a Microsoft 365 Copilot APIs client with an authentication provider in the supported languages. The authentication provider handles acquiring access tokens for the application. Many different authentication providers are available for each language and platform. The different authentication providers support different client scenarios. For details about which provider and options are appropriate for your scenario, see [Choose an Authentication Provider](https://learn.microsoft.com/graph/sdks/choose-authentication-providers).
|
|
16
|
+
|
|
17
|
+
The example also shows how to make a call to the Microsoft 365 Copilot Retrieval API. To call this API, you first need to create a request object and then run the POST method on the request.
|
|
18
|
+
|
|
19
|
+
The client ID is the app registration ID that is generated when you [register your app in the Azure portal](https://learn.microsoft.com/graph/auth-register-app-v2).
|
|
20
|
+
|
|
21
|
+
1. Create a `.env` file with the following values:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
TENANT_ID = "YOUR_TENANT_ID"
|
|
25
|
+
CLIENT_ID = "YOUR_CLIENT_ID"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
>**Note:**
|
|
29
|
+
>
|
|
30
|
+
> Your tenant must have a Microsoft 365 Copilot license.
|
|
31
|
+
|
|
32
|
+
2. Create a `main.py` file with the following snippet:
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import asyncio
|
|
36
|
+
import os
|
|
37
|
+
from datetime import datetime
|
|
38
|
+
|
|
39
|
+
from azure.identity import DeviceCodeCredential
|
|
40
|
+
from dotenv import load_dotenv
|
|
41
|
+
from kiota_abstractions.api_error import APIError
|
|
42
|
+
|
|
43
|
+
from microsoft_agents_m365copilot import AgentsM365CopilotServiceClient
|
|
44
|
+
from microsoft_agents_m365copilot.generated.copilot.retrieval.retrieval_post_request_body import (
|
|
45
|
+
RetrievalPostRequestBody,
|
|
46
|
+
)
|
|
47
|
+
from microsoft_agents_m365copilot.generated.models.retrieval_data_source import RetrievalDataSource
|
|
48
|
+
|
|
49
|
+
load_dotenv()
|
|
50
|
+
|
|
51
|
+
TENANT_ID = os.getenv("TENANT_ID")
|
|
52
|
+
CLIENT_ID = os.getenv("CLIENT_ID")
|
|
53
|
+
|
|
54
|
+
# Define a proper callback function that accepts all three parameters
|
|
55
|
+
def auth_callback(verification_uri: str, user_code: str, expires_on: datetime):
|
|
56
|
+
print(f"\nTo sign in, use a web browser to open the page {verification_uri}")
|
|
57
|
+
print(f"Enter the code {user_code} to authenticate.")
|
|
58
|
+
print(f"The code will expire at {expires_on}")
|
|
59
|
+
|
|
60
|
+
# Create device code credential with correct callback
|
|
61
|
+
credentials = DeviceCodeCredential(
|
|
62
|
+
client_id=CLIENT_ID,
|
|
63
|
+
tenant_id=TENANT_ID,
|
|
64
|
+
prompt_callback=auth_callback
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Use the Graph API V1 endpoint explicitly
|
|
68
|
+
scopes = ['https://graph.microsoft.com/.default']
|
|
69
|
+
client = AgentsM365CopilotBetaServiceClient(credentials=credentials, scopes=scopes)
|
|
70
|
+
|
|
71
|
+
# Make sure the base URL is set to V1
|
|
72
|
+
client.request_adapter.base_url = "https://graph.microsoft.com/v1.0"
|
|
73
|
+
|
|
74
|
+
async def retrieve():
|
|
75
|
+
try:
|
|
76
|
+
# Print the URL being used
|
|
77
|
+
print(f"Using API base URL: {client.request_adapter.base_url}\n")
|
|
78
|
+
|
|
79
|
+
# Create the retrieval request body
|
|
80
|
+
retrieval_body = RetrievalPostRequestBody()
|
|
81
|
+
retrieval_body.data_source = RetrievalDataSource.SharePoint
|
|
82
|
+
retrieval_body.query_string = "What is the latest in my organization?"
|
|
83
|
+
|
|
84
|
+
# Try more parameters that might be required
|
|
85
|
+
# retrieval_body.maximum_number_of_results = 10
|
|
86
|
+
|
|
87
|
+
# Make the API call
|
|
88
|
+
print("Making retrieval API request...")
|
|
89
|
+
retrieval = await client.copilot.retrieval.post(retrieval_body)
|
|
90
|
+
|
|
91
|
+
# Process the results
|
|
92
|
+
if retrieval and hasattr(retrieval, "retrieval_hits"):
|
|
93
|
+
print(f"Received {len(retrieval.retrieval_hits)} hits")
|
|
94
|
+
for r in retrieval.retrieval_hits:
|
|
95
|
+
print(f"Web URL: {r.web_url}\n")
|
|
96
|
+
for extract in r.extracts:
|
|
97
|
+
print(f"Text:\n{extract.text}\n")
|
|
98
|
+
else:
|
|
99
|
+
print(f"Retrieval response structure: {dir(retrieval)}")
|
|
100
|
+
except APIError as e:
|
|
101
|
+
print(f"Error: {e.error.code}: {e.error.message}")
|
|
102
|
+
if hasattr(e, 'error') and hasattr(e.error, 'inner_error'):
|
|
103
|
+
print(f"Inner error details: {e.error.inner_error}")
|
|
104
|
+
raise e
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
# Run the async function
|
|
108
|
+
asyncio.run(retrieve())
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
3. If successful, you should get a list of `retrievalHits` collection.
|
|
112
|
+
|
|
113
|
+
## Issues
|
|
114
|
+
|
|
115
|
+
To view or log issues, see [issues](https://github.com/microsoft/Agents-M365Copilot/issues).
|
|
116
|
+
|
|
117
|
+
## Contributing
|
|
118
|
+
|
|
119
|
+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
|
120
|
+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
|
121
|
+
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
|
|
122
|
+
|
|
123
|
+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
|
|
124
|
+
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
|
|
125
|
+
provided by the bot. You will only need to do this once across all repos using our CLA.
|
|
126
|
+
|
|
127
|
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
|
128
|
+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
|
129
|
+
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
|
130
|
+
|
|
131
|
+
## Trademarks
|
|
132
|
+
|
|
133
|
+
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
|
|
134
|
+
trademarks or logos is subject to and must follow
|
|
135
|
+
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
136
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
137
|
+
Any use of third-party trademarks or logos are subject to those third-party's policies.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# ------------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) Microsoft Corporation. All Rights Reserved.
|
|
3
|
+
# Licensed under the MIT License. See License in the project root for license information.
|
|
4
|
+
# ------------------------------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
Python client for the Microsoft CCS Python SDK.
|
|
8
|
+
"""
|
|
9
|
+
from ._version import VERSION
|
|
10
|
+
from .agents_m365_copilot_request_adapter import AgentsM365CopilotRequestAdapter
|
|
11
|
+
from .agents_m365_copilot_service_client import AgentsM365CopilotServiceClient
|
|
12
|
+
|
|
13
|
+
__version__ = VERSION
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"AgentsM365CopilotServiceClient", "AgentsM365CopilotRequestAdapter"
|
|
17
|
+
]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# ------------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) Microsoft Corporation. All Rights Reserved.
|
|
3
|
+
# Licensed under the MIT License. See License in the project root for license information.
|
|
4
|
+
# ------------------------------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
# The SDK version
|
|
7
|
+
# x-release-please-start-version
|
|
8
|
+
VERSION: str = '0.1.0-preview.2'
|
|
9
|
+
# x-release-please-end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
from kiota_abstractions.authentication import AuthenticationProvider
|
|
5
|
+
from kiota_http.middleware.options import UrlReplaceHandlerOption
|
|
6
|
+
from microsoft_agents_m365copilot_core import (
|
|
7
|
+
APIVersion,
|
|
8
|
+
BaseMicrosoftAgentsM365CopilotRequestAdapter,
|
|
9
|
+
MicrosoftAgentsM365CopilotClientFactory,
|
|
10
|
+
MicrosoftAgentsM365CopilotTelemetryHandlerOption,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
from ._version import VERSION
|
|
14
|
+
|
|
15
|
+
options = {
|
|
16
|
+
MicrosoftAgentsM365CopilotTelemetryHandlerOption.get_key(): MicrosoftAgentsM365CopilotTelemetryHandlerOption(
|
|
17
|
+
api_version=APIVersion.v1,
|
|
18
|
+
sdk_version=VERSION)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class AgentsM365CopilotRequestAdapter(BaseMicrosoftAgentsM365CopilotRequestAdapter):
|
|
23
|
+
def __init__(self, auth_provider: AuthenticationProvider,
|
|
24
|
+
client: Optional[httpx.AsyncClient] = None) -> None:
|
|
25
|
+
if client is None:
|
|
26
|
+
client = MicrosoftAgentsM365CopilotClientFactory.create_with_default_middleware(options=options)
|
|
27
|
+
super().__init__(auth_provider, http_client=client)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# ------------------------------------
|
|
2
|
+
# Copyright (c) Microsoft Corporation. All Rights Reserved.
|
|
3
|
+
# Licensed under the MIT License.
|
|
4
|
+
# See License in the project root for license information.
|
|
5
|
+
# -----------------------------------
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import TYPE_CHECKING, List, Optional, Union
|
|
10
|
+
|
|
11
|
+
from azure.core.credentials import TokenCredential
|
|
12
|
+
from azure.core.credentials_async import AsyncTokenCredential
|
|
13
|
+
from kiota_authentication_azure.azure_identity_authentication_provider import (
|
|
14
|
+
AzureIdentityAuthenticationProvider,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
from .agents_m365_copilot_request_adapter import AgentsM365CopilotRequestAdapter
|
|
18
|
+
from .generated.base_agents_m365_copilot_service_client import BaseAgentsM365CopilotServiceClient
|
|
19
|
+
|
|
20
|
+
if TYPE_CHECKING:
|
|
21
|
+
from microsoft_agents_m365copilot_core import BatchRequestBuilder
|
|
22
|
+
|
|
23
|
+
from .generated.copilot.users.users_request_builder import AiUserItemRequestBuilder
|
|
24
|
+
|
|
25
|
+
class AgentsM365CopilotServiceClient(BaseAgentsM365CopilotServiceClient):
|
|
26
|
+
|
|
27
|
+
def __init__(
|
|
28
|
+
self,
|
|
29
|
+
credentials: Optional[Union[TokenCredential, AsyncTokenCredential]] = None,
|
|
30
|
+
scopes: Optional[List[str]] = None,
|
|
31
|
+
request_adapter: Optional[AgentsM365CopilotRequestAdapter] = None,
|
|
32
|
+
) -> None:
|
|
33
|
+
"""Constructs a client instance to use for making requests.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
credentials (Union[TokenCredential, AsyncTokenCredential]): The
|
|
37
|
+
tokenCredential to use for authentication.
|
|
38
|
+
scopes (Optional[List[str]]): The scopes to use for authentication.
|
|
39
|
+
Defaults to ['https://graph.microsoft.com/.default'].
|
|
40
|
+
request_adapter (Optional[AgentsM365CopilotRequestAdapter], optional): The request
|
|
41
|
+
adapter to use for requests. Defaults to None.
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
if not request_adapter:
|
|
45
|
+
if not credentials:
|
|
46
|
+
raise ValueError("Missing request adapter or valid credentials")
|
|
47
|
+
|
|
48
|
+
if scopes:
|
|
49
|
+
auth_provider = AzureIdentityAuthenticationProvider(credentials, scopes=scopes)
|
|
50
|
+
else:
|
|
51
|
+
auth_provider = AzureIdentityAuthenticationProvider(credentials)
|
|
52
|
+
|
|
53
|
+
request_adapter = AgentsM365CopilotRequestAdapter(auth_provider)
|
|
54
|
+
|
|
55
|
+
super().__init__(request_adapter)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from collections.abc import Callable
|
|
3
|
+
from kiota_abstractions.api_client_builder import enable_backing_store_for_serialization_writer_factory, register_default_deserializer, register_default_serializer
|
|
4
|
+
from kiota_abstractions.base_request_builder import BaseRequestBuilder
|
|
5
|
+
from kiota_abstractions.get_path_parameters import get_path_parameters
|
|
6
|
+
from kiota_abstractions.request_adapter import RequestAdapter
|
|
7
|
+
from kiota_abstractions.serialization import ParseNodeFactoryRegistry, SerializationWriterFactoryRegistry
|
|
8
|
+
from kiota_serialization_form.form_parse_node_factory import FormParseNodeFactory
|
|
9
|
+
from kiota_serialization_form.form_serialization_writer_factory import FormSerializationWriterFactory
|
|
10
|
+
from kiota_serialization_json.json_parse_node_factory import JsonParseNodeFactory
|
|
11
|
+
from kiota_serialization_json.json_serialization_writer_factory import JsonSerializationWriterFactory
|
|
12
|
+
from kiota_serialization_multipart.multipart_serialization_writer_factory import MultipartSerializationWriterFactory
|
|
13
|
+
from kiota_serialization_text.text_parse_node_factory import TextParseNodeFactory
|
|
14
|
+
from kiota_serialization_text.text_serialization_writer_factory import TextSerializationWriterFactory
|
|
15
|
+
from typing import Any, Optional, TYPE_CHECKING, Union
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from .copilot.copilot_request_builder import CopilotRequestBuilder
|
|
19
|
+
|
|
20
|
+
class BaseAgentsM365CopilotServiceClient(BaseRequestBuilder):
|
|
21
|
+
"""
|
|
22
|
+
The main entry point of the SDK, exposes the configuration and the fluent API.
|
|
23
|
+
"""
|
|
24
|
+
def __init__(self,request_adapter: RequestAdapter) -> None:
|
|
25
|
+
"""
|
|
26
|
+
Instantiates a new BaseAgentsM365CopilotServiceClient and sets the default values.
|
|
27
|
+
param request_adapter: The request adapter to use to execute the requests.
|
|
28
|
+
Returns: None
|
|
29
|
+
"""
|
|
30
|
+
if request_adapter is None:
|
|
31
|
+
raise TypeError("request_adapter cannot be null.")
|
|
32
|
+
super().__init__(request_adapter, "{+baseurl}", None)
|
|
33
|
+
register_default_serializer(JsonSerializationWriterFactory)
|
|
34
|
+
register_default_serializer(TextSerializationWriterFactory)
|
|
35
|
+
register_default_serializer(FormSerializationWriterFactory)
|
|
36
|
+
register_default_serializer(MultipartSerializationWriterFactory)
|
|
37
|
+
register_default_deserializer(JsonParseNodeFactory)
|
|
38
|
+
register_default_deserializer(TextParseNodeFactory)
|
|
39
|
+
register_default_deserializer(FormParseNodeFactory)
|
|
40
|
+
if not self.request_adapter.base_url:
|
|
41
|
+
self.request_adapter.base_url = "https://graph.microsoft.com/v1.0"
|
|
42
|
+
self.path_parameters["base_url"] = self.request_adapter.base_url
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def copilot(self) -> CopilotRequestBuilder:
|
|
46
|
+
"""
|
|
47
|
+
The copilot property
|
|
48
|
+
"""
|
|
49
|
+
from .copilot.copilot_request_builder import CopilotRequestBuilder
|
|
50
|
+
|
|
51
|
+
return CopilotRequestBuilder(self.request_adapter, self.path_parameters)
|
|
52
|
+
|
|
53
|
+
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from collections.abc import Callable
|
|
3
|
+
from dataclasses import dataclass, field
|
|
4
|
+
from kiota_abstractions.base_request_builder import BaseRequestBuilder
|
|
5
|
+
from kiota_abstractions.base_request_configuration import RequestConfiguration
|
|
6
|
+
from kiota_abstractions.default_query_parameters import QueryParameters
|
|
7
|
+
from kiota_abstractions.get_path_parameters import get_path_parameters
|
|
8
|
+
from kiota_abstractions.method import Method
|
|
9
|
+
from kiota_abstractions.request_adapter import RequestAdapter
|
|
10
|
+
from kiota_abstractions.request_information import RequestInformation
|
|
11
|
+
from kiota_abstractions.request_option import RequestOption
|
|
12
|
+
from kiota_abstractions.serialization import Parsable, ParsableFactory
|
|
13
|
+
from typing import Any, Optional, TYPE_CHECKING, Union
|
|
14
|
+
from warnings import warn
|
|
15
|
+
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from ...models.copilot_admin import CopilotAdmin
|
|
18
|
+
from ...models.o_data_errors.o_data_error import ODataError
|
|
19
|
+
from .settings.settings_request_builder import SettingsRequestBuilder
|
|
20
|
+
|
|
21
|
+
class AdminRequestBuilder(BaseRequestBuilder):
|
|
22
|
+
"""
|
|
23
|
+
Provides operations to manage the admin property of the microsoft.graph.copilotRoot entity.
|
|
24
|
+
"""
|
|
25
|
+
def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None:
|
|
26
|
+
"""
|
|
27
|
+
Instantiates a new AdminRequestBuilder and sets the default values.
|
|
28
|
+
param path_parameters: The raw url or the url-template parameters for the request.
|
|
29
|
+
param request_adapter: The request adapter to use to execute the requests.
|
|
30
|
+
Returns: None
|
|
31
|
+
"""
|
|
32
|
+
super().__init__(request_adapter, "{+baseurl}/copilot/admin{?%24expand,%24select}", path_parameters)
|
|
33
|
+
|
|
34
|
+
async def delete(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> None:
|
|
35
|
+
"""
|
|
36
|
+
Delete navigation property admin for copilot
|
|
37
|
+
param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
|
|
38
|
+
Returns: None
|
|
39
|
+
"""
|
|
40
|
+
request_info = self.to_delete_request_information(
|
|
41
|
+
request_configuration
|
|
42
|
+
)
|
|
43
|
+
from ...models.o_data_errors.o_data_error import ODataError
|
|
44
|
+
|
|
45
|
+
error_mapping: dict[str, type[ParsableFactory]] = {
|
|
46
|
+
"XXX": ODataError,
|
|
47
|
+
}
|
|
48
|
+
if not self.request_adapter:
|
|
49
|
+
raise Exception("Http core is null")
|
|
50
|
+
return await self.request_adapter.send_no_response_content_async(request_info, error_mapping)
|
|
51
|
+
|
|
52
|
+
async def get(self,request_configuration: Optional[RequestConfiguration[AdminRequestBuilderGetQueryParameters]] = None) -> Optional[CopilotAdmin]:
|
|
53
|
+
"""
|
|
54
|
+
Get admin from copilot
|
|
55
|
+
param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
|
|
56
|
+
Returns: Optional[CopilotAdmin]
|
|
57
|
+
"""
|
|
58
|
+
request_info = self.to_get_request_information(
|
|
59
|
+
request_configuration
|
|
60
|
+
)
|
|
61
|
+
from ...models.o_data_errors.o_data_error import ODataError
|
|
62
|
+
|
|
63
|
+
error_mapping: dict[str, type[ParsableFactory]] = {
|
|
64
|
+
"XXX": ODataError,
|
|
65
|
+
}
|
|
66
|
+
if not self.request_adapter:
|
|
67
|
+
raise Exception("Http core is null")
|
|
68
|
+
from ...models.copilot_admin import CopilotAdmin
|
|
69
|
+
|
|
70
|
+
return await self.request_adapter.send_async(request_info, CopilotAdmin, error_mapping)
|
|
71
|
+
|
|
72
|
+
async def patch(self,body: CopilotAdmin, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[CopilotAdmin]:
|
|
73
|
+
"""
|
|
74
|
+
Update the navigation property admin in copilot
|
|
75
|
+
param body: The request body
|
|
76
|
+
param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
|
|
77
|
+
Returns: Optional[CopilotAdmin]
|
|
78
|
+
"""
|
|
79
|
+
if body is None:
|
|
80
|
+
raise TypeError("body cannot be null.")
|
|
81
|
+
request_info = self.to_patch_request_information(
|
|
82
|
+
body, request_configuration
|
|
83
|
+
)
|
|
84
|
+
from ...models.o_data_errors.o_data_error import ODataError
|
|
85
|
+
|
|
86
|
+
error_mapping: dict[str, type[ParsableFactory]] = {
|
|
87
|
+
"XXX": ODataError,
|
|
88
|
+
}
|
|
89
|
+
if not self.request_adapter:
|
|
90
|
+
raise Exception("Http core is null")
|
|
91
|
+
from ...models.copilot_admin import CopilotAdmin
|
|
92
|
+
|
|
93
|
+
return await self.request_adapter.send_async(request_info, CopilotAdmin, error_mapping)
|
|
94
|
+
|
|
95
|
+
def to_delete_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation:
|
|
96
|
+
"""
|
|
97
|
+
Delete navigation property admin for copilot
|
|
98
|
+
param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
|
|
99
|
+
Returns: RequestInformation
|
|
100
|
+
"""
|
|
101
|
+
request_info = RequestInformation(Method.DELETE, self.url_template, self.path_parameters)
|
|
102
|
+
request_info.configure(request_configuration)
|
|
103
|
+
request_info.headers.try_add("Accept", "application/json")
|
|
104
|
+
return request_info
|
|
105
|
+
|
|
106
|
+
def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[AdminRequestBuilderGetQueryParameters]] = None) -> RequestInformation:
|
|
107
|
+
"""
|
|
108
|
+
Get admin from copilot
|
|
109
|
+
param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
|
|
110
|
+
Returns: RequestInformation
|
|
111
|
+
"""
|
|
112
|
+
request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters)
|
|
113
|
+
request_info.configure(request_configuration)
|
|
114
|
+
request_info.headers.try_add("Accept", "application/json")
|
|
115
|
+
return request_info
|
|
116
|
+
|
|
117
|
+
def to_patch_request_information(self,body: CopilotAdmin, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation:
|
|
118
|
+
"""
|
|
119
|
+
Update the navigation property admin in copilot
|
|
120
|
+
param body: The request body
|
|
121
|
+
param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
|
|
122
|
+
Returns: RequestInformation
|
|
123
|
+
"""
|
|
124
|
+
if body is None:
|
|
125
|
+
raise TypeError("body cannot be null.")
|
|
126
|
+
request_info = RequestInformation(Method.PATCH, self.url_template, self.path_parameters)
|
|
127
|
+
request_info.configure(request_configuration)
|
|
128
|
+
request_info.headers.try_add("Accept", "application/json")
|
|
129
|
+
request_info.set_content_from_parsable(self.request_adapter, "application/json", body)
|
|
130
|
+
return request_info
|
|
131
|
+
|
|
132
|
+
def with_url(self,raw_url: str) -> AdminRequestBuilder:
|
|
133
|
+
"""
|
|
134
|
+
Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
|
|
135
|
+
param raw_url: The raw URL to use for the request builder.
|
|
136
|
+
Returns: AdminRequestBuilder
|
|
137
|
+
"""
|
|
138
|
+
if raw_url is None:
|
|
139
|
+
raise TypeError("raw_url cannot be null.")
|
|
140
|
+
return AdminRequestBuilder(self.request_adapter, raw_url)
|
|
141
|
+
|
|
142
|
+
@property
|
|
143
|
+
def settings(self) -> SettingsRequestBuilder:
|
|
144
|
+
"""
|
|
145
|
+
Provides operations to manage the settings property of the microsoft.graph.copilotAdmin entity.
|
|
146
|
+
"""
|
|
147
|
+
from .settings.settings_request_builder import SettingsRequestBuilder
|
|
148
|
+
|
|
149
|
+
return SettingsRequestBuilder(self.request_adapter, self.path_parameters)
|
|
150
|
+
|
|
151
|
+
@dataclass
|
|
152
|
+
class AdminRequestBuilderDeleteRequestConfiguration(RequestConfiguration[QueryParameters]):
|
|
153
|
+
"""
|
|
154
|
+
Configuration for the request such as headers, query parameters, and middleware options.
|
|
155
|
+
"""
|
|
156
|
+
warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning)
|
|
157
|
+
|
|
158
|
+
@dataclass
|
|
159
|
+
class AdminRequestBuilderGetQueryParameters():
|
|
160
|
+
"""
|
|
161
|
+
Get admin from copilot
|
|
162
|
+
"""
|
|
163
|
+
def get_query_parameter(self,original_name: str) -> str:
|
|
164
|
+
"""
|
|
165
|
+
Maps the query parameters names to their encoded names for the URI template parsing.
|
|
166
|
+
param original_name: The original query parameter name in the class.
|
|
167
|
+
Returns: str
|
|
168
|
+
"""
|
|
169
|
+
if original_name is None:
|
|
170
|
+
raise TypeError("original_name cannot be null.")
|
|
171
|
+
if original_name == "expand":
|
|
172
|
+
return "%24expand"
|
|
173
|
+
if original_name == "select":
|
|
174
|
+
return "%24select"
|
|
175
|
+
return original_name
|
|
176
|
+
|
|
177
|
+
# Expand related entities
|
|
178
|
+
expand: Optional[list[str]] = None
|
|
179
|
+
|
|
180
|
+
# Select properties to be returned
|
|
181
|
+
select: Optional[list[str]] = None
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
@dataclass
|
|
185
|
+
class AdminRequestBuilderGetRequestConfiguration(RequestConfiguration[AdminRequestBuilderGetQueryParameters]):
|
|
186
|
+
"""
|
|
187
|
+
Configuration for the request such as headers, query parameters, and middleware options.
|
|
188
|
+
"""
|
|
189
|
+
warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning)
|
|
190
|
+
|
|
191
|
+
@dataclass
|
|
192
|
+
class AdminRequestBuilderPatchRequestConfiguration(RequestConfiguration[QueryParameters]):
|
|
193
|
+
"""
|
|
194
|
+
Configuration for the request such as headers, query parameters, and middleware options.
|
|
195
|
+
"""
|
|
196
|
+
warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning)
|
|
197
|
+
|
|
198
|
+
|