@@ -334,9 +334,30 @@ class IndexifyClient {
334
334
async getTasks (
335
335
extractionGraph : string ,
336
336
extractionPolicy : string ,
337
+ params ?: {
338
+ namespace : string ;
339
+ extractionGraph : string ;
340
+ extractionPolicy : string ;
341
+ contentId ?: string ;
342
+ outcome ?: string ;
343
+ startId ?: string ;
344
+ limit ?: number ;
345
+ returnTotal ?: boolean ;
346
+ }
337
347
) : Promise < ITask [ ] > {
348
+
349
+ const defaultParams = {
350
+ namespace : this . namespace ,
351
+ extractionGraph : extractionGraph ,
352
+ extractionPolicy : extractionPolicy ,
353
+ returnTotal : false ,
354
+ ...params
355
+ } ;
356
+
338
357
const response = await this . client . get (
339
- `/extraction_graphs/${ extractionGraph } /extraction_policies/${ extractionPolicy } /tasks` ,
358
+ `/extraction_graphs/${ extractionGraph } /extraction_policies/${ extractionPolicy } /tasks` , {
359
+ params : defaultParams
360
+ }
340
361
) ;
341
362
342
363
return response . data . tasks ;
@@ -533,21 +554,38 @@ class IndexifyClient {
533
554
async listContent (
534
555
extractionGraph : string ,
535
556
namespace ?: string ,
536
- ) : Promise < IContentMetadata [ ] > {
537
- let response ;
538
- if ( namespace ) {
539
- response = await axios . get (
540
- `/namespaces/${ namespace } /extraction_graphs/${ extractionGraph } /content`
541
- ) ;
542
- } else {
543
- response = await this . client . get (
544
- `extraction_graphs/${ extractionGraph } /content`
545
- ) ;
557
+ params ?: {
558
+ namespace : string ;
559
+ extractionGraph : string ;
560
+ source ?: string ;
561
+ parentId ?: string ;
562
+ labelsFilter ?: string [ ] ;
563
+ startId ?: string ;
564
+ limit ?: number ;
565
+ returnTotal ?: boolean ;
546
566
}
567
+ ) : Promise < { contentList : IContentMetadata [ ] ; total ?: number } > {
568
+
569
+ const defaultParams = {
570
+ namespace : namespace ,
571
+ extractionGraph : extractionGraph ,
572
+ returnTotal : false ,
573
+ ...params
574
+ } ;
575
+
576
+ const response = await this . client . get (
577
+ `extraction_graphs/${ extractionGraph } /content` , {
578
+ params : defaultParams
579
+ }
580
+ ) ;
547
581
548
- return response . data . content_list . map ( ( item : IBaseContentMetadata ) =>
582
+ const contentList = response . data . content_list . map ( ( item : IBaseContentMetadata ) =>
549
583
this . baseContentToContentMetadata ( item )
550
584
) ;
585
+
586
+ const totalCount = response . data . total ;
587
+
588
+ return { contentList, total : totalCount } ;
551
589
}
552
590
553
591
async sqlQuery ( query : string ) : Promise < any > {
0 commit comments