Skip to content

Commit c523c67

Browse files
feat(api): api update
1 parent a4d91a7 commit c523c67

8 files changed

Lines changed: 80 additions & 27 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 20
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-f2509d0b758e88572e5a8145b8296cb330154727d9797e615ad19e44e050af26.yml
3-
openapi_spec_hash: 40640a033ee09bda79ec066ba3744206
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-905e35387d755a84a2e7cd711f31eeea130e08a83bb7b39d3fa5445a187ef62f.yml
3+
openapi_spec_hash: 205b2c17cb40ad54d76c2c06c9e5dda4
44
config_hash: 91cf2dcefb99c39eb9cd3e98e15d6011

lib/brand_dev/models/brand_screenshot_params.rb

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,20 @@ class BrandScreenshotParams < BrandDev::Internal::Type::BaseModel
77
extend BrandDev::Internal::Type::RequestParameters::Converter
88
include BrandDev::Internal::Type::RequestParameters
99

10+
# @!attribute direct_url
11+
# A specific URL to screenshot directly, bypassing domain resolution (e.g.,
12+
# 'https://example.com/pricing'). When provided, the screenshot is taken of this
13+
# exact URL.
14+
#
15+
# @return [String, nil]
16+
optional :direct_url, String
17+
1018
# @!attribute domain
1119
# Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
1220
# domain will be automatically normalized and validated.
1321
#
14-
# @return [String]
15-
required :domain, String
22+
# @return [String, nil]
23+
optional :domain, String
1624

1725
# @!attribute full_screenshot
1826
# Optional parameter to determine screenshot type. If 'true', takes a full page
@@ -26,7 +34,8 @@ class BrandScreenshotParams < BrandDev::Internal::Type::BaseModel
2634
# Optional parameter to specify which page type to screenshot. If provided, the
2735
# system will scrape the domain's links and use heuristics to find the most
2836
# appropriate URL for the specified page type (30 supported languages). If not
29-
# provided, screenshots the main domain landing page.
37+
# provided, screenshots the main domain landing page. Only applicable when using
38+
# 'domain', not 'directUrl'.
3039
#
3140
# @return [Symbol, BrandDev::Models::BrandScreenshotParams::Page, nil]
3241
optional :page, enum: -> { BrandDev::BrandScreenshotParams::Page }
@@ -39,10 +48,12 @@ class BrandScreenshotParams < BrandDev::Internal::Type::BaseModel
3948
# @return [Symbol, BrandDev::Models::BrandScreenshotParams::Prioritize, nil]
4049
optional :prioritize, enum: -> { BrandDev::BrandScreenshotParams::Prioritize }
4150

42-
# @!method initialize(domain:, full_screenshot: nil, page: nil, prioritize: nil, request_options: {})
51+
# @!method initialize(direct_url: nil, domain: nil, full_screenshot: nil, page: nil, prioritize: nil, request_options: {})
4352
# Some parameter documentations has been truncated, see
4453
# {BrandDev::Models::BrandScreenshotParams} for more details.
4554
#
55+
# @param direct_url [String] A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https
56+
#
4657
# @param domain [String] Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domai
4758
#
4859
# @param full_screenshot [Symbol, BrandDev::Models::BrandScreenshotParams::FullScreenshot] Optional parameter to determine screenshot type. If 'true', takes a full page sc
@@ -69,7 +80,8 @@ module FullScreenshot
6980
# Optional parameter to specify which page type to screenshot. If provided, the
7081
# system will scrape the domain's links and use heuristics to find the most
7182
# appropriate URL for the specified page type (30 supported languages). If not
72-
# provided, screenshots the main domain landing page.
83+
# provided, screenshots the main domain landing page. Only applicable when using
84+
# 'domain', not 'directUrl'.
7385
module Page
7486
extend BrandDev::Internal::Type::Enum
7587

lib/brand_dev/resources/brand.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,13 @@ def retrieve_simplified(params)
465465
#
466466
# Capture a screenshot of a website. Supports both viewport (standard browser
467467
# view) and full-page screenshots. Can also screenshot specific page types (login,
468-
# pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to
469-
# the uploaded screenshot image hosted on our CDN.
468+
# pricing, etc.) by using heuristics to find the appropriate URL. Either 'domain'
469+
# or 'directUrl' must be provided as a query parameter, but not both. Returns a
470+
# URL to the uploaded screenshot image hosted on our CDN.
470471
#
471-
# @overload screenshot(domain:, full_screenshot: nil, page: nil, prioritize: nil, request_options: {})
472+
# @overload screenshot(direct_url: nil, domain: nil, full_screenshot: nil, page: nil, prioritize: nil, request_options: {})
473+
#
474+
# @param direct_url [String] A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https
472475
#
473476
# @param domain [String] Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domai
474477
#
@@ -483,13 +486,13 @@ def retrieve_simplified(params)
483486
# @return [BrandDev::Models::BrandScreenshotResponse]
484487
#
485488
# @see BrandDev::Models::BrandScreenshotParams
486-
def screenshot(params)
489+
def screenshot(params = {})
487490
parsed, options = BrandDev::BrandScreenshotParams.dump_request(params)
488491
query = BrandDev::Internal::Util.encode_query_params(parsed)
489492
@client.request(
490493
method: :get,
491494
path: "brand/screenshot",
492-
query: query.transform_keys(full_screenshot: "fullScreenshot"),
495+
query: query.transform_keys(direct_url: "directUrl", full_screenshot: "fullScreenshot"),
493496
model: BrandDev::Models::BrandScreenshotResponse,
494497
options: options
495498
)

rbi/brand_dev/models/brand_screenshot_params.rbi

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,22 @@ module BrandDev
1111
T.any(BrandDev::BrandScreenshotParams, BrandDev::Internal::AnyHash)
1212
end
1313

14+
# A specific URL to screenshot directly, bypassing domain resolution (e.g.,
15+
# 'https://example.com/pricing'). When provided, the screenshot is taken of this
16+
# exact URL.
17+
sig { returns(T.nilable(String)) }
18+
attr_reader :direct_url
19+
20+
sig { params(direct_url: String).void }
21+
attr_writer :direct_url
22+
1423
# Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
1524
# domain will be automatically normalized and validated.
16-
sig { returns(String) }
17-
attr_accessor :domain
25+
sig { returns(T.nilable(String)) }
26+
attr_reader :domain
27+
28+
sig { params(domain: String).void }
29+
attr_writer :domain
1830

1931
# Optional parameter to determine screenshot type. If 'true', takes a full page
2032
# screenshot capturing all content. If 'false' or not provided, takes a viewport
@@ -37,7 +49,8 @@ module BrandDev
3749
# Optional parameter to specify which page type to screenshot. If provided, the
3850
# system will scrape the domain's links and use heuristics to find the most
3951
# appropriate URL for the specified page type (30 supported languages). If not
40-
# provided, screenshots the main domain landing page.
52+
# provided, screenshots the main domain landing page. Only applicable when using
53+
# 'domain', not 'directUrl'.
4154
sig do
4255
returns(T.nilable(BrandDev::BrandScreenshotParams::Page::OrSymbol))
4356
end
@@ -65,6 +78,7 @@ module BrandDev
6578

6679
sig do
6780
params(
81+
direct_url: String,
6882
domain: String,
6983
full_screenshot:
7084
BrandDev::BrandScreenshotParams::FullScreenshot::OrSymbol,
@@ -74,17 +88,22 @@ module BrandDev
7488
).returns(T.attached_class)
7589
end
7690
def self.new(
91+
# A specific URL to screenshot directly, bypassing domain resolution (e.g.,
92+
# 'https://example.com/pricing'). When provided, the screenshot is taken of this
93+
# exact URL.
94+
direct_url: nil,
7795
# Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
7896
# domain will be automatically normalized and validated.
79-
domain:,
97+
domain: nil,
8098
# Optional parameter to determine screenshot type. If 'true', takes a full page
8199
# screenshot capturing all content. If 'false' or not provided, takes a viewport
82100
# screenshot (standard browser view).
83101
full_screenshot: nil,
84102
# Optional parameter to specify which page type to screenshot. If provided, the
85103
# system will scrape the domain's links and use heuristics to find the most
86104
# appropriate URL for the specified page type (30 supported languages). If not
87-
# provided, screenshots the main domain landing page.
105+
# provided, screenshots the main domain landing page. Only applicable when using
106+
# 'domain', not 'directUrl'.
88107
page: nil,
89108
# Optional parameter to prioritize screenshot capture. If 'speed', optimizes for
90109
# faster capture with basic quality. If 'quality', optimizes for higher quality
@@ -97,6 +116,7 @@ module BrandDev
97116
sig do
98117
override.returns(
99118
{
119+
direct_url: String,
100120
domain: String,
101121
full_screenshot:
102122
BrandDev::BrandScreenshotParams::FullScreenshot::OrSymbol,
@@ -146,7 +166,8 @@ module BrandDev
146166
# Optional parameter to specify which page type to screenshot. If provided, the
147167
# system will scrape the domain's links and use heuristics to find the most
148168
# appropriate URL for the specified page type (30 supported languages). If not
149-
# provided, screenshots the main domain landing page.
169+
# provided, screenshots the main domain landing page. Only applicable when using
170+
# 'domain', not 'directUrl'.
150171
module Page
151172
extend BrandDev::Internal::Type::Enum
152173

rbi/brand_dev/resources/brand.rbi

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,12 @@ module BrandDev
399399

400400
# Capture a screenshot of a website. Supports both viewport (standard browser
401401
# view) and full-page screenshots. Can also screenshot specific page types (login,
402-
# pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to
403-
# the uploaded screenshot image hosted on our CDN.
402+
# pricing, etc.) by using heuristics to find the appropriate URL. Either 'domain'
403+
# or 'directUrl' must be provided as a query parameter, but not both. Returns a
404+
# URL to the uploaded screenshot image hosted on our CDN.
404405
sig do
405406
params(
407+
direct_url: String,
406408
domain: String,
407409
full_screenshot:
408410
BrandDev::BrandScreenshotParams::FullScreenshot::OrSymbol,
@@ -412,17 +414,22 @@ module BrandDev
412414
).returns(BrandDev::Models::BrandScreenshotResponse)
413415
end
414416
def screenshot(
417+
# A specific URL to screenshot directly, bypassing domain resolution (e.g.,
418+
# 'https://example.com/pricing'). When provided, the screenshot is taken of this
419+
# exact URL.
420+
direct_url: nil,
415421
# Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
416422
# domain will be automatically normalized and validated.
417-
domain:,
423+
domain: nil,
418424
# Optional parameter to determine screenshot type. If 'true', takes a full page
419425
# screenshot capturing all content. If 'false' or not provided, takes a viewport
420426
# screenshot (standard browser view).
421427
full_screenshot: nil,
422428
# Optional parameter to specify which page type to screenshot. If provided, the
423429
# system will scrape the domain's links and use heuristics to find the most
424430
# appropriate URL for the specified page type (30 supported languages). If not
425-
# provided, screenshots the main domain landing page.
431+
# provided, screenshots the main domain landing page. Only applicable when using
432+
# 'domain', not 'directUrl'.
426433
page: nil,
427434
# Optional parameter to prioritize screenshot capture. If 'speed', optimizes for
428435
# faster capture with basic quality. If 'quality', optimizes for higher quality

sig/brand_dev/models/brand_screenshot_params.rbs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module BrandDev
22
module Models
33
type brand_screenshot_params =
44
{
5+
direct_url: String,
56
domain: String,
67
full_screenshot: BrandDev::Models::BrandScreenshotParams::full_screenshot,
78
page: BrandDev::Models::BrandScreenshotParams::page,
@@ -13,7 +14,13 @@ module BrandDev
1314
extend BrandDev::Internal::Type::RequestParameters::Converter
1415
include BrandDev::Internal::Type::RequestParameters
1516

16-
attr_accessor domain: String
17+
attr_reader direct_url: String?
18+
19+
def direct_url=: (String) -> String
20+
21+
attr_reader domain: String?
22+
23+
def domain=: (String) -> String
1724

1825
attr_reader full_screenshot: BrandDev::Models::BrandScreenshotParams::full_screenshot?
1926

@@ -34,14 +41,16 @@ module BrandDev
3441
) -> BrandDev::Models::BrandScreenshotParams::prioritize
3542

3643
def initialize: (
37-
domain: String,
44+
?direct_url: String,
45+
?domain: String,
3846
?full_screenshot: BrandDev::Models::BrandScreenshotParams::full_screenshot,
3947
?page: BrandDev::Models::BrandScreenshotParams::page,
4048
?prioritize: BrandDev::Models::BrandScreenshotParams::prioritize,
4149
?request_options: BrandDev::request_opts
4250
) -> void
4351

4452
def to_hash: -> {
53+
direct_url: String,
4554
domain: String,
4655
full_screenshot: BrandDev::Models::BrandScreenshotParams::full_screenshot,
4756
page: BrandDev::Models::BrandScreenshotParams::page,

sig/brand_dev/resources/brand.rbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ module BrandDev
108108
) -> BrandDev::Models::BrandRetrieveSimplifiedResponse
109109

110110
def screenshot: (
111-
domain: String,
111+
?direct_url: String,
112+
?domain: String,
112113
?full_screenshot: BrandDev::Models::BrandScreenshotParams::full_screenshot,
113114
?page: BrandDev::Models::BrandScreenshotParams::page,
114115
?prioritize: BrandDev::Models::BrandScreenshotParams::prioritize,

test/brand_dev/resources/brand_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ def test_retrieve_simplified_required_params
267267
end
268268
end
269269

270-
def test_screenshot_required_params
270+
def test_screenshot
271271
skip("Mock server tests are disabled")
272272

273-
response = @brand_dev.brand.screenshot(domain: "domain")
273+
response = @brand_dev.brand.screenshot
274274

275275
assert_pattern do
276276
response => BrandDev::Models::BrandScreenshotResponse

0 commit comments

Comments
 (0)