Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.15.0"
".": "1.16.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-44904c513baa439f294b23964ea368ad52863e13328980f9cac5a8e78cbb58cb.yml
openapi_spec_hash: 9bb50ca838166fb474d28009a7edbd49
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d880c25aee159e1260e23dfa3685b1bb9e35b02a1927adecbff32664ba8e11a4.yml
openapi_spec_hash: aa96a6030390bca0b4cdfa2363961807
config_hash: 70354330f92ce169beabc98696ebb9a3
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 1.16.0 (2026-05-07)

Full Changelog: [v1.15.0...v1.16.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.15.0...v1.16.0)

### Features

* **api:** api update ([f0b1f3a](https://github.com/context-dot-dev/context-ruby-sdk/commit/f0b1f3afd885c44cb464393b57d944fa27a6c0b5))

## 1.15.0 (2026-05-06)

Full Changelog: [v1.14.0...v1.15.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.14.0...v1.15.0)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
context.dev (1.15.0)
context.dev (1.16.0)
cgi
connection_pool

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "context.dev", "~> 1.15.0"
gem "context.dev", "~> 1.16.0"
```

<!-- x-release-please-end -->
Expand Down
41 changes: 40 additions & 1 deletion lib/context_dev/models/web_screenshot_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ class WebScreenshotParams < ContextDev::Internal::Type::BaseModel
# @return [Symbol, ContextDev::Models::WebScreenshotParams::FullScreenshot, nil]
optional :full_screenshot, enum: -> { ContextDev::WebScreenshotParams::FullScreenshot }

# @!attribute max_age_ms
# Return a cached screenshot if a prior screenshot for the same parameters exists
# and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
# omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh.
#
# @return [Integer, nil]
optional :max_age_ms, Integer

# @!attribute page
# Optional parameter to specify which page type to screenshot. If provided, the
# system will scrape the domain's links and use heuristics to find the most
Expand All @@ -49,7 +57,13 @@ class WebScreenshotParams < ContextDev::Internal::Type::BaseModel
# @return [Symbol, ContextDev::Models::WebScreenshotParams::Prioritize, nil]
optional :prioritize, enum: -> { ContextDev::WebScreenshotParams::Prioritize }

# @!method initialize(direct_url: nil, domain: nil, full_screenshot: nil, page: nil, prioritize: nil, request_options: {})
# @!attribute viewport
# Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080.
#
# @return [ContextDev::Models::WebScreenshotParams::Viewport, nil]
optional :viewport, -> { ContextDev::WebScreenshotParams::Viewport }

# @!method initialize(direct_url: nil, domain: nil, full_screenshot: nil, max_age_ms: nil, page: nil, prioritize: nil, viewport: nil, request_options: {})
# Some parameter documentations has been truncated, see
# {ContextDev::Models::WebScreenshotParams} for more details.
#
Expand All @@ -59,10 +73,14 @@ class WebScreenshotParams < ContextDev::Internal::Type::BaseModel
#
# @param full_screenshot [Symbol, ContextDev::Models::WebScreenshotParams::FullScreenshot] Optional parameter to determine screenshot type. If 'true', takes a full page sc
#
# @param max_age_ms [Integer] Return a cached screenshot if a prior screenshot for the same parameters exists
#
# @param page [Symbol, ContextDev::Models::WebScreenshotParams::Page] Optional parameter to specify which page type to screenshot. If provided, the sy
#
# @param prioritize [Symbol, ContextDev::Models::WebScreenshotParams::Prioritize] Optional parameter to prioritize screenshot capture. If 'speed', optimizes for f
#
# @param viewport [ContextDev::Models::WebScreenshotParams::Viewport] Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080.
#
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]

# Optional parameter to determine screenshot type. If 'true', takes a full page
Expand Down Expand Up @@ -111,6 +129,27 @@ module Prioritize
# @!method self.values
# @return [Array<Symbol>]
end

class Viewport < ContextDev::Internal::Type::BaseModel
# @!attribute height
# Viewport height in pixels.
#
# @return [Integer, nil]
optional :height, Integer

# @!attribute width
# Viewport width in pixels.
#
# @return [Integer, nil]
optional :width, Integer

# @!method initialize(height: nil, width: nil)
# Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080.
#
# @param height [Integer] Viewport height in pixels.
#
# @param width [Integer] Viewport width in pixels.
end
end
end
end
18 changes: 17 additions & 1 deletion lib/context_dev/models/web_screenshot_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ class WebScreenshotResponse < ContextDev::Internal::Type::BaseModel
# @return [String, nil]
optional :domain, String

# @!attribute height
# Height in pixels of the returned screenshot image
#
# @return [Integer, nil]
optional :height, Integer

# @!attribute screenshot
# Public URL of the uploaded screenshot image
#
Expand All @@ -36,16 +42,26 @@ class WebScreenshotResponse < ContextDev::Internal::Type::BaseModel
# @return [String, nil]
optional :status, String

# @!method initialize(code: nil, domain: nil, screenshot: nil, screenshot_type: nil, status: nil)
# @!attribute width
# Width in pixels of the returned screenshot image
#
# @return [Integer, nil]
optional :width, Integer

# @!method initialize(code: nil, domain: nil, height: nil, screenshot: nil, screenshot_type: nil, status: nil, width: nil)
# @param code [Integer] HTTP status code
#
# @param domain [String] The normalized domain that was processed
#
# @param height [Integer] Height in pixels of the returned screenshot image
#
# @param screenshot [String] Public URL of the uploaded screenshot image
#
# @param screenshot_type [Symbol, ContextDev::Models::WebScreenshotResponse::ScreenshotType] Type of screenshot that was captured
#
# @param status [String] Status of the response, e.g., 'ok'
#
# @param width [Integer] Width in pixels of the returned screenshot image

# Type of screenshot that was captured
#
Expand Down
12 changes: 10 additions & 2 deletions lib/context_dev/resources/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,22 @@ def extract_styleguide(params = {})
#
# Capture a screenshot of a website.
#
# @overload screenshot(direct_url: nil, domain: nil, full_screenshot: nil, page: nil, prioritize: nil, request_options: {})
# @overload screenshot(direct_url: nil, domain: nil, full_screenshot: nil, max_age_ms: nil, page: nil, prioritize: nil, viewport: nil, request_options: {})
#
# @param direct_url [String] A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https
#
# @param domain [String] Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domai
#
# @param full_screenshot [Symbol, ContextDev::Models::WebScreenshotParams::FullScreenshot] Optional parameter to determine screenshot type. If 'true', takes a full page sc
#
# @param max_age_ms [Integer] Return a cached screenshot if a prior screenshot for the same parameters exists
#
# @param page [Symbol, ContextDev::Models::WebScreenshotParams::Page] Optional parameter to specify which page type to screenshot. If provided, the sy
#
# @param prioritize [Symbol, ContextDev::Models::WebScreenshotParams::Prioritize] Optional parameter to prioritize screenshot capture. If 'speed', optimizes for f
#
# @param viewport [ContextDev::Models::WebScreenshotParams::Viewport] Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080.
#
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
#
# @return [ContextDev::Models::WebScreenshotResponse]
Expand All @@ -93,7 +97,11 @@ def screenshot(params = {})
@client.request(
method: :get,
path: "web/screenshot",
query: query.transform_keys(direct_url: "directUrl", full_screenshot: "fullScreenshot"),
query: query.transform_keys(
direct_url: "directUrl",
full_screenshot: "fullScreenshot",
max_age_ms: "maxAgeMs"
),
model: ContextDev::Models::WebScreenshotResponse,
options: options
)
Expand Down
2 changes: 1 addition & 1 deletion lib/context_dev/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module ContextDev
VERSION = "1.15.0"
VERSION = "1.16.0"
end
68 changes: 68 additions & 0 deletions rbi/context_dev/models/web_screenshot_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ module ContextDev
end
attr_writer :full_screenshot

# Return a cached screenshot if a prior screenshot for the same parameters exists
# and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
# omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh.
sig { returns(T.nilable(Integer)) }
attr_reader :max_age_ms

sig { params(max_age_ms: Integer).void }
attr_writer :max_age_ms

# Optional parameter to specify which page type to screenshot. If provided, the
# system will scrape the domain's links and use heuristics to find the most
# appropriate URL for the specified page type (30 supported languages). If not
Expand Down Expand Up @@ -77,14 +86,25 @@ module ContextDev
end
attr_writer :prioritize

# Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080.
sig { returns(T.nilable(ContextDev::WebScreenshotParams::Viewport)) }
attr_reader :viewport

sig do
params(viewport: ContextDev::WebScreenshotParams::Viewport::OrHash).void
end
attr_writer :viewport

sig do
params(
direct_url: String,
domain: String,
full_screenshot:
ContextDev::WebScreenshotParams::FullScreenshot::OrSymbol,
max_age_ms: Integer,
page: ContextDev::WebScreenshotParams::Page::OrSymbol,
prioritize: ContextDev::WebScreenshotParams::Prioritize::OrSymbol,
viewport: ContextDev::WebScreenshotParams::Viewport::OrHash,
request_options: ContextDev::RequestOptions::OrHash
).returns(T.attached_class)
end
Expand All @@ -101,6 +121,10 @@ module ContextDev
# screenshot capturing all content. If 'false' or not provided, takes a viewport
# screenshot (standard browser view).
full_screenshot: nil,
# Return a cached screenshot if a prior screenshot for the same parameters exists
# and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
# omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh.
max_age_ms: nil,
# Optional parameter to specify which page type to screenshot. If provided, the
# system will scrape the domain's links and use heuristics to find the most
# appropriate URL for the specified page type (30 supported languages). If not
Expand All @@ -111,6 +135,8 @@ module ContextDev
# faster capture with basic quality. If 'quality', optimizes for higher quality
# with longer wait times. Defaults to 'quality' if not provided.
prioritize: nil,
# Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080.
viewport: nil,
request_options: {}
)
end
Expand All @@ -122,8 +148,10 @@ module ContextDev
domain: String,
full_screenshot:
ContextDev::WebScreenshotParams::FullScreenshot::OrSymbol,
max_age_ms: Integer,
page: ContextDev::WebScreenshotParams::Page::OrSymbol,
prioritize: ContextDev::WebScreenshotParams::Prioritize::OrSymbol,
viewport: ContextDev::WebScreenshotParams::Viewport,
request_options: ContextDev::RequestOptions
}
)
Expand Down Expand Up @@ -233,6 +261,46 @@ module ContextDev
def self.values
end
end

class Viewport < ContextDev::Internal::Type::BaseModel
OrHash =
T.type_alias do
T.any(
ContextDev::WebScreenshotParams::Viewport,
ContextDev::Internal::AnyHash
)
end

# Viewport height in pixels.
sig { returns(T.nilable(Integer)) }
attr_reader :height

sig { params(height: Integer).void }
attr_writer :height

# Viewport width in pixels.
sig { returns(T.nilable(Integer)) }
attr_reader :width

sig { params(width: Integer).void }
attr_writer :width

# Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080.
sig do
params(height: Integer, width: Integer).returns(T.attached_class)
end
def self.new(
# Viewport height in pixels.
height: nil,
# Viewport width in pixels.
width: nil
)
end

sig { override.returns({ height: Integer, width: Integer }) }
def to_hash
end
end
end
end
end
28 changes: 25 additions & 3 deletions rbi/context_dev/models/web_screenshot_response.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ module ContextDev
sig { params(domain: String).void }
attr_writer :domain

# Height in pixels of the returned screenshot image
sig { returns(T.nilable(Integer)) }
attr_reader :height

sig { params(height: Integer).void }
attr_writer :height

# Public URL of the uploaded screenshot image
sig { returns(T.nilable(String)) }
attr_reader :screenshot
Expand Down Expand Up @@ -57,27 +64,40 @@ module ContextDev
sig { params(status: String).void }
attr_writer :status

# Width in pixels of the returned screenshot image
sig { returns(T.nilable(Integer)) }
attr_reader :width

sig { params(width: Integer).void }
attr_writer :width

sig do
params(
code: Integer,
domain: String,
height: Integer,
screenshot: String,
screenshot_type:
ContextDev::Models::WebScreenshotResponse::ScreenshotType::OrSymbol,
status: String
status: String,
width: Integer
).returns(T.attached_class)
end
def self.new(
# HTTP status code
code: nil,
# The normalized domain that was processed
domain: nil,
# Height in pixels of the returned screenshot image
height: nil,
# Public URL of the uploaded screenshot image
screenshot: nil,
# Type of screenshot that was captured
screenshot_type: nil,
# Status of the response, e.g., 'ok'
status: nil
status: nil,
# Width in pixels of the returned screenshot image
width: nil
)
end

Expand All @@ -86,10 +106,12 @@ module ContextDev
{
code: Integer,
domain: String,
height: Integer,
screenshot: String,
screenshot_type:
ContextDev::Models::WebScreenshotResponse::ScreenshotType::TaggedSymbol,
status: String
status: String,
width: Integer
}
)
end
Expand Down
Loading
Loading