context.dev 2.5.0 → 2.6.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.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +4 -0
  5. data/lib/context_dev/models/batch_cancel_params.rb +22 -0
  6. data/lib/context_dev/models/batch_cancel_response.rb +354 -0
  7. data/lib/context_dev/models/batch_get_results_params.rb +42 -0
  8. data/lib/context_dev/models/batch_get_results_response.rb +463 -0
  9. data/lib/context_dev/models/batch_list_params.rb +94 -0
  10. data/lib/context_dev/models/batch_list_response.rb +388 -0
  11. data/lib/context_dev/models/batch_retrieve_params.rb +22 -0
  12. data/lib/context_dev/models/batch_retrieve_response.rb +390 -0
  13. data/lib/context_dev/models/batch_submit_params.rb +56 -0
  14. data/lib/context_dev/models/batch_submit_response.rb +614 -0
  15. data/lib/context_dev/models/error.rb +26 -0
  16. data/lib/context_dev/models/error_count.rb +26 -0
  17. data/lib/context_dev/models/monitor_create_params.rb +141 -127
  18. data/lib/context_dev/models/monitor_create_response.rb +34 -10
  19. data/lib/context_dev/models/monitor_list_response.rb +21 -7
  20. data/lib/context_dev/models/monitor_retrieve_response.rb +21 -7
  21. data/lib/context_dev/models/monitor_update_params.rb +21 -7
  22. data/lib/context_dev/models/monitor_update_response.rb +21 -7
  23. data/lib/context_dev/models/web_web_scrape_html_response.rb +93 -1
  24. data/lib/context_dev/models/web_web_scrape_md_response.rb +93 -1
  25. data/lib/context_dev/models.rb +14 -0
  26. data/lib/context_dev/resources/batch.rb +155 -0
  27. data/lib/context_dev/resources/monitors.rb +5 -5
  28. data/lib/context_dev/version.rb +1 -1
  29. data/lib/context_dev.rb +13 -0
  30. data/rbi/context_dev/client.rbi +3 -0
  31. data/rbi/context_dev/models/batch_cancel_params.rbi +40 -0
  32. data/rbi/context_dev/models/batch_cancel_response.rbi +642 -0
  33. data/rbi/context_dev/models/batch_get_results_params.rbi +70 -0
  34. data/rbi/context_dev/models/batch_get_results_response.rbi +848 -0
  35. data/rbi/context_dev/models/batch_list_params.rbi +166 -0
  36. data/rbi/context_dev/models/batch_list_response.rbi +738 -0
  37. data/rbi/context_dev/models/batch_retrieve_params.rbi +40 -0
  38. data/rbi/context_dev/models/batch_retrieve_response.rbi +707 -0
  39. data/rbi/context_dev/models/batch_submit_params.rbi +105 -0
  40. data/rbi/context_dev/models/batch_submit_response.rbi +1330 -0
  41. data/rbi/context_dev/models/error.rbi +32 -0
  42. data/rbi/context_dev/models/error_count.rbi +34 -0
  43. data/rbi/context_dev/models/monitor_create_params.rbi +274 -242
  44. data/rbi/context_dev/models/monitor_create_response.rbi +38 -7
  45. data/rbi/context_dev/models/monitor_list_response.rbi +24 -5
  46. data/rbi/context_dev/models/monitor_retrieve_response.rbi +24 -5
  47. data/rbi/context_dev/models/monitor_update_params.rbi +24 -5
  48. data/rbi/context_dev/models/monitor_update_response.rbi +24 -5
  49. data/rbi/context_dev/models/web_web_scrape_html_response.rbi +182 -0
  50. data/rbi/context_dev/models/web_web_scrape_md_response.rbi +180 -0
  51. data/rbi/context_dev/models.rbi +14 -0
  52. data/rbi/context_dev/resources/batch.rbi +120 -0
  53. data/rbi/context_dev/resources/monitors.rbi +12 -12
  54. data/sig/context_dev/client.rbs +2 -0
  55. data/sig/context_dev/models/batch_cancel_params.rbs +23 -0
  56. data/sig/context_dev/models/batch_cancel_response.rbs +266 -0
  57. data/sig/context_dev/models/batch_get_results_params.rbs +36 -0
  58. data/sig/context_dev/models/batch_get_results_response.rbs +399 -0
  59. data/sig/context_dev/models/batch_list_params.rbs +94 -0
  60. data/sig/context_dev/models/batch_list_response.rbs +304 -0
  61. data/sig/context_dev/models/batch_retrieve_params.rbs +23 -0
  62. data/sig/context_dev/models/batch_retrieve_response.rbs +290 -0
  63. data/sig/context_dev/models/batch_submit_params.rbs +52 -0
  64. data/sig/context_dev/models/batch_submit_response.rbs +542 -0
  65. data/sig/context_dev/models/error.rbs +15 -0
  66. data/sig/context_dev/models/error_count.rbs +15 -0
  67. data/sig/context_dev/models/monitor_create_params.rbs +117 -97
  68. data/sig/context_dev/models/monitor_create_response.rbs +18 -1
  69. data/sig/context_dev/models/monitor_list_response.rbs +13 -1
  70. data/sig/context_dev/models/monitor_retrieve_response.rbs +13 -1
  71. data/sig/context_dev/models/monitor_update_params.rbs +13 -1
  72. data/sig/context_dev/models/monitor_update_response.rbs +13 -1
  73. data/sig/context_dev/models/web_web_scrape_html_response.rbs +85 -0
  74. data/sig/context_dev/models/web_web_scrape_md_response.rbs +85 -0
  75. data/sig/context_dev/models.rbs +14 -0
  76. data/sig/context_dev/resources/batch.rbs +41 -0
  77. data/sig/context_dev/resources/monitors.rbs +2 -2
  78. metadata +41 -2
@@ -164,7 +164,7 @@ module ContextDev
164
164
  # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
165
165
  variant :exact, -> { ContextDev::Models::MonitorUpdateResponse::ChangeDetection::Exact }
166
166
 
167
- # Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided).
167
+ # Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided).
168
168
  variant :semantic, -> { ContextDev::Models::MonitorUpdateResponse::ChangeDetection::Semantic }
169
169
 
170
170
  class Exact < ContextDev::Internal::Type::BaseModel
@@ -192,9 +192,10 @@ module ContextDev
192
192
  optional :confidence_threshold, Float
193
193
 
194
194
  # @!method initialize(confidence_threshold: nil, type: :semantic)
195
- # Detect meaning-level changes to tracked page content, ignoring cosmetic or
196
- # paraphrase-only differences. Which changes are meaningful is judged against the
197
- # extract target's `instructions` (and `schema`, when provided).
195
+ # Detect meaning-level changes to page content, ignoring cosmetic or
196
+ # instruction-irrelevant differences. Which changes are meaningful is judged
197
+ # against the page or extract target's `instructions` (and an extract target's
198
+ # `schema`, when provided).
198
199
  #
199
200
  # @param confidence_threshold [Float]
200
201
  # @param type [Symbol, :semantic]
@@ -300,7 +301,7 @@ module ContextDev
300
301
 
301
302
  discriminator :type
302
303
 
303
- # Watch a single web page.
304
+ # Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`.
304
305
  variant :page, -> { ContextDev::Models::MonitorUpdateResponse::Target::Page }
305
306
 
306
307
  # Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps.
@@ -320,17 +321,30 @@ module ContextDev
320
321
  # @return [String]
321
322
  required :url, String
322
323
 
324
+ # @!attribute instructions
325
+ # Plain-language goal describing which page changes matter. When provided without
326
+ # change_detection, semantic detection is inferred.
327
+ #
328
+ # @return [String, nil]
329
+ optional :instructions, String
330
+
323
331
  # @!attribute normalize_whitespace
324
332
  # Normalize whitespace before comparing or analyzing text.
325
333
  #
326
334
  # @return [Boolean, nil]
327
335
  optional :normalize_whitespace, ContextDev::Internal::Type::Boolean
328
336
 
329
- # @!method initialize(url:, normalize_whitespace: nil, type: :page)
330
- # Watch a single web page.
337
+ # @!method initialize(url:, instructions: nil, normalize_whitespace: nil, type: :page)
338
+ # Some parameter documentations has been truncated, see
339
+ # {ContextDev::Models::MonitorUpdateResponse::Target::Page} for more details.
340
+ #
341
+ # Watch a single web page. Exact detection reports visible-text diffs; semantic
342
+ # detection judges confirmed stable diffs against `instructions`.
331
343
  #
332
344
  # @param url [String]
333
345
  #
346
+ # @param instructions [String] Plain-language goal describing which page changes matter. When provided without
347
+ #
334
348
  # @param normalize_whitespace [Boolean] Normalize whitespace before comparing or analyzing text.
335
349
  #
336
350
  # @param type [Symbol, :page]
@@ -39,6 +39,21 @@ module ContextDev
39
39
  # @return [String]
40
40
  required :url, String
41
41
 
42
+ # @!attribute actions_applied
43
+ # One verified outcome per requested browser action, in request order.
44
+ #
45
+ # @return [Array<ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied>, nil]
46
+ optional :actions_applied,
47
+ -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied] },
48
+ api_name: :actionsApplied
49
+
50
+ # @!attribute actions_html_stale
51
+ # True when an action was applied but the returned content could not be refreshed
52
+ # afterward.
53
+ #
54
+ # @return [Boolean, nil]
55
+ optional :actions_html_stale, ContextDev::Internal::Type::Boolean, api_name: :actionsHtmlStale
56
+
42
57
  # @!attribute key_metadata
43
58
  # Metadata about the API key used for the request. Included in every response
44
59
  # whenever a valid API key is provided, even when the response status is not 200.
@@ -46,7 +61,7 @@ module ContextDev
46
61
  # @return [ContextDev::Models::WebWebScrapeHTMLResponse::KeyMetadata, nil]
47
62
  optional :key_metadata, -> { ContextDev::Models::WebWebScrapeHTMLResponse::KeyMetadata }
48
63
 
49
- # @!method initialize(html:, metadata:, success:, type:, url:, key_metadata: nil)
64
+ # @!method initialize(html:, metadata:, success:, type:, url:, actions_applied: nil, actions_html_stale: nil, key_metadata: nil)
50
65
  # Some parameter documentations has been truncated, see
51
66
  # {ContextDev::Models::WebWebScrapeHTMLResponse} for more details.
52
67
  #
@@ -60,6 +75,10 @@ module ContextDev
60
75
  #
61
76
  # @param url [String] The URL that was scraped
62
77
  #
78
+ # @param actions_applied [Array<ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied>] One verified outcome per requested browser action, in request order.
79
+ #
80
+ # @param actions_html_stale [Boolean] True when an action was applied but the returned content could not be refreshed
81
+ #
63
82
  # @param key_metadata [ContextDev::Models::WebWebScrapeHTMLResponse::KeyMetadata] Metadata about the API key used for the request. Included in every response when
64
83
 
65
84
  # @see ContextDev::Models::WebWebScrapeHTMLResponse#metadata
@@ -349,6 +368,79 @@ module ContextDev
349
368
  # @return [Array<Symbol>]
350
369
  end
351
370
 
371
+ class ActionsApplied < ContextDev::Internal::Type::BaseModel
372
+ # @!attribute instruction
373
+ #
374
+ # @return [String]
375
+ required :instruction, String
376
+
377
+ # @!attribute status
378
+ # Applied means the requested page state was visibly verified. Failed means it was
379
+ # not verified. Skipped means it was not attempted.
380
+ #
381
+ # @return [Symbol, ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::Status]
382
+ required :status, enum: -> { ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::Status }
383
+
384
+ # @!attribute completion_evidence
385
+ # Visible page evidence used to verify an applied action.
386
+ #
387
+ # @return [String, nil]
388
+ optional :completion_evidence, String, api_name: :completionEvidence
389
+
390
+ # @!attribute duration_ms
391
+ #
392
+ # @return [Float, nil]
393
+ optional :duration_ms, Float, api_name: :durationMs
394
+
395
+ # @!attribute error
396
+ #
397
+ # @return [String, nil]
398
+ optional :error, String
399
+
400
+ # @!attribute method_
401
+ #
402
+ # @return [String, nil]
403
+ optional :method_, String, api_name: :method
404
+
405
+ # @!attribute target_description
406
+ #
407
+ # @return [String, nil]
408
+ optional :target_description, String, api_name: :targetDescription
409
+
410
+ # @!method initialize(instruction:, status:, completion_evidence: nil, duration_ms: nil, error: nil, method_: nil, target_description: nil)
411
+ # Some parameter documentations has been truncated, see
412
+ # {ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied} for more details.
413
+ #
414
+ # @param instruction [String]
415
+ #
416
+ # @param status [Symbol, ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::Status] Applied means the requested page state was visibly verified. Failed means it was
417
+ #
418
+ # @param completion_evidence [String] Visible page evidence used to verify an applied action.
419
+ #
420
+ # @param duration_ms [Float]
421
+ #
422
+ # @param error [String]
423
+ #
424
+ # @param method_ [String]
425
+ #
426
+ # @param target_description [String]
427
+
428
+ # Applied means the requested page state was visibly verified. Failed means it was
429
+ # not verified. Skipped means it was not attempted.
430
+ #
431
+ # @see ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied#status
432
+ module Status
433
+ extend ContextDev::Internal::Type::Enum
434
+
435
+ APPLIED = :applied
436
+ FAILED = :failed
437
+ SKIPPED = :skipped
438
+
439
+ # @!method self.values
440
+ # @return [Array<Symbol>]
441
+ end
442
+ end
443
+
352
444
  # @see ContextDev::Models::WebWebScrapeHTMLResponse#key_metadata
353
445
  class KeyMetadata < ContextDev::Internal::Type::BaseModel
354
446
  # @!attribute credits_consumed
@@ -36,6 +36,21 @@ module ContextDev
36
36
  # @return [String]
37
37
  required :url, String
38
38
 
39
+ # @!attribute actions_applied
40
+ # One verified outcome per requested browser action, in request order.
41
+ #
42
+ # @return [Array<ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied>, nil]
43
+ optional :actions_applied,
44
+ -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied] },
45
+ api_name: :actionsApplied
46
+
47
+ # @!attribute actions_html_stale
48
+ # True when an action was applied but the returned content could not be refreshed
49
+ # afterward.
50
+ #
51
+ # @return [Boolean, nil]
52
+ optional :actions_html_stale, ContextDev::Internal::Type::Boolean, api_name: :actionsHtmlStale
53
+
39
54
  # @!attribute key_metadata
40
55
  # Metadata about the API key used for the request. Included in every response
41
56
  # whenever a valid API key is provided, even when the response status is not 200.
@@ -43,7 +58,7 @@ module ContextDev
43
58
  # @return [ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata, nil]
44
59
  optional :key_metadata, -> { ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata }
45
60
 
46
- # @!method initialize(content_length:, markdown:, metadata:, success:, url:, key_metadata: nil)
61
+ # @!method initialize(content_length:, markdown:, metadata:, success:, url:, actions_applied: nil, actions_html_stale: nil, key_metadata: nil)
47
62
  # Some parameter documentations has been truncated, see
48
63
  # {ContextDev::Models::WebWebScrapeMdResponse} for more details.
49
64
  #
@@ -57,6 +72,10 @@ module ContextDev
57
72
  #
58
73
  # @param url [String] The URL that was scraped
59
74
  #
75
+ # @param actions_applied [Array<ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied>] One verified outcome per requested browser action, in request order.
76
+ #
77
+ # @param actions_html_stale [Boolean] True when an action was applied but the returned content could not be refreshed
78
+ #
60
79
  # @param key_metadata [ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata] Metadata about the API key used for the request. Included in every response when
61
80
 
62
81
  # @see ContextDev::Models::WebWebScrapeMdResponse#metadata
@@ -318,6 +337,79 @@ module ContextDev
318
337
  # @return [Array<Boolean>]
319
338
  end
320
339
 
340
+ class ActionsApplied < ContextDev::Internal::Type::BaseModel
341
+ # @!attribute instruction
342
+ #
343
+ # @return [String]
344
+ required :instruction, String
345
+
346
+ # @!attribute status
347
+ # Applied means the requested page state was visibly verified. Failed means it was
348
+ # not verified. Skipped means it was not attempted.
349
+ #
350
+ # @return [Symbol, ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status]
351
+ required :status, enum: -> { ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status }
352
+
353
+ # @!attribute completion_evidence
354
+ # Visible page evidence used to verify an applied action.
355
+ #
356
+ # @return [String, nil]
357
+ optional :completion_evidence, String, api_name: :completionEvidence
358
+
359
+ # @!attribute duration_ms
360
+ #
361
+ # @return [Float, nil]
362
+ optional :duration_ms, Float, api_name: :durationMs
363
+
364
+ # @!attribute error
365
+ #
366
+ # @return [String, nil]
367
+ optional :error, String
368
+
369
+ # @!attribute method_
370
+ #
371
+ # @return [String, nil]
372
+ optional :method_, String, api_name: :method
373
+
374
+ # @!attribute target_description
375
+ #
376
+ # @return [String, nil]
377
+ optional :target_description, String, api_name: :targetDescription
378
+
379
+ # @!method initialize(instruction:, status:, completion_evidence: nil, duration_ms: nil, error: nil, method_: nil, target_description: nil)
380
+ # Some parameter documentations has been truncated, see
381
+ # {ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied} for more details.
382
+ #
383
+ # @param instruction [String]
384
+ #
385
+ # @param status [Symbol, ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status] Applied means the requested page state was visibly verified. Failed means it was
386
+ #
387
+ # @param completion_evidence [String] Visible page evidence used to verify an applied action.
388
+ #
389
+ # @param duration_ms [Float]
390
+ #
391
+ # @param error [String]
392
+ #
393
+ # @param method_ [String]
394
+ #
395
+ # @param target_description [String]
396
+
397
+ # Applied means the requested page state was visibly verified. Failed means it was
398
+ # not verified. Skipped means it was not attempted.
399
+ #
400
+ # @see ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied#status
401
+ module Status
402
+ extend ContextDev::Internal::Type::Enum
403
+
404
+ APPLIED = :applied
405
+ FAILED = :failed
406
+ SKIPPED = :skipped
407
+
408
+ # @!method self.values
409
+ # @return [Array<Symbol>]
410
+ end
411
+ end
412
+
321
413
  # @see ContextDev::Models::WebWebScrapeMdResponse#key_metadata
322
414
  class KeyMetadata < ContextDev::Internal::Type::BaseModel
323
415
  # @!attribute credits_consumed
@@ -43,10 +43,24 @@ module ContextDev
43
43
 
44
44
  AIExtractProductsParams = ContextDev::Models::AIExtractProductsParams
45
45
 
46
+ BatchCancelParams = ContextDev::Models::BatchCancelParams
47
+
48
+ BatchGetResultsParams = ContextDev::Models::BatchGetResultsParams
49
+
50
+ BatchListParams = ContextDev::Models::BatchListParams
51
+
52
+ BatchRetrieveParams = ContextDev::Models::BatchRetrieveParams
53
+
54
+ BatchSubmitParams = ContextDev::Models::BatchSubmitParams
55
+
46
56
  BrandRetrieveParams = ContextDev::Models::BrandRetrieveParams
47
57
 
48
58
  BrandRetrieveSimplifiedParams = ContextDev::Models::BrandRetrieveSimplifiedParams
49
59
 
60
+ Error = ContextDev::Models::Error
61
+
62
+ ErrorCount = ContextDev::Models::ErrorCount
63
+
50
64
  IndustryRetrieveNaicsParams = ContextDev::Models::IndustryRetrieveNaicsParams
51
65
 
52
66
  IndustryRetrieveSicParams = ContextDev::Models::IndustryRetrieveSicParams
@@ -0,0 +1,155 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ContextDev
4
+ module Resources
5
+ class Batch
6
+ # Check progress and get download links when the batch finishes. Also returns the
7
+ # rejected-URL list and webhook signing secret from submission, so nothing is lost
8
+ # if the submit response was dropped.
9
+ #
10
+ # @overload retrieve(batch_id, request_options: {})
11
+ #
12
+ # @param batch_id [String] ID of the batch to retrieve or cancel.
13
+ #
14
+ # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
15
+ #
16
+ # @return [ContextDev::Models::BatchRetrieveResponse]
17
+ #
18
+ # @see ContextDev::Models::BatchRetrieveParams
19
+ def retrieve(batch_id, params = {})
20
+ @client.request(
21
+ method: :get,
22
+ path: ["batch/%1$s", batch_id],
23
+ model: ContextDev::Models::BatchRetrieveResponse,
24
+ options: params[:request_options]
25
+ )
26
+ end
27
+
28
+ # Some parameter documentations has been truncated, see
29
+ # {ContextDev::Models::BatchListParams} for more details.
30
+ #
31
+ # List your batches from newest to oldest. Filter by status or continue with a
32
+ # cursor.
33
+ #
34
+ # @overload list(cursor: nil, limit: nil, q: nil, search_type: nil, status: nil, tags: nil, request_options: {})
35
+ #
36
+ # @param cursor [String] Cursor from the previous page.
37
+ #
38
+ # @param limit [Integer] Batches per page. Defaults to 25.
39
+ #
40
+ # @param q [String] Free-text search term, matched against the batch id, crawl source (start URL or
41
+ #
42
+ # @param search_type [Symbol, ContextDev::Models::BatchListParams::SearchType] `prefix` for as-you-type prefix matching (default), `exact` for full-token match
43
+ #
44
+ # @param status [Symbol, ContextDev::Models::BatchListParams::Status] Filter by status.
45
+ #
46
+ # @param tags [String] Comma-separated list of tags to filter by (matches batches having any of them).
47
+ #
48
+ # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
49
+ #
50
+ # @return [ContextDev::Models::BatchListResponse]
51
+ #
52
+ # @see ContextDev::Models::BatchListParams
53
+ def list(params = {})
54
+ parsed, options = ContextDev::BatchListParams.dump_request(params)
55
+ query = ContextDev::Internal::Util.encode_query_params(parsed)
56
+ @client.request(
57
+ method: :get,
58
+ path: "batch/list",
59
+ query: query,
60
+ model: ContextDev::Models::BatchListResponse,
61
+ options: options
62
+ )
63
+ end
64
+
65
+ # Stop a batch from starting new pages. In-progress pages finish, and unused
66
+ # credits are refunded.
67
+ #
68
+ # @overload cancel(batch_id, request_options: {})
69
+ #
70
+ # @param batch_id [String] ID of the batch to retrieve or cancel.
71
+ #
72
+ # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
73
+ #
74
+ # @return [ContextDev::Models::BatchCancelResponse]
75
+ #
76
+ # @see ContextDev::Models::BatchCancelParams
77
+ def cancel(batch_id, params = {})
78
+ @client.request(
79
+ method: :post,
80
+ path: ["batch/%1$s/cancel", batch_id],
81
+ model: ContextDev::Models::BatchCancelResponse,
82
+ options: params[:request_options]
83
+ )
84
+ end
85
+
86
+ # Some parameter documentations has been truncated, see
87
+ # {ContextDev::Models::BatchGetResultsParams} for more details.
88
+ #
89
+ # Page through the result records of a finished batch as JSON, in the same order
90
+ # as the downloadable result files. Use this instead of downloading and parsing
91
+ # the NDJSON files yourself.
92
+ #
93
+ # @overload get_results(batch_id, cursor: nil, limit: nil, request_options: {})
94
+ #
95
+ # @param batch_id [String] ID of the batch to retrieve or cancel.
96
+ #
97
+ # @param cursor [String] next_cursor from the previous page.
98
+ #
99
+ # @param limit [Integer] Records per page. Defaults to 25. A page can close early so its payload stays un
100
+ #
101
+ # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
102
+ #
103
+ # @return [ContextDev::Models::BatchGetResultsResponse]
104
+ #
105
+ # @see ContextDev::Models::BatchGetResultsParams
106
+ def get_results(batch_id, params = {})
107
+ parsed, options = ContextDev::BatchGetResultsParams.dump_request(params)
108
+ query = ContextDev::Internal::Util.encode_query_params(parsed)
109
+ @client.request(
110
+ method: :get,
111
+ path: ["batch/%1$s/results", batch_id],
112
+ query: query,
113
+ model: ContextDev::Models::BatchGetResultsResponse,
114
+ options: options
115
+ )
116
+ end
117
+
118
+ # Some parameter documentations has been truncated, see
119
+ # {ContextDev::Models::BatchSubmitParams} for more details.
120
+ #
121
+ # Retrieve and normalize a person profile from identifiers.
122
+ #
123
+ # @overload submit(identifiers:, tags: nil, timeout_ms: nil, request_options: {})
124
+ #
125
+ # @param identifiers [ContextDev::Models::BatchSubmitParams::Identifiers] Known identifiers for the person. At least one identifier is required.
126
+ #
127
+ # @param tags [Array<String>] Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
128
+ #
129
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
130
+ #
131
+ # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
132
+ #
133
+ # @return [ContextDev::Models::BatchSubmitResponse]
134
+ #
135
+ # @see ContextDev::Models::BatchSubmitParams
136
+ def submit(params)
137
+ parsed, options = ContextDev::BatchSubmitParams.dump_request(params)
138
+ @client.request(
139
+ method: :post,
140
+ path: "people/retrieve",
141
+ body: parsed,
142
+ model: ContextDev::Models::BatchSubmitResponse,
143
+ options: options
144
+ )
145
+ end
146
+
147
+ # @api private
148
+ #
149
+ # @param client [ContextDev::Client]
150
+ def initialize(client:)
151
+ @client = client
152
+ end
153
+ end
154
+ end
155
+ end
@@ -14,18 +14,18 @@ module ContextDev
14
14
  # detection combinations. The monitor runs immediately after creation to create
15
15
  # its initial baseline.
16
16
  #
17
- # @overload create(change_detection:, name:, schedule:, target:, mode: nil, tags: nil, webhook: nil, request_options: {})
18
- #
19
- # @param change_detection [ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic] Discriminated union describing how changes are detected.
17
+ # @overload create(name:, target:, change_detection: nil, mode: nil, schedule: nil, tags: nil, webhook: nil, request_options: {})
20
18
  #
21
19
  # @param name [String]
22
20
  #
23
- # @param schedule [ContextDev::Models::MonitorCreateParams::Schedule] Run the monitor on a fixed interval defined by a frequency and a unit, e.g. ever
24
- #
25
21
  # @param target [ContextDev::Models::MonitorCreateParams::Target::Page, ContextDev::Models::MonitorCreateParams::Target::Sitemap, ContextDev::Models::MonitorCreateParams::Target::Extract] Discriminated union describing what the monitor watches.
26
22
  #
23
+ # @param change_detection [ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic] Discriminated union describing how changes are detected.
24
+ #
27
25
  # @param mode [Symbol, ContextDev::Models::MonitorCreateParams::Mode] Top-level monitor category. Always `web` today; the concrete behavior is describ
28
26
  #
27
+ # @param schedule [ContextDev::Models::MonitorCreateParams::Schedule] Run the monitor on a fixed interval defined by a frequency and a unit, e.g. ever
28
+ #
29
29
  # @param tags [Array<String>] User-defined tags for grouping and filtering monitors and their changes. Duplica
30
30
  #
31
31
  # @param webhook [ContextDev::Models::MonitorCreateParams::Webhook, nil]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ContextDev
4
- VERSION = "2.5.0"
4
+ VERSION = "2.6.0"
5
5
  end
data/lib/context_dev.rb CHANGED
@@ -56,10 +56,22 @@ require_relative "context_dev/models/ai_extract_product_params"
56
56
  require_relative "context_dev/models/ai_extract_product_response"
57
57
  require_relative "context_dev/models/ai_extract_products_params"
58
58
  require_relative "context_dev/models/ai_extract_products_response"
59
+ require_relative "context_dev/models/batch_cancel_params"
60
+ require_relative "context_dev/models/batch_cancel_response"
61
+ require_relative "context_dev/models/batch_get_results_params"
62
+ require_relative "context_dev/models/batch_get_results_response"
63
+ require_relative "context_dev/models/batch_list_params"
64
+ require_relative "context_dev/models/batch_list_response"
65
+ require_relative "context_dev/models/batch_retrieve_params"
66
+ require_relative "context_dev/models/batch_retrieve_response"
67
+ require_relative "context_dev/models/batch_submit_params"
68
+ require_relative "context_dev/models/batch_submit_response"
59
69
  require_relative "context_dev/models/brand_retrieve_params"
60
70
  require_relative "context_dev/models/brand_retrieve_response"
61
71
  require_relative "context_dev/models/brand_retrieve_simplified_params"
62
72
  require_relative "context_dev/models/brand_retrieve_simplified_response"
73
+ require_relative "context_dev/models/error"
74
+ require_relative "context_dev/models/error_count"
63
75
  require_relative "context_dev/models/industry_retrieve_naics_params"
64
76
  require_relative "context_dev/models/industry_retrieve_naics_response"
65
77
  require_relative "context_dev/models/industry_retrieve_sic_params"
@@ -119,6 +131,7 @@ require_relative "context_dev/models/web_web_scrape_sitemap_params"
119
131
  require_relative "context_dev/models/web_web_scrape_sitemap_response"
120
132
  require_relative "context_dev/models"
121
133
  require_relative "context_dev/resources/ai"
134
+ require_relative "context_dev/resources/batch"
122
135
  require_relative "context_dev/resources/brand"
123
136
  require_relative "context_dev/resources/industry"
124
137
  require_relative "context_dev/resources/monitors"
@@ -38,6 +38,9 @@ module ContextDev
38
38
  sig { returns(ContextDev::Resources::Monitors) }
39
39
  attr_reader :monitors
40
40
 
41
+ sig { returns(ContextDev::Resources::Batch) }
42
+ attr_reader :batch
43
+
41
44
  # @api private
42
45
  sig { override.returns(T::Hash[String, String]) }
43
46
  private def auth_headers
@@ -0,0 +1,40 @@
1
+ # typed: strong
2
+
3
+ module ContextDev
4
+ module Models
5
+ class BatchCancelParams < ContextDev::Internal::Type::BaseModel
6
+ extend ContextDev::Internal::Type::RequestParameters::Converter
7
+ include ContextDev::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(ContextDev::BatchCancelParams, ContextDev::Internal::AnyHash)
12
+ end
13
+
14
+ # ID of the batch to retrieve or cancel.
15
+ sig { returns(String) }
16
+ attr_accessor :batch_id
17
+
18
+ sig do
19
+ params(
20
+ batch_id: String,
21
+ request_options: ContextDev::RequestOptions::OrHash
22
+ ).returns(T.attached_class)
23
+ end
24
+ def self.new(
25
+ # ID of the batch to retrieve or cancel.
26
+ batch_id:,
27
+ request_options: {}
28
+ )
29
+ end
30
+
31
+ sig do
32
+ override.returns(
33
+ { batch_id: String, request_options: ContextDev::RequestOptions }
34
+ )
35
+ end
36
+ def to_hash
37
+ end
38
+ end
39
+ end
40
+ end