Skip to content

Commit 5b9af3c

Browse files
authored
Merge pull request #1162 from RogerSelwyn/docs_for_query
Add query to the docs, plus minor corrections to docs in query
2 parents 7578e64 + f8efeb0 commit 5b9af3c

File tree

6 files changed

+38
-9
lines changed

6 files changed

+38
-9
lines changed

O365/utils/query.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def get_filter_by_attribute(self, attribute: str) -> Optional[str]:
3939
"""
4040
Returns a filter value by attribute name. It will match the attribute to the start of each filter attribute
4141
and return the first found.
42+
4243
:param attribute: the attribute you want to search
4344
:return: The value applied to that attribute or None
4445
"""
@@ -607,11 +608,14 @@ def iterable_operation(self, operation: str, collection: str, filter_instance: C
607608
""" Performs the provided filter operation on a collection by iterating over it.
608609
609610
For example:
610-
q.iterable(
611-
operation='any',
612-
collection='email_addresses',
613-
filter_instance=q.equals('address', '[email protected]')
614-
)
611+
612+
.. code-block:: python
613+
614+
q.iterable(
615+
operation='any',
616+
collection='email_addresses',
617+
filter_instance=q.equals('address', '[email protected]')
618+
)
615619
616620
will transform to a filter such as:
617621
emailAddresses/any(a:a/address eq '[email protected]')
@@ -753,7 +757,7 @@ def select(self, *attributes: str) -> CompositeFilter:
753757
"""
754758
Returns a 'select' query param
755759
This is useful to return a limited set of attributes from a resource or return attributes that are not
756-
returned by default by the resource.
760+
returned by default by the resource.
757761
758762
:param attributes: a tuple of attribute names to select
759763
:return: a CompositeFilter instance that can render the OData select operation
@@ -770,8 +774,8 @@ def expand(self, relationship: str, select: Optional[CompositeFilter] = None) ->
770774
"""
771775
Returns an 'expand' query param
772776
Important: If the 'expand' is a relationship (e.g. "event" or "attachments"), then the ApiComponent using
773-
this query should know how to handle the relationship (e.g. Message knows how to handle attachments,
774-
and event (if it's an EventMessage).
777+
this query should know how to handle the relationship (e.g. Message knows how to handle attachments,
778+
and event (if it's an EventMessage).
775779
Important: When using expand on multi-value relationships a max of 20 items will be returned.
776780
777781
:param relationship: a relationship that will be expanded

O365/utils/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,13 @@ def close_group(self):
13081308
return self
13091309

13101310
def get_filter_by_attribute(self, attribute):
1311-
""" Returns a filter word applied to an attribute """
1311+
"""
1312+
Returns a filter value by attribute name. It will match the attribute to the start of each filter attribute
1313+
and return the first found.
1314+
1315+
:param attribute: the attribute you want to search
1316+
:return: The value applied to that attribute or None
1317+
"""
13121318

13131319
attribute = attribute.lower()
13141320

docs/source/api/utils.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ Utils
77
:caption: Contents:
88

99
utils/attachment
10+
utils/query
1011
utils/token
1112
utils/utils

docs/source/api/utils/query.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Query
2+
-----
3+
4+
.. include:: ../global.rst
5+
6+
.. automodule:: O365.utils.query
7+
:members:
8+
:undoc-members:
9+
:show-inheritance:
10+
:member-order: groupwise

docs/source/usage/utils.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ Utils
66
:maxdepth: 2
77
:caption: Contents:
88

9+
utils/query
910
utils/token
1011
utils/utils

docs/source/usage/utils/query.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Query
2+
=====
3+
4+
Query Builder
5+
-------------
6+
7+

0 commit comments

Comments
 (0)