context.dev 2.20.0 → 2.21.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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +6 -0
  5. data/lib/context_dev/models/feedback_submit_params.rb +73 -0
  6. data/lib/context_dev/models/feedback_submit_response.rb +68 -0
  7. data/lib/context_dev/models/news_search_params.rb +13 -6
  8. data/lib/context_dev/models/web_scrape_params.rb +36 -30
  9. data/lib/context_dev/models/web_scrape_response.rb +114 -37
  10. data/lib/context_dev/models.rb +2 -0
  11. data/lib/context_dev/resources/feedback.rb +50 -0
  12. data/lib/context_dev/resources/news.rb +8 -4
  13. data/lib/context_dev/resources/web.rb +15 -9
  14. data/lib/context_dev/version.rb +1 -1
  15. data/lib/context_dev.rb +3 -0
  16. data/rbi/context_dev/client.rbi +5 -0
  17. data/rbi/context_dev/models/feedback_submit_params.rbi +133 -0
  18. data/rbi/context_dev/models/feedback_submit_response.rbi +122 -0
  19. data/rbi/context_dev/models/news_search_params.rbi +12 -6
  20. data/rbi/context_dev/models/web_scrape_params.rbi +55 -46
  21. data/rbi/context_dev/models/web_scrape_response.rbi +183 -69
  22. data/rbi/context_dev/models.rbi +2 -0
  23. data/rbi/context_dev/resources/feedback.rbi +42 -0
  24. data/rbi/context_dev/resources/news.rbi +7 -4
  25. data/rbi/context_dev/resources/web.rbi +26 -17
  26. data/sig/context_dev/client.rbs +2 -0
  27. data/sig/context_dev/models/feedback_submit_params.rbs +73 -0
  28. data/sig/context_dev/models/feedback_submit_response.rbs +58 -0
  29. data/sig/context_dev/models/web_scrape_response.rbs +81 -27
  30. data/sig/context_dev/models.rbs +2 -0
  31. data/sig/context_dev/resources/feedback.rbs +16 -0
  32. metadata +11 -2
@@ -20,9 +20,9 @@ module ContextDev
20
20
  required :cache_metadata, -> { ContextDev::Models::WebScrapeResponse::CacheMetadata }
21
21
 
22
22
  # @!attribute highlights
23
- # Plain-text passages relevant to highlightsParams.query, in page order, each
24
- # prefixed with its section heading in square brackets. Empty when the page has no
25
- # text.
23
+ # Relevant Markdown excerpts for your question or topic, in page order. Headings
24
+ # in square brackets supply necessary context; ellipses mark omitted portions.
25
+ # Empty when the page has no text.
26
26
  #
27
27
  # @return [ContextDev::Models::WebScrapeResponse::Highlights]
28
28
  required :highlights, -> { ContextDev::Models::WebScrapeResponse::Highlights }
@@ -40,10 +40,7 @@ module ContextDev
40
40
  required :images, -> { ContextDev::Models::WebScrapeResponse::Images }
41
41
 
42
42
  # @!attribute json
43
- # Page data extracted into jsonParams.schema, after shared content filters. Values
44
- # are grounded in the page; optional fields the page does not state are omitted,
45
- # or null when their type allows null. An empty object when the filters leave no
46
- # text.
43
+ # Page data extracted using your schema.
47
44
  #
48
45
  # @return [ContextDev::Models::WebScrapeResponse::Json]
49
46
  required :json, -> { ContextDev::Models::WebScrapeResponse::Json }
@@ -67,7 +64,7 @@ module ContextDev
67
64
  required :parsed, -> { ContextDev::Models::WebScrapeResponse::Parsed }
68
65
 
69
66
  # @!attribute product
70
- # Product detail page classification and the extracted product.
67
+ # Product details found on the page.
71
68
  #
72
69
  # @return [ContextDev::Models::WebScrapeResponse::Product]
73
70
  required :product, -> { ContextDev::Models::WebScrapeResponse::Product }
@@ -92,10 +89,11 @@ module ContextDev
92
89
  required :url, String
93
90
 
94
91
  # @!attribute is_partial
95
- # Present when return-partial captures a page that is still loading, returns
96
- # images before image processing finishes, or cuts product AI extraction short.
97
- # Also present if the optional product AI fallback fails. Partial responses are
98
- # not cached.
92
+ # Present when at least one requested output succeeds while another fails, or when
93
+ # successful outputs come from a page that is still loading or images returned
94
+ # before processing finished. Absent when every requested output fails. Check each
95
+ # output's success field for its result. Valid captured pieces may be cached
96
+ # independently; failed retrievals and incomplete captures are not cached.
99
97
  #
100
98
  # @return [Boolean, ContextDev::Models::WebScrapeResponse::IsPartial, nil]
101
99
  optional :is_partial, enum: -> { ContextDev::Models::WebScrapeResponse::IsPartial }, api_name: :isPartial
@@ -114,13 +112,13 @@ module ContextDev
114
112
  #
115
113
  # @param cache_metadata [ContextDev::Models::WebScrapeResponse::CacheMetadata] Cache outcome for this response. Composite responses are hits only when every ca
116
114
  #
117
- # @param highlights [ContextDev::Models::WebScrapeResponse::Highlights] Plain-text passages relevant to highlightsParams.query, in page order, each pref
115
+ # @param highlights [ContextDev::Models::WebScrapeResponse::Highlights] Relevant Markdown excerpts for your question or topic, in page order. Headings i
118
116
  #
119
117
  # @param html [ContextDev::Models::WebScrapeResponse::HTML] Rendered HTML after content filters.
120
118
  #
121
119
  # @param images [ContextDev::Models::WebScrapeResponse::Images] Images after content filters. Empty when none are found.
122
120
  #
123
- # @param json [ContextDev::Models::WebScrapeResponse::Json] Page data extracted into jsonParams.schema, after shared content filters. Values
121
+ # @param json [ContextDev::Models::WebScrapeResponse::Json] Page data extracted using your schema.
124
122
  #
125
123
  # @param markdown [ContextDev::Models::WebScrapeResponse::Markdown] Markdown after content filters.
126
124
  #
@@ -128,7 +126,7 @@ module ContextDev
128
126
  #
129
127
  # @param parsed [ContextDev::Models::WebScrapeResponse::Parsed] Fields produced by parseParams.rules, after shared content filters.
130
128
  #
131
- # @param product [ContextDev::Models::WebScrapeResponse::Product] Product detail page classification and the extracted product.
129
+ # @param product [ContextDev::Models::WebScrapeResponse::Product] Product details found on the page.
132
130
  #
133
131
  # @param request_id [String] Unique id of this API call, also sent in the X-Request-Id response header. Quote
134
132
  #
@@ -136,7 +134,7 @@ module ContextDev
136
134
  #
137
135
  # @param url [String] Final URL after redirects and browser actions.
138
136
  #
139
- # @param is_partial [Boolean, ContextDev::Models::WebScrapeResponse::IsPartial] Present when return-partial captures a page that is still loading, returns image
137
+ # @param is_partial [Boolean, ContextDev::Models::WebScrapeResponse::IsPartial] Present when at least one requested output succeeds while another fails, or when
140
138
  #
141
139
  # @param key_metadata [ContextDev::Models::WebScrapeResponse::KeyMetadata] Credit usage, included whenever a valid API key is provided.
142
140
 
@@ -152,12 +150,21 @@ module ContextDev
152
150
  # @return [Boolean]
153
151
  required :requested, ContextDev::Internal::Type::Boolean
154
152
 
155
- # @!method initialize(data:, requested:)
153
+ # @!attribute success
154
+ # True when retrieved, false when retrieval failed, and null when not requested.
155
+ #
156
+ # @return [Boolean, nil]
157
+ required :success, ContextDev::Internal::Type::Boolean, nil?: true
158
+
159
+ # @!method initialize(data:, requested:, success:)
156
160
  # Original HTTP response body. Waiting, actions, and content filters never change
157
161
  # it.
158
162
  #
159
163
  # @param data [ContextDev::Models::WebScrapeResponse::Bytes::Data, nil]
164
+ #
160
165
  # @param requested [Boolean]
166
+ #
167
+ # @param success [Boolean, nil] True when retrieved, false when retrieval failed, and null when not requested.
161
168
 
162
169
  # @see ContextDev::Models::WebScrapeResponse::Bytes#data
163
170
  class Data < ContextDev::Internal::Type::BaseModel
@@ -238,13 +245,22 @@ module ContextDev
238
245
  # @return [Boolean]
239
246
  required :requested, ContextDev::Internal::Type::Boolean
240
247
 
241
- # @!method initialize(data:, requested:)
242
- # Plain-text passages relevant to highlightsParams.query, in page order, each
243
- # prefixed with its section heading in square brackets. Empty when the page has no
244
- # text.
248
+ # @!attribute success
249
+ # True when retrieved, false when retrieval failed, and null when not requested.
250
+ #
251
+ # @return [Boolean, nil]
252
+ required :success, ContextDev::Internal::Type::Boolean, nil?: true
253
+
254
+ # @!method initialize(data:, requested:, success:)
255
+ # Relevant Markdown excerpts for your question or topic, in page order. Headings
256
+ # in square brackets supply necessary context; ellipses mark omitted portions.
257
+ # Empty when the page has no text.
245
258
  #
246
259
  # @param data [Array<String>, nil]
260
+ #
247
261
  # @param requested [Boolean]
262
+ #
263
+ # @param success [Boolean, nil] True when retrieved, false when retrieval failed, and null when not requested.
248
264
  end
249
265
 
250
266
  # @see ContextDev::Models::WebScrapeResponse#html
@@ -259,11 +275,20 @@ module ContextDev
259
275
  # @return [Boolean]
260
276
  required :requested, ContextDev::Internal::Type::Boolean
261
277
 
262
- # @!method initialize(data:, requested:)
278
+ # @!attribute success
279
+ # True when retrieved, false when retrieval failed, and null when not requested.
280
+ #
281
+ # @return [Boolean, nil]
282
+ required :success, ContextDev::Internal::Type::Boolean, nil?: true
283
+
284
+ # @!method initialize(data:, requested:, success:)
263
285
  # Rendered HTML after content filters.
264
286
  #
265
287
  # @param data [String, nil]
288
+ #
266
289
  # @param requested [Boolean]
290
+ #
291
+ # @param success [Boolean, nil] True when retrieved, false when retrieval failed, and null when not requested.
267
292
  end
268
293
 
269
294
  # @see ContextDev::Models::WebScrapeResponse#images
@@ -280,11 +305,20 @@ module ContextDev
280
305
  # @return [Boolean]
281
306
  required :requested, ContextDev::Internal::Type::Boolean
282
307
 
283
- # @!method initialize(data:, requested:)
308
+ # @!attribute success
309
+ # True when retrieved, false when retrieval failed, and null when not requested.
310
+ #
311
+ # @return [Boolean, nil]
312
+ required :success, ContextDev::Internal::Type::Boolean, nil?: true
313
+
314
+ # @!method initialize(data:, requested:, success:)
284
315
  # Images after content filters. Empty when none are found.
285
316
  #
286
317
  # @param data [Array<ContextDev::Models::WebScrapeResponse::Images::Data>, nil]
318
+ #
287
319
  # @param requested [Boolean]
320
+ #
321
+ # @param success [Boolean, nil] True when retrieved, false when retrieval failed, and null when not requested.
288
322
 
289
323
  class Data < ContextDev::Internal::Type::BaseModel
290
324
  # @!attribute alt
@@ -368,14 +402,20 @@ module ContextDev
368
402
  # @return [Boolean]
369
403
  required :requested, ContextDev::Internal::Type::Boolean
370
404
 
371
- # @!method initialize(data:, requested:)
372
- # Page data extracted into jsonParams.schema, after shared content filters. Values
373
- # are grounded in the page; optional fields the page does not state are omitted,
374
- # or null when their type allows null. An empty object when the filters leave no
375
- # text.
405
+ # @!attribute success
406
+ # True when retrieved, false when retrieval failed, and null when not requested.
407
+ #
408
+ # @return [Boolean, nil]
409
+ required :success, ContextDev::Internal::Type::Boolean, nil?: true
410
+
411
+ # @!method initialize(data:, requested:, success:)
412
+ # Page data extracted using your schema.
376
413
  #
377
414
  # @param data [Hash{Symbol=>Object}, nil]
415
+ #
378
416
  # @param requested [Boolean]
417
+ #
418
+ # @param success [Boolean, nil] True when retrieved, false when retrieval failed, and null when not requested.
379
419
  end
380
420
 
381
421
  # @see ContextDev::Models::WebScrapeResponse#markdown
@@ -390,11 +430,20 @@ module ContextDev
390
430
  # @return [Boolean]
391
431
  required :requested, ContextDev::Internal::Type::Boolean
392
432
 
393
- # @!method initialize(data:, requested:)
433
+ # @!attribute success
434
+ # True when retrieved, false when retrieval failed, and null when not requested.
435
+ #
436
+ # @return [Boolean, nil]
437
+ required :success, ContextDev::Internal::Type::Boolean, nil?: true
438
+
439
+ # @!method initialize(data:, requested:, success:)
394
440
  # Markdown after content filters.
395
441
  #
396
442
  # @param data [String, nil]
443
+ #
397
444
  # @param requested [Boolean]
445
+ #
446
+ # @param success [Boolean, nil] True when retrieved, false when retrieval failed, and null when not requested.
398
447
  end
399
448
 
400
449
  # @see ContextDev::Models::WebScrapeResponse#metadata
@@ -668,11 +717,20 @@ module ContextDev
668
717
  # @return [Boolean]
669
718
  required :requested, ContextDev::Internal::Type::Boolean
670
719
 
671
- # @!method initialize(data:, requested:)
720
+ # @!attribute success
721
+ # True when retrieved, false when retrieval failed, and null when not requested.
722
+ #
723
+ # @return [Boolean, nil]
724
+ required :success, ContextDev::Internal::Type::Boolean, nil?: true
725
+
726
+ # @!method initialize(data:, requested:, success:)
672
727
  # Fields produced by parseParams.rules, after shared content filters.
673
728
  #
674
729
  # @param data [Hash{Symbol=>Object}, nil]
730
+ #
675
731
  # @param requested [Boolean]
732
+ #
733
+ # @param success [Boolean, nil] True when retrieved, false when retrieval failed, and null when not requested.
676
734
  end
677
735
 
678
736
  # @see ContextDev::Models::WebScrapeResponse#product
@@ -687,11 +745,20 @@ module ContextDev
687
745
  # @return [Boolean]
688
746
  required :requested, ContextDev::Internal::Type::Boolean
689
747
 
690
- # @!method initialize(data:, requested:)
691
- # Product detail page classification and the extracted product.
748
+ # @!attribute success
749
+ # True when retrieved, false when retrieval failed, and null when not requested.
750
+ #
751
+ # @return [Boolean, nil]
752
+ required :success, ContextDev::Internal::Type::Boolean, nil?: true
753
+
754
+ # @!method initialize(data:, requested:, success:)
755
+ # Product details found on the page.
692
756
  #
693
757
  # @param data [ContextDev::Models::WebScrapeResponse::Product::Data, nil]
758
+ #
694
759
  # @param requested [Boolean]
760
+ #
761
+ # @param success [Boolean, nil] True when retrieved, false when retrieval failed, and null when not requested.
695
762
 
696
763
  # @see ContextDev::Models::WebScrapeResponse::Product#data
697
764
  class Data < ContextDev::Internal::Type::BaseModel
@@ -926,17 +993,27 @@ module ContextDev
926
993
  # @return [Boolean]
927
994
  required :requested, ContextDev::Internal::Type::Boolean
928
995
 
929
- # @!method initialize(data:, requested:)
996
+ # @!attribute success
997
+ # True when retrieved, false when retrieval failed, and null when not requested.
998
+ #
999
+ # @return [Boolean, nil]
1000
+ required :success, ContextDev::Internal::Type::Boolean, nil?: true
1001
+
1002
+ # @!method initialize(data:, requested:, success:)
930
1003
  # An image data URL. Use directly as an image src.
931
1004
  #
932
1005
  # @param data [String, nil]
1006
+ #
933
1007
  # @param requested [Boolean]
1008
+ #
1009
+ # @param success [Boolean, nil] True when retrieved, false when retrieval failed, and null when not requested.
934
1010
  end
935
1011
 
936
- # Present when return-partial captures a page that is still loading, returns
937
- # images before image processing finishes, or cuts product AI extraction short.
938
- # Also present if the optional product AI fallback fails. Partial responses are
939
- # not cached.
1012
+ # Present when at least one requested output succeeds while another fails, or when
1013
+ # successful outputs come from a page that is still loading or images returned
1014
+ # before processing finished. Absent when every requested output fails. Check each
1015
+ # output's success field for its result. Valid captured pieces may be cached
1016
+ # independently; failed retrievals and incomplete captures are not cached.
940
1017
  #
941
1018
  # @see ContextDev::Models::WebScrapeResponse#is_partial
942
1019
  module IsPartial
@@ -59,6 +59,8 @@ module ContextDev
59
59
 
60
60
  Failure = ContextDev::Models::Failure
61
61
 
62
+ FeedbackSubmitParams = ContextDev::Models::FeedbackSubmitParams
63
+
62
64
  IndustryRetrieveNaicsParams = ContextDev::Models::IndustryRetrieveNaicsParams
63
65
 
64
66
  IndustryRetrieveSicParams = ContextDev::Models::IndustryRetrieveSicParams
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ContextDev
4
+ module Resources
5
+ # Report bugs, docs mismatches, and friction with any Context.dev API. Submissions
6
+ # cost no credits and use a separate rate limit.
7
+ class Feedback
8
+ # Some parameter documentations has been truncated, see
9
+ # {ContextDev::Models::FeedbackSubmitParams} for more details.
10
+ #
11
+ # Report a problem with a Context.dev API call, docs page, SDK, or CLI. Include
12
+ # request_id, url, or both.
13
+ #
14
+ # @overload submit(category:, note:, request_id: nil, tags: nil, url: nil, request_options: {})
15
+ #
16
+ # @param category [Symbol, ContextDev::Models::FeedbackSubmitParams::Category] Kind of issue.
17
+ #
18
+ # @param note [String] What went wrong and what you expected instead.
19
+ #
20
+ # @param request_id [String] The request_id of the API call the feedback is about, from its response body or
21
+ #
22
+ # @param tags [Array<String>] Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
23
+ #
24
+ # @param url [String] The page the feedback is about, such as one page of a crawl or a docs page.
25
+ #
26
+ # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
27
+ #
28
+ # @return [ContextDev::Models::FeedbackSubmitResponse]
29
+ #
30
+ # @see ContextDev::Models::FeedbackSubmitParams
31
+ def submit(params)
32
+ parsed, options = ContextDev::FeedbackSubmitParams.dump_request(params)
33
+ @client.request(
34
+ method: :post,
35
+ path: "feedback",
36
+ body: parsed,
37
+ model: ContextDev::Models::FeedbackSubmitResponse,
38
+ options: options
39
+ )
40
+ end
41
+
42
+ # @api private
43
+ #
44
+ # @param client [ContextDev::Client]
45
+ def initialize(client:)
46
+ @client = client
47
+ end
48
+ end
49
+ end
50
+ end
@@ -4,11 +4,15 @@ module ContextDev
4
4
  module Resources
5
5
  # Search live first-party RSS and free historical news data by company identity.
6
6
  class News
7
+ # Some parameter documentations has been truncated, see
8
+ # {ContextDev::Models::NewsSearchParams} for more details.
9
+ #
7
10
  # Searches live and historical company news for one company, identified in
8
11
  # searchBy by name, domain, ticker (optionally disambiguated by exchange), or
9
- # ISIN. Results can be filtered by publisher domain, publisher country, article
10
- # language, article type, and published-at date, and include stable story IDs,
11
- # source metadata, verified entity relevance, and cursor pagination.
12
+ # ISIN. Results can be filtered by one of publisher domain, publisher country,
13
+ # article language, or article type, optionally combined with a published-at date
14
+ # range, and include stable story IDs, source metadata, verified entity relevance,
15
+ # and cursor pagination.
12
16
  #
13
17
  # @overload search(search_by:, cursor: nil, filter_by: nil, limit: nil, sort_by: nil, tags: nil, request_options: {})
14
18
  #
@@ -16,7 +20,7 @@ module ContextDev
16
20
  #
17
21
  # @param cursor [String, nil] Opaque next_cursor from the previous response, or null for the first page.
18
22
  #
19
- # @param filter_by [ContextDev::Models::NewsSearchParams::FilterBy] Optional result filters.
23
+ # @param filter_by [ContextDev::Models::NewsSearchParams::FilterBy] Optional result filters. Use at most one of sourceDomain, sourceCountry, article
20
24
  #
21
25
  # @param limit [Integer] Maximum results to return. Defaults to 10.
22
26
  #
@@ -186,15 +186,21 @@ module ContextDev
186
186
  # is shared with Markdown, parsed fields, product data, highlights, and JSON
187
187
  # extraction. Cached outputs can come from different visits within maxAgeMs; use 0
188
188
  # for a fresh capture. HTML-only requests use the existing fast acquisition path.
189
- # Highlights return the plain-text passages most relevant to
190
- # highlightsParams.query. One credit per request, including cache hits and missing
191
- # pages, or two with browser actions; highlights add 3 credits when passages are
192
- # returned; JSON extraction adds four credits and runs an LLM over the page
193
- # Markdown on every request that has text to extract; PDF OCR adds one credit per
194
- # recovered page on fresh extraction; the product output adds one credit, plus six
195
- # more when the specialized model is used. Original response bytes and screenshots
196
- # are limited to 20 MiB each, screenshots to 40 megapixels, and the combined
197
- # browser capture to 60 MiB.
189
+ # Highlights return Markdown excerpts most relevant to highlightsParams.query.
190
+ # Requests with at least one successful output cost one base credit, including
191
+ # cache hits, or two with browser actions. All-failed responses are unbilled
192
+ # except missing pages, which retain the base price and the one-credit product
193
+ # charge when product was requested. Highlights add 3 credits when passages are
194
+ # returned. JSON extraction runs an LLM over nonempty page Markdown and adds four
195
+ # credits only when its result is returned successfully. PDF OCR adds one credit
196
+ # per recovered page on fresh extraction. Product adds one credit when its
197
+ # successful result is returned, plus six if that result used the specialized
198
+ # model. Original response bytes and screenshots are limited to 20 MiB each,
199
+ # screenshots to 40 megapixels, and the combined response to 60 MiB. An oversized
200
+ # output has success: false and data: null. If the combined response exceeds its
201
+ # limit, the largest outputs are marked failed until the remaining outputs fit.
202
+ # Valid captured pieces may still be cached when omitted to meet the response size
203
+ # limit.
198
204
  #
199
205
  # @overload scrape(formats:, url:, highlights_params: nil, image_params: nil, json_params: nil, markdown_params: nil, max_age_ms: nil, parse_params: nil, product_params: nil, screenshot_params: nil, shared_params: nil, tags: nil, timeout_opts: nil, zdr: nil, request_options: {})
200
206
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ContextDev
4
- VERSION = "2.20.0"
4
+ VERSION = "2.21.0"
5
5
  end
data/lib/context_dev.rb CHANGED
@@ -71,6 +71,8 @@ require_relative "context_dev/models/brand_search_params"
71
71
  require_relative "context_dev/models/brand_search_response"
72
72
  require_relative "context_dev/models/crawl_controls"
73
73
  require_relative "context_dev/models/failure"
74
+ require_relative "context_dev/models/feedback_submit_params"
75
+ require_relative "context_dev/models/feedback_submit_response"
74
76
  require_relative "context_dev/models/industry_retrieve_naics_params"
75
77
  require_relative "context_dev/models/industry_retrieve_naics_response"
76
78
  require_relative "context_dev/models/industry_retrieve_sic_params"
@@ -150,6 +152,7 @@ require_relative "context_dev/models/web_web_crawl_md_response"
150
152
  require_relative "context_dev/models"
151
153
  require_relative "context_dev/resources/batch"
152
154
  require_relative "context_dev/resources/brand"
155
+ require_relative "context_dev/resources/feedback"
153
156
  require_relative "context_dev/resources/industry"
154
157
  require_relative "context_dev/resources/logs"
155
158
  require_relative "context_dev/resources/monitors"
@@ -54,6 +54,11 @@ module ContextDev
54
54
  sig { returns(ContextDev::Resources::Logs) }
55
55
  attr_reader :logs
56
56
 
57
+ # Report bugs, docs mismatches, and friction with any Context.dev API. Submissions
58
+ # cost no credits and use a separate rate limit.
59
+ sig { returns(ContextDev::Resources::Feedback) }
60
+ attr_reader :feedback
61
+
57
62
  # @api private
58
63
  sig { override.returns(T::Hash[String, String]) }
59
64
  private def auth_headers
@@ -0,0 +1,133 @@
1
+ # typed: strong
2
+
3
+ module ContextDev
4
+ module Models
5
+ class FeedbackSubmitParams < 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::FeedbackSubmitParams, ContextDev::Internal::AnyHash)
12
+ end
13
+
14
+ # Kind of issue.
15
+ sig { returns(ContextDev::FeedbackSubmitParams::Category::OrSymbol) }
16
+ attr_accessor :category
17
+
18
+ # What went wrong and what you expected instead.
19
+ sig { returns(String) }
20
+ attr_accessor :note
21
+
22
+ # The request_id of the API call the feedback is about, from its response body or
23
+ # X-Request-Id header.
24
+ sig { returns(T.nilable(String)) }
25
+ attr_reader :request_id
26
+
27
+ sig { params(request_id: String).void }
28
+ attr_writer :request_id
29
+
30
+ # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
31
+ sig { returns(T.nilable(T::Array[String])) }
32
+ attr_reader :tags
33
+
34
+ sig { params(tags: T::Array[String]).void }
35
+ attr_writer :tags
36
+
37
+ # The page the feedback is about, such as one page of a crawl or a docs page.
38
+ sig { returns(T.nilable(String)) }
39
+ attr_reader :url
40
+
41
+ sig { params(url: String).void }
42
+ attr_writer :url
43
+
44
+ sig do
45
+ params(
46
+ category: ContextDev::FeedbackSubmitParams::Category::OrSymbol,
47
+ note: String,
48
+ request_id: String,
49
+ tags: T::Array[String],
50
+ url: String,
51
+ request_options: ContextDev::RequestOptions::OrHash
52
+ ).returns(T.attached_class)
53
+ end
54
+ def self.new(
55
+ # Kind of issue.
56
+ category:,
57
+ # What went wrong and what you expected instead.
58
+ note:,
59
+ # The request_id of the API call the feedback is about, from its response body or
60
+ # X-Request-Id header.
61
+ request_id: nil,
62
+ # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
63
+ tags: nil,
64
+ # The page the feedback is about, such as one page of a crawl or a docs page.
65
+ url: nil,
66
+ request_options: {}
67
+ )
68
+ end
69
+
70
+ sig do
71
+ override.returns(
72
+ {
73
+ category: ContextDev::FeedbackSubmitParams::Category::OrSymbol,
74
+ note: String,
75
+ request_id: String,
76
+ tags: T::Array[String],
77
+ url: String,
78
+ request_options: ContextDev::RequestOptions
79
+ }
80
+ )
81
+ end
82
+ def to_hash
83
+ end
84
+
85
+ # Kind of issue.
86
+ module Category
87
+ extend ContextDev::Internal::Type::Enum
88
+
89
+ TaggedSymbol =
90
+ T.type_alias do
91
+ T.all(Symbol, ContextDev::FeedbackSubmitParams::Category)
92
+ end
93
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
94
+
95
+ BUG =
96
+ T.let(:bug, ContextDev::FeedbackSubmitParams::Category::TaggedSymbol)
97
+ DOCS_MISMATCH =
98
+ T.let(
99
+ :docs_mismatch,
100
+ ContextDev::FeedbackSubmitParams::Category::TaggedSymbol
101
+ )
102
+ FRICTION =
103
+ T.let(
104
+ :friction,
105
+ ContextDev::FeedbackSubmitParams::Category::TaggedSymbol
106
+ )
107
+ FEATURE_GAP =
108
+ T.let(
109
+ :feature_gap,
110
+ ContextDev::FeedbackSubmitParams::Category::TaggedSymbol
111
+ )
112
+ QUALITY_DEGRADATION =
113
+ T.let(
114
+ :quality_degradation,
115
+ ContextDev::FeedbackSubmitParams::Category::TaggedSymbol
116
+ )
117
+ OTHER =
118
+ T.let(
119
+ :other,
120
+ ContextDev::FeedbackSubmitParams::Category::TaggedSymbol
121
+ )
122
+
123
+ sig do
124
+ override.returns(
125
+ T::Array[ContextDev::FeedbackSubmitParams::Category::TaggedSymbol]
126
+ )
127
+ end
128
+ def self.values
129
+ end
130
+ end
131
+ end
132
+ end
133
+ end