@@ -285,14 +285,14 @@ def list(self, **kwargs):
285285 stop_time_start = kwargs .get ("stopTimeStart" , None )
286286 stop_time_stop = kwargs .get ("stopTimeStop" , None )
287287 filters = kwargs .get ("filters" , [])
288- first = kwargs .get ("first" , 500 )
288+ first = kwargs .get ("first" , 100 )
289289 after = kwargs .get ("after" , None )
290290 order_by = kwargs .get ("orderBy" , None )
291291 order_mode = kwargs .get ("orderMode" , None )
292292 get_all = kwargs .get ("getAll" , False )
293293 with_pagination = kwargs .get ("withPagination" , False )
294294 if get_all :
295- first = 500
295+ first = 100
296296
297297 self .opencti .log (
298298 "info" ,
@@ -346,9 +346,44 @@ def list(self, **kwargs):
346346 "orderMode" : order_mode ,
347347 },
348348 )
349- return self .opencti .process_multiple (
350- result ["data" ]["stixCoreRelationships" ], with_pagination
351- )
349+ if get_all :
350+ final_data = []
351+ data = self .opencti .process_multiple (
352+ result ["data" ]["stixCoreRelationships" ]
353+ )
354+ final_data = final_data + data
355+ while result ["data" ]["stixCoreRelationships" ]["pageInfo" ]["hasNextPage" ]:
356+ after = result ["data" ]["stixCoreRelationships" ]["pageInfo" ]["endCursor" ]
357+ self .opencti .log ("info" , "Listing StixCoreRelationships after " + after )
358+ result = self .opencti .query (
359+ query ,
360+ {
361+ "elementId" : element_id ,
362+ "fromId" : from_id ,
363+ "fromTypes" : from_types ,
364+ "toId" : to_id ,
365+ "toTypes" : to_types ,
366+ "relationship_type" : relationship_type ,
367+ "startTimeStart" : start_time_start ,
368+ "startTimeStop" : start_time_stop ,
369+ "stopTimeStart" : stop_time_start ,
370+ "stopTimeStop" : stop_time_stop ,
371+ "filters" : filters ,
372+ "first" : first ,
373+ "after" : after ,
374+ "orderBy" : order_by ,
375+ "orderMode" : order_mode ,
376+ },
377+ )
378+ data = self .opencti .process_multiple (
379+ result ["data" ]["stixCoreRelationships" ]
380+ )
381+ final_data = final_data + data
382+ return final_data
383+ else :
384+ return self .opencti .process_multiple (
385+ result ["data" ]["stixCoreRelationships" ], with_pagination
386+ )
352387
353388 """
354389 Read a stix_core_relationship object
0 commit comments