Office365-REST-Python-Client 2.6.1__py3-none-any.whl → 2.6.2__py3-none-any.whl

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.
Files changed (233) hide show
  1. {Office365_REST_Python_Client-2.6.1.dist-info → Office365_REST_Python_Client-2.6.2.dist-info}/METADATA +1 -1
  2. {Office365_REST_Python_Client-2.6.1.dist-info → Office365_REST_Python_Client-2.6.2.dist-info}/RECORD +232 -155
  3. office365/admin/people_settings.py +16 -0
  4. office365/admin/sharepoint_settings.py +50 -1
  5. office365/admin/sharing_capabilities.py +2 -0
  6. office365/communications/calls/participant.py +6 -0
  7. office365/communications/onlinemeetings/broadcast_settings.py +5 -0
  8. office365/communications/onlinemeetings/collection.py +29 -0
  9. office365/communications/onlinemeetings/online_meeting.py +1 -1
  10. office365/communications/onlinemeetings/recordings/call.py +5 -0
  11. office365/communications/onlinemeetings/restricted.py +5 -0
  12. office365/directory/applications/collection.py +11 -0
  13. office365/directory/audit/directory.py +31 -0
  14. office365/directory/audit/signins/signin.py +14 -0
  15. office365/directory/audit/target_resource.py +5 -0
  16. office365/directory/authentication/conditions/conditions.py +5 -1
  17. office365/directory/datapolicy/operation.py +39 -0
  18. office365/directory/directory.py +13 -0
  19. office365/directory/identitygovernance/accessreview/instance.py +29 -0
  20. office365/directory/identitygovernance/accessreview/stage.py +13 -0
  21. office365/directory/identitygovernance/accessreview/stages.py +11 -0
  22. office365/directory/identitygovernance/appconsent/request.py +9 -0
  23. office365/directory/identitygovernance/privilegedaccess/group.py +1 -1
  24. office365/directory/identitygovernance/privilegedaccess/schedule/__init__.py +0 -0
  25. office365/directory/identitygovernance/privilegedaccess/{group_assignment_schedule_instance.py → schedule/group_assignment_instance.py} +1 -1
  26. office365/directory/identitygovernance/privilegedaccess/schedule/schedule.py +6 -0
  27. office365/directory/insights/trending.py +25 -0
  28. office365/directory/licenses/assignment_state.py +5 -5
  29. office365/directory/licenses/details.py +6 -0
  30. office365/directory/permissions/scoped_role_membership.py +8 -0
  31. office365/directory/policies/applied_conditional_access.py +31 -0
  32. office365/directory/policies/feature_rollout.py +24 -0
  33. office365/directory/protection/information.py +73 -2
  34. office365/directory/protection/riskyusers/collection.py +1 -1
  35. office365/directory/protection/threatassessment/requests/__init__.py +0 -0
  36. office365/directory/protection/threatassessment/{email_file_request.py → requests/email_file.py} +9 -1
  37. office365/directory/protection/threatassessment/requests/file.py +10 -0
  38. office365/directory/protection/threatassessment/{mail_request.py → requests/mail.py} +1 -1
  39. office365/directory/protection/threatassessment/requests/url.py +9 -0
  40. office365/directory/rolemanagement/app_scope.py +14 -0
  41. office365/directory/rolemanagement/application.py +3 -2
  42. office365/directory/rolemanagement/role.py +15 -0
  43. office365/directory/rolemanagement/unifiedrole/__init__.py +0 -0
  44. office365/directory/rolemanagement/{unified_role_assignment.py → unifiedrole/assignment.py} +37 -1
  45. office365/directory/rolemanagement/{unified_role_definition.py → unifiedrole/definition.py} +6 -1
  46. office365/directory/security/alerts/file_security_state.py +5 -0
  47. office365/directory/security/attacksimulations/automation.py +8 -0
  48. office365/directory/security/attacksimulations/automation_run.py +8 -0
  49. office365/directory/security/attacksimulations/repeat_offender.py +7 -0
  50. office365/directory/security/attacksimulations/report.py +2 -2
  51. office365/directory/security/attacksimulations/user.py +5 -0
  52. office365/directory/security/incidents/incident.py +6 -1
  53. office365/directory/security/security.py +5 -0
  54. office365/directory/subscriptions/__init__.py +0 -0
  55. office365/directory/subscriptions/company.py +7 -0
  56. office365/directory/synchronization/progress.py +12 -0
  57. office365/directory/users/activities/activity.py +10 -1
  58. office365/directory/users/settings.py +51 -1
  59. office365/directory/users/storage.py +5 -0
  60. office365/directory/users/user.py +114 -3
  61. office365/entity_collection.py +21 -0
  62. office365/onedrive/contenttypes/collection.py +2 -0
  63. office365/onedrive/driveitems/driveItem.py +3 -2
  64. office365/onedrive/driveitems/publication_facet.py +6 -1
  65. office365/onedrive/filestorage/container.py +22 -0
  66. office365/onedrive/filestorage/container_collection.py +37 -0
  67. office365/onedrive/filestorage/file_storage.py +4 -4
  68. office365/onedrive/listitems/collection.py +38 -0
  69. office365/onedrive/lists/list.py +3 -5
  70. office365/onedrive/sitepages/base.py +8 -0
  71. office365/onedrive/sitepages/collection.py +8 -2
  72. office365/onedrive/sitepages/site_page.py +13 -2
  73. office365/onedrive/sites/site.py +1 -1
  74. office365/onedrive/workbooks/charts/title.py +12 -0
  75. office365/onedrive/workbooks/charts/title_format.py +5 -0
  76. office365/onedrive/workbooks/functions/functions.py +16 -0
  77. office365/onedrive/workbooks/ranges/border.py +30 -0
  78. office365/onedrive/workbooks/ranges/font.py +39 -0
  79. office365/onedrive/workbooks/ranges/range.py +6 -0
  80. office365/onedrive/workbooks/worksheets/protection_options.py +34 -5
  81. office365/outlook/calendar/events/event.py +57 -0
  82. office365/outlook/mail/automatic_replies_mailtips.py +20 -0
  83. office365/outlook/mail/folders/folder.py +3 -4
  84. office365/outlook/mail/messages/message.py +21 -4
  85. office365/outlook/mail/messages/rules/collection.py +26 -0
  86. office365/outlook/mail/tips/__init__.py +0 -0
  87. office365/outlook/mail/tips/error.py +5 -0
  88. office365/outlook/mail/tips/tips.py +41 -0
  89. office365/outlook/people/__init__.py +0 -0
  90. office365/outlook/people/profile_card_property.py +15 -0
  91. office365/outlook/person.py +7 -0
  92. office365/planner/category_descriptions.py +6 -0
  93. office365/planner/external_references.py +7 -0
  94. office365/planner/planner.py +4 -4
  95. office365/planner/plans/container.py +12 -0
  96. office365/planner/plans/details.py +31 -0
  97. office365/planner/tasks/collection.py +37 -0
  98. office365/planner/tasks/task.py +24 -0
  99. office365/planner/tasks/task_details.py +34 -1
  100. office365/planner/user_ids.py +8 -0
  101. office365/reports/internal/queries/create_report_query.py +12 -3
  102. office365/reports/root.py +61 -2
  103. office365/runtime/auth/authentication_context.py +10 -1
  104. office365/runtime/auth/sts_profile.py +3 -1
  105. office365/runtime/client_object.py +1 -1
  106. office365/runtime/client_object_collection.py +3 -5
  107. office365/runtime/client_result.py +3 -3
  108. office365/runtime/client_runtime_context.py +2 -2
  109. office365/runtime/odata/json_format.py +14 -3
  110. office365/runtime/odata/request.py +1 -3
  111. office365/runtime/odata/v3/json_light_format.py +18 -0
  112. office365/runtime/odata/v4/json_format.py +19 -0
  113. office365/runtime/queries/client_query.py +13 -8
  114. office365/runtime/queries/create_entity.py +7 -5
  115. office365/runtime/queries/delete_entity.py +6 -2
  116. office365/runtime/queries/function.py +3 -4
  117. office365/runtime/queries/read_entity.py +3 -5
  118. office365/runtime/queries/service_operation.py +2 -7
  119. office365/search/acronyms/__init__.py +0 -0
  120. office365/search/answer.py +35 -0
  121. office365/search/bookmarks/__init__.py +0 -0
  122. office365/search/bookmarks/bookmark.py +7 -0
  123. office365/search/entity.py +81 -2
  124. office365/search/entity_type.py +6 -1
  125. office365/search/external/item.py +5 -0
  126. office365/search/identity_set.py +11 -0
  127. office365/search/qnas/__init__.py +0 -0
  128. office365/search/qnas/qna.py +9 -0
  129. office365/sharepoint/activities/client_response.py +2 -2
  130. office365/sharepoint/apps/launcher.py +9 -0
  131. office365/sharepoint/brandcenter/brand_center.py +26 -0
  132. office365/sharepoint/client_context.py +19 -1
  133. office365/sharepoint/compliance/preserve_document_submitter.py +5 -0
  134. office365/sharepoint/compliance/store_proxy.py +75 -0
  135. office365/sharepoint/convergence/migration_complete_state_api.py +9 -0
  136. office365/sharepoint/copilot/file_metadata.py +5 -0
  137. office365/sharepoint/fields/builtin_field_id.py +8 -0
  138. office365/sharepoint/files/collection.py +10 -0
  139. office365/sharepoint/files/file.py +24 -3
  140. office365/sharepoint/listitems/listitem.py +61 -3
  141. office365/sharepoint/lists/exporter.py +1 -0
  142. office365/sharepoint/lists/list.py +37 -3
  143. office365/sharepoint/migrationcenter/common/results/batch_creation.py +24 -0
  144. office365/sharepoint/migrationcenter/common/task.py +8 -0
  145. office365/sharepoint/migrationcenter/common/task_definition.py +7 -1
  146. office365/sharepoint/migrationcenter/common/teams/__init__.py +0 -0
  147. office365/sharepoint/migrationcenter/common/teams/channel_resource.py +5 -0
  148. office365/sharepoint/migrationcenter/common/teams/team_resource.py +5 -0
  149. office365/sharepoint/migrationcenter/common/url_parser.py +39 -0
  150. office365/sharepoint/migrationcenter/service/services.py +13 -1
  151. office365/sharepoint/migrationcenter/service/teams.py +11 -0
  152. office365/sharepoint/navigation/node.py +7 -16
  153. office365/sharepoint/policy/license_utilities.py +1 -0
  154. office365/sharepoint/portal/groups/creation_context.py +11 -0
  155. office365/sharepoint/portal/groups/service.py +1 -1
  156. office365/sharepoint/portal/groups/site_manager.py +1 -1
  157. office365/sharepoint/publishing/pages/3d/__init__.py +0 -0
  158. office365/sharepoint/publishing/pages/3d/types.py +5 -0
  159. office365/sharepoint/publishing/pages/campaign/__init__.py +0 -0
  160. office365/sharepoint/publishing/pages/{campaign_publication.py → campaign/publication.py} +2 -0
  161. office365/sharepoint/publishing/pages/campaign/types.py +18 -0
  162. office365/sharepoint/publishing/pages/coauth_state.py +20 -0
  163. office365/sharepoint/publishing/pages/dependency_metadata.py +9 -0
  164. office365/sharepoint/publishing/pages/metadata.py +0 -10
  165. office365/sharepoint/publishing/pages/page.py +29 -0
  166. office365/sharepoint/publishing/pages/service.py +27 -6
  167. office365/sharepoint/publishing/pages/topics/collection.py +1 -1
  168. office365/sharepoint/request.py +5 -1
  169. office365/sharepoint/search/administration/tenant_crawl_versions_info_provider.py +16 -0
  170. office365/sharepoint/sharing/access_request_settings.py +18 -0
  171. office365/sharepoint/sharing/address_bar_link_settings.py +5 -0
  172. office365/sharepoint/sharing/information.py +2 -0
  173. office365/sharepoint/sharing/links/partial_success_response.py +4 -0
  174. office365/sharepoint/sites/azure_container_Info.py +4 -1
  175. office365/sharepoint/sites/brand_center_configuration.py +5 -0
  176. office365/sharepoint/sites/manager/__init__.py +0 -0
  177. office365/sharepoint/sites/manager/service.py +34 -0
  178. office365/sharepoint/sites/manager/types.py +5 -0
  179. office365/sharepoint/sites/site.py +54 -0
  180. office365/sharepoint/sites/themes.py +5 -0
  181. office365/sharepoint/storagemetrics/storage_metrics.py +18 -0
  182. office365/sharepoint/tenant/administration/copilot/agentinsights/__init__.py +0 -0
  183. office365/sharepoint/tenant/administration/copilot/agentinsights/client.py +42 -0
  184. office365/sharepoint/tenant/administration/copilot/agentinsights/report_metadata.py +5 -0
  185. office365/sharepoint/tenant/administration/group.py +34 -0
  186. office365/sharepoint/tenant/administration/policies/file_version_types.py +17 -0
  187. office365/sharepoint/tenant/administration/policies/list_parameters.py +9 -0
  188. office365/sharepoint/tenant/administration/policies/resource_storage.py +9 -0
  189. office365/sharepoint/tenant/administration/sites/properties_enumerable_filter.py +6 -0
  190. office365/sharepoint/tenant/administration/tenant.py +182 -5
  191. office365/sharepoint/userprofiles/people_manager.py +3 -1
  192. office365/sharepoint/utilities/utility.py +16 -0
  193. office365/sharepoint/webparts/definition.py +26 -0
  194. office365/sharepoint/webparts/limited_manager.py +53 -0
  195. office365/sharepoint/webparts/webpart.py +47 -0
  196. office365/sharepoint/webs/regional_settings.py +27 -0
  197. office365/sharepoint/webs/web.py +20 -1
  198. office365/teams/apps/app.py +17 -0
  199. office365/teams/apps/authorization.py +16 -0
  200. office365/teams/apps/permission_set.py +14 -0
  201. office365/teams/apps/resource_specific_permission.py +5 -0
  202. office365/teams/chats/chat.py +60 -0
  203. office365/teams/chats/messages/message.py +17 -0
  204. office365/teams/chats/type.py +13 -0
  205. office365/teams/chats/viewpoint.py +5 -0
  206. office365/teams/fun_settings.py +14 -2
  207. office365/teams/info.py +1 -1
  208. office365/teams/schedule/entity.py +3 -0
  209. office365/teams/schedule/shifts/item.py +1 -0
  210. office365/teams/schedule/shifts/offer/request.py +41 -1
  211. office365/teams/teamwork/activity_topic.py +5 -0
  212. office365/teams/teamwork/online_meeting_info.py +21 -0
  213. office365/teams/teamwork/shiftmanagement/__init__.py +0 -0
  214. office365/teams/teamwork/shiftmanagement/user_solution_root.py +5 -0
  215. office365/teams/teamwork/user.py +48 -1
  216. office365/teams/teamwork/user_identity.py +5 -0
  217. office365/teams/viva/community.py +13 -0
  218. office365/teams/viva/employee_experience.py +27 -0
  219. office365/teams/viva/employee_experience_user.py +16 -0
  220. office365/teams/viva/learning/courses/self_initiated.py +5 -0
  221. office365/todo/attachments/task_file.py +3 -0
  222. office365/todo/checklist_item.py +11 -0
  223. office365/todo/tasks/list.py +11 -0
  224. office365/todo/tasks/task.py +31 -0
  225. office365/outlook/mail/tips.py +0 -17
  226. {Office365_REST_Python_Client-2.6.1.dist-info → Office365_REST_Python_Client-2.6.2.dist-info}/LICENSE +0 -0
  227. {Office365_REST_Python_Client-2.6.1.dist-info → Office365_REST_Python_Client-2.6.2.dist-info}/WHEEL +0 -0
  228. {Office365_REST_Python_Client-2.6.1.dist-info → Office365_REST_Python_Client-2.6.2.dist-info}/top_level.txt +0 -0
  229. /office365/directory/identitygovernance/privilegedaccess/{schedule_instance.py → schedule/instance.py} +0 -0
  230. /office365/directory/protection/threatassessment/{request.py → requests/request.py} +0 -0
  231. /office365/directory/rolemanagement/{unified_role_permission.py → unifiedrole/permission.py} +0 -0
  232. /office365/search/{acronym.py → acronyms/acronym.py} +0 -0
  233. /office365/sharepoint/publishing/pages/{page_3d.py → 3d/page.py} +0 -0
office365/reports/root.py CHANGED
@@ -89,7 +89,9 @@ class ReportRoot(Entity):
89
89
  The supported values for {period_value} are: D7, D30, D90, and D180. These values follow the format
90
90
  Dn where n represents the number of days over which the report is aggregated. Required.
91
91
  """
92
- qry = create_report_query(self, "getEmailActivityUserDetail", period)
92
+ qry = create_report_query(
93
+ self, "getEmailActivityUserDetail", period, return_stream=True
94
+ )
93
95
  self.context.add_query(qry)
94
96
  return qry.return_type
95
97
 
@@ -105,18 +107,61 @@ class ReportRoot(Entity):
105
107
  self.context.add_query(qry)
106
108
  return qry.return_type
107
109
 
110
+ def get_email_app_usage_user_counts(self, period):
111
+ """
112
+ Get the count of unique users that connected to Exchange Online using any email app.
113
+
114
+ :param str period: Specifies the length of time over which the report is aggregated.
115
+ The supported values for {period_value} are: D7, D30, D90, and D180. These values follow the format
116
+ Dn where n represents the number of days over which the report is aggregated. Required.
117
+ """
118
+ qry = create_report_query(self, "getEmailAppUsageUserCounts", period, True)
119
+ self.context.add_query(qry)
120
+ return qry.return_type
121
+
122
+ ###
123
+ def get_email_app_usage_user_detail(self, period):
124
+ """
125
+ Get details about which activities users performed on the various email apps.
126
+
127
+ :param str period: Specifies the length of time over which the report is aggregated.
128
+ The supported values for {period_value} are: D7, D30, D90, and D180. These values follow the format
129
+ Dn where n represents the number of days over which the report is aggregated. Required.
130
+ """
131
+ qry = create_report_query(self, "getEmailAppUsageUserDetail", period, True)
132
+ self.context.add_query(qry)
133
+ return qry.return_type
134
+
135
+ def get_mailbox_usage_storage(self, period):
136
+ """
137
+ Get the amount of storage used in your organization.
138
+
139
+ :param str period: Specifies the length of time over which the report is aggregated.
140
+ The supported values for {period_value} are: D7, D30, D90, and D180. These values follow the format
141
+ Dn where n represents the number of days over which the report is aggregated. Required.
142
+ """
143
+ qry = create_report_query(self, "getMailboxUsageStorage", period, True)
144
+ self.context.add_query(qry)
145
+ return qry.return_type
146
+
108
147
  def get_m365_app_user_counts(self, period=None):
109
148
  """
110
149
  Get a report that provides the trend in the number of active users for each app (Outlook, Word, Excel,
111
150
  PowerPoint, OneNote, and Teams) in your organization.
112
151
  """
113
- return_type = ClientResult(self.context, str())
152
+ return_type = ClientResult(self.context, bytes())
114
153
  qry = FunctionQuery(
115
154
  self, "getM365AppUserCounts", {"period": period}, return_type
116
155
  )
117
156
  self.context.add_query(qry)
118
157
  return return_type
119
158
 
159
+ def get_office365_activation_counts(self):
160
+ """Get the count of Microsoft 365 activations on desktops and devices."""
161
+ qry = create_report_query(self, "getOffice365ActivationCounts")
162
+ self.context.add_query(qry)
163
+ return qry.return_type
164
+
120
165
  def get_office365_activations_user_counts(self):
121
166
  """Get the count of Microsoft 365 activations on desktops and devices."""
122
167
  qry = create_report_query(self, "getOffice365ActivationsUserCounts")
@@ -283,6 +328,20 @@ class ReportRoot(Entity):
283
328
  self.context.add_query(qry)
284
329
  return qry.return_type
285
330
 
331
+ def get_teams_team_counts(self, period):
332
+ """
333
+ Get the number of teams of a particular type in an instance of Microsoft Teams.
334
+
335
+ :param str period: Specifies the length of time over which the report is aggregated.
336
+ The supported values for {period_value} are: D7, D30, D90, and D180. These values follow the format
337
+ Dn where n represents the number of days over which the report is aggregated. Required.
338
+ """
339
+ qry = create_report_query(
340
+ self, "getTeamsTeamCounts", period, return_stream=True
341
+ )
342
+ self.context.add_query(qry)
343
+ return qry.return_type
344
+
286
345
  @property
287
346
  def authentication_methods(self):
288
347
  """Container for navigation properties for Azure AD authentication methods resources."""
@@ -1,5 +1,6 @@
1
1
  import json
2
2
  import sys
3
+ from datetime import datetime, timedelta, timezone
3
4
  from typing import Any, Callable
4
5
 
5
6
  from typing_extensions import Required, Self, TypedDict
@@ -46,6 +47,7 @@ class AuthenticationContext(object):
46
47
  self._environment = environment
47
48
  self._allow_ntlm = allow_ntlm
48
49
  self._browser_mode = browser_mode
50
+ self._token_expires = datetime.max
49
51
 
50
52
  def with_client_certificate(
51
53
  self,
@@ -178,8 +180,15 @@ class AuthenticationContext(object):
178
180
  """
179
181
 
180
182
  def _authenticate(request):
181
- if self._cached_token is None:
183
+
184
+ request_time = datetime.now(timezone.utc)
185
+
186
+ if self._cached_token is None or request_time > self._token_expires:
182
187
  self._cached_token = token_func()
188
+ if hasattr(self._cached_token, "expiresIn"):
189
+ self._token_expires = request_time + timedelta(
190
+ seconds=self._cached_token.expiresIn
191
+ )
183
192
  request.set_header(
184
193
  "Authorization", _get_authorization_header(self._cached_token)
185
194
  )
@@ -30,7 +30,9 @@ class STSProfile(object):
30
30
  @property
31
31
  def signin_page_url(self):
32
32
  site_info = urlparse(self._site_url)
33
- return "{0}://{1}/_forms/default.aspx?wa=wsignin1.0".format(site_info.scheme, site_info.netloc)
33
+ return "{0}://{1}/_forms/default.aspx?wa=wsignin1.0".format(
34
+ site_info.scheme, site_info.netloc
35
+ )
34
36
 
35
37
  @property
36
38
  def user_realm_service_url(self):
@@ -86,7 +86,7 @@ class ClientObject(Generic[T]):
86
86
  def before_execute(self, action):
87
87
  # type: (Callable[[RequestOptions], None]) -> Self
88
88
  """Attach an event handler to client object which gets triggered after query is submitted to server"""
89
- self.context.before_execute(action)
89
+ self.context.before_query_execute(action)
90
90
  return self
91
91
 
92
92
  def after_execute(self, action, execute_first=False, include_response=False):
@@ -81,14 +81,12 @@ class ClientObjectCollection(ClientObject, Generic[T]):
81
81
 
82
82
  def __iter__(self):
83
83
  # type: () -> Iterator[T]
84
- for item in self._data:
85
- yield item
84
+ yield from self._data
86
85
  if self._paged_mode:
87
86
  while self.has_next:
88
87
  self._get_next().execute_query()
89
88
  next_items = self._data[self._current_pos :]
90
- for next_item in next_items:
91
- yield next_item
89
+ yield from next_items
92
90
 
93
91
  def __len__(self):
94
92
  # type: () -> int
@@ -234,7 +232,7 @@ class ClientObjectCollection(ClientObject, Generic[T]):
234
232
  @property
235
233
  def has_next(self):
236
234
  # type: () -> bool
237
- """"""
235
+ """Determines whether the collection contains a next page of data."""
238
236
  return self._next_request_url is not None
239
237
 
240
238
  @property
@@ -28,10 +28,10 @@ class ClientResult(Generic[T]):
28
28
  self._context.before_query_execute(action)
29
29
  return self
30
30
 
31
- def after_execute(self, action, execute_first=False):
32
- # type: (Callable[[Self], None], bool) -> Self
31
+ def after_execute(self, action, execute_first=False, include_response=False):
32
+ # type: (Callable[[Self], None], bool, bool) -> Self
33
33
  """Attach an event handler which is triggered after query is submitted to server"""
34
- self._context.after_query_execute(action, execute_first)
34
+ self._context.after_query_execute(action, execute_first, include_response)
35
35
  return self
36
36
 
37
37
  def set_property(self, key, value, persist_changes=False):
@@ -96,7 +96,7 @@ class ClientRuntimeContext(object):
96
96
  :param bool once: Flag which determines whether action is executed once or multiple times
97
97
  """
98
98
  if len(self._queries) == 0:
99
- return
99
+ return self
100
100
  query = self._queries[-1]
101
101
 
102
102
  def _prepare_request(request):
@@ -130,7 +130,7 @@ class ClientRuntimeContext(object):
130
130
  # type: (Callable[[T|Response], None], bool, bool) -> Self
131
131
  """Attach an event handler which is triggered after query is submitted to server"""
132
132
  if len(self._queries) == 0:
133
- return
133
+ return self
134
134
  query = self._queries[-1]
135
135
 
136
136
  def _process_response(resp):
@@ -4,10 +4,9 @@ from abc import ABCMeta
4
4
  class ODataJsonFormat(object):
5
5
  """OData JSON format"""
6
6
 
7
- def __init__(self, metadata_level=None, etag=None):
8
- # type: (str, str) -> None
7
+ def __init__(self, metadata_level=None):
8
+ # type: (str) -> None
9
9
  self.metadata_level = metadata_level
10
- self.etag = etag
11
10
 
12
11
  __metaclass__ = ABCMeta
13
12
 
@@ -23,6 +22,18 @@ class ODataJsonFormat(object):
23
22
  def collection_next(self):
24
23
  raise NotImplementedError
25
24
 
25
+ @property
26
+ def collection_delta(self):
27
+ raise NotImplementedError
28
+
29
+ @property
30
+ def etag(self):
31
+ raise NotImplementedError
32
+
33
+ @property
34
+ def value_tag(self):
35
+ raise NotImplementedError
36
+
26
37
  @property
27
38
  def media_type(self):
28
39
  # type: () -> str
@@ -99,7 +99,7 @@ class ODataRequest(ClientRequest):
99
99
  elif isinstance(json, dict):
100
100
  for name, value in json.items():
101
101
  if isinstance(json_format, JsonLightFormat):
102
- is_valid = name != "__metadata" and not (
102
+ is_valid = name != json_format.metadata_type and not (
103
103
  isinstance(value, dict) and "__deferred" in value
104
104
  )
105
105
  else:
@@ -155,5 +155,3 @@ class ODataRequest(ClientRequest):
155
155
  media_type = self.json_format.media_type
156
156
  request.ensure_header("Content-Type", media_type)
157
157
  request.ensure_header("Accept", media_type)
158
- if self.json_format.etag is not None:
159
- request.ensure_header("If-Match", self.json_format.etag)
@@ -25,10 +25,28 @@ class JsonLightFormat(ODataJsonFormat):
25
25
  """Property name for a reference to the next page of results"""
26
26
  return "__next"
27
27
 
28
+ @property
29
+ def collection_delta(self):
30
+ """Property name for a reference to the next page of results"""
31
+ return "__delta"
32
+
28
33
  @property
29
34
  def metadata_type(self):
30
35
  return "__metadata"
31
36
 
37
+ @property
38
+ def deferred_type(self):
39
+ return "__deferred"
40
+
41
+ @property
42
+ def value_tag(self):
43
+ return "__value"
44
+
45
+ @property
46
+ def etag(self):
47
+ """The entity tag that represents the version of the object."""
48
+ return "__etag"
49
+
32
50
  @property
33
51
  def media_type(self):
34
52
  return "application/json;odata={0}".format(self.metadata_level)
@@ -14,16 +14,35 @@ class V4JsonFormat(ODataJsonFormat):
14
14
 
15
15
  @property
16
16
  def metadata_type(self):
17
+ """The OData entity type in Microsoft Graph that describes the represented object."""
17
18
  return "@odata.type"
18
19
 
20
+ @property
21
+ def value_tag(self):
22
+ """The OData entity type in Microsoft Graph that describes the represented object."""
23
+ return "@odata.value"
24
+
19
25
  @property
20
26
  def collection(self):
21
27
  return "value"
22
28
 
23
29
  @property
24
30
  def collection_next(self):
31
+ """
32
+ Property name for a reference to the next page of results
33
+ """
25
34
  return "@odata.nextLink"
26
35
 
36
+ @property
37
+ def collection_delta(self):
38
+ """ """
39
+ return "@odata.deltaLink"
40
+
41
+ @property
42
+ def etag(self):
43
+ """The entity tag that represents the version of the object."""
44
+ return "@odata.etag"
45
+
27
46
  @property
28
47
  def media_type(self):
29
48
  return "application/json;odata.metadata={0};odata.streaming={1};IEEE754Compatible={2}".format(
@@ -1,4 +1,15 @@
1
- class ClientQuery(object):
1
+ from typing import TYPE_CHECKING, AnyStr, Dict, Generic, Optional, TypeVar, Union
2
+
3
+ if TYPE_CHECKING:
4
+ from office365.runtime.client_object import ClientObject
5
+ from office365.runtime.client_result import ClientResult
6
+ from office365.runtime.client_runtime_context import ClientRuntimeContext
7
+ from office365.runtime.client_value import ClientValue
8
+
9
+ T = TypeVar("T", bound=Union["ClientObject", "ClientResult"])
10
+
11
+
12
+ class ClientQuery(Generic[T]):
2
13
  """Client query"""
3
14
 
4
15
  def __init__(
@@ -9,15 +20,9 @@ class ClientQuery(object):
9
20
  parameters_name=None,
10
21
  return_type=None,
11
22
  ):
23
+ # type: (ClientRuntimeContext, Optional[ClientObject], Optional[ClientObject|ClientValue|Dict|AnyStr], Optional[str], Optional[T]) -> None
12
24
  """
13
25
  Generic query
14
-
15
- :type context: office365.runtime.client_runtime_context.ClientRuntimeContext
16
- :type binding_type: office365.runtime.client_object.ClientObject or None
17
- :type parameters_type: office365.runtime.client_object.ClientObject or ClientValue or dict or bytes or None
18
- :type parameters_name: str or None
19
- :type return_type: office365.runtime.client_object.ClientObject
20
- or office365.runtime.client_result.ClientResult or None
21
26
  """
22
27
  self._context = context
23
28
  self._binding_type = binding_type
@@ -1,13 +1,15 @@
1
- from typing import Dict
1
+ from typing import TYPE_CHECKING, Dict
2
2
 
3
- from office365.runtime.client_object import ClientObject
4
3
  from office365.runtime.client_value import ClientValue
5
- from office365.runtime.queries.client_query import ClientQuery
4
+ from office365.runtime.queries.client_query import ClientQuery, T
6
5
 
6
+ if TYPE_CHECKING:
7
+ from office365.runtime.client_object import ClientObject
7
8
 
8
- class CreateEntityQuery(ClientQuery):
9
+
10
+ class CreateEntityQuery(ClientQuery[T]):
9
11
  def __init__(self, parent_entity, parameters, return_type=None):
10
- # type: (ClientObject, ClientObject|ClientValue|Dict, ClientObject) -> None
12
+ # type: (ClientObject, ClientObject|ClientValue|Dict, T) -> None
11
13
  """Create entity query"""
12
14
  super(CreateEntityQuery, self).__init__(
13
15
  parent_entity.context, parent_entity, parameters, None, return_type
@@ -1,11 +1,15 @@
1
+ from typing import TYPE_CHECKING
2
+
1
3
  from office365.runtime.queries.client_query import ClientQuery
2
4
 
5
+ if TYPE_CHECKING:
6
+ from office365.runtime.client_object import ClientObject
7
+
3
8
 
4
9
  class DeleteEntityQuery(ClientQuery):
5
10
  def __init__(self, delete_type):
11
+ # type: (ClientObject) -> None
6
12
  """
7
13
  Delete entity query
8
-
9
- :type delete_type: office365.runtime.client_object.ClientObject
10
14
  """
11
15
  super(DeleteEntityQuery, self).__init__(delete_type.context, delete_type)
@@ -1,17 +1,16 @@
1
1
  from office365.runtime.client_object import ClientObject
2
- from office365.runtime.client_result import ClientResult
3
2
  from office365.runtime.client_value import ClientValue
4
3
  from office365.runtime.paths.service_operation import ServiceOperationPath
5
- from office365.runtime.queries.client_query import ClientQuery
4
+ from office365.runtime.queries.client_query import ClientQuery, T
6
5
 
7
6
 
8
- class FunctionQuery(ClientQuery):
7
+ class FunctionQuery(ClientQuery[T]):
9
8
  """Function query"""
10
9
 
11
10
  def __init__(
12
11
  self, binding_type, method_name=None, method_params=None, return_type=None
13
12
  ):
14
- # type: (ClientObject, str, list|dict|ClientValue, ClientObject|ClientResult) -> None
13
+ # type: (ClientObject, str, list|dict|ClientValue, T) -> None
15
14
  """Function query"""
16
15
  super(FunctionQuery, self).__init__(
17
16
  binding_type.context, binding_type, None, None, return_type
@@ -1,14 +1,12 @@
1
1
  from office365.runtime.odata.query_options import QueryOptions
2
- from office365.runtime.queries.client_query import ClientQuery
2
+ from office365.runtime.queries.client_query import ClientQuery, T
3
3
 
4
4
 
5
- class ReadEntityQuery(ClientQuery):
5
+ class ReadEntityQuery(ClientQuery[T]):
6
6
  def __init__(self, return_type, properties_to_include=None):
7
+ # type: (T, list[str]) -> None
7
8
  """
8
9
  Read client object query
9
-
10
- :type properties_to_include: list[str] or None
11
- :type return_type: office365.runtime.client_object.ClientObject
12
10
  """
13
11
  super(ReadEntityQuery, self).__init__(
14
12
  return_type.context, return_type, None, None, return_type
@@ -1,8 +1,8 @@
1
1
  from office365.runtime.paths.service_operation import ServiceOperationPath
2
- from office365.runtime.queries.client_query import ClientQuery
2
+ from office365.runtime.queries.client_query import ClientQuery, T
3
3
 
4
4
 
5
- class ServiceOperationQuery(ClientQuery):
5
+ class ServiceOperationQuery(ClientQuery[T]):
6
6
  """ "Service operation query"""
7
7
 
8
8
  def __init__(
@@ -15,11 +15,6 @@ class ServiceOperationQuery(ClientQuery):
15
15
  return_type=None,
16
16
  is_static=False,
17
17
  ):
18
- """
19
-
20
- :type method_params: list or dict or office365.runtime.client_value.ClientValue or None
21
- :type method_name: str or None
22
- """
23
18
  super(ServiceOperationQuery, self).__init__(
24
19
  binding_type.context,
25
20
  binding_type,
File without changes
@@ -1,9 +1,44 @@
1
+ from datetime import datetime
2
+ from typing import Optional
3
+
1
4
  from office365.entity import Entity
5
+ from office365.search.identity_set import IdentitySet
2
6
 
3
7
 
4
8
  class SearchAnswer(Entity):
5
9
  """Represents the base type for other search answers."""
6
10
 
11
+ @property
12
+ def description(self):
13
+ # type: () -> Optional[str]
14
+ """The search answer description that is shown on the search results page."""
15
+ return self.properties.get("description", None)
16
+
17
+ @property
18
+ def display_name(self):
19
+ # type: () -> Optional[str]
20
+ """The search answer name that is displayed in search results."""
21
+ return self.properties.get("displayName", None)
22
+
23
+ @property
24
+ def last_modified_by(self):
25
+ # type: () -> IdentitySet
26
+ """Details of the user who created or last modified the search answer."""
27
+ return self.properties.get("lastModifiedBy", IdentitySet())
28
+
29
+ @property
30
+ def last_modified_datetime(self):
31
+ # type: () -> Optional[datetime]
32
+ """Date and time when the search answer was created or last edited."""
33
+ return self.properties.get("lastModifiedDateTime", datetime.min)
34
+
35
+ @property
36
+ def web_url(self):
37
+ # type: () -> Optional[str]
38
+ """The URL link for the search answer. When users select this search answer from the search results,
39
+ they are directed to the specified URL."""
40
+ return self.properties.get("webUrl", None)
41
+
7
42
  @property
8
43
  def entity_type_name(self):
9
44
  return "microsoft.graph.search.searchAnswer"
File without changes
@@ -0,0 +1,7 @@
1
+ from office365.search.answer import SearchAnswer
2
+
3
+
4
+ class Bookmark(SearchAnswer):
5
+ """Represents a bookmark that is an administrative answer in Microsoft Search results for common search queries
6
+ in an organization. A bookmark has many properties that allow administrators to make common resources more
7
+ accessible in their organization."""
@@ -7,9 +7,11 @@ from office365.runtime.client_value_collection import ClientValueCollection
7
7
  from office365.runtime.paths.resource_path import ResourcePath
8
8
  from office365.runtime.paths.v4.entity import EntityPath
9
9
  from office365.runtime.queries.service_operation import ServiceOperationQuery
10
- from office365.search.acronym import Acronym
10
+ from office365.search.acronyms.acronym import Acronym
11
+ from office365.search.bookmarks.bookmark import Bookmark
11
12
  from office365.search.entity_type import EntityType
12
13
  from office365.search.hit import SearchHit
14
+ from office365.search.qnas.qna import Qna
13
15
  from office365.search.query import SearchQuery
14
16
  from office365.search.request import SearchRequest
15
17
  from office365.search.response import SearchResponse
@@ -28,8 +30,9 @@ class SearchEntity(Entity):
28
30
  page_from=None,
29
31
  size=None,
30
32
  enable_top_results=None,
33
+ region=None,
31
34
  ):
32
- # type: (str, Optional[List[str]], Optional[int], Optional[int], Optional[bool]) -> ClientResult[ClientValueCollection[SearchResponse]]
35
+ # type: (str, Optional[List[str]], Optional[int], Optional[int], Optional[bool], Optional[str]) -> ClientResult[ClientValueCollection[SearchResponse]]
33
36
  """
34
37
  Runs the query specified in the request body. Search results are provided in the response.
35
38
 
@@ -39,6 +42,8 @@ class SearchEntity(Entity):
39
42
  :param int page_from: Specifies the offset for the search results. Offset 0 returns the very first result.
40
43
  :param int size: The size of the page to be retrieved. The maximum value is 500. Optional.
41
44
  :param bool enable_top_results: This triggers hybrid sort for messages
45
+ :param str region: The geographic location for the search. Required for searches that use application
46
+ permissions. For details, see Get the region value.
42
47
  """
43
48
  search_request = SearchRequest(
44
49
  query=SearchQuery(query_string),
@@ -46,6 +51,7 @@ class SearchEntity(Entity):
46
51
  page_from=page_from,
47
52
  size=size,
48
53
  enable_top_results=enable_top_results,
54
+ region=region,
49
55
  )
50
56
 
51
57
  def _patch_hit(search_hit):
@@ -106,6 +112,54 @@ class SearchEntity(Entity):
106
112
  size=size,
107
113
  )
108
114
 
115
+ def query_list_items(self, query_string, page_from=None, size=None, region=None):
116
+ """Searches list items. Alias to query method
117
+
118
+ :param str query_string: Contains the query terms.
119
+ :param int page_from: Specifies the offset for the search results. Offset 0 returns the very first result.
120
+ :param int size: The size of the page to be retrieved. The maximum value is 500.
121
+ :param str region: The geographic location for the search. Required for searches that use application
122
+ """
123
+ return self.query(
124
+ query_string,
125
+ entity_types=[EntityType.listItem],
126
+ page_from=page_from,
127
+ size=size,
128
+ region=region,
129
+ )
130
+
131
+ def query_peoples(self, query_string, page_from=None, size=None, region=None):
132
+ """Searches peoples. Alias to query method
133
+
134
+ :param str query_string: Contains the query terms.
135
+ :param int page_from: Specifies the offset for the search results. Offset 0 returns the very first result.
136
+ :param int size: The size of the page to be retrieved. The maximum value is 500.
137
+ :param str region: The geographic location for the search. Required for searches that use application
138
+ """
139
+ return self.query(
140
+ query_string,
141
+ entity_types=[EntityType.person],
142
+ page_from=page_from,
143
+ size=size,
144
+ region=region,
145
+ )
146
+
147
+ def query_sites(self, query_string, page_from=None, size=None, region=None):
148
+ """Searches sites. Alias to query method
149
+
150
+ :param str query_string: Contains the query terms.
151
+ :param int page_from: Specifies the offset for the search results. Offset 0 returns the very first result.
152
+ :param int size: The size of the page to be retrieved. The maximum value is 500.
153
+ :param str region: The geographic location for the search. Required for searches that use application
154
+ """
155
+ return self.query(
156
+ query_string,
157
+ entity_types=[EntityType.site],
158
+ page_from=page_from,
159
+ size=size,
160
+ region=region,
161
+ )
162
+
109
163
  @property
110
164
  def acronyms(self):
111
165
  """Administrative answer in Microsoft Search results to define common acronyms in an organization."""
@@ -117,3 +171,28 @@ class SearchEntity(Entity):
117
171
  ResourcePath("acronyms", self.resource_path),
118
172
  ),
119
173
  )
174
+
175
+ @property
176
+ def bookmarks(self):
177
+ """Administrative answer in Microsoft Search results for common search queries in an organization."""
178
+ return self.properties.get(
179
+ "bookmarks",
180
+ EntityCollection(
181
+ self.context,
182
+ Bookmark,
183
+ ResourcePath("bookmarks", self.resource_path),
184
+ ),
185
+ )
186
+
187
+ @property
188
+ def qnas(self):
189
+ """Administrative answer in Microsoft Search results that provide answers for specific search keywords in
190
+ an organization."""
191
+ return self.properties.get(
192
+ "qnas",
193
+ EntityCollection(
194
+ self.context,
195
+ Qna,
196
+ ResourcePath("qnas", self.resource_path),
197
+ ),
198
+ )
@@ -7,6 +7,8 @@ from office365.onedrive.lists.list import List
7
7
  from office365.onedrive.sites.site import Site
8
8
  from office365.outlook.calendar.events.event import Event
9
9
  from office365.outlook.mail.messages.message import Message
10
+ from office365.outlook.person import Person
11
+ from office365.search.external.item import ExternalItem
10
12
 
11
13
 
12
14
  class EntityType:
@@ -20,7 +22,8 @@ class EntityType:
20
22
  "message": Message,
21
23
  "drive": Drive,
22
24
  "driveItem": DriveItem,
23
- # "externalItem": ExternalItem
25
+ "externalItem": ExternalItem,
26
+ "person": Person,
24
27
  }
25
28
 
26
29
  def __init__(self):
@@ -47,3 +50,5 @@ class EntityType:
47
50
  driveItem = "driveItem"
48
51
 
49
52
  externalItem = "externalItem"
53
+
54
+ person = "person"