88
99
1010class Query (object ):
11+ """
12+ The Query class allows you to specify filters using the
13+ `Resource Query Language <https://github.com/persvr/rql>`_ syntax.
14+
15+ :param dict properties: Initial list of input properties
16+ """
17+
1118 def __init__ (self , properties = None ):
12- """
13- The Query class allows you to specify filters using the
14- `Resource Query Language <https://github.com/persvr/rql>`_ syntax.
15- :param dict properties: Initial list of input properties
16- """
1719 super (Query , self ).__init__ ()
1820 self ._in = {} # type: Dict[str, List[str]]
1921 self ._out = {} # type: Dict[str, List[str]]
@@ -38,6 +40,7 @@ def __init__(self, properties=None):
3840 def in_ (self , prop , values ):
3941 """
4042 Select objects where the specified property value is in the provided array.
43+
4144 :param str prop: Property
4245 :param list values: Values
4346 :return: The Query object to provide a fluent interface (chaining method calls).
@@ -49,6 +52,7 @@ def in_(self, prop, values):
4952 def out (self , prop , values ):
5053 """
5154 Select objects where the specified property value is not in the provided array.
55+
5256 :param str prop: Property
5357 :param list values: Values
5458 :return: The Query object to provide a fluent interface (chaining method calls).
@@ -60,6 +64,7 @@ def out(self, prop, values):
6064 def limit (self , amount ):
6165 """
6266 Indicates the given number of objects from the start position.
67+
6368 :param int amount: Amount of objects to return.
6469 :return: The Query object to provide a fluent interface (chaining method calls).
6570 :rtype: :py:class:`.Query`
@@ -70,6 +75,7 @@ def limit(self, amount):
7075 def order_by (self , prop ):
7176 """
7277 Order list by given property.
78+
7379 :param str prop: Property.
7480 :return: The Query object to provide a fluent interface (chaining method calls).
7581 :rtype: :py:class:`.Query`
@@ -80,6 +86,7 @@ def order_by(self, prop):
8086 def offset (self , page ):
8187 """
8288 Offset (page) to return on paged queries.
89+
8390 :param int page: Offset.
8491 :return: The Query object to provide a fluent interface (chaining method calls).
8592 :rtype: :py:class:`.Query`
@@ -92,6 +99,7 @@ def ordering(self, props):
9299 Order list of objects by the given properties (unlimited number of properties).
93100 The list is ordered first by the first specified property, then by the second, and
94101 so on. The order is specified by the prefix: + ascending order, - descending.
102+
95103 :param list props: Properties.
96104 :return: The Query object to provide a fluent interface (chaining method calls).
97105 :rtype: :py:class:`.Query`
@@ -106,6 +114,7 @@ def like(self, prop, pattern):
106114 a pattern the * symbol itself, it must be percent-encoded, that is, you need to specify
107115 %2A instead of *, see the usage examples below. In addition, it is possible to use the
108116 ? wildcard in the pattern to specify that any symbol will be valid in this position.
117+
109118 :param str prop: Property.
110119 :param str pattern: Pattern.
111120 :return: The Query object to provide a fluent interface (chaining method calls).
@@ -117,6 +126,7 @@ def like(self, prop, pattern):
117126 def ilike (self , prop , pattern ):
118127 """
119128 Same as like but case unsensitive.
129+
120130 :param str prop: Property.
121131 :param str pattern: Pattern.
122132 :return: The Query object to provide a fluent interface (chaining method calls).
@@ -133,6 +143,7 @@ def select(self, attributes):
133143 resources. The output is the list of objects presenting the selected properties and related
134144 (linked) resources. Normally, when relations are selected, the base resource properties are
135145 also presented in the output.
146+
136147 :param list attributes: Attributes.
137148 :return: The Query object to provide a fluent interface (chaining method calls).
138149 :rtype: :py:class:`.Query`
0 commit comments