@@ -181,7 +181,11 @@ def list(
181181 * ,
182182 task_id : str ,
183183 limit : int | Omit = omit ,
184+ cursor : str | Omit = omit ,
185+ direction : str | Omit = omit ,
184186 page_number : int | Omit = omit ,
187+ order_by : str | Omit = omit ,
188+ order_direction : str | Omit = omit ,
185189 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
186190 # The extra values given here take precedence over values defined on the client or passed to this method.
187191 extra_headers : Headers | None = None ,
@@ -190,18 +194,47 @@ def list(
190194 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
191195 ) -> MessageListResponse :
192196 """
193- List Messages
197+ List Messages with cursor-based pagination.
198+
199+ Returns messages for a task with pagination metadata.
200+ Use the `next_cursor` from the response to fetch the next page.
194201
195202 Args:
196203 task_id: The task ID
197204
205+ limit: Maximum number of messages to return (default: 50)
206+
207+ cursor: Opaque cursor string for pagination. Pass the `next_cursor` from
208+ a previous response to get the next page.
209+
210+ direction: Pagination direction - "older" to get older messages (default),
211+ "newer" to get newer messages.
212+
213+ page_number: [DEPRECATED] Use cursor instead. Page number for offset pagination.
214+
215+ order_by: Field to order by (default: created_at)
216+
217+ order_direction: Order direction - "asc" or "desc" (default: desc)
218+
198219 extra_headers: Send extra headers
199220
200221 extra_query: Add additional query parameters to the request
201222
202223 extra_body: Add additional JSON properties to the request
203224
204225 timeout: Override the client-level default timeout for this request, in seconds
226+
227+ Example:
228+ # First request
229+ response = client.messages.list(task_id="xxx", limit=50)
230+
231+ # Next page
232+ if response.has_more:
233+ next_page = client.messages.list(
234+ task_id="xxx",
235+ limit=50,
236+ cursor=response.next_cursor
237+ )
205238 """
206239 return self ._get (
207240 "/messages" ,
@@ -214,7 +247,11 @@ def list(
214247 {
215248 "task_id" : task_id ,
216249 "limit" : limit ,
250+ "cursor" : cursor ,
251+ "direction" : direction ,
217252 "page_number" : page_number ,
253+ "order_by" : order_by ,
254+ "order_direction" : order_direction ,
218255 },
219256 message_list_params .MessageListParams ,
220257 ),
@@ -370,7 +407,11 @@ async def list(
370407 * ,
371408 task_id : str ,
372409 limit : int | Omit = omit ,
410+ cursor : str | Omit = omit ,
411+ direction : str | Omit = omit ,
373412 page_number : int | Omit = omit ,
413+ order_by : str | Omit = omit ,
414+ order_direction : str | Omit = omit ,
374415 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
375416 # The extra values given here take precedence over values defined on the client or passed to this method.
376417 extra_headers : Headers | None = None ,
@@ -379,18 +420,47 @@ async def list(
379420 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
380421 ) -> MessageListResponse :
381422 """
382- List Messages
423+ List Messages with cursor-based pagination.
424+
425+ Returns messages for a task with pagination metadata.
426+ Use the `next_cursor` from the response to fetch the next page.
383427
384428 Args:
385429 task_id: The task ID
386430
431+ limit: Maximum number of messages to return (default: 50)
432+
433+ cursor: Opaque cursor string for pagination. Pass the `next_cursor` from
434+ a previous response to get the next page.
435+
436+ direction: Pagination direction - "older" to get older messages (default),
437+ "newer" to get newer messages.
438+
439+ page_number: [DEPRECATED] Use cursor instead. Page number for offset pagination.
440+
441+ order_by: Field to order by (default: created_at)
442+
443+ order_direction: Order direction - "asc" or "desc" (default: desc)
444+
387445 extra_headers: Send extra headers
388446
389447 extra_query: Add additional query parameters to the request
390448
391449 extra_body: Add additional JSON properties to the request
392450
393451 timeout: Override the client-level default timeout for this request, in seconds
452+
453+ Example:
454+ # First request
455+ response = await client.messages.list(task_id="xxx", limit=50)
456+
457+ # Next page
458+ if response.has_more:
459+ next_page = await client.messages.list(
460+ task_id="xxx",
461+ limit=50,
462+ cursor=response.next_cursor
463+ )
394464 """
395465 return await self ._get (
396466 "/messages" ,
@@ -403,7 +473,11 @@ async def list(
403473 {
404474 "task_id" : task_id ,
405475 "limit" : limit ,
476+ "cursor" : cursor ,
477+ "direction" : direction ,
406478 "page_number" : page_number ,
479+ "order_by" : order_by ,
480+ "order_direction" : order_direction ,
407481 },
408482 message_list_params .MessageListParams ,
409483 ),
0 commit comments