exa-ai 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.md +72 -1
- data/exe/exa-ai +139 -1
- data/exe/exa-ai-enrichment-cancel +108 -0
- data/exe/exa-ai-enrichment-create +188 -0
- data/exe/exa-ai-enrichment-delete +122 -0
- data/exe/exa-ai-enrichment-get +104 -0
- data/exe/exa-ai-enrichment-list +99 -0
- data/exe/exa-ai-enrichment-update +140 -0
- data/exe/exa-ai-import-create +224 -0
- data/exe/exa-ai-import-delete +92 -0
- data/exe/exa-ai-import-get +92 -0
- data/exe/exa-ai-import-list +71 -0
- data/exe/exa-ai-import-update +130 -0
- data/exe/exa-ai-monitor-create +180 -0
- data/exe/exa-ai-monitor-delete +101 -0
- data/exe/exa-ai-monitor-get +92 -0
- data/exe/exa-ai-monitor-list +89 -0
- data/exe/exa-ai-monitor-runs-get +103 -0
- data/exe/exa-ai-monitor-runs-list +110 -0
- data/exe/exa-ai-monitor-update +192 -0
- data/exe/exa-ai-search +10 -0
- data/exe/exa-ai-search-monitor-create +1 -1
- data/exe/exa-ai-search-monitor-delete +1 -1
- data/exe/exa-ai-search-monitor-get +1 -1
- data/exe/exa-ai-search-monitor-list +1 -1
- data/exe/exa-ai-search-monitor-trigger +1 -1
- data/exe/exa-ai-webset-cancel +97 -0
- data/exe/exa-ai-webset-create +220 -0
- data/exe/exa-ai-webset-delete +111 -0
- data/exe/exa-ai-webset-get +93 -0
- data/exe/exa-ai-webset-item-delete +111 -0
- data/exe/exa-ai-webset-item-get +105 -0
- data/exe/exa-ai-webset-item-list +108 -0
- data/exe/exa-ai-webset-list +96 -0
- data/exe/exa-ai-webset-search-cancel +104 -0
- data/exe/exa-ai-webset-search-create +231 -0
- data/exe/exa-ai-webset-search-get +105 -0
- data/exe/exa-ai-webset-update +116 -0
- data/lib/exa/cli/formatters/enrichment_formatter.rb +125 -0
- data/lib/exa/cli/formatters/import_formatter.rb +153 -0
- data/lib/exa/cli/formatters/monitor_formatter.rb +144 -0
- data/lib/exa/cli/formatters/monitor_run_formatter.rb +126 -0
- data/lib/exa/cli/formatters/search_formatter.rb +22 -1
- data/lib/exa/cli/formatters/search_monitor_formatter.rb +1 -1
- data/lib/exa/cli/formatters/webset_formatter.rb +134 -0
- data/lib/exa/cli/formatters/webset_item_formatter.rb +132 -0
- data/lib/exa/cli/formatters/webset_search_formatter.rb +57 -0
- data/lib/exa/cli/search_parser.rb +4 -0
- data/lib/exa/client.rb +313 -1
- data/lib/exa/constants/websets.rb +19 -0
- data/lib/exa/resources/import.rb +111 -0
- data/lib/exa/resources/import_collection.rb +33 -0
- data/lib/exa/resources/monitor.rb +72 -0
- data/lib/exa/resources/monitor_collection.rb +30 -0
- data/lib/exa/resources/monitor_run.rb +82 -0
- data/lib/exa/resources/monitor_run_collection.rb +30 -0
- data/lib/exa/resources/search_monitor.rb +1 -0
- data/lib/exa/resources/search_result.rb +5 -1
- data/lib/exa/resources/webset.rb +106 -0
- data/lib/exa/resources/webset_collection.rb +33 -0
- data/lib/exa/resources/webset_enrichment.rb +71 -0
- data/lib/exa/resources/webset_enrichment_collection.rb +28 -0
- data/lib/exa/resources/webset_item.rb +63 -0
- data/lib/exa/resources/webset_item_collection.rb +33 -0
- data/lib/exa/resources/webset_search.rb +140 -0
- data/lib/exa/services/parameter_converter.rb +3 -2
- data/lib/exa/services/search.rb +2 -1
- data/lib/exa/services/websets/cancel.rb +19 -0
- data/lib/exa/services/websets/cancel_enrichment.rb +35 -0
- data/lib/exa/services/websets/cancel_search.rb +23 -0
- data/lib/exa/services/websets/create.rb +28 -0
- data/lib/exa/services/websets/create_enrichment.rb +35 -0
- data/lib/exa/services/websets/create_search.rb +28 -0
- data/lib/exa/services/websets/create_search_validator.rb +135 -0
- data/lib/exa/services/websets/create_validator.rb +214 -0
- data/lib/exa/services/websets/delete.rb +19 -0
- data/lib/exa/services/websets/delete_enrichment.rb +35 -0
- data/lib/exa/services/websets/delete_item.rb +20 -0
- data/lib/exa/services/websets/get_item.rb +20 -0
- data/lib/exa/services/websets/get_search.rb +22 -0
- data/lib/exa/services/websets/import_create.rb +22 -0
- data/lib/exa/services/websets/import_delete.rb +19 -0
- data/lib/exa/services/websets/import_get.rb +19 -0
- data/lib/exa/services/websets/import_list.rb +25 -0
- data/lib/exa/services/websets/import_update.rb +20 -0
- data/lib/exa/services/websets/import_upload.rb +59 -0
- data/lib/exa/services/websets/list.rb +25 -0
- data/lib/exa/services/websets/list_items.rb +26 -0
- data/lib/exa/services/websets/monitors/create.rb +31 -0
- data/lib/exa/services/websets/monitors/delete.rb +21 -0
- data/lib/exa/services/websets/monitors/get.rb +22 -0
- data/lib/exa/services/websets/monitors/list.rb +27 -0
- data/lib/exa/services/websets/monitors/runs/get.rb +25 -0
- data/lib/exa/services/websets/monitors/runs/list.rb +30 -0
- data/lib/exa/services/websets/monitors/update.rb +28 -0
- data/lib/exa/services/websets/retrieve.rb +30 -0
- data/lib/exa/services/websets/retrieve_enrichment.rb +35 -0
- data/lib/exa/services/websets/update.rb +40 -0
- data/lib/exa/services/websets/update_enrichment.rb +36 -0
- data/lib/exa/services/websets_parameter_converter.rb +51 -0
- data/lib/exa/version.rb +1 -1
- data/lib/exa.rb +51 -0
- metadata +331 -227
data/lib/exa/client.rb
CHANGED
|
@@ -255,7 +255,7 @@ module Exa
|
|
|
255
255
|
end
|
|
256
256
|
|
|
257
257
|
# Create a search monitor: a scheduled Exa search that posts new results to a webhook.
|
|
258
|
-
# This is the /monitors API.
|
|
258
|
+
# This is the /monitors API, not Websets monitors (see #create_monitor).
|
|
259
259
|
#
|
|
260
260
|
# @param search [Hash] Search to run (required: :query; optional :num_results,
|
|
261
261
|
# :include_domains, :exclude_domains, :contents)
|
|
@@ -361,6 +361,318 @@ module Exa
|
|
|
361
361
|
Services::Context.new(connection, query: query, **params).call
|
|
362
362
|
end
|
|
363
363
|
|
|
364
|
+
# List all websets
|
|
365
|
+
#
|
|
366
|
+
# @param params [Hash] Pagination parameters
|
|
367
|
+
# @option params [String] :cursor Cursor for pagination
|
|
368
|
+
# @option params [Integer] :limit Maximum number of websets to return
|
|
369
|
+
# @return [Resources::WebsetCollection] Paginated list of websets
|
|
370
|
+
def list_websets(**params)
|
|
371
|
+
Services::Websets::List.new(connection, **params).call
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
# Get a specific webset by ID
|
|
375
|
+
#
|
|
376
|
+
# @param id [String] Webset ID
|
|
377
|
+
# @param params [Hash] Optional parameters
|
|
378
|
+
# @option params [Array<String>] :expand Resources to expand in response (e.g., ['items'])
|
|
379
|
+
# @return [Resources::Webset] The requested webset
|
|
380
|
+
def get_webset(id, **params)
|
|
381
|
+
Services::Websets::Retrieve.new(connection, id: id, **params).call
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
# Delete a webset
|
|
385
|
+
#
|
|
386
|
+
# @param id [String] Webset ID
|
|
387
|
+
# @return [Resources::Webset] The deleted webset
|
|
388
|
+
def delete_webset(id)
|
|
389
|
+
Services::Websets::Delete.new(connection, id: id).call
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
# Cancel in-progress operations on a webset
|
|
393
|
+
#
|
|
394
|
+
# @param id [String] Webset ID
|
|
395
|
+
# @return [Resources::Webset] The webset with cancelled operations
|
|
396
|
+
def cancel_webset(id)
|
|
397
|
+
Services::Websets::Cancel.new(connection, id: id).call
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
# Update a webset's title and/or metadata
|
|
401
|
+
#
|
|
402
|
+
# @param id [String] Webset ID
|
|
403
|
+
# @param params [Hash] Update parameters
|
|
404
|
+
# @option params [String] :title Title for the webset
|
|
405
|
+
# @option params [Hash] :metadata Metadata to update
|
|
406
|
+
# @return [Resources::Webset] The updated webset
|
|
407
|
+
def update_webset(id, **params)
|
|
408
|
+
Services::Websets::Update.new(connection, id: id, **params).call
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
# Create a new webset
|
|
412
|
+
#
|
|
413
|
+
# @param params [Hash] Creation parameters
|
|
414
|
+
# @option params [Hash] :search Search configuration
|
|
415
|
+
# @return [Resources::Webset] The newly created webset
|
|
416
|
+
def create_webset(**params)
|
|
417
|
+
Services::Websets::Create.new(connection, **params).call
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
# Create a new enrichment for a webset
|
|
421
|
+
#
|
|
422
|
+
# @param webset_id [String] Webset ID
|
|
423
|
+
# @param params [Hash] Enrichment parameters
|
|
424
|
+
# @option params [String] :description Description of data to extract
|
|
425
|
+
# @option params [String] :format Format type (text, url, options, etc.)
|
|
426
|
+
# @option params [Array<Hash>] :options Options for enrichment
|
|
427
|
+
# @option params [Hash] :metadata Custom metadata
|
|
428
|
+
# @return [Resources::WebsetEnrichment] The newly created enrichment
|
|
429
|
+
def create_enrichment(webset_id:, **params)
|
|
430
|
+
Services::Websets::CreateEnrichment.new(connection, webset_id: webset_id, **params).call
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
# Get a specific enrichment by ID
|
|
434
|
+
#
|
|
435
|
+
# @param webset_id [String] Webset ID
|
|
436
|
+
# @param id [String] Enrichment ID
|
|
437
|
+
# @return [Resources::WebsetEnrichment] The requested enrichment
|
|
438
|
+
def get_enrichment(webset_id:, id:)
|
|
439
|
+
Services::Websets::RetrieveEnrichment.new(connection, webset_id: webset_id, id: id).call
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
# Update an enrichment
|
|
443
|
+
#
|
|
444
|
+
# @param webset_id [String] Webset ID
|
|
445
|
+
# @param id [String] Enrichment ID
|
|
446
|
+
# @param params [Hash] Update parameters
|
|
447
|
+
# @option params [String] :description Updated description
|
|
448
|
+
# @option params [String] :format Updated format
|
|
449
|
+
# @option params [Array<Hash>] :options Updated options
|
|
450
|
+
# @option params [Hash] :metadata Updated metadata
|
|
451
|
+
# @return [Resources::WebsetEnrichment] The updated enrichment
|
|
452
|
+
def update_enrichment(webset_id:, id:, **params)
|
|
453
|
+
Services::Websets::UpdateEnrichment.new(connection, webset_id: webset_id, id: id, **params).call
|
|
454
|
+
end
|
|
455
|
+
|
|
456
|
+
# Delete an enrichment
|
|
457
|
+
#
|
|
458
|
+
# @param webset_id [String] Webset ID
|
|
459
|
+
# @param id [String] Enrichment ID
|
|
460
|
+
# @return [Resources::WebsetEnrichment] The deleted enrichment
|
|
461
|
+
def delete_enrichment(webset_id:, id:)
|
|
462
|
+
Services::Websets::DeleteEnrichment.new(connection, webset_id: webset_id, id: id).call
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
# Cancel a running enrichment
|
|
466
|
+
#
|
|
467
|
+
# @param webset_id [String] Webset ID
|
|
468
|
+
# @param id [String] Enrichment ID
|
|
469
|
+
# @return [Resources::WebsetEnrichment] The cancelled enrichment
|
|
470
|
+
def cancel_enrichment(webset_id:, id:)
|
|
471
|
+
Services::Websets::CancelEnrichment.new(connection, webset_id: webset_id, id: id).call
|
|
472
|
+
end
|
|
473
|
+
|
|
474
|
+
# Create a new search within a webset
|
|
475
|
+
#
|
|
476
|
+
# @param webset_id [String] Webset ID
|
|
477
|
+
# @param params [Hash] Search parameters
|
|
478
|
+
# @option params [String] :query The search query (required)
|
|
479
|
+
# @option params [Integer] :count Number of results to find
|
|
480
|
+
# @option params [Hash] :entity Entity type specification
|
|
481
|
+
# @option params [Array<Hash>] :criteria Search criteria
|
|
482
|
+
# @option params [Array<Hash>] :exclude Items to exclude from results
|
|
483
|
+
# @option params [Array<Hash>] :scope Limit search to specific sources
|
|
484
|
+
# @option params [Boolean] :recall Whether to estimate total available results
|
|
485
|
+
# @option params [String] :behavior "override" or "append" (default: "override")
|
|
486
|
+
# @option params [Hash] :metadata Custom metadata
|
|
487
|
+
# @return [Resources::WebsetSearch] The newly created search
|
|
488
|
+
def create_webset_search(webset_id:, **params)
|
|
489
|
+
Services::Websets::CreateSearch.new(connection, webset_id: webset_id, **params).call
|
|
490
|
+
end
|
|
491
|
+
|
|
492
|
+
# Get a webset search by ID
|
|
493
|
+
#
|
|
494
|
+
# @param webset_id [String] Webset ID
|
|
495
|
+
# @param id [String] Search ID
|
|
496
|
+
# @return [Resources::WebsetSearch] The requested search
|
|
497
|
+
def get_webset_search(webset_id:, id:)
|
|
498
|
+
Services::Websets::GetSearch.new(connection, webset_id: webset_id, id: id).call
|
|
499
|
+
end
|
|
500
|
+
|
|
501
|
+
# Cancel a webset search
|
|
502
|
+
#
|
|
503
|
+
# @param webset_id [String] Webset ID
|
|
504
|
+
# @param id [String] Search ID
|
|
505
|
+
# @return [Resources::WebsetSearch] The cancelled search
|
|
506
|
+
def cancel_webset_search(webset_id:, id:)
|
|
507
|
+
Services::Websets::CancelSearch.new(connection, webset_id: webset_id, id: id).call
|
|
508
|
+
end
|
|
509
|
+
|
|
510
|
+
# Get a webset item by ID
|
|
511
|
+
#
|
|
512
|
+
# @param webset_id [String] Webset ID
|
|
513
|
+
# @param id [String] Item ID
|
|
514
|
+
# @return [Resources::WebsetItem] The requested item
|
|
515
|
+
def get_item(webset_id:, id:)
|
|
516
|
+
Services::Websets::GetItem.new(connection, webset_id: webset_id, id: id).call
|
|
517
|
+
end
|
|
518
|
+
|
|
519
|
+
# Delete a webset item by ID
|
|
520
|
+
#
|
|
521
|
+
# @param webset_id [String] Webset ID
|
|
522
|
+
# @param id [String] Item ID
|
|
523
|
+
# @return [Boolean] True if deletion was successful
|
|
524
|
+
def delete_item(webset_id:, id:)
|
|
525
|
+
Services::Websets::DeleteItem.new(connection, webset_id: webset_id, id: id).call
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
# List all items in a webset
|
|
529
|
+
#
|
|
530
|
+
# @param webset_id [String] Webset ID
|
|
531
|
+
# @param params [Hash] Pagination parameters
|
|
532
|
+
# @option params [String] :cursor Cursor for pagination
|
|
533
|
+
# @option params [Integer] :limit Maximum number of items to return (default: 20)
|
|
534
|
+
# @return [Resources::WebsetItemCollection] Paginated list of items
|
|
535
|
+
def list_items(webset_id:, **params)
|
|
536
|
+
Services::Websets::ListItems.new(connection, webset_id: webset_id, **params).call
|
|
537
|
+
end
|
|
538
|
+
|
|
539
|
+
# List all imports
|
|
540
|
+
#
|
|
541
|
+
# @param params [Hash] Pagination parameters
|
|
542
|
+
# @option params [String] :cursor Cursor for pagination
|
|
543
|
+
# @option params [Integer] :limit Maximum number of imports to return
|
|
544
|
+
# @return [Resources::ImportCollection] Paginated list of imports
|
|
545
|
+
def list_imports(**params)
|
|
546
|
+
Services::Websets::ListImports.new(connection, **params).call
|
|
547
|
+
end
|
|
548
|
+
|
|
549
|
+
# Create a new import
|
|
550
|
+
#
|
|
551
|
+
# @param params [Hash] Import parameters
|
|
552
|
+
# @option params [Integer] :size Size of the import file
|
|
553
|
+
# @option params [Integer] :count Number of items to import
|
|
554
|
+
# @option params [String] :title Import title
|
|
555
|
+
# @option params [String] :format Import format (e.g., "csv")
|
|
556
|
+
# @option params [Hash] :entity Entity type specification
|
|
557
|
+
# @option params [Hash] :metadata Custom metadata
|
|
558
|
+
# @option params [Hash] :csv CSV-specific configuration
|
|
559
|
+
# @return [Resources::Import] The newly created import
|
|
560
|
+
def create_import(**params)
|
|
561
|
+
Services::Websets::CreateImport.new(connection, **params).call
|
|
562
|
+
end
|
|
563
|
+
|
|
564
|
+
# Upload a file for import (creates import and uploads file)
|
|
565
|
+
#
|
|
566
|
+
# @param file_path [String] Path to the file to upload
|
|
567
|
+
# @param params [Hash] Import parameters
|
|
568
|
+
# @option params [Integer] :count Number of items to import
|
|
569
|
+
# @option params [String] :title Import title
|
|
570
|
+
# @option params [String] :format Import format (e.g., "csv")
|
|
571
|
+
# @option params [Hash] :entity Entity type specification
|
|
572
|
+
# @option params [Hash] :metadata Custom metadata
|
|
573
|
+
# @option params [Hash] :csv CSV-specific configuration
|
|
574
|
+
# @return [Resources::Import] The created import (file size is inferred automatically)
|
|
575
|
+
def upload_import(file_path:, **params)
|
|
576
|
+
Services::Websets::UploadImport.new(connection, file_path: file_path, **params).call
|
|
577
|
+
end
|
|
578
|
+
|
|
579
|
+
# Get a specific import by ID
|
|
580
|
+
#
|
|
581
|
+
# @param id [String] Import ID
|
|
582
|
+
# @return [Resources::Import] The requested import
|
|
583
|
+
def get_import(id)
|
|
584
|
+
Services::Websets::GetImport.new(connection, id: id).call
|
|
585
|
+
end
|
|
586
|
+
|
|
587
|
+
# Update an import
|
|
588
|
+
#
|
|
589
|
+
# @param id [String] Import ID
|
|
590
|
+
# @param params [Hash] Update parameters
|
|
591
|
+
# @option params [String] :title Updated title
|
|
592
|
+
# @option params [Hash] :metadata Updated metadata
|
|
593
|
+
# @return [Resources::Import] The updated import
|
|
594
|
+
def update_import(id, **params)
|
|
595
|
+
Services::Websets::UpdateImport.new(connection, id: id, **params).call
|
|
596
|
+
end
|
|
597
|
+
|
|
598
|
+
# Delete an import
|
|
599
|
+
#
|
|
600
|
+
# @param id [String] Import ID
|
|
601
|
+
# @return [Resources::Import] The deleted import
|
|
602
|
+
def delete_import(id)
|
|
603
|
+
Services::Websets::DeleteImport.new(connection, id: id).call
|
|
604
|
+
end
|
|
605
|
+
|
|
606
|
+
# Create a new monitor for a webset
|
|
607
|
+
#
|
|
608
|
+
# @param webset_id [String] Webset ID
|
|
609
|
+
# @param cadence [Hash] Schedule configuration with :cron and :timezone
|
|
610
|
+
# @param behavior [Hash] Behavior configuration (type, query, etc.)
|
|
611
|
+
# @param params [Hash] Additional monitor parameters
|
|
612
|
+
# @option params [Hash] :metadata Custom metadata
|
|
613
|
+
# @return [Resources::Monitor] The newly created monitor
|
|
614
|
+
def create_monitor(webset_id:, cadence:, behavior:, **params)
|
|
615
|
+
Services::Websets::Monitors::Create.new(connection, webset_id: webset_id, cadence: cadence, behavior: behavior, **params).call
|
|
616
|
+
end
|
|
617
|
+
|
|
618
|
+
# List all monitors
|
|
619
|
+
#
|
|
620
|
+
# @param params [Hash] Pagination parameters
|
|
621
|
+
# @option params [String] :cursor Cursor for pagination
|
|
622
|
+
# @option params [Integer] :limit Maximum number of monitors to return
|
|
623
|
+
# @return [Resources::MonitorCollection] Paginated list of monitors
|
|
624
|
+
def list_monitors(**params)
|
|
625
|
+
Services::Websets::Monitors::List.new(connection, **params).call
|
|
626
|
+
end
|
|
627
|
+
|
|
628
|
+
# Get a specific monitor by ID
|
|
629
|
+
#
|
|
630
|
+
# @param id [String] Monitor ID
|
|
631
|
+
# @return [Resources::Monitor] The requested monitor
|
|
632
|
+
def get_monitor(id:)
|
|
633
|
+
Services::Websets::Monitors::Get.new(connection, id: id).call
|
|
634
|
+
end
|
|
635
|
+
|
|
636
|
+
# Update a monitor
|
|
637
|
+
#
|
|
638
|
+
# @param id [String] Monitor ID
|
|
639
|
+
# @param params [Hash] Update parameters
|
|
640
|
+
# @option params [Hash] :cadence Updated schedule configuration
|
|
641
|
+
# @option params [Hash] :behavior Updated behavior configuration
|
|
642
|
+
# @option params [Hash] :metadata Updated metadata
|
|
643
|
+
# @return [Resources::Monitor] The updated monitor
|
|
644
|
+
def update_monitor(id:, **params)
|
|
645
|
+
Services::Websets::Monitors::Update.new(connection, id: id, **params).call
|
|
646
|
+
end
|
|
647
|
+
|
|
648
|
+
# Delete a monitor
|
|
649
|
+
#
|
|
650
|
+
# @param id [String] Monitor ID
|
|
651
|
+
# @return [Resources::Monitor] The deleted monitor
|
|
652
|
+
def delete_monitor(id:)
|
|
653
|
+
Services::Websets::Monitors::Delete.new(connection, id: id).call
|
|
654
|
+
end
|
|
655
|
+
|
|
656
|
+
# List all runs for a specific monitor
|
|
657
|
+
#
|
|
658
|
+
# @param monitor_id [String] Monitor ID
|
|
659
|
+
# @param params [Hash] Pagination parameters
|
|
660
|
+
# @option params [String] :cursor Cursor for pagination
|
|
661
|
+
# @option params [Integer] :limit Maximum number of runs to return
|
|
662
|
+
# @return [Resources::MonitorRunCollection] Paginated list of monitor runs
|
|
663
|
+
def list_monitor_runs(monitor_id:, **params)
|
|
664
|
+
Services::Websets::Monitors::Runs::List.new(connection, monitor_id: monitor_id, **params).call
|
|
665
|
+
end
|
|
666
|
+
|
|
667
|
+
# Get a specific monitor run by ID
|
|
668
|
+
#
|
|
669
|
+
# @param monitor_id [String] Monitor ID
|
|
670
|
+
# @param id [String] Run ID
|
|
671
|
+
# @return [Resources::MonitorRun] The requested monitor run
|
|
672
|
+
def get_monitor_run(monitor_id:, id:)
|
|
673
|
+
Services::Websets::Monitors::Runs::Get.new(connection, monitor_id: monitor_id, id: id).call
|
|
674
|
+
end
|
|
675
|
+
|
|
364
676
|
private
|
|
365
677
|
|
|
366
678
|
def connection
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Exa
|
|
4
|
+
module Constants
|
|
5
|
+
module Websets
|
|
6
|
+
# Valid entity types for websets
|
|
7
|
+
ENTITY_TYPES = %w[company person article research_paper custom].freeze
|
|
8
|
+
|
|
9
|
+
# Valid enrichment formats
|
|
10
|
+
ENRICHMENT_FORMATS = %w[text date number options email phone url].freeze
|
|
11
|
+
|
|
12
|
+
# Valid source types for imports and exclusions
|
|
13
|
+
SOURCE_TYPES = %w[import webset].freeze
|
|
14
|
+
|
|
15
|
+
# Valid import formats
|
|
16
|
+
IMPORT_FORMATS = %w[csv].freeze
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Exa
|
|
4
|
+
module Resources
|
|
5
|
+
# Represents an import operation for bringing external data into Exa
|
|
6
|
+
#
|
|
7
|
+
# An import allows uploading CSV data containing entities (e.g., companies)
|
|
8
|
+
# to be processed and enriched within the Exa system.
|
|
9
|
+
class Import < Struct.new(
|
|
10
|
+
:id,
|
|
11
|
+
:object,
|
|
12
|
+
:status,
|
|
13
|
+
:format,
|
|
14
|
+
:entity,
|
|
15
|
+
:title,
|
|
16
|
+
:count,
|
|
17
|
+
:metadata,
|
|
18
|
+
:failed_reason,
|
|
19
|
+
:failed_at,
|
|
20
|
+
:failed_message,
|
|
21
|
+
:created_at,
|
|
22
|
+
:updated_at,
|
|
23
|
+
:upload_url,
|
|
24
|
+
:upload_valid_until,
|
|
25
|
+
keyword_init: true
|
|
26
|
+
)
|
|
27
|
+
def initialize(
|
|
28
|
+
id:,
|
|
29
|
+
object:,
|
|
30
|
+
status:,
|
|
31
|
+
format: nil,
|
|
32
|
+
entity: nil,
|
|
33
|
+
title: nil,
|
|
34
|
+
count: nil,
|
|
35
|
+
metadata: nil,
|
|
36
|
+
failed_reason: nil,
|
|
37
|
+
failed_at: nil,
|
|
38
|
+
failed_message: nil,
|
|
39
|
+
created_at: nil,
|
|
40
|
+
updated_at: nil,
|
|
41
|
+
upload_url: nil,
|
|
42
|
+
upload_valid_until: nil
|
|
43
|
+
)
|
|
44
|
+
super
|
|
45
|
+
freeze
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Build from a raw API response body (camelCase keys).
|
|
49
|
+
def self.from_response(body)
|
|
50
|
+
new(
|
|
51
|
+
id: body["id"],
|
|
52
|
+
object: body["object"],
|
|
53
|
+
status: body["status"],
|
|
54
|
+
format: body["format"],
|
|
55
|
+
entity: body["entity"],
|
|
56
|
+
title: body["title"],
|
|
57
|
+
count: body["count"],
|
|
58
|
+
metadata: body["metadata"],
|
|
59
|
+
failed_reason: body["failedReason"],
|
|
60
|
+
failed_at: body["failedAt"],
|
|
61
|
+
failed_message: body["failedMessage"],
|
|
62
|
+
created_at: body["createdAt"],
|
|
63
|
+
updated_at: body["updatedAt"],
|
|
64
|
+
upload_url: body["uploadUrl"],
|
|
65
|
+
upload_valid_until: body["uploadValidUntil"]
|
|
66
|
+
)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Status helper methods
|
|
70
|
+
def canceled?
|
|
71
|
+
status == "canceled"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def pending?
|
|
75
|
+
status == "pending"
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def processing?
|
|
79
|
+
status == "processing"
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def completed?
|
|
83
|
+
status == "completed"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def failed?
|
|
87
|
+
status == "failed"
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def to_h
|
|
91
|
+
{
|
|
92
|
+
id: id,
|
|
93
|
+
object: object,
|
|
94
|
+
status: status,
|
|
95
|
+
format: format,
|
|
96
|
+
entity: entity,
|
|
97
|
+
title: title,
|
|
98
|
+
count: count,
|
|
99
|
+
metadata: metadata,
|
|
100
|
+
failed_reason: failed_reason,
|
|
101
|
+
failed_at: failed_at,
|
|
102
|
+
failed_message: failed_message,
|
|
103
|
+
created_at: created_at,
|
|
104
|
+
updated_at: updated_at,
|
|
105
|
+
upload_url: upload_url,
|
|
106
|
+
upload_valid_until: upload_valid_until
|
|
107
|
+
}.compact
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Exa
|
|
4
|
+
module Resources
|
|
5
|
+
# Represents a paginated list of imports from the Exa API
|
|
6
|
+
#
|
|
7
|
+
# This class wraps the JSON response from the GET /websets/v0/imports endpoint
|
|
8
|
+
# and provides pagination support.
|
|
9
|
+
class ImportCollection < Struct.new(
|
|
10
|
+
:data,
|
|
11
|
+
:has_more,
|
|
12
|
+
:next_cursor,
|
|
13
|
+
keyword_init: true
|
|
14
|
+
)
|
|
15
|
+
def initialize(data:, has_more: false, next_cursor: nil)
|
|
16
|
+
super
|
|
17
|
+
freeze
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def empty?
|
|
21
|
+
data.empty?
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def to_h
|
|
25
|
+
{
|
|
26
|
+
data: data.map(&:to_h),
|
|
27
|
+
has_more: has_more,
|
|
28
|
+
next_cursor: next_cursor
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
module Exa
|
|
2
|
+
module Resources
|
|
3
|
+
# Represents a webset monitor that automates updates on a schedule
|
|
4
|
+
Monitor = Struct.new(
|
|
5
|
+
:id,
|
|
6
|
+
:object,
|
|
7
|
+
:status,
|
|
8
|
+
:webset_id,
|
|
9
|
+
:cadence,
|
|
10
|
+
:behavior,
|
|
11
|
+
:last_run,
|
|
12
|
+
:next_run_at,
|
|
13
|
+
:metadata,
|
|
14
|
+
:created_at,
|
|
15
|
+
:updated_at,
|
|
16
|
+
keyword_init: true
|
|
17
|
+
) do
|
|
18
|
+
def initialize(**)
|
|
19
|
+
super
|
|
20
|
+
freeze
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Build from a raw API response body (camelCase keys).
|
|
24
|
+
def self.from_response(body)
|
|
25
|
+
new(
|
|
26
|
+
id: body["id"],
|
|
27
|
+
object: body["object"],
|
|
28
|
+
status: body["status"],
|
|
29
|
+
webset_id: body["websetId"],
|
|
30
|
+
cadence: body["cadence"],
|
|
31
|
+
behavior: body["behavior"],
|
|
32
|
+
last_run: body["lastRun"],
|
|
33
|
+
next_run_at: body["nextRunAt"],
|
|
34
|
+
metadata: body["metadata"],
|
|
35
|
+
created_at: body["createdAt"],
|
|
36
|
+
updated_at: body["updatedAt"]
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def freeze
|
|
41
|
+
super
|
|
42
|
+
cadence.freeze if cadence
|
|
43
|
+
behavior.freeze if behavior
|
|
44
|
+
self
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def enabled?
|
|
48
|
+
status == "enabled"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def disabled?
|
|
52
|
+
status == "disabled"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def to_h
|
|
56
|
+
{
|
|
57
|
+
id: id,
|
|
58
|
+
object: object,
|
|
59
|
+
status: status,
|
|
60
|
+
webset_id: webset_id,
|
|
61
|
+
cadence: cadence,
|
|
62
|
+
behavior: behavior,
|
|
63
|
+
last_run: last_run,
|
|
64
|
+
next_run_at: next_run_at,
|
|
65
|
+
metadata: metadata,
|
|
66
|
+
created_at: created_at,
|
|
67
|
+
updated_at: updated_at
|
|
68
|
+
}.compact
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Exa
|
|
4
|
+
module Resources
|
|
5
|
+
# Represents a paginated list of monitors from the Exa API
|
|
6
|
+
class MonitorCollection < Struct.new(
|
|
7
|
+
:data,
|
|
8
|
+
:has_more,
|
|
9
|
+
:next_cursor,
|
|
10
|
+
keyword_init: true
|
|
11
|
+
)
|
|
12
|
+
def initialize(data:, has_more: false, next_cursor: nil)
|
|
13
|
+
super
|
|
14
|
+
freeze
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def empty?
|
|
18
|
+
data.empty?
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def to_h
|
|
22
|
+
{
|
|
23
|
+
data: data.map(&:to_h),
|
|
24
|
+
has_more: has_more,
|
|
25
|
+
next_cursor: next_cursor
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
module Exa
|
|
2
|
+
module Resources
|
|
3
|
+
# Represents a monitor run execution
|
|
4
|
+
MonitorRun = Struct.new(
|
|
5
|
+
:id,
|
|
6
|
+
:object,
|
|
7
|
+
:monitor_id,
|
|
8
|
+
:status,
|
|
9
|
+
:type,
|
|
10
|
+
:created_at,
|
|
11
|
+
:updated_at,
|
|
12
|
+
:completed_at,
|
|
13
|
+
:failed_at,
|
|
14
|
+
:failed_reason,
|
|
15
|
+
:canceled_at,
|
|
16
|
+
keyword_init: true
|
|
17
|
+
) do
|
|
18
|
+
def initialize(**)
|
|
19
|
+
super
|
|
20
|
+
freeze
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Build from a raw API response body (camelCase keys).
|
|
24
|
+
def self.from_response(body)
|
|
25
|
+
new(
|
|
26
|
+
id: body["id"],
|
|
27
|
+
object: body["object"],
|
|
28
|
+
monitor_id: body["monitorId"],
|
|
29
|
+
status: body["status"],
|
|
30
|
+
type: body["type"],
|
|
31
|
+
created_at: body["createdAt"],
|
|
32
|
+
updated_at: body["updatedAt"],
|
|
33
|
+
completed_at: body["completedAt"],
|
|
34
|
+
failed_at: body["failedAt"],
|
|
35
|
+
failed_reason: body["failedReason"],
|
|
36
|
+
canceled_at: body["canceledAt"]
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def freeze
|
|
41
|
+
super
|
|
42
|
+
self
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def created?
|
|
46
|
+
status == "created"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def canceled?
|
|
50
|
+
status == "canceled"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def running?
|
|
54
|
+
status == "running"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def completed?
|
|
58
|
+
status == "completed"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def failed?
|
|
62
|
+
status == "failed"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def to_h
|
|
66
|
+
{
|
|
67
|
+
id: id,
|
|
68
|
+
object: object,
|
|
69
|
+
monitor_id: monitor_id,
|
|
70
|
+
status: status,
|
|
71
|
+
type: type,
|
|
72
|
+
created_at: created_at,
|
|
73
|
+
updated_at: updated_at,
|
|
74
|
+
completed_at: completed_at,
|
|
75
|
+
failed_at: failed_at,
|
|
76
|
+
failed_reason: failed_reason,
|
|
77
|
+
canceled_at: canceled_at
|
|
78
|
+
}.compact
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Exa
|
|
4
|
+
module Resources
|
|
5
|
+
# Represents a paginated list of monitor runs from the Exa API
|
|
6
|
+
class MonitorRunCollection < Struct.new(
|
|
7
|
+
:data,
|
|
8
|
+
:has_more,
|
|
9
|
+
:next_cursor,
|
|
10
|
+
keyword_init: true
|
|
11
|
+
)
|
|
12
|
+
def initialize(data:, has_more: false, next_cursor: nil)
|
|
13
|
+
super
|
|
14
|
+
freeze
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def empty?
|
|
18
|
+
data.empty?
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def to_h
|
|
22
|
+
{
|
|
23
|
+
data: data.map(&:to_h),
|
|
24
|
+
has_more: has_more,
|
|
25
|
+
next_cursor: next_cursor
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|