context.dev 2.2.0 → 2.3.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 +14 -0
- data/README.md +1 -1
- data/lib/context_dev/client.rb +7 -2
- data/lib/context_dev/internal/type/base_model.rb +5 -5
- data/lib/context_dev/models/monitor_create_params.rb +28 -3
- data/lib/context_dev/models/monitor_create_response.rb +96 -4
- data/lib/context_dev/models/monitor_list_account_runs_response.rb +19 -98
- data/lib/context_dev/models/monitor_list_response.rb +100 -4
- data/lib/context_dev/models/monitor_list_runs_response.rb +19 -96
- data/lib/context_dev/models/monitor_retrieve_change_response.rb +10 -10
- data/lib/context_dev/models/monitor_retrieve_response.rb +97 -4
- data/lib/context_dev/models/monitor_update_params.rb +28 -3
- data/lib/context_dev/models/monitor_update_response.rb +96 -4
- data/lib/context_dev/models/parse_handle_params.rb +110 -0
- data/lib/context_dev/models/parse_handle_response.rb +132 -0
- data/lib/context_dev/models/web_web_crawl_md_params.rb +16 -6
- data/lib/context_dev/models/web_web_scrape_html_params.rb +16 -6
- data/lib/context_dev/models/web_web_scrape_md_params.rb +16 -6
- data/lib/context_dev/models/web_web_scrape_md_response.rb +11 -1
- data/lib/context_dev/models/webhook_delivery.rb +109 -0
- data/lib/context_dev/models.rb +4 -0
- data/lib/context_dev/resources/monitors.rb +3 -2
- data/lib/context_dev/resources/parse.rb +63 -0
- data/lib/context_dev/resources/web.rb +19 -4
- data/lib/context_dev/version.rb +1 -1
- data/lib/context_dev.rb +4 -0
- data/rbi/context_dev/client.rbi +6 -2
- data/rbi/context_dev/models/monitor_create_params.rbi +85 -5
- data/rbi/context_dev/models/monitor_create_response.rbi +234 -6
- data/rbi/context_dev/models/monitor_list_account_runs_response.rbi +27 -192
- data/rbi/context_dev/models/monitor_list_response.rbi +235 -5
- data/rbi/context_dev/models/monitor_list_runs_response.rbi +27 -192
- data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +12 -15
- data/rbi/context_dev/models/monitor_retrieve_response.rbi +234 -6
- data/rbi/context_dev/models/monitor_update_params.rbi +85 -5
- data/rbi/context_dev/models/monitor_update_response.rbi +234 -6
- data/rbi/context_dev/models/parse_handle_params.rbi +163 -0
- data/rbi/context_dev/models/parse_handle_response.rbi +377 -0
- data/rbi/context_dev/models/web_web_crawl_md_params.rbi +26 -7
- data/rbi/context_dev/models/web_web_scrape_html_params.rbi +26 -7
- data/rbi/context_dev/models/web_web_scrape_md_params.rbi +26 -7
- data/rbi/context_dev/models/web_web_scrape_md_response.rbi +12 -0
- data/rbi/context_dev/models/webhook_delivery.rbi +172 -0
- data/rbi/context_dev/models.rbi +4 -0
- data/rbi/context_dev/resources/monitors.rbi +3 -2
- data/rbi/context_dev/resources/parse.rbi +65 -0
- data/rbi/context_dev/resources/web.rbi +22 -7
- data/sig/context_dev/client.rbs +2 -0
- data/sig/context_dev/models/monitor_create_params.rbs +32 -3
- data/sig/context_dev/models/monitor_create_response.rbs +85 -6
- data/sig/context_dev/models/monitor_list_account_runs_response.rbs +15 -68
- data/sig/context_dev/models/monitor_list_response.rbs +85 -6
- data/sig/context_dev/models/monitor_list_runs_response.rbs +15 -68
- data/sig/context_dev/models/monitor_retrieve_change_response.rbs +8 -10
- data/sig/context_dev/models/monitor_retrieve_response.rbs +85 -6
- data/sig/context_dev/models/monitor_update_params.rbs +32 -3
- data/sig/context_dev/models/monitor_update_response.rbs +85 -6
- data/sig/context_dev/models/parse_handle_params.rbs +96 -0
- data/sig/context_dev/models/parse_handle_response.rbs +159 -0
- data/sig/context_dev/models/web_web_crawl_md_params.rbs +13 -2
- data/sig/context_dev/models/web_web_scrape_html_params.rbs +13 -2
- data/sig/context_dev/models/web_web_scrape_md_params.rbs +13 -2
- data/sig/context_dev/models/web_web_scrape_md_response.rbs +5 -0
- data/sig/context_dev/models/webhook_delivery.rbs +81 -0
- data/sig/context_dev/models.rbs +4 -0
- data/sig/context_dev/resources/parse.rbs +22 -0
- metadata +14 -2
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ContextDev
|
|
4
|
+
module Models
|
|
5
|
+
# @see ContextDev::Resources::Parse#handle
|
|
6
|
+
class ParseHandleResponse < ContextDev::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute markdown
|
|
8
|
+
# Input bytes converted to GitHub Flavored Markdown
|
|
9
|
+
#
|
|
10
|
+
# @return [String]
|
|
11
|
+
required :markdown, String
|
|
12
|
+
|
|
13
|
+
# @!attribute success
|
|
14
|
+
# Indicates success
|
|
15
|
+
#
|
|
16
|
+
# @return [Boolean, ContextDev::Models::ParseHandleResponse::Success]
|
|
17
|
+
required :success, enum: -> { ContextDev::Models::ParseHandleResponse::Success }
|
|
18
|
+
|
|
19
|
+
# @!attribute type
|
|
20
|
+
# Detected content type used for parsing
|
|
21
|
+
#
|
|
22
|
+
# @return [Symbol, ContextDev::Models::ParseHandleResponse::Type]
|
|
23
|
+
required :type, enum: -> { ContextDev::Models::ParseHandleResponse::Type }
|
|
24
|
+
|
|
25
|
+
# @!attribute key_metadata
|
|
26
|
+
# Metadata about the API key used for the request. Included in every response
|
|
27
|
+
# whenever a valid API key is provided, even when the response status is not 200.
|
|
28
|
+
#
|
|
29
|
+
# @return [ContextDev::Models::ParseHandleResponse::KeyMetadata, nil]
|
|
30
|
+
optional :key_metadata, -> { ContextDev::Models::ParseHandleResponse::KeyMetadata }
|
|
31
|
+
|
|
32
|
+
# @!method initialize(markdown:, success:, type:, key_metadata: nil)
|
|
33
|
+
# Some parameter documentations has been truncated, see
|
|
34
|
+
# {ContextDev::Models::ParseHandleResponse} for more details.
|
|
35
|
+
#
|
|
36
|
+
# @param markdown [String] Input bytes converted to GitHub Flavored Markdown
|
|
37
|
+
#
|
|
38
|
+
# @param success [Boolean, ContextDev::Models::ParseHandleResponse::Success] Indicates success
|
|
39
|
+
#
|
|
40
|
+
# @param type [Symbol, ContextDev::Models::ParseHandleResponse::Type] Detected content type used for parsing
|
|
41
|
+
#
|
|
42
|
+
# @param key_metadata [ContextDev::Models::ParseHandleResponse::KeyMetadata] Metadata about the API key used for the request. Included in every response when
|
|
43
|
+
|
|
44
|
+
# Indicates success
|
|
45
|
+
#
|
|
46
|
+
# @see ContextDev::Models::ParseHandleResponse#success
|
|
47
|
+
module Success
|
|
48
|
+
extend ContextDev::Internal::Type::Enum
|
|
49
|
+
|
|
50
|
+
TRUE = true
|
|
51
|
+
|
|
52
|
+
# @!method self.values
|
|
53
|
+
# @return [Array<Boolean>]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Detected content type used for parsing
|
|
57
|
+
#
|
|
58
|
+
# @see ContextDev::Models::ParseHandleResponse#type
|
|
59
|
+
module Type
|
|
60
|
+
extend ContextDev::Internal::Type::Enum
|
|
61
|
+
|
|
62
|
+
HTML = :html
|
|
63
|
+
XML = :xml
|
|
64
|
+
JSON = :json
|
|
65
|
+
JSONL = :jsonl
|
|
66
|
+
TEXT = :text
|
|
67
|
+
CSV = :csv
|
|
68
|
+
TSV = :tsv
|
|
69
|
+
MARKDOWN = :markdown
|
|
70
|
+
YAML = :yaml
|
|
71
|
+
PYTHON = :python
|
|
72
|
+
JAVA = :java
|
|
73
|
+
JAVASCRIPT = :javascript
|
|
74
|
+
PHP = :php
|
|
75
|
+
SHELL = :shell
|
|
76
|
+
RUBY = :ruby
|
|
77
|
+
TYPESCRIPT = :typescript
|
|
78
|
+
RTF = :rtf
|
|
79
|
+
SRT = :srt
|
|
80
|
+
CSS = :css
|
|
81
|
+
SCSS = :scss
|
|
82
|
+
LESS = :less
|
|
83
|
+
STYLUS = :stylus
|
|
84
|
+
SASS = :sass
|
|
85
|
+
SVG = :svg
|
|
86
|
+
PDF = :pdf
|
|
87
|
+
DOCX = :docx
|
|
88
|
+
DOC = :doc
|
|
89
|
+
XLSX = :xlsx
|
|
90
|
+
XLS = :xls
|
|
91
|
+
PPTX = :pptx
|
|
92
|
+
PPT = :ppt
|
|
93
|
+
JPG = :jpg
|
|
94
|
+
PNG = :png
|
|
95
|
+
GIF = :gif
|
|
96
|
+
BMP = :bmp
|
|
97
|
+
TIFF = :tiff
|
|
98
|
+
WEBP = :webp
|
|
99
|
+
PPM = :ppm
|
|
100
|
+
PBM = :pbm
|
|
101
|
+
PGM = :pgm
|
|
102
|
+
PNM = :pnm
|
|
103
|
+
|
|
104
|
+
# @!method self.values
|
|
105
|
+
# @return [Array<Symbol>]
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# @see ContextDev::Models::ParseHandleResponse#key_metadata
|
|
109
|
+
class KeyMetadata < ContextDev::Internal::Type::BaseModel
|
|
110
|
+
# @!attribute credits_consumed
|
|
111
|
+
# The number of credits consumed by this request.
|
|
112
|
+
#
|
|
113
|
+
# @return [Integer]
|
|
114
|
+
required :credits_consumed, Integer
|
|
115
|
+
|
|
116
|
+
# @!attribute credits_remaining
|
|
117
|
+
# The number of credits remaining for your organization after this request.
|
|
118
|
+
#
|
|
119
|
+
# @return [Integer]
|
|
120
|
+
required :credits_remaining, Integer
|
|
121
|
+
|
|
122
|
+
# @!method initialize(credits_consumed:, credits_remaining:)
|
|
123
|
+
# Metadata about the API key used for the request. Included in every response
|
|
124
|
+
# whenever a valid API key is provided, even when the response status is not 200.
|
|
125
|
+
#
|
|
126
|
+
# @param credits_consumed [Integer] The number of credits consumed by this request.
|
|
127
|
+
#
|
|
128
|
+
# @param credits_remaining [Integer] The number of credits remaining for your organization after this request.
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
@@ -86,8 +86,8 @@ module ContextDev
|
|
|
86
86
|
optional :max_pages, Integer, api_name: :maxPages
|
|
87
87
|
|
|
88
88
|
# @!attribute pdf
|
|
89
|
-
# PDF parsing controls. Use start/end to limit text extraction and
|
|
90
|
-
# inclusive 1-based page range.
|
|
89
|
+
# PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
90
|
+
# detection/OCR to an inclusive 1-based page range.
|
|
91
91
|
#
|
|
92
92
|
# @return [ContextDev::Models::WebWebCrawlMdParams::Pdf, nil]
|
|
93
93
|
optional :pdf, -> { ContextDev::WebWebCrawlMdParams::Pdf }
|
|
@@ -169,7 +169,7 @@ module ContextDev
|
|
|
169
169
|
#
|
|
170
170
|
# @param max_pages [Integer] Maximum number of pages to crawl. Hard cap: 500.
|
|
171
171
|
#
|
|
172
|
-
# @param pdf [ContextDev::Models::WebWebCrawlMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and
|
|
172
|
+
# @param pdf [ContextDev::Models::WebWebCrawlMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
173
173
|
#
|
|
174
174
|
# @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before extr
|
|
175
175
|
#
|
|
@@ -410,6 +410,14 @@ module ContextDev
|
|
|
410
410
|
# @return [Integer, nil]
|
|
411
411
|
optional :end_, Integer, api_name: :end
|
|
412
412
|
|
|
413
|
+
# @!attribute ocr
|
|
414
|
+
# When true, detect and OCR images embedded in the selected PDF pages, inserting
|
|
415
|
+
# recognized text at each image's position in page reading order while preserving
|
|
416
|
+
# the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
|
|
417
|
+
#
|
|
418
|
+
# @return [Boolean, nil]
|
|
419
|
+
optional :ocr, ContextDev::Internal::Type::Boolean
|
|
420
|
+
|
|
413
421
|
# @!attribute should_parse
|
|
414
422
|
# When true, PDF pages are fetched and parsed. When false, PDF pages are skipped
|
|
415
423
|
# entirely (not included in results and not counted as failures).
|
|
@@ -423,15 +431,17 @@ module ContextDev
|
|
|
423
431
|
# @return [Integer, nil]
|
|
424
432
|
optional :start, Integer
|
|
425
433
|
|
|
426
|
-
# @!method initialize(end_: nil, should_parse: nil, start: nil)
|
|
434
|
+
# @!method initialize(end_: nil, ocr: nil, should_parse: nil, start: nil)
|
|
427
435
|
# Some parameter documentations has been truncated, see
|
|
428
436
|
# {ContextDev::Models::WebWebCrawlMdParams::Pdf} for more details.
|
|
429
437
|
#
|
|
430
|
-
# PDF parsing controls. Use start/end to limit text extraction and
|
|
431
|
-
# inclusive 1-based page range.
|
|
438
|
+
# PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
439
|
+
# detection/OCR to an inclusive 1-based page range.
|
|
432
440
|
#
|
|
433
441
|
# @param end_ [Integer] Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Mus
|
|
434
442
|
#
|
|
443
|
+
# @param ocr [Boolean] When true, detect and OCR images embedded in the selected PDF pages, inserting r
|
|
444
|
+
#
|
|
435
445
|
# @param should_parse [Boolean] When true, PDF pages are fetched and parsed. When false, PDF pages are skipped e
|
|
436
446
|
#
|
|
437
447
|
# @param start [Integer] First 1-based PDF page to parse. When omitted, parsing starts at the first page.
|
|
@@ -59,8 +59,8 @@ module ContextDev
|
|
|
59
59
|
optional :max_age_ms, Integer
|
|
60
60
|
|
|
61
61
|
# @!attribute pdf
|
|
62
|
-
# PDF parsing controls. Use start/end to limit text extraction and
|
|
63
|
-
# inclusive 1-based page range.
|
|
62
|
+
# PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
63
|
+
# detection/OCR to an inclusive 1-based page range.
|
|
64
64
|
#
|
|
65
65
|
# @return [ContextDev::Models::WebWebScrapeHTMLParams::Pdf, nil]
|
|
66
66
|
optional :pdf, -> { ContextDev::WebWebScrapeHTMLParams::Pdf }
|
|
@@ -113,7 +113,7 @@ module ContextDev
|
|
|
113
113
|
#
|
|
114
114
|
# @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y
|
|
115
115
|
#
|
|
116
|
-
# @param pdf [ContextDev::Models::WebWebScrapeHTMLParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and
|
|
116
|
+
# @param pdf [ContextDev::Models::WebWebScrapeHTMLParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
117
117
|
#
|
|
118
118
|
# @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before extr
|
|
119
119
|
#
|
|
@@ -347,6 +347,14 @@ module ContextDev
|
|
|
347
347
|
# @return [Integer, nil]
|
|
348
348
|
optional :end_, Integer, api_name: :end
|
|
349
349
|
|
|
350
|
+
# @!attribute ocr
|
|
351
|
+
# When true, detect and OCR images embedded in the selected PDF pages, inserting
|
|
352
|
+
# recognized text at each image's position in page reading order while preserving
|
|
353
|
+
# the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
|
|
354
|
+
#
|
|
355
|
+
# @return [Boolean, nil]
|
|
356
|
+
optional :ocr, ContextDev::Internal::Type::Boolean
|
|
357
|
+
|
|
350
358
|
# @!attribute should_parse
|
|
351
359
|
# When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
|
|
352
360
|
# a 400 WEBSITE_ACCESS_ERROR is returned.
|
|
@@ -360,15 +368,17 @@ module ContextDev
|
|
|
360
368
|
# @return [Integer, nil]
|
|
361
369
|
optional :start, Integer
|
|
362
370
|
|
|
363
|
-
# @!method initialize(end_: nil, should_parse: nil, start: nil)
|
|
371
|
+
# @!method initialize(end_: nil, ocr: nil, should_parse: nil, start: nil)
|
|
364
372
|
# Some parameter documentations has been truncated, see
|
|
365
373
|
# {ContextDev::Models::WebWebScrapeHTMLParams::Pdf} for more details.
|
|
366
374
|
#
|
|
367
|
-
# PDF parsing controls. Use start/end to limit text extraction and
|
|
368
|
-
# inclusive 1-based page range.
|
|
375
|
+
# PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
376
|
+
# detection/OCR to an inclusive 1-based page range.
|
|
369
377
|
#
|
|
370
378
|
# @param end_ [Integer] Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Mus
|
|
371
379
|
#
|
|
380
|
+
# @param ocr [Boolean] When true, detect and OCR images embedded in the selected PDF pages, inserting r
|
|
381
|
+
#
|
|
372
382
|
# @param should_parse [Boolean] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
|
|
373
383
|
#
|
|
374
384
|
# @param start [Integer] First 1-based PDF page to parse. When omitted, parsing starts at the first page.
|
|
@@ -72,8 +72,8 @@ module ContextDev
|
|
|
72
72
|
optional :max_age_ms, Integer
|
|
73
73
|
|
|
74
74
|
# @!attribute pdf
|
|
75
|
-
# PDF parsing controls. Use start/end to limit text extraction and
|
|
76
|
-
# inclusive 1-based page range.
|
|
75
|
+
# PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
76
|
+
# detection/OCR to an inclusive 1-based page range.
|
|
77
77
|
#
|
|
78
78
|
# @return [ContextDev::Models::WebWebScrapeMdParams::Pdf, nil]
|
|
79
79
|
optional :pdf, -> { ContextDev::WebWebScrapeMdParams::Pdf }
|
|
@@ -136,7 +136,7 @@ module ContextDev
|
|
|
136
136
|
#
|
|
137
137
|
# @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y
|
|
138
138
|
#
|
|
139
|
-
# @param pdf [ContextDev::Models::WebWebScrapeMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and
|
|
139
|
+
# @param pdf [ContextDev::Models::WebWebScrapeMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
140
140
|
#
|
|
141
141
|
# @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before conv
|
|
142
142
|
#
|
|
@@ -372,6 +372,14 @@ module ContextDev
|
|
|
372
372
|
# @return [Integer, nil]
|
|
373
373
|
optional :end_, Integer, api_name: :end
|
|
374
374
|
|
|
375
|
+
# @!attribute ocr
|
|
376
|
+
# When true, detect and OCR images embedded in the selected PDF pages, inserting
|
|
377
|
+
# recognized text at each image's position in page reading order while preserving
|
|
378
|
+
# the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
|
|
379
|
+
#
|
|
380
|
+
# @return [Boolean, nil]
|
|
381
|
+
optional :ocr, ContextDev::Internal::Type::Boolean
|
|
382
|
+
|
|
375
383
|
# @!attribute should_parse
|
|
376
384
|
# When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
|
|
377
385
|
# a 400 WEBSITE_ACCESS_ERROR is returned.
|
|
@@ -385,15 +393,17 @@ module ContextDev
|
|
|
385
393
|
# @return [Integer, nil]
|
|
386
394
|
optional :start, Integer
|
|
387
395
|
|
|
388
|
-
# @!method initialize(end_: nil, should_parse: nil, start: nil)
|
|
396
|
+
# @!method initialize(end_: nil, ocr: nil, should_parse: nil, start: nil)
|
|
389
397
|
# Some parameter documentations has been truncated, see
|
|
390
398
|
# {ContextDev::Models::WebWebScrapeMdParams::Pdf} for more details.
|
|
391
399
|
#
|
|
392
|
-
# PDF parsing controls. Use start/end to limit text extraction and
|
|
393
|
-
# inclusive 1-based page range.
|
|
400
|
+
# PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
401
|
+
# detection/OCR to an inclusive 1-based page range.
|
|
394
402
|
#
|
|
395
403
|
# @param end_ [Integer] Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Mus
|
|
396
404
|
#
|
|
405
|
+
# @param ocr [Boolean] When true, detect and OCR images embedded in the selected PDF pages, inserting r
|
|
406
|
+
#
|
|
397
407
|
# @param should_parse [Boolean] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
|
|
398
408
|
#
|
|
399
409
|
# @param start [Integer] First 1-based PDF page to parse. When omitted, parsing starts at the first page.
|
|
@@ -4,6 +4,14 @@ module ContextDev
|
|
|
4
4
|
module Models
|
|
5
5
|
# @see ContextDev::Resources::Web#web_scrape_md
|
|
6
6
|
class WebWebScrapeMdResponse < ContextDev::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute content_length
|
|
8
|
+
# UTF-8 byte length of the returned Markdown. Use 0 to identify an empty result
|
|
9
|
+
# and compare small values against your workload's minimum useful-content
|
|
10
|
+
# threshold.
|
|
11
|
+
#
|
|
12
|
+
# @return [Integer]
|
|
13
|
+
required :content_length, Integer, api_name: :contentLength
|
|
14
|
+
|
|
7
15
|
# @!attribute markdown
|
|
8
16
|
# Page content converted to GitHub Flavored Markdown
|
|
9
17
|
#
|
|
@@ -35,10 +43,12 @@ module ContextDev
|
|
|
35
43
|
# @return [ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata, nil]
|
|
36
44
|
optional :key_metadata, -> { ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata }
|
|
37
45
|
|
|
38
|
-
# @!method initialize(markdown:, metadata:, success:, url:, key_metadata: nil)
|
|
46
|
+
# @!method initialize(content_length:, markdown:, metadata:, success:, url:, key_metadata: nil)
|
|
39
47
|
# Some parameter documentations has been truncated, see
|
|
40
48
|
# {ContextDev::Models::WebWebScrapeMdResponse} for more details.
|
|
41
49
|
#
|
|
50
|
+
# @param content_length [Integer] UTF-8 byte length of the returned Markdown. Use 0 to identify an empty result an
|
|
51
|
+
#
|
|
42
52
|
# @param markdown [String] Page content converted to GitHub Flavored Markdown
|
|
43
53
|
#
|
|
44
54
|
# @param metadata [ContextDev::Models::WebWebScrapeMdResponse::Metadata] Metadata extracted from the scraped page HTML.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ContextDev
|
|
4
|
+
module Models
|
|
5
|
+
class WebhookDelivery < ContextDev::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute attempted_at
|
|
7
|
+
#
|
|
8
|
+
# @return [Time]
|
|
9
|
+
required :attempted_at, Time
|
|
10
|
+
|
|
11
|
+
# @!attribute error
|
|
12
|
+
#
|
|
13
|
+
# @return [ContextDev::Models::WebhookDelivery::Error, nil]
|
|
14
|
+
required :error, -> { ContextDev::WebhookDelivery::Error }, nil?: true
|
|
15
|
+
|
|
16
|
+
# @!attribute event
|
|
17
|
+
# The event this delivery carried. Deliveries recorded before event selection
|
|
18
|
+
# existed report change.detected.
|
|
19
|
+
#
|
|
20
|
+
# @return [Symbol, ContextDev::Models::WebhookDelivery::Event]
|
|
21
|
+
required :event, enum: -> { ContextDev::WebhookDelivery::Event }
|
|
22
|
+
|
|
23
|
+
# @!attribute event_id
|
|
24
|
+
# Identifier sent in the X-Context-Id header.
|
|
25
|
+
#
|
|
26
|
+
# @return [String]
|
|
27
|
+
required :event_id, String
|
|
28
|
+
|
|
29
|
+
# @!attribute http_status
|
|
30
|
+
# The endpoint's final HTTP response status, or null when no response was
|
|
31
|
+
# received.
|
|
32
|
+
#
|
|
33
|
+
# @return [Integer, nil]
|
|
34
|
+
required :http_status, Integer, nil?: true
|
|
35
|
+
|
|
36
|
+
# @!attribute status
|
|
37
|
+
# Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
|
|
38
|
+
# response; failed means no HTTP response was received; skipped_unsafe_url means
|
|
39
|
+
# the URL failed the public-endpoint safety check.
|
|
40
|
+
#
|
|
41
|
+
# @return [Symbol, ContextDev::Models::WebhookDelivery::Status]
|
|
42
|
+
required :status, enum: -> { ContextDev::WebhookDelivery::Status }
|
|
43
|
+
|
|
44
|
+
# @!method initialize(attempted_at:, error:, event:, event_id:, http_status:, status:)
|
|
45
|
+
# Some parameter documentations has been truncated, see
|
|
46
|
+
# {ContextDev::Models::WebhookDelivery} for more details.
|
|
47
|
+
#
|
|
48
|
+
# @param attempted_at [Time]
|
|
49
|
+
#
|
|
50
|
+
# @param error [ContextDev::Models::WebhookDelivery::Error, nil]
|
|
51
|
+
#
|
|
52
|
+
# @param event [Symbol, ContextDev::Models::WebhookDelivery::Event] The event this delivery carried. Deliveries recorded before event selection exis
|
|
53
|
+
#
|
|
54
|
+
# @param event_id [String] Identifier sent in the X-Context-Id header.
|
|
55
|
+
#
|
|
56
|
+
# @param http_status [Integer, nil] The endpoint's final HTTP response status, or null when no response was received
|
|
57
|
+
#
|
|
58
|
+
# @param status [Symbol, ContextDev::Models::WebhookDelivery::Status] Delivery outcome. delivered means any 2xx response; rejected means a non-2xx res
|
|
59
|
+
|
|
60
|
+
# @see ContextDev::Models::WebhookDelivery#error
|
|
61
|
+
class Error < ContextDev::Internal::Type::BaseModel
|
|
62
|
+
# @!attribute code
|
|
63
|
+
#
|
|
64
|
+
# @return [String]
|
|
65
|
+
required :code, String
|
|
66
|
+
|
|
67
|
+
# @!attribute message
|
|
68
|
+
#
|
|
69
|
+
# @return [String]
|
|
70
|
+
required :message, String
|
|
71
|
+
|
|
72
|
+
# @!method initialize(code:, message:)
|
|
73
|
+
# @param code [String]
|
|
74
|
+
# @param message [String]
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# The event this delivery carried. Deliveries recorded before event selection
|
|
78
|
+
# existed report change.detected.
|
|
79
|
+
#
|
|
80
|
+
# @see ContextDev::Models::WebhookDelivery#event
|
|
81
|
+
module Event
|
|
82
|
+
extend ContextDev::Internal::Type::Enum
|
|
83
|
+
|
|
84
|
+
CHANGE_DETECTED = :"change.detected"
|
|
85
|
+
RUN_COMPLETED = :"run.completed"
|
|
86
|
+
|
|
87
|
+
# @!method self.values
|
|
88
|
+
# @return [Array<Symbol>]
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
|
|
92
|
+
# response; failed means no HTTP response was received; skipped_unsafe_url means
|
|
93
|
+
# the URL failed the public-endpoint safety check.
|
|
94
|
+
#
|
|
95
|
+
# @see ContextDev::Models::WebhookDelivery#status
|
|
96
|
+
module Status
|
|
97
|
+
extend ContextDev::Internal::Type::Enum
|
|
98
|
+
|
|
99
|
+
DELIVERED = :delivered
|
|
100
|
+
REJECTED = :rejected
|
|
101
|
+
FAILED = :failed
|
|
102
|
+
SKIPPED_UNSAFE_URL = :skipped_unsafe_url
|
|
103
|
+
|
|
104
|
+
# @!method self.values
|
|
105
|
+
# @return [Array<Symbol>]
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
data/lib/context_dev/models.rb
CHANGED
|
@@ -73,6 +73,8 @@ module ContextDev
|
|
|
73
73
|
|
|
74
74
|
MonitorUpdateParams = ContextDev::Models::MonitorUpdateParams
|
|
75
75
|
|
|
76
|
+
ParseHandleParams = ContextDev::Models::ParseHandleParams
|
|
77
|
+
|
|
76
78
|
UtilityPrefetchParams = ContextDev::Models::UtilityPrefetchParams
|
|
77
79
|
|
|
78
80
|
WebExtractCompetitorsParams = ContextDev::Models::WebExtractCompetitorsParams
|
|
@@ -83,6 +85,8 @@ module ContextDev
|
|
|
83
85
|
|
|
84
86
|
WebExtractStyleguideParams = ContextDev::Models::WebExtractStyleguideParams
|
|
85
87
|
|
|
88
|
+
WebhookDelivery = ContextDev::Models::WebhookDelivery
|
|
89
|
+
|
|
86
90
|
WebScreenshotParams = ContextDev::Models::WebScreenshotParams
|
|
87
91
|
|
|
88
92
|
WebSearchParams = ContextDev::Models::WebSearchParams
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
module ContextDev
|
|
4
4
|
module Resources
|
|
5
5
|
# Monitor pages, sitemaps, and extracted website data for exact or semantic
|
|
6
|
-
# changes.
|
|
7
|
-
# MonitorsChangeDetectedWebhookPayload
|
|
6
|
+
# changes. Webhook payloads are documented by the
|
|
7
|
+
# MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload
|
|
8
|
+
# schemas.
|
|
8
9
|
class Monitors
|
|
9
10
|
# Some parameter documentations has been truncated, see
|
|
10
11
|
# {ContextDev::Models::MonitorCreateParams} for more details.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ContextDev
|
|
4
|
+
module Resources
|
|
5
|
+
class Parse
|
|
6
|
+
# Some parameter documentations has been truncated, see
|
|
7
|
+
# {ContextDev::Models::ParseHandleParams} for more details.
|
|
8
|
+
#
|
|
9
|
+
# Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes
|
|
10
|
+
# into LLM-usable Markdown.
|
|
11
|
+
#
|
|
12
|
+
# @overload handle(body:, base_url: nil, extension: nil, filename: nil, include_images: nil, include_links: nil, ocr: nil, pdf_end: nil, pdf_start: nil, shorten_base64_images: nil, use_main_content_only: nil, request_options: {})
|
|
13
|
+
#
|
|
14
|
+
# @param body [Pathname, StringIO, IO, String, ContextDev::FilePart] Body param
|
|
15
|
+
#
|
|
16
|
+
# @param base_url [String] Query param: Optional HTTP(S) source document URL used to resolve relative links
|
|
17
|
+
#
|
|
18
|
+
# @param extension [String] Query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html,
|
|
19
|
+
#
|
|
20
|
+
# @param filename [String] Query param: Optional filename hint used to infer the extension when extension i
|
|
21
|
+
#
|
|
22
|
+
# @param include_images [Boolean] Query param: Include image references in Markdown output
|
|
23
|
+
#
|
|
24
|
+
# @param include_links [Boolean] Query param: Preserve hyperlinks in Markdown output
|
|
25
|
+
#
|
|
26
|
+
# @param ocr [Boolean] Query param: When true for PDF inputs, detect and OCR images embedded in the sel
|
|
27
|
+
#
|
|
28
|
+
# @param pdf_end [Integer] Query param: Last 1-based PDF page to parse. When omitted, parsing ends at the l
|
|
29
|
+
#
|
|
30
|
+
# @param pdf_start [Integer] Query param: First 1-based PDF page to parse. When omitted, parsing starts at th
|
|
31
|
+
#
|
|
32
|
+
# @param shorten_base64_images [Boolean] Query param: Shorten base64-encoded image data in the Markdown output
|
|
33
|
+
#
|
|
34
|
+
# @param use_main_content_only [Boolean] Query param: Extract only the main content from HTML-like inputs
|
|
35
|
+
#
|
|
36
|
+
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
37
|
+
#
|
|
38
|
+
# @return [ContextDev::Models::ParseHandleResponse]
|
|
39
|
+
#
|
|
40
|
+
# @see ContextDev::Models::ParseHandleParams
|
|
41
|
+
def handle(params)
|
|
42
|
+
parsed, options = ContextDev::ParseHandleParams.dump_request(params)
|
|
43
|
+
query = ContextDev::Internal::Util.encode_query_params(parsed.except(:body))
|
|
44
|
+
@client.request(
|
|
45
|
+
method: :post,
|
|
46
|
+
path: "parse",
|
|
47
|
+
query: query,
|
|
48
|
+
headers: {"content-type" => "application/octet-stream"},
|
|
49
|
+
body: parsed[:body],
|
|
50
|
+
model: ContextDev::Models::ParseHandleResponse,
|
|
51
|
+
options: options
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# @api private
|
|
56
|
+
#
|
|
57
|
+
# @param client [ContextDev::Client]
|
|
58
|
+
def initialize(client:)
|
|
59
|
+
@client = client
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -289,7 +289,7 @@ module ContextDev
|
|
|
289
289
|
#
|
|
290
290
|
# @param max_pages [Integer] Maximum number of pages to crawl. Hard cap: 500.
|
|
291
291
|
#
|
|
292
|
-
# @param pdf [ContextDev::Models::WebWebCrawlMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and
|
|
292
|
+
# @param pdf [ContextDev::Models::WebWebCrawlMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
293
293
|
#
|
|
294
294
|
# @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before extr
|
|
295
295
|
#
|
|
@@ -342,7 +342,7 @@ module ContextDev
|
|
|
342
342
|
#
|
|
343
343
|
# @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y
|
|
344
344
|
#
|
|
345
|
-
# @param pdf [ContextDev::Models::WebWebScrapeHTMLParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and
|
|
345
|
+
# @param pdf [ContextDev::Models::WebWebScrapeHTMLParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
346
346
|
#
|
|
347
347
|
# @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before extr
|
|
348
348
|
#
|
|
@@ -426,7 +426,22 @@ module ContextDev
|
|
|
426
426
|
# Some parameter documentations has been truncated, see
|
|
427
427
|
# {ContextDev::Models::WebWebScrapeMdParams} for more details.
|
|
428
428
|
#
|
|
429
|
-
# Scrapes the given URL into LLM usable Markdown.
|
|
429
|
+
# Scrapes the given URL into LLM usable Markdown. Inspect key_metadata on JSON
|
|
430
|
+
# responses from a recognized API key; use error_code to distinguish stable
|
|
431
|
+
# failure categories.
|
|
432
|
+
#
|
|
433
|
+
# ### Billing & errors
|
|
434
|
+
#
|
|
435
|
+
# | HTTP status | Billed? | Meaning |
|
|
436
|
+
# | ----------- | -------------- | ---------------------------------------------------------------------------------------- |
|
|
437
|
+
# | 200 | Yes — 1 credit | Successful scrape, including a zero-length result when includeSelectors matched nothing |
|
|
438
|
+
# | 400 | No | Invalid input, skipped PDF, or the page could not be scraped |
|
|
439
|
+
# | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
|
|
440
|
+
# | 404 | No | Target page returned or fingerprinted as not found |
|
|
441
|
+
# | 408 | No | Request timed out |
|
|
442
|
+
# | 415 | No | Unsupported content type |
|
|
443
|
+
# | 429 | No | Per-minute rate limit exceeded; honor Retry-After |
|
|
444
|
+
# | 500 | No | Internal error |
|
|
430
445
|
#
|
|
431
446
|
# @overload web_scrape_md(url:, country: nil, exclude_selectors: nil, headers: nil, include_frames: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, settle_animations: nil, shorten_base64_images: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, request_options: {})
|
|
432
447
|
#
|
|
@@ -448,7 +463,7 @@ module ContextDev
|
|
|
448
463
|
#
|
|
449
464
|
# @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y
|
|
450
465
|
#
|
|
451
|
-
# @param pdf [ContextDev::Models::WebWebScrapeMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and
|
|
466
|
+
# @param pdf [ContextDev::Models::WebWebScrapeMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and embedded-image
|
|
452
467
|
#
|
|
453
468
|
# @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before conv
|
|
454
469
|
#
|
data/lib/context_dev/version.rb
CHANGED
data/lib/context_dev.rb
CHANGED
|
@@ -86,6 +86,8 @@ require_relative "context_dev/models/monitor_run_params"
|
|
|
86
86
|
require_relative "context_dev/models/monitor_run_response"
|
|
87
87
|
require_relative "context_dev/models/monitor_update_params"
|
|
88
88
|
require_relative "context_dev/models/monitor_update_response"
|
|
89
|
+
require_relative "context_dev/models/parse_handle_params"
|
|
90
|
+
require_relative "context_dev/models/parse_handle_response"
|
|
89
91
|
require_relative "context_dev/models/utility_prefetch_params"
|
|
90
92
|
require_relative "context_dev/models/utility_prefetch_response"
|
|
91
93
|
require_relative "context_dev/models/web_extract_competitors_params"
|
|
@@ -96,6 +98,7 @@ require_relative "context_dev/models/web_extract_params"
|
|
|
96
98
|
require_relative "context_dev/models/web_extract_response"
|
|
97
99
|
require_relative "context_dev/models/web_extract_styleguide_params"
|
|
98
100
|
require_relative "context_dev/models/web_extract_styleguide_response"
|
|
101
|
+
require_relative "context_dev/models/webhook_delivery"
|
|
99
102
|
require_relative "context_dev/models/web_screenshot_params"
|
|
100
103
|
require_relative "context_dev/models/web_screenshot_response"
|
|
101
104
|
require_relative "context_dev/models/web_search_params"
|
|
@@ -115,5 +118,6 @@ require_relative "context_dev/resources/ai"
|
|
|
115
118
|
require_relative "context_dev/resources/brand"
|
|
116
119
|
require_relative "context_dev/resources/industry"
|
|
117
120
|
require_relative "context_dev/resources/monitors"
|
|
121
|
+
require_relative "context_dev/resources/parse"
|
|
118
122
|
require_relative "context_dev/resources/utility"
|
|
119
123
|
require_relative "context_dev/resources/web"
|
data/rbi/context_dev/client.rbi
CHANGED
|
@@ -13,6 +13,9 @@ module ContextDev
|
|
|
13
13
|
sig { returns(String) }
|
|
14
14
|
attr_reader :api_key
|
|
15
15
|
|
|
16
|
+
sig { returns(ContextDev::Resources::Parse) }
|
|
17
|
+
attr_reader :parse
|
|
18
|
+
|
|
16
19
|
sig { returns(ContextDev::Resources::Web) }
|
|
17
20
|
attr_reader :web
|
|
18
21
|
|
|
@@ -29,8 +32,9 @@ module ContextDev
|
|
|
29
32
|
attr_reader :utility
|
|
30
33
|
|
|
31
34
|
# Monitor pages, sitemaps, and extracted website data for exact or semantic
|
|
32
|
-
# changes.
|
|
33
|
-
# MonitorsChangeDetectedWebhookPayload
|
|
35
|
+
# changes. Webhook payloads are documented by the
|
|
36
|
+
# MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload
|
|
37
|
+
# schemas.
|
|
34
38
|
sig { returns(ContextDev::Resources::Monitors) }
|
|
35
39
|
attr_reader :monitors
|
|
36
40
|
|