Office365-REST-Python-Client 2.5.4__py3-none-any.whl → 2.5.6__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 (225) hide show
  1. {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/METADATA +2 -2
  2. {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/RECORD +224 -204
  3. office365/booking/business/business.py +5 -3
  4. office365/booking/virtualevents/__init__.py +0 -0
  5. office365/booking/virtualevents/root.py +5 -0
  6. office365/communications/calls/participant.py +4 -5
  7. office365/directory/applications/application.py +3 -3
  8. office365/directory/applications/roles/assignment_collection.py +1 -1
  9. office365/directory/applications/roles/collection.py +2 -2
  10. office365/directory/authentication/method_configuration.py +9 -0
  11. office365/directory/authentication/method_mode_detail.py +8 -0
  12. office365/directory/authentication/method_target.py +5 -0
  13. office365/directory/authentication/strength_root.py +5 -0
  14. office365/directory/certificates/auth_configuration.py +1 -3
  15. office365/directory/extensions/extended_property.py +4 -4
  16. office365/directory/extensions/open_type.py +4 -4
  17. office365/directory/groups/group.py +2 -6
  18. office365/directory/identities/conditional_access_root.py +10 -1
  19. office365/directory/identities/container.py +3 -9
  20. office365/directory/identities/providers/base.py +7 -5
  21. office365/directory/identities/providers/builtin_identity.py +3 -2
  22. office365/directory/identities/providers/saml_or_wsfed.py +4 -5
  23. office365/directory/identities/providers/social_identity.py +5 -3
  24. office365/directory/identities/userflows/b2x/user_flow.py +6 -5
  25. office365/directory/identities/userflows/language_configuration.py +10 -7
  26. office365/directory/identitygovernance/governance.py +14 -3
  27. office365/directory/identitygovernance/privilegedaccess/__init__.py +0 -0
  28. office365/directory/identitygovernance/privilegedaccess/root.py +5 -0
  29. office365/directory/key_credential.py +3 -0
  30. office365/directory/licenses/assignment_state.py +26 -2
  31. office365/directory/licenses/details.py +8 -6
  32. office365/directory/licenses/subscribed_sku.py +8 -10
  33. office365/directory/object_collection.py +40 -25
  34. office365/directory/password_credential.py +3 -0
  35. office365/directory/permissions/default_user_role.py +5 -0
  36. office365/directory/permissions/grants/condition_set.py +4 -2
  37. office365/directory/permissions/grants/oauth2.py +7 -10
  38. office365/directory/policies/authorization.py +50 -3
  39. office365/directory/policies/permission_grant.py +2 -0
  40. office365/directory/profile_photo.py +6 -6
  41. office365/directory/protection/riskyusers/risky_user.py +4 -4
  42. office365/directory/rolemanagement/resource_action.py +10 -0
  43. office365/directory/rolemanagement/role_permission.py +10 -0
  44. office365/directory/security/alerts/alert.py +5 -7
  45. office365/directory/security/attacksimulations/landing_page.py +5 -0
  46. office365/directory/security/attacksimulations/operation.py +5 -0
  47. office365/directory/security/attacksimulations/report.py +8 -1
  48. office365/directory/security/attacksimulations/root.py +33 -0
  49. office365/directory/security/attacksimulations/users/__init__.py +0 -0
  50. office365/directory/security/attacksimulations/users/details.py +5 -0
  51. office365/directory/security/hunting_query_results.py +5 -0
  52. office365/directory/security/incidents/incident.py +8 -13
  53. office365/directory/security/security.py +20 -3
  54. office365/directory/serviceprincipals/service_principal.py +3 -4
  55. office365/directory/synchronization/synchronization.py +2 -0
  56. office365/directory/users/activities/history_item.py +3 -2
  57. office365/directory/users/user.py +37 -10
  58. office365/entity_collection.py +3 -2
  59. office365/graph_client.py +58 -30
  60. office365/intune/audit/event.py +1 -3
  61. office365/intune/audit/event_collection.py +1 -1
  62. office365/intune/devices/alternative_security_id.py +4 -0
  63. office365/intune/devices/collection.py +57 -0
  64. office365/intune/devices/device.py +38 -10
  65. office365/intune/devices/management/management.py +12 -0
  66. office365/intune/organizations/organization.py +1 -0
  67. office365/onedrive/analytics/item_activity_stat.py +9 -0
  68. office365/onedrive/analytics/item_analytics.py +1 -0
  69. office365/onedrive/contenttypes/content_type.py +4 -12
  70. office365/onedrive/driveitems/driveItem.py +9 -10
  71. office365/onedrive/files/hashes.py +5 -0
  72. office365/onedrive/lists/collection.py +2 -2
  73. office365/onedrive/operations/long_running.py +6 -6
  74. office365/onedrive/operations/rich_long_running.py +4 -3
  75. office365/onedrive/permissions/collection.py +1 -14
  76. office365/onedrive/sharepoint_settings.py +6 -6
  77. office365/onedrive/sites/sites_with_root.py +1 -3
  78. office365/onedrive/termstore/store.py +2 -4
  79. office365/onedrive/termstore/terms/collection.py +1 -2
  80. office365/onedrive/workbooks/comments/comment.py +7 -6
  81. office365/onedrive/workbooks/filter.py +9 -0
  82. office365/onedrive/workbooks/filter_criteria.py +5 -0
  83. office365/onedrive/workbooks/functions/functions.py +6 -3
  84. office365/onedrive/workbooks/functions/result.py +2 -0
  85. office365/onedrive/workbooks/operations/workbook.py +7 -10
  86. office365/onedrive/workbooks/tables/pivot_table.py +9 -9
  87. office365/onedrive/workbooks/worksheets/collection.py +0 -6
  88. office365/onedrive/workbooks/worksheets/protection.py +2 -0
  89. office365/onedrive/workbooks/worksheets/worksheet.py +30 -2
  90. office365/onenote/notebooks/collection.py +0 -1
  91. office365/outlook/calendar/events/event.py +24 -46
  92. office365/outlook/calendar/permissions/permission.py +7 -7
  93. office365/outlook/calendar/place.py +5 -3
  94. office365/outlook/mail/attachments/collection.py +6 -1
  95. office365/outlook/mail/attachments/file.py +9 -16
  96. office365/outlook/mail/messages/message.py +1 -1
  97. office365/planner/user.py +3 -7
  98. office365/reports/root.py +50 -4
  99. office365/runtime/auth/providers/acs_token_provider.py +10 -7
  100. office365/runtime/auth/sts_profile.py +0 -1
  101. office365/runtime/client_object.py +21 -17
  102. office365/runtime/client_object_collection.py +9 -24
  103. office365/runtime/client_request_exception.py +1 -3
  104. office365/runtime/client_result.py +11 -14
  105. office365/runtime/client_runtime_context.py +20 -32
  106. office365/runtime/odata/json_format.py +4 -7
  107. office365/runtime/odata/request.py +3 -3
  108. office365/runtime/odata/v3/batch_request.py +17 -31
  109. office365/runtime/odata/v4/batch_request.py +13 -21
  110. office365/runtime/queries/batch.py +5 -11
  111. office365/runtime/queries/function.py +5 -6
  112. office365/runtime/types/event_handler.py +1 -1
  113. office365/search/entity.py +3 -2
  114. office365/sharepoint/activities/facets/delete.py +1 -1
  115. office365/sharepoint/activities/tracked_item_service.py +2 -3
  116. office365/sharepoint/administration/web_application.py +8 -7
  117. office365/sharepoint/alerts/alert.py +8 -12
  118. office365/sharepoint/audit/audit.py +3 -2
  119. office365/sharepoint/changes/alert.py +4 -3
  120. office365/sharepoint/changes/collection.py +7 -10
  121. office365/sharepoint/changes/content_type.py +4 -4
  122. office365/sharepoint/changes/field.py +4 -5
  123. office365/sharepoint/changes/item.py +34 -7
  124. office365/sharepoint/changes/list.py +4 -4
  125. office365/sharepoint/changes/user.py +5 -6
  126. office365/sharepoint/client_context.py +20 -20
  127. office365/sharepoint/clientsidecomponent/component_context_info.py +4 -3
  128. office365/sharepoint/contentcenter/machinelearning/enabled.py +4 -3
  129. office365/sharepoint/contentcenter/machinelearning/hub.py +6 -6
  130. office365/sharepoint/contentcenter/machinelearning/models/collection.py +1 -1
  131. office365/sharepoint/contenttypes/fieldlinks/collection.py +4 -6
  132. office365/sharepoint/contenttypes/fieldlinks/field_link.py +14 -22
  133. office365/sharepoint/entity.py +12 -5
  134. office365/sharepoint/entity_collection.py +1 -3
  135. office365/sharepoint/eventreceivers/definition.py +8 -12
  136. office365/sharepoint/features/collection.py +3 -6
  137. office365/sharepoint/features/definitions/definition.py +6 -3
  138. office365/sharepoint/fields/calculated.py +8 -14
  139. office365/sharepoint/fields/collection.py +42 -10
  140. office365/sharepoint/fields/computed.py +4 -5
  141. office365/sharepoint/fields/currency.py +7 -11
  142. office365/sharepoint/fields/date_time.py +4 -8
  143. office365/sharepoint/fields/field.py +6 -16
  144. office365/sharepoint/fields/lookup.py +11 -9
  145. office365/sharepoint/fields/multi_choice.py +8 -12
  146. office365/sharepoint/fields/multi_line_text.py +10 -14
  147. office365/sharepoint/fields/number.py +13 -26
  148. office365/sharepoint/fields/rating_scale.py +6 -10
  149. office365/sharepoint/fields/related_field.py +10 -17
  150. office365/sharepoint/fields/url.py +4 -5
  151. office365/sharepoint/fields/user.py +10 -9
  152. office365/sharepoint/files/checked_out_file.py +4 -3
  153. office365/sharepoint/files/collection.py +17 -15
  154. office365/sharepoint/files/file.py +33 -27
  155. office365/sharepoint/folders/collection.py +22 -5
  156. office365/sharepoint/folders/coloring.py +11 -9
  157. office365/sharepoint/folders/coloring_information.py +38 -0
  158. office365/sharepoint/folders/folder.py +26 -30
  159. office365/sharepoint/likes/liked_by_information.py +7 -10
  160. office365/sharepoint/likes/user_entity.py +6 -8
  161. office365/sharepoint/listitems/form_update_value.py +17 -1
  162. office365/sharepoint/listitems/listitem.py +9 -11
  163. office365/sharepoint/lists/bloom_filter.py +5 -7
  164. office365/sharepoint/lists/creatables_info.py +5 -6
  165. office365/sharepoint/lists/list.py +25 -10
  166. office365/sharepoint/lists/template.py +7 -4
  167. office365/sharepoint/lists/template_collection.py +2 -4
  168. office365/sharepoint/marketplace/app_metadata.py +14 -23
  169. office365/sharepoint/marketplace/sitecollection/appcatalog/allowed_item.py +6 -8
  170. office365/sharepoint/navigation/node.py +5 -8
  171. office365/sharepoint/permissions/irm/effective_settings.py +6 -8
  172. office365/sharepoint/permissions/irm/file_settings.py +8 -6
  173. office365/sharepoint/permissions/irm/settings.py +25 -43
  174. office365/sharepoint/portal/groups/site_manager.py +6 -7
  175. office365/sharepoint/portal/sites/manager.py +4 -3
  176. office365/sharepoint/publishing/embed_data_v1.py +8 -15
  177. office365/sharepoint/publishing/pages/campaign_publication.py +4 -3
  178. office365/sharepoint/publishing/primary_city_time.py +8 -9
  179. office365/sharepoint/publishing/video/service_discoverer.py +4 -3
  180. office365/sharepoint/pushnotifications/subscriber.py +11 -15
  181. office365/sharepoint/sharing/object_sharing_settings.py +24 -46
  182. office365/sharepoint/sharing/permission_information.py +5 -5
  183. office365/sharepoint/sharing/result.py +1 -0
  184. office365/sharepoint/sitedesigns/run.py +4 -3
  185. office365/sharepoint/sites/site.py +7 -16
  186. office365/sharepoint/taxonomy/field.py +32 -21
  187. office365/sharepoint/taxonomy/groups/group.py +12 -1
  188. office365/sharepoint/taxonomy/sets/set.py +6 -0
  189. office365/sharepoint/taxonomy/stores/store.py +4 -2
  190. office365/sharepoint/teams/channel.py +6 -6
  191. office365/sharepoint/tenant/administration/endpoints.py +4 -3
  192. office365/sharepoint/tenant/administration/hubsites/properties.py +4 -5
  193. office365/sharepoint/tenant/administration/sites/properties.py +0 -1
  194. office365/sharepoint/tenant/administration/spo_operation.py +4 -4
  195. office365/sharepoint/tenant/administration/tenant.py +1 -0
  196. office365/sharepoint/tenant/insights/report.py +11 -0
  197. office365/sharepoint/tenant/insights/report_manager.py +5 -0
  198. office365/sharepoint/tenant/insights/report_metadata.py +5 -0
  199. office365/sharepoint/tenant/settings.py +4 -3
  200. office365/sharepoint/translation/sync_translator.py +3 -2
  201. office365/sharepoint/ui/applicationpages/peoplepicker/entity_information.py +4 -4
  202. office365/sharepoint/usercustomactions/action.py +12 -20
  203. office365/sharepoint/userprofiles/followed_content.py +6 -10
  204. office365/sharepoint/userprofiles/people_manager.py +0 -1
  205. office365/sharepoint/userprofiles/person_properties.py +14 -30
  206. office365/sharepoint/userprofiles/personal_cache.py +4 -3
  207. office365/sharepoint/userprofiles/properties_for_user.py +4 -5
  208. office365/sharepoint/userprofiles/sharedwithme/document.py +12 -21
  209. office365/sharepoint/utilities/move_copy_util.py +19 -19
  210. office365/sharepoint/utilities/upload_status.py +7 -10
  211. office365/sharepoint/views/field_collection.py +9 -14
  212. office365/sharepoint/views/view.py +43 -64
  213. office365/sharepoint/webhooks/subscription.py +11 -19
  214. office365/sharepoint/webparts/webpart.py +3 -1
  215. office365/sharepoint/webs/modernize_homepage_result.py +4 -3
  216. office365/sharepoint/webs/regional_settings.py +9 -17
  217. office365/sharepoint/webs/template.py +18 -18
  218. office365/sharepoint/webs/theme_info.py +6 -6
  219. office365/sharepoint/webs/web.py +16 -23
  220. office365/teams/members/aad_user_conversation.py +4 -4
  221. office365/teams/operations/async_operation.py +5 -7
  222. office365/runtime/paths/item.py +0 -8
  223. {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/LICENSE +0 -0
  224. {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/WHEEL +0 -0
  225. {Office365_REST_Python_Client-2.5.4.dist-info → Office365_REST_Python_Client-2.5.6.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,10 @@
1
1
  import json
2
2
  import re
3
3
  from email.message import Message
4
+ from typing import AnyStr, Iterator, List, Tuple
4
5
 
5
6
  import requests
7
+ from requests import Response
6
8
  from requests.structures import CaseInsensitiveDict
7
9
 
8
10
  from office365.runtime.compat import (
@@ -12,16 +14,14 @@ from office365.runtime.compat import (
12
14
  from office365.runtime.http.http_method import HttpMethod
13
15
  from office365.runtime.http.request_options import RequestOptions
14
16
  from office365.runtime.odata.request import ODataRequest
15
- from office365.runtime.queries.batch import create_boundary
17
+ from office365.runtime.queries.batch import BatchQuery, create_boundary
18
+ from office365.runtime.queries.client_query import ClientQuery
16
19
 
17
20
 
18
21
  class ODataBatchV3Request(ODataRequest):
19
22
  def build_request(self, query):
20
- """
21
- Construct a OData v3 Batch request
22
-
23
- :type query: office365.runtime.queries.batch.BatchQuery
24
- """
23
+ # type: (BatchQuery) -> RequestOptions
24
+ """Construct a OData v3 Batch request"""
25
25
  request = RequestOptions(query.url)
26
26
  request.method = HttpMethod.Post
27
27
  media_type = "multipart/mixed"
@@ -33,22 +33,15 @@ class ODataBatchV3Request(ODataRequest):
33
33
  return request
34
34
 
35
35
  def process_response(self, response, query):
36
- """
37
- Parses an HTTP response.
38
-
39
- :type response: requests.Response
40
- :type query: office365.runtime.queries.batch.BatchQuery
41
- """
36
+ # type: (Response, BatchQuery) -> None
37
+ """Parses an HTTP response."""
42
38
  for sub_qry, sub_resp in self._extract_response(response, query):
43
39
  sub_resp.raise_for_status()
44
40
  super(ODataBatchV3Request, self).process_response(sub_resp, sub_qry)
45
41
 
46
42
  def _extract_response(self, response, query):
47
- """Parses a multipart/mixed response body from the position defined by the context.
48
-
49
- :type response: requests.Response
50
- :type query: office365.runtime.queries.batch.BatchQuery
51
- """
43
+ # type: (Response, BatchQuery) -> Iterator[Tuple[ClientQuery, Response]]
44
+ """Parses a multipart/mixed response body from the position defined by the context."""
52
45
  content_type = response.headers["Content-Type"].encode("ascii")
53
46
  http_body = b"Content-Type: " + content_type + b"\r\n\r\n" + response.content
54
47
 
@@ -62,11 +55,8 @@ class ODataBatchV3Request(ODataRequest):
62
55
  yield qry, self._deserialize_response(raw_response)
63
56
 
64
57
  def _prepare_payload(self, query):
65
- """
66
- Serializes a batch request body.
67
-
68
- :type query: office365.runtime.queries.batch.BatchQuery
69
- """
58
+ # type: (BatchQuery) -> AnyStr
59
+ """Serializes a batch request body."""
70
60
  main_message = Message()
71
61
  main_message.add_header("Content-Type", "multipart/mixed")
72
62
  main_message.set_boundary(query.current_boundary)
@@ -92,9 +82,8 @@ class ODataBatchV3Request(ODataRequest):
92
82
 
93
83
  @staticmethod
94
84
  def _normalize_headers(headers_raw):
95
- """
96
- :type headers_raw: list[str]
97
- """
85
+ # type: (List[str]) -> CaseInsensitiveDict
86
+ """ """
98
87
  headers = {}
99
88
  for header_line in headers_raw:
100
89
  k, v = header_line.split(":", 1)
@@ -102,9 +91,7 @@ class ODataBatchV3Request(ODataRequest):
102
91
  return CaseInsensitiveDict(headers)
103
92
 
104
93
  def _deserialize_response(self, raw_response):
105
- """
106
- :type raw_response: Message
107
- """
94
+ # type: (Message) -> Response
108
95
  response = raw_response.get_payload(decode=True)
109
96
  lines = list(filter(None, response.decode("utf-8").split("\r\n")))
110
97
  response_status_regex = "^HTTP/1\\.\\d (\\d{3}) (.*)$"
@@ -123,10 +110,9 @@ class ODataBatchV3Request(ODataRequest):
123
110
 
124
111
  @staticmethod
125
112
  def _serialize_request(request):
113
+ # type: (RequestOptions) -> Message
126
114
  """Serializes a part of a batch request to a string. A part can be either a GET request or
127
- a change set grouping several CUD (create, update, delete) requests.
128
-
129
- :type request: RequestOptions
115
+ a change set grouping several CUD (create, update, delete) requests.
130
116
  """
131
117
  eol = "\r\n"
132
118
  method = request.method
@@ -1,22 +1,22 @@
1
1
  import json
2
+ from typing import Any, Dict, Iterator, List, Optional, Tuple
2
3
 
3
- import requests
4
+ from requests import Response
4
5
  from requests.structures import CaseInsensitiveDict
5
6
 
6
7
  from office365.runtime.http.http_method import HttpMethod
7
8
  from office365.runtime.http.request_options import RequestOptions
8
9
  from office365.runtime.odata.request import ODataRequest
10
+ from office365.runtime.queries.batch import BatchQuery
11
+ from office365.runtime.queries.client_query import ClientQuery
9
12
 
10
13
 
11
14
  class ODataV4BatchRequest(ODataRequest):
12
15
  """JSON batch request"""
13
16
 
14
17
  def build_request(self, query):
15
- """
16
- Builds a batch request
17
-
18
- :type query: office365.runtime.queries.batch.BatchQuery
19
- """
18
+ # type: (BatchQuery) -> RequestOptions
19
+ """Builds a batch request"""
20
20
  request = RequestOptions(query.url)
21
21
  request.method = HttpMethod.Post
22
22
  request.ensure_header("Content-Type", "application/json")
@@ -25,24 +25,19 @@ class ODataV4BatchRequest(ODataRequest):
25
25
  return request
26
26
 
27
27
  def process_response(self, response, query):
28
- """Parses an HTTP response.
29
-
30
- :type response: requests.Response
31
- :type query: office365.runtime.queries.batch.BatchQuery
32
- """
28
+ # type: (Response, BatchQuery) -> None
29
+ """Parses an HTTP response."""
33
30
  for sub_qry, sub_resp in self._extract_response(response, query):
34
31
  sub_resp.raise_for_status()
35
32
  super(ODataV4BatchRequest, self).process_response(sub_resp, sub_qry)
36
33
 
37
34
  @staticmethod
38
35
  def _extract_response(response, query):
39
- """
40
- :type response: requests.Response
41
- :type query: office365.runtime.queries.batch.BatchQuery
42
- """
36
+ # type: (Response, BatchQuery) -> Iterator[Tuple[ClientQuery, Response]]
37
+ """ """
43
38
  json_responses = response.json()
44
39
  for json_resp in json_responses["responses"]:
45
- resp = requests.Response()
40
+ resp = Response()
46
41
  resp.status_code = int(json_resp["status"])
47
42
  resp.headers = CaseInsensitiveDict(json_resp["headers"])
48
43
  resp._content = json.dumps(json_resp["body"]).encode("utf-8")
@@ -65,11 +60,8 @@ class ODataV4BatchRequest(ODataRequest):
65
60
 
66
61
  @staticmethod
67
62
  def _normalize_request(query, query_id, depends_on=None):
68
- """
69
- :type query: office365.runtime.queries.client_query.ClientQuery
70
- :type query_id: str
71
- :type depends_on: list[str] or None
72
- """
63
+ # type: (ClientQuery, str, Optional[List[str]]) -> Dict[str, Any]
64
+ """ """
73
65
  request = query.build_request()
74
66
  allowed_props = ["id", "method", "headers", "url", "body"]
75
67
  request_json = dict(
@@ -1,5 +1,7 @@
1
1
  import uuid
2
+ from typing import List
2
3
 
4
+ from office365.runtime.client_runtime_context import ClientRuntimeContext
3
5
  from office365.runtime.queries.client_query import ClientQuery
4
6
  from office365.runtime.queries.read_entity import ReadEntityQuery
5
7
 
@@ -20,11 +22,7 @@ class BatchQuery(ClientQuery):
20
22
  """Client query collection"""
21
23
 
22
24
  def __init__(self, context, queries=None):
23
- """
24
-
25
- :type context: office365.runtime.client_runtime_context.ClientRuntimeContext
26
- :type queries: list[ClientQuery]
27
- """
25
+ # type: (ClientRuntimeContext, List[ClientQuery]) -> None
28
26
  super(BatchQuery, self).__init__(context)
29
27
  self._current_boundary = create_boundary("batch_")
30
28
  if queries is None:
@@ -32,9 +30,7 @@ class BatchQuery(ClientQuery):
32
30
  self._queries = queries
33
31
 
34
32
  def add(self, query):
35
- """
36
- :type query: ClientQuery
37
- """
33
+ # type: (ClientQuery) -> None
38
34
  self._queries.append(query)
39
35
 
40
36
  @property
@@ -51,9 +47,7 @@ class BatchQuery(ClientQuery):
51
47
 
52
48
  @property
53
49
  def queries(self):
54
- """
55
- :rtype: list[ClientQuery]
56
- """
50
+ # type: () -> List[ClientQuery]
57
51
  return self._queries
58
52
 
59
53
  @property
@@ -1,3 +1,6 @@
1
+ from office365.runtime.client_object import ClientObject
2
+ from office365.runtime.client_result import ClientResult
3
+ from office365.runtime.client_value import ClientValue
1
4
  from office365.runtime.paths.service_operation import ServiceOperationPath
2
5
  from office365.runtime.queries.client_query import ClientQuery
3
6
 
@@ -8,12 +11,8 @@ class FunctionQuery(ClientQuery):
8
11
  def __init__(
9
12
  self, binding_type, method_name=None, method_params=None, return_type=None
10
13
  ):
11
- """
12
- Function query
13
-
14
- :type method_params: list or dict or office365.runtime.client_value.ClientValue or None
15
- :type method_name: str or None
16
- """
14
+ # type: (ClientObject, str, list|dict|ClientValue, ClientObject|ClientResult) -> None
15
+ """Function query"""
17
16
  super(FunctionQuery, self).__init__(
18
17
  binding_type.context, binding_type, None, None, return_type
19
18
  )
@@ -35,7 +35,7 @@ class EventHandler:
35
35
 
36
36
  def notify(self, *args, **kwargs):
37
37
  # type: (Any, Any) -> None
38
- for listener in self._listeners:
38
+ for listener in self._listeners[:]:
39
39
  if self._once:
40
40
  self._listeners.remove(listener)
41
41
  listener(*args, **kwargs)
@@ -38,8 +38,9 @@ class SearchEntity(Entity):
38
38
  # self.context.pending_request().map_json(search_hit.resource, resource)
39
39
  # search_hit.set_property("resource", resource)
40
40
 
41
- def _process_response():
42
- for item in return_type.value:
41
+ def _process_response(result):
42
+ # type: (ClientResult[ClientValueCollection[SearchResponse]]) -> None
43
+ for item in result.value:
43
44
  for hcs in item.hitsContainers:
44
45
  [_patch_hit(hit) for hit in hcs.hits]
45
46
 
@@ -9,4 +9,4 @@ class DeleteFacet(ClientValue):
9
9
 
10
10
  @property
11
11
  def entity_type_name(self):
12
- return "Microsoft.SharePoint.Activities.CreateFacet"
12
+ return "Microsoft.SharePoint.Activities.DeleteFacet"
@@ -3,15 +3,14 @@ from office365.runtime.queries.service_operation import ServiceOperationQuery
3
3
  from office365.sharepoint.activities.tracked_item_updates_request import (
4
4
  TrackedItemUpdatesRequest,
5
5
  )
6
+ from office365.sharepoint.client_context import ClientContext
6
7
  from office365.sharepoint.entity import Entity
7
8
 
8
9
 
9
10
  class TrackedItemService(Entity):
10
11
  @staticmethod
11
12
  def get_tracked_item_updates_for_user(context):
12
- """
13
- :type context: office365.sharepoint.client_context.ClientContext
14
- """
13
+ # type: (ClientContext) -> ClientResult[str]
15
14
  return_type = ClientResult(context)
16
15
  payload = {"request": TrackedItemUpdatesRequest()}
17
16
  qry = ServiceOperationQuery(
@@ -1,5 +1,8 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.paths.resource_path import ResourcePath
2
4
  from office365.runtime.queries.service_operation import ServiceOperationQuery
5
+ from office365.sharepoint.client_context import ClientContext
3
6
  from office365.sharepoint.entity import Entity
4
7
  from office365.sharepoint.entity_collection import EntityCollection
5
8
  from office365.sharepoint.sites.site import Site
@@ -8,10 +11,8 @@ from office365.sharepoint.sites.site import Site
8
11
  class WebApplication(Entity):
9
12
  @staticmethod
10
13
  def lookup(context, request_uri):
11
- """
12
- :type context
13
- :type request_uri str
14
- """
14
+ # type: (ClientContext, str) -> WebApplication
15
+ """ """
15
16
  return_type = WebApplication(context)
16
17
  payload = {"requestUri": request_uri}
17
18
  qry = ServiceOperationQuery(
@@ -22,13 +23,13 @@ class WebApplication(Entity):
22
23
 
23
24
  @property
24
25
  def outbound_mail_sender_address(self):
25
- """
26
- :rtype: str or None
27
- """
26
+ # type: () -> Optional[str]
27
+ """ """
28
28
  return self.properties.get("OutboundMailSenderAddress", None)
29
29
 
30
30
  @property
31
31
  def sites(self):
32
+ # type: () -> EntityCollection[Site]
32
33
  return self.properties.get(
33
34
  "Sites",
34
35
  EntityCollection(
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.paths.resource_path import ResourcePath
2
4
  from office365.sharepoint.entity import Entity
3
5
 
@@ -14,26 +16,20 @@ class Alert(Entity):
14
16
 
15
17
  @property
16
18
  def alert_frequency(self):
17
- """
18
- Gets the time interval for sending the alert.
19
- :rtype: int
20
- """
19
+ # type: () -> Optional[int]
20
+ """Gets the time interval for sending the alert."""
21
21
  return self.properties.get("AlertFrequency", None)
22
22
 
23
23
  @property
24
24
  def alert_template_name(self):
25
- """
26
- Gets the string representing the alert template name.
27
- :rtype: int
28
- """
25
+ # type: () -> Optional[int]
26
+ """Gets the string representing the alert template name."""
29
27
  return self.properties.get("AlertTemplateName", None)
30
28
 
31
29
  @property
32
30
  def always_notify(self):
33
- """
34
- Gets a Boolean value that causes daily and weekly alerts to trigger, even if there is no matching event.
35
- :rtype: bool
36
- """
31
+ # type: () -> Optional[bool]
32
+ """Gets a Boolean value that causes daily and weekly alerts to trigger, even if there is no matching event."""
37
33
  return self.properties.get("AlwaysNotify", None)
38
34
 
39
35
  @property
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.entity import Entity
2
4
 
3
5
 
@@ -8,11 +10,10 @@ class Audit(Entity):
8
10
 
9
11
  @property
10
12
  def allow_designer(self):
13
+ # type: () -> Optional[bool]
11
14
  """
12
15
  Specifies whether a designer can be used on this site collection.
13
16
  See Microsoft.SharePoint.Client.Web.AllowDesignerForCurrentUser, which is the scalar property used
14
17
  to determine the behavior for the current user. The default, if not disabled on the Web application, is "true".
15
-
16
- :rtype: bool or None
17
18
  """
18
19
  return self.properties.get("AllowDesigner", None)
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.changes.change import Change
2
4
 
3
5
 
@@ -6,7 +8,6 @@ class ChangeAlert(Change):
6
8
 
7
9
  @property
8
10
  def alert_id(self):
9
- """Identifies the changed alert.
10
- :rtype: str or None
11
- """
11
+ # type: () -> Optional[str]
12
+ """Identifies the changed alert."""
12
13
  return self.properties.get("AlertId", None)
@@ -9,15 +9,12 @@ class ChangeCollection(EntityCollection[Change]):
9
9
  super(ChangeCollection, self).__init__(context, Change, resource_path)
10
10
 
11
11
  def set_property(self, key, value, persist_changes=False):
12
- self.resolve_change_type(value)
12
+ self._resolve_change_type(value)
13
13
  super(ChangeCollection, self).set_property(key, value)
14
14
 
15
- def resolve_change_type(self, properties):
16
- """
17
- Resolves a change type
18
-
19
- :type properties: dict
20
- """
15
+ def _resolve_change_type(self, properties):
16
+ # type: (dict) -> None
17
+ """Resolves a change type"""
21
18
  from office365.sharepoint.changes.alert import ChangeAlert
22
19
  from office365.sharepoint.changes.content_type import ChangeContentType
23
20
  from office365.sharepoint.changes.field import ChangeField
@@ -27,10 +24,10 @@ class ChangeCollection(EntityCollection[Change]):
27
24
  from office365.sharepoint.changes.user import ChangeUser
28
25
  from office365.sharepoint.changes.web import ChangeWeb
29
26
 
30
- if "ListId" in properties and "WebId" in properties:
31
- self._item_type = ChangeList
32
- elif "ItemId" in properties and "ListId" in properties:
27
+ if "ItemId" in properties and "ListId" in properties:
33
28
  self._item_type = ChangeItem
29
+ elif "ListId" in properties and "WebId" in properties:
30
+ self._item_type = ChangeList
34
31
  elif "WebId" in properties:
35
32
  self._item_type = ChangeWeb
36
33
  elif "UserId" in properties:
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.changes.change import Change
2
4
 
3
5
 
@@ -6,8 +8,6 @@ class ChangeContentType(Change):
6
8
 
7
9
  @property
8
10
  def content_type_id(self):
9
- """Identifies the content type that has changed.
10
-
11
- :rtype: str or None
12
- """
11
+ # type: () -> Optional[str]
12
+ """Identifies the content type that has changed."""
13
13
  return self.properties.get("ContentTypeId", None)
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.changes.change import Change
2
4
 
3
5
 
@@ -6,9 +8,6 @@ class ChangeField(Change):
6
8
 
7
9
  @property
8
10
  def field_id(self):
9
- """ "
10
- Identifies the changed field
11
-
12
- :rtype: str or None
13
- """
11
+ # type: () -> Optional[str]
12
+ """Identifies the changed field"""
14
13
  return self.properties.get("FieldId", None)
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.client_value_collection import ClientValueCollection
2
4
  from office365.sharepoint.changes.change import Change
3
5
  from office365.sharepoint.contenttypes.content_type_id import ContentTypeId
@@ -9,19 +11,38 @@ class ChangeItem(Change):
9
11
 
10
12
  @property
11
13
  def activity_type(self):
12
- """
13
- Returns activity type defined in ChangeActivityType
14
- :rtype: str or None
15
- """
14
+ # type: () -> Optional[str]
15
+ """Returns activity type defined in ChangeActivityType"""
16
16
  return self.properties.get("ActivityType", None)
17
17
 
18
18
  @property
19
19
  def content_type_id(self):
20
- """
21
- Specifies an identifier for the content type
22
- """
20
+ """Specifies an identifier for the content type"""
23
21
  return self.properties.get("ContentTypeId", ContentTypeId())
24
22
 
23
+ @property
24
+ def file_type(self):
25
+ # type: () -> Optional[str]
26
+ """Returns the list item’s file type."""
27
+ return self.properties.get("FileType", None)
28
+
29
+ @property
30
+ def item_id(self):
31
+ # type: () -> Optional[int]
32
+ """Identifies the changed item."""
33
+ return self.properties.get("ItemId", None)
34
+
35
+ @property
36
+ def is_recycle_bin_operation(self):
37
+ # type: () -> Optional[bool]
38
+ return self.properties.get("IsRecycleBinOperation", None)
39
+
40
+ @property
41
+ def server_relative_url(self):
42
+ # type: () -> Optional[str]
43
+ """Specifies the server-relative URL of the item."""
44
+ return self.properties.get("ServerRelativeUrl", None)
45
+
25
46
  @property
26
47
  def shared_by_user(self):
27
48
  """Return the sharedBy User Information in sharing action for change log."""
@@ -34,6 +55,12 @@ class ChangeItem(Change):
34
55
  "SharedWithUsers", ClientValueCollection(SharedWithUser)
35
56
  )
36
57
 
58
+ @property
59
+ def unique_id(self):
60
+ # type: () -> Optional[str]
61
+ """The Document identifier of the item."""
62
+ return self.properties.get("UniqueId", None)
63
+
37
64
  def get_property(self, name, default_value=None):
38
65
  if default_value is None:
39
66
  property_mapping = {
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.runtime.paths.resource_path import ResourcePath
2
4
  from office365.sharepoint.changes.change import Change
3
5
 
@@ -19,10 +21,8 @@ class ChangeList(Change):
19
21
 
20
22
  @property
21
23
  def list_id(self):
22
- """
23
- Identifies the changed list
24
- :rtype: str or None
25
- """
24
+ # type: () -> Optional[str]
25
+ """Identifies the changed list"""
26
26
  return self.properties.get("ListId", None)
27
27
 
28
28
  @property
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.sharepoint.changes.change import Change
2
4
 
3
5
 
@@ -6,21 +8,18 @@ class ChangeUser(Change):
6
8
 
7
9
  @property
8
10
  def activate(self):
11
+ # type: () -> Optional[bool]
9
12
  """
10
13
  Specifies whether a user has changed from an inactive state to an active state.
11
14
 
12
15
  When a user is added to a site and only has browse permissions, the user is in an inactive state.
13
16
  However, once the user can author list items, add documents, be assigned tasks, or make any contribution
14
17
  to the site, the user is in an active state.
15
-
16
- :rtype: bool or None
17
18
  """
18
19
  return self.properties.get("Activate", None)
19
20
 
20
21
  @property
21
22
  def user_id(self):
22
- """Uniquely identifies the changed user.
23
-
24
- :rtype: str or None
25
- """
23
+ # type: () -> Optional[str]
24
+ """Uniquely identifies the changed user."""
26
25
  return self.properties.get("UserId", None)