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
@@ -44,6 +44,34 @@ module ContextDev
44
44
  sig { returns(String) }
45
45
  attr_accessor :url
46
46
 
47
+ # One verified outcome per requested browser action, in request order.
48
+ sig do
49
+ returns(
50
+ T.nilable(
51
+ T::Array[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied]
52
+ )
53
+ )
54
+ end
55
+ attr_reader :actions_applied
56
+
57
+ sig do
58
+ params(
59
+ actions_applied:
60
+ T::Array[
61
+ ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::OrHash
62
+ ]
63
+ ).void
64
+ end
65
+ attr_writer :actions_applied
66
+
67
+ # True when an action was applied but the returned content could not be refreshed
68
+ # afterward.
69
+ sig { returns(T.nilable(T::Boolean)) }
70
+ attr_reader :actions_html_stale
71
+
72
+ sig { params(actions_html_stale: T::Boolean).void }
73
+ attr_writer :actions_html_stale
74
+
47
75
  # Metadata about the API key used for the request. Included in every response
48
76
  # whenever a valid API key is provided, even when the response status is not 200.
49
77
  sig do
@@ -70,6 +98,11 @@ module ContextDev
70
98
  success:
71
99
  ContextDev::Models::WebWebScrapeMdResponse::Success::OrBoolean,
72
100
  url: String,
101
+ actions_applied:
102
+ T::Array[
103
+ ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::OrHash
104
+ ],
105
+ actions_html_stale: T::Boolean,
73
106
  key_metadata:
74
107
  ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata::OrHash
75
108
  ).returns(T.attached_class)
@@ -87,6 +120,11 @@ module ContextDev
87
120
  success:,
88
121
  # The URL that was scraped
89
122
  url:,
123
+ # One verified outcome per requested browser action, in request order.
124
+ actions_applied: nil,
125
+ # True when an action was applied but the returned content could not be refreshed
126
+ # afterward.
127
+ actions_html_stale: nil,
90
128
  # Metadata about the API key used for the request. Included in every response
91
129
  # whenever a valid API key is provided, even when the response status is not 200.
92
130
  key_metadata: nil
@@ -102,6 +140,11 @@ module ContextDev
102
140
  success:
103
141
  ContextDev::Models::WebWebScrapeMdResponse::Success::TaggedBoolean,
104
142
  url: String,
143
+ actions_applied:
144
+ T::Array[
145
+ ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied
146
+ ],
147
+ actions_html_stale: T::Boolean,
105
148
  key_metadata:
106
149
  ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata
107
150
  }
@@ -598,6 +641,143 @@ module ContextDev
598
641
  end
599
642
  end
600
643
 
644
+ class ActionsApplied < ContextDev::Internal::Type::BaseModel
645
+ OrHash =
646
+ T.type_alias do
647
+ T.any(
648
+ ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied,
649
+ ContextDev::Internal::AnyHash
650
+ )
651
+ end
652
+
653
+ sig { returns(String) }
654
+ attr_accessor :instruction
655
+
656
+ # Applied means the requested page state was visibly verified. Failed means it was
657
+ # not verified. Skipped means it was not attempted.
658
+ sig do
659
+ returns(
660
+ ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status::TaggedSymbol
661
+ )
662
+ end
663
+ attr_accessor :status
664
+
665
+ # Visible page evidence used to verify an applied action.
666
+ sig { returns(T.nilable(String)) }
667
+ attr_reader :completion_evidence
668
+
669
+ sig { params(completion_evidence: String).void }
670
+ attr_writer :completion_evidence
671
+
672
+ sig { returns(T.nilable(Float)) }
673
+ attr_reader :duration_ms
674
+
675
+ sig { params(duration_ms: Float).void }
676
+ attr_writer :duration_ms
677
+
678
+ sig { returns(T.nilable(String)) }
679
+ attr_reader :error
680
+
681
+ sig { params(error: String).void }
682
+ attr_writer :error
683
+
684
+ sig { returns(T.nilable(String)) }
685
+ attr_reader :method_
686
+
687
+ sig { params(method_: String).void }
688
+ attr_writer :method_
689
+
690
+ sig { returns(T.nilable(String)) }
691
+ attr_reader :target_description
692
+
693
+ sig { params(target_description: String).void }
694
+ attr_writer :target_description
695
+
696
+ sig do
697
+ params(
698
+ instruction: String,
699
+ status:
700
+ ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status::OrSymbol,
701
+ completion_evidence: String,
702
+ duration_ms: Float,
703
+ error: String,
704
+ method_: String,
705
+ target_description: String
706
+ ).returns(T.attached_class)
707
+ end
708
+ def self.new(
709
+ instruction:,
710
+ # Applied means the requested page state was visibly verified. Failed means it was
711
+ # not verified. Skipped means it was not attempted.
712
+ status:,
713
+ # Visible page evidence used to verify an applied action.
714
+ completion_evidence: nil,
715
+ duration_ms: nil,
716
+ error: nil,
717
+ method_: nil,
718
+ target_description: nil
719
+ )
720
+ end
721
+
722
+ sig do
723
+ override.returns(
724
+ {
725
+ instruction: String,
726
+ status:
727
+ ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status::TaggedSymbol,
728
+ completion_evidence: String,
729
+ duration_ms: Float,
730
+ error: String,
731
+ method_: String,
732
+ target_description: String
733
+ }
734
+ )
735
+ end
736
+ def to_hash
737
+ end
738
+
739
+ # Applied means the requested page state was visibly verified. Failed means it was
740
+ # not verified. Skipped means it was not attempted.
741
+ module Status
742
+ extend ContextDev::Internal::Type::Enum
743
+
744
+ TaggedSymbol =
745
+ T.type_alias do
746
+ T.all(
747
+ Symbol,
748
+ ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status
749
+ )
750
+ end
751
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
752
+
753
+ APPLIED =
754
+ T.let(
755
+ :applied,
756
+ ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status::TaggedSymbol
757
+ )
758
+ FAILED =
759
+ T.let(
760
+ :failed,
761
+ ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status::TaggedSymbol
762
+ )
763
+ SKIPPED =
764
+ T.let(
765
+ :skipped,
766
+ ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status::TaggedSymbol
767
+ )
768
+
769
+ sig do
770
+ override.returns(
771
+ T::Array[
772
+ ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status::TaggedSymbol
773
+ ]
774
+ )
775
+ end
776
+ def self.values
777
+ end
778
+ end
779
+ end
780
+
601
781
  class KeyMetadata < ContextDev::Internal::Type::BaseModel
602
782
  OrHash =
603
783
  T.type_alias do
@@ -5,11 +5,25 @@ module ContextDev
5
5
 
6
6
  AIExtractProductsParams = ContextDev::Models::AIExtractProductsParams
7
7
 
8
+ BatchCancelParams = ContextDev::Models::BatchCancelParams
9
+
10
+ BatchGetResultsParams = ContextDev::Models::BatchGetResultsParams
11
+
12
+ BatchListParams = ContextDev::Models::BatchListParams
13
+
14
+ BatchRetrieveParams = ContextDev::Models::BatchRetrieveParams
15
+
16
+ BatchSubmitParams = ContextDev::Models::BatchSubmitParams
17
+
8
18
  BrandRetrieveParams = ContextDev::Models::BrandRetrieveParams
9
19
 
10
20
  BrandRetrieveSimplifiedParams =
11
21
  ContextDev::Models::BrandRetrieveSimplifiedParams
12
22
 
23
+ Error = ContextDev::Models::Error
24
+
25
+ ErrorCount = ContextDev::Models::ErrorCount
26
+
13
27
  IndustryRetrieveNaicsParams = ContextDev::Models::IndustryRetrieveNaicsParams
14
28
 
15
29
  IndustryRetrieveSicParams = ContextDev::Models::IndustryRetrieveSicParams
@@ -0,0 +1,120 @@
1
+ # typed: strong
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
+ sig do
10
+ params(
11
+ batch_id: String,
12
+ request_options: ContextDev::RequestOptions::OrHash
13
+ ).returns(ContextDev::Models::BatchRetrieveResponse)
14
+ end
15
+ def retrieve(
16
+ # ID of the batch to retrieve or cancel.
17
+ batch_id,
18
+ request_options: {}
19
+ )
20
+ end
21
+
22
+ # List your batches from newest to oldest. Filter by status or continue with a
23
+ # cursor.
24
+ sig do
25
+ params(
26
+ cursor: String,
27
+ limit: Integer,
28
+ q: String,
29
+ search_type: ContextDev::BatchListParams::SearchType::OrSymbol,
30
+ status: ContextDev::BatchListParams::Status::OrSymbol,
31
+ tags: String,
32
+ request_options: ContextDev::RequestOptions::OrHash
33
+ ).returns(ContextDev::Models::BatchListResponse)
34
+ end
35
+ def list(
36
+ # Cursor from the previous page.
37
+ cursor: nil,
38
+ # Batches per page. Defaults to 25.
39
+ limit: nil,
40
+ # Free-text search term, matched against the batch id, crawl source (start URL or
41
+ # sitemap domain), and tags.
42
+ q: nil,
43
+ # `prefix` for as-you-type prefix matching (default), `exact` for full-token
44
+ # matching.
45
+ search_type: nil,
46
+ # Filter by status.
47
+ status: nil,
48
+ # Comma-separated list of tags to filter by (matches batches having any of them).
49
+ tags: nil,
50
+ request_options: {}
51
+ )
52
+ end
53
+
54
+ # Stop a batch from starting new pages. In-progress pages finish, and unused
55
+ # credits are refunded.
56
+ sig do
57
+ params(
58
+ batch_id: String,
59
+ request_options: ContextDev::RequestOptions::OrHash
60
+ ).returns(ContextDev::Models::BatchCancelResponse)
61
+ end
62
+ def cancel(
63
+ # ID of the batch to retrieve or cancel.
64
+ batch_id,
65
+ request_options: {}
66
+ )
67
+ end
68
+
69
+ # Page through the result records of a finished batch as JSON, in the same order
70
+ # as the downloadable result files. Use this instead of downloading and parsing
71
+ # the NDJSON files yourself.
72
+ sig do
73
+ params(
74
+ batch_id: String,
75
+ cursor: String,
76
+ limit: Integer,
77
+ request_options: ContextDev::RequestOptions::OrHash
78
+ ).returns(ContextDev::Models::BatchGetResultsResponse)
79
+ end
80
+ def get_results(
81
+ # ID of the batch to retrieve or cancel.
82
+ batch_id,
83
+ # next_cursor from the previous page.
84
+ cursor: nil,
85
+ # Records per page. Defaults to 25. A page can close early so its payload stays
86
+ # under ~8 MB; rely on next_cursor rather than counting records.
87
+ limit: nil,
88
+ request_options: {}
89
+ )
90
+ end
91
+
92
+ # Retrieve and normalize a person profile from identifiers.
93
+ sig do
94
+ params(
95
+ identifiers: ContextDev::BatchSubmitParams::Identifiers::OrHash,
96
+ tags: T::Array[String],
97
+ timeout_ms: Integer,
98
+ request_options: ContextDev::RequestOptions::OrHash
99
+ ).returns(ContextDev::Models::BatchSubmitResponse)
100
+ end
101
+ def submit(
102
+ # Known identifiers for the person. At least one identifier is required.
103
+ identifiers:,
104
+ # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
105
+ tags: nil,
106
+ # Optional timeout in milliseconds for the request. If the request takes longer
107
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
108
+ # value is 300000ms (5 minutes).
109
+ timeout_ms: nil,
110
+ request_options: {}
111
+ )
112
+ end
113
+
114
+ # @api private
115
+ sig { params(client: ContextDev::Client).returns(T.attached_class) }
116
+ def self.new(client:)
117
+ end
118
+ end
119
+ end
120
+ end
@@ -12,38 +12,38 @@ module ContextDev
12
12
  # its initial baseline.
13
13
  sig do
14
14
  params(
15
- change_detection:
16
- T.any(
17
- ContextDev::MonitorCreateParams::ChangeDetection::Exact::OrHash,
18
- ContextDev::MonitorCreateParams::ChangeDetection::Semantic::OrHash
19
- ),
20
15
  name: String,
21
- schedule: ContextDev::MonitorCreateParams::Schedule::OrHash,
22
16
  target:
23
17
  T.any(
24
18
  ContextDev::MonitorCreateParams::Target::Page::OrHash,
25
19
  ContextDev::MonitorCreateParams::Target::Sitemap::OrHash,
26
20
  ContextDev::MonitorCreateParams::Target::Extract::OrHash
27
21
  ),
22
+ change_detection:
23
+ T.any(
24
+ ContextDev::MonitorCreateParams::ChangeDetection::Exact::OrHash,
25
+ ContextDev::MonitorCreateParams::ChangeDetection::Semantic::OrHash
26
+ ),
28
27
  mode: ContextDev::MonitorCreateParams::Mode::OrSymbol,
28
+ schedule: ContextDev::MonitorCreateParams::Schedule::OrHash,
29
29
  tags: T::Array[String],
30
30
  webhook: T.nilable(ContextDev::MonitorCreateParams::Webhook::OrHash),
31
31
  request_options: ContextDev::RequestOptions::OrHash
32
32
  ).returns(ContextDev::Models::MonitorCreateResponse)
33
33
  end
34
34
  def create(
35
- # Discriminated union describing how changes are detected.
36
- change_detection:,
37
35
  name:,
38
- # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
39
- # every 6 hours or every 2 days. The total interval (frequency × unit) must be
40
- # between 10 minutes and 1 year.
41
- schedule:,
42
36
  # Discriminated union describing what the monitor watches.
43
37
  target:,
38
+ # Discriminated union describing how changes are detected.
39
+ change_detection: nil,
44
40
  # Top-level monitor category. Always `web` today; the concrete behavior is
45
41
  # described by `target` and `change_detection`.
46
42
  mode: nil,
43
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
44
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
45
+ # between 10 minutes and 1 year.
46
+ schedule: nil,
47
47
  # User-defined tags for grouping and filtering monitors and their changes.
48
48
  # Duplicates are removed.
49
49
  tags: nil,
@@ -24,6 +24,8 @@ module ContextDev
24
24
 
25
25
  attr_reader monitors: ContextDev::Resources::Monitors
26
26
 
27
+ attr_reader batch: ContextDev::Resources::Batch
28
+
27
29
  private def auth_headers: -> ::Hash[String, String]
28
30
 
29
31
  def initialize: (
@@ -0,0 +1,23 @@
1
+ module ContextDev
2
+ module Models
3
+ type batch_cancel_params =
4
+ { batch_id: String } & ContextDev::Internal::Type::request_parameters
5
+
6
+ class BatchCancelParams < ContextDev::Internal::Type::BaseModel
7
+ extend ContextDev::Internal::Type::RequestParameters::Converter
8
+ include ContextDev::Internal::Type::RequestParameters
9
+
10
+ attr_accessor batch_id: String
11
+
12
+ def initialize: (
13
+ batch_id: String,
14
+ ?request_options: ContextDev::request_opts
15
+ ) -> void
16
+
17
+ def to_hash: -> {
18
+ batch_id: String,
19
+ request_options: ContextDev::RequestOptions
20
+ }
21
+ end
22
+ end
23
+ end