File tree Expand file tree Collapse file tree
plugins/NinjaOne/v1/dataStreams/scripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,8 +50,18 @@ result = {
5050 metadata : ( data && data . metadata ) ? { ...data . metadata } : { }
5151} ;
5252
53+ // Capture next_page_token from root if present (some endpoints put it there)
54+ if ( data && data . next_page_token ) {
55+ result . metadata . next_page_token = data . next_page_token ;
56+ }
57+
58+ // Capture cursor from root if present (used by some endpoints)
59+ if ( data && data . cursor ) {
60+ result . metadata . cursor = data . cursor ;
61+ }
62+
5363// If the response was a flat array, we can still support paging by providing a next_page_token
54- // if it 's not already in the metadata.
64+ // based on the last item 's ID (which is what NinjaOne often expects in 'after' param)
5565if ( Array . isArray ( data ) && ! result . metadata . next_page_token ) {
5666 result . metadata . next_page_token = processedItems . length > 0 ? processedItems [ processedItems . length - 1 ] . id : null ;
5767}
You can’t perform that action at this time.
0 commit comments