Description
The maxResults parameter is being ignored in the community/posts/search endpoint. Presumably this is not limited to a single endpoint.
A PR fixing this bug is ready to be submitted if issue is approved.
What type of issue is this? (place an x in one of the [ ])
Requirements (place an x in each of the [ ])
Bug Report
SDK ignores maxResults argument in request body (ServerContentCommunityPostPostMessagesPostListRequest) for endpoint community/post/search. Instead, it returns all items matching the request.
The unexpected result happens regardless of whether the value for maxResults is passed as an integer or string.
This is using the get_call method in the BaseClient.
In contrast, maxResults is honored for endpoint community/post/list. The difference here is that maxResults is passed in the parameters instead of a request body.
(NOTE: Though I haven't tested whether this happens in other scenarios, it seems likely this bug is affecting other endpoints.)
Reproducible in:
lumapps-sdk version: 1.2.0
python version: 3.9.13
OS version(s): OSX 11.6.6 (Big Sur)
Steps to reproduce:
- Load a quantity n of
community/post items into a LumApps instance.
- Construct a
ServerContentCommunityPostPostMessagesPostListRequest request body with an explicit maxResults argument that specifies a number less than n. Call this nmaxResults
- Add the appropriate arguments to a
get_call method, i.e. the endpoint name community/post/search and the request body.
- Call the endpoint with the
get_call method constructed in step 3.
Expected result:
The get_call execution against the community/post/search endpoint returns nmaxResults results.
Actual result:
The get_call execution against the community/post/search endpoint returns all n results.
Attachments:
This example code will retrieve all n results from the endpoint instead of nmaxResults specified in maxResults.
All n results will be printed to the console.
import json
from lumapps import BaseClient
if __name__ == "__main__":
ACCESS_TOKEN = "<access token>"
client = BaseClient(token=ACCESS_TOKEN)
# Ensure maxResults is less than the total number of community posts.
# This example assumes there are more than 5 community posts in the instance.
community_posts_req = '''
{
"maxResults": 5,
"instanceId": "<instance ID>",
"customerId": "<customer ID>",
"lang": "en",
"contentId": ["<content ID>"],
"followingOnly": false,
"sortOrder": ["-likes", "-updatedAt"],
"postType": ["QUESTION"],
"fields": "items(uid)"
}
'''
community_posts = client.get_call("community/post/search", body=community_posts_req)
print(json.dumps(community_posts, indent=2))
Description
The
maxResultsparameter is being ignored in thecommunity/posts/searchendpoint. Presumably this is not limited to a single endpoint.A PR fixing this bug is ready to be submitted if issue is approved.
What type of issue is this? (place an
xin one of the[ ])Requirements (place an
xin each of the[ ])Bug Report
SDK ignores
maxResultsargument in request body (ServerContentCommunityPostPostMessagesPostListRequest) for endpointcommunity/post/search. Instead, it returns all items matching the request.The unexpected result happens regardless of whether the value for
maxResultsis passed as an integer or string.This is using the
get_callmethod in theBaseClient.In contrast,
maxResultsis honored for endpointcommunity/post/list. The difference here is thatmaxResultsis passed in the parameters instead of a request body.(NOTE: Though I haven't tested whether this happens in other scenarios, it seems likely this bug is affecting other endpoints.)
Reproducible in:
lumapps-sdk version: 1.2.0
python version: 3.9.13
OS version(s): OSX 11.6.6 (Big Sur)
Steps to reproduce:
community/postitems into a LumApps instance.ServerContentCommunityPostPostMessagesPostListRequestrequest body with an explicitmaxResultsargument that specifies a number less than n. Call this nmaxResultsget_callmethod, i.e. the endpoint namecommunity/post/searchand the request body.get_callmethod constructed in step 3.Expected result:
The
get_callexecution against thecommunity/post/searchendpoint returns nmaxResults results.Actual result:
The
get_callexecution against thecommunity/post/searchendpoint returns all n results.Attachments:
This example code will retrieve all n results from the endpoint instead of nmaxResults specified in
maxResults.All n results will be printed to the console.