rsm
– Result Set Management (XEP-0059)¶
This module provides the XSO
model for other parts of
aioxmpp
and applications which wish to work with XEP-0059 (Result Set
Management).
New in version 0.8.
XSO¶
-
class
aioxmpp.rsm.xso.
ResultSetMetadata
[source]¶ Represent the result set or query metadata.
For requests, the following attributes are relevant:
-
max
¶ The maximum number of items to return or
None
.Setting
max
to zero will make the peer return aResultSetMetadata
with the total number of items in thecount
field.
These methods are useful when constructing queries:
-
classmethod
fetch_page
(index, max_=None)[source]¶ Return a query set which requests a specific page.
- Parameters
- Return type
- Returns
A new request set up to request a page starting with the element indexed by index.
Note
This way of retrieving items may be approximate. See XEP-0059 and the embedding protocol for which RSM is used for specifics.
-
limit
(max_)[source]¶ Limit the result set to a given number of items.
- Parameters
- Return type
- Returns
A new request set up to request at most max_ items.
This method can be called on the class and on objects. When called on objects, it returns a copy of the object with
max_
set accordingly. When called on the class, it creates a fresh object withmax_
set accordingly.
-
classmethod
last_page
(max_=None)[source]¶ Return a query set which requests the last page.
- Parameters
- Return type
- Returns
A new request set up to request the last page.
For responses, the following attributes are relevant:
-
count
¶ Either
None
or the number of elements in the result set.If this is a response to a query with
max
set to zero, this is the total number of elements in the queried data.
These methods are useful to construct a new request from a previous response:
-
next_page
(max_=None)[source]¶ Return a query set which requests the page after this response.
- Parameters
- Return type
- Returns
A new request set up to request the next page.
Must be called on a result set which has
last
set.
-
-
class
aioxmpp.rsm.xso.
After
(*args, **kwargs)[source]¶ -
value
¶ Identifier of the element which serves as a range limit for the query.
-
-
class
aioxmpp.rsm.xso.
Before
(*args, **kwargs)[source]¶ -
value
¶ Identifier of the element which serves as a range limit for the query.
-
-
class
aioxmpp.rsm.xso.
First
(*args, **kwargs)[source]¶ -
value
¶ Identifier of the first element in the result set.
-
index
¶ Approximate index of the first element in the result set.
Can be used with
ResultSetMetadata.index
andResultSetMetadata.fetch_page()
to approximately re-retrieve the page.See also
fetch_page()
for hints on caveats and inaccuracies
-