brand.dev 0.1.0.pre.alpha.7 → 0.1.0.pre.alpha.9
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 +29 -0
- data/README.md +1 -1
- data/lib/brand_dev/errors.rb +22 -0
- data/lib/brand_dev/internal/type/array_of.rb +6 -1
- data/lib/brand_dev/internal/type/base_model.rb +77 -25
- data/lib/brand_dev/internal/type/boolean.rb +7 -1
- data/lib/brand_dev/internal/type/converter.rb +42 -34
- data/lib/brand_dev/internal/type/enum.rb +10 -2
- data/lib/brand_dev/internal/type/file_input.rb +6 -1
- data/lib/brand_dev/internal/type/hash_of.rb +6 -1
- data/lib/brand_dev/internal/type/union.rb +12 -7
- data/lib/brand_dev/internal/type/unknown.rb +7 -1
- data/lib/brand_dev/models/brand_retrieve_simplified_params.rb +35 -0
- data/lib/brand_dev/models/brand_retrieve_simplified_response.rb +280 -0
- data/lib/brand_dev/models/brand_screenshot_params.rb +49 -0
- data/lib/brand_dev/models/brand_screenshot_response.rb +64 -0
- data/lib/brand_dev/models/brand_styleguide_params.rb +36 -0
- data/lib/brand_dev/models/brand_styleguide_response.rb +769 -0
- data/lib/brand_dev/models.rb +6 -0
- data/lib/brand_dev/resources/brand.rb +88 -0
- data/lib/brand_dev/version.rb +1 -1
- data/lib/brand_dev.rb +6 -0
- data/rbi/brand_dev/errors.rbi +16 -0
- data/rbi/brand_dev/internal/type/boolean.rbi +2 -0
- data/rbi/brand_dev/internal/type/converter.rbi +15 -15
- data/rbi/brand_dev/internal/type/union.rbi +5 -0
- data/rbi/brand_dev/internal/type/unknown.rbi +2 -0
- data/rbi/brand_dev/models/brand_retrieve_simplified_params.rbi +61 -0
- data/rbi/brand_dev/models/brand_retrieve_simplified_response.rbi +667 -0
- data/rbi/brand_dev/models/brand_screenshot_params.rbi +105 -0
- data/rbi/brand_dev/models/brand_screenshot_response.rbi +135 -0
- data/rbi/brand_dev/models/brand_styleguide_params.rbi +60 -0
- data/rbi/brand_dev/models/brand_styleguide_response.rbi +1648 -0
- data/rbi/brand_dev/models.rbi +7 -0
- data/rbi/brand_dev/resources/brand.rbi +67 -0
- data/sig/brand_dev/errors.rbs +9 -0
- data/sig/brand_dev/internal/type/converter.rbs +7 -1
- data/sig/brand_dev/models/brand_retrieve_simplified_params.rbs +30 -0
- data/sig/brand_dev/models/brand_retrieve_simplified_response.rbs +292 -0
- data/sig/brand_dev/models/brand_screenshot_params.rbs +46 -0
- data/sig/brand_dev/models/brand_screenshot_response.rbs +63 -0
- data/sig/brand_dev/models/brand_styleguide_params.rbs +30 -0
- data/sig/brand_dev/models/brand_styleguide_response.rbs +925 -0
- data/sig/brand_dev/models.rbs +6 -0
- data/sig/brand_dev/resources/brand.rbs +18 -0
- metadata +20 -2
data/lib/brand_dev/models.rb
CHANGED
@@ -51,5 +51,11 @@ module BrandDev
|
|
51
51
|
|
52
52
|
BrandRetrieveParams = BrandDev::Models::BrandRetrieveParams
|
53
53
|
|
54
|
+
BrandRetrieveSimplifiedParams = BrandDev::Models::BrandRetrieveSimplifiedParams
|
55
|
+
|
56
|
+
BrandScreenshotParams = BrandDev::Models::BrandScreenshotParams
|
57
|
+
|
54
58
|
BrandSearchParams = BrandDev::Models::BrandSearchParams
|
59
|
+
|
60
|
+
BrandStyleguideParams = BrandDev::Models::BrandStyleguideParams
|
55
61
|
end
|
@@ -179,6 +179,64 @@ module BrandDev
|
|
179
179
|
)
|
180
180
|
end
|
181
181
|
|
182
|
+
# Some parameter documentations has been truncated, see
|
183
|
+
# {BrandDev::Models::BrandRetrieveSimplifiedParams} for more details.
|
184
|
+
#
|
185
|
+
# Returns a simplified version of brand data containing only essential
|
186
|
+
# information: domain, title, colors, logos, and backdrops. This endpoint is
|
187
|
+
# optimized for faster responses and reduced data transfer.
|
188
|
+
#
|
189
|
+
# @overload retrieve_simplified(domain:, timeout_ms: nil, request_options: {})
|
190
|
+
#
|
191
|
+
# @param domain [String] Domain name to retrieve simplified brand data for
|
192
|
+
#
|
193
|
+
# @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
|
194
|
+
#
|
195
|
+
# @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
|
196
|
+
#
|
197
|
+
# @return [BrandDev::Models::BrandRetrieveSimplifiedResponse]
|
198
|
+
#
|
199
|
+
# @see BrandDev::Models::BrandRetrieveSimplifiedParams
|
200
|
+
def retrieve_simplified(params)
|
201
|
+
parsed, options = BrandDev::BrandRetrieveSimplifiedParams.dump_request(params)
|
202
|
+
@client.request(
|
203
|
+
method: :get,
|
204
|
+
path: "brand/retrieve-simplified",
|
205
|
+
query: parsed.transform_keys(timeout_ms: "timeoutMS"),
|
206
|
+
model: BrandDev::Models::BrandRetrieveSimplifiedResponse,
|
207
|
+
options: options
|
208
|
+
)
|
209
|
+
end
|
210
|
+
|
211
|
+
# Some parameter documentations has been truncated, see
|
212
|
+
# {BrandDev::Models::BrandScreenshotParams} for more details.
|
213
|
+
#
|
214
|
+
# Beta feature: Capture a screenshot of a website. Supports both viewport
|
215
|
+
# (standard browser view) and full-page screenshots. Returns a URL to the uploaded
|
216
|
+
# screenshot image hosted on our CDN.
|
217
|
+
#
|
218
|
+
# @overload screenshot(domain:, full_screenshot: nil, request_options: {})
|
219
|
+
#
|
220
|
+
# @param domain [String] Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domai
|
221
|
+
#
|
222
|
+
# @param full_screenshot [Symbol, BrandDev::Models::BrandScreenshotParams::FullScreenshot] Optional parameter to determine screenshot type. If 'true', takes a full page sc
|
223
|
+
#
|
224
|
+
# @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
|
225
|
+
#
|
226
|
+
# @return [BrandDev::Models::BrandScreenshotResponse]
|
227
|
+
#
|
228
|
+
# @see BrandDev::Models::BrandScreenshotParams
|
229
|
+
def screenshot(params)
|
230
|
+
parsed, options = BrandDev::BrandScreenshotParams.dump_request(params)
|
231
|
+
@client.request(
|
232
|
+
method: :get,
|
233
|
+
path: "brand/screenshot",
|
234
|
+
query: parsed.transform_keys(full_screenshot: "fullScreenshot"),
|
235
|
+
model: BrandDev::Models::BrandScreenshotResponse,
|
236
|
+
options: options
|
237
|
+
)
|
238
|
+
end
|
239
|
+
|
182
240
|
# Some parameter documentations has been truncated, see
|
183
241
|
# {BrandDev::Models::BrandSearchParams} for more details.
|
184
242
|
#
|
@@ -206,6 +264,36 @@ module BrandDev
|
|
206
264
|
)
|
207
265
|
end
|
208
266
|
|
267
|
+
# Some parameter documentations has been truncated, see
|
268
|
+
# {BrandDev::Models::BrandStyleguideParams} for more details.
|
269
|
+
#
|
270
|
+
# Beta feature: Automatically extract comprehensive design system information from
|
271
|
+
# a brand's website including colors, typography, spacing, shadows, and UI
|
272
|
+
# components. Uses AI-powered analysis of website screenshots to identify design
|
273
|
+
# patterns and create a reusable styleguide.
|
274
|
+
#
|
275
|
+
# @overload styleguide(domain:, timeout_ms: nil, request_options: {})
|
276
|
+
#
|
277
|
+
# @param domain [String] Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
|
278
|
+
#
|
279
|
+
# @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
|
280
|
+
#
|
281
|
+
# @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
|
282
|
+
#
|
283
|
+
# @return [BrandDev::Models::BrandStyleguideResponse]
|
284
|
+
#
|
285
|
+
# @see BrandDev::Models::BrandStyleguideParams
|
286
|
+
def styleguide(params)
|
287
|
+
parsed, options = BrandDev::BrandStyleguideParams.dump_request(params)
|
288
|
+
@client.request(
|
289
|
+
method: :get,
|
290
|
+
path: "brand/styleguide",
|
291
|
+
query: parsed.transform_keys(timeout_ms: "timeoutMS"),
|
292
|
+
model: BrandDev::Models::BrandStyleguideResponse,
|
293
|
+
options: options
|
294
|
+
)
|
295
|
+
end
|
296
|
+
|
209
297
|
# @api private
|
210
298
|
#
|
211
299
|
# @param client [BrandDev::Client]
|
data/lib/brand_dev/version.rb
CHANGED
data/lib/brand_dev.rb
CHANGED
@@ -62,7 +62,13 @@ require_relative "brand_dev/models/brand_retrieve_naics_params"
|
|
62
62
|
require_relative "brand_dev/models/brand_retrieve_naics_response"
|
63
63
|
require_relative "brand_dev/models/brand_retrieve_params"
|
64
64
|
require_relative "brand_dev/models/brand_retrieve_response"
|
65
|
+
require_relative "brand_dev/models/brand_retrieve_simplified_params"
|
66
|
+
require_relative "brand_dev/models/brand_retrieve_simplified_response"
|
67
|
+
require_relative "brand_dev/models/brand_screenshot_params"
|
68
|
+
require_relative "brand_dev/models/brand_screenshot_response"
|
65
69
|
require_relative "brand_dev/models/brand_search_params"
|
66
70
|
require_relative "brand_dev/models/brand_search_response"
|
71
|
+
require_relative "brand_dev/models/brand_styleguide_params"
|
72
|
+
require_relative "brand_dev/models/brand_styleguide_response"
|
67
73
|
require_relative "brand_dev/models"
|
68
74
|
require_relative "brand_dev/resources/brand"
|
data/rbi/brand_dev/errors.rbi
CHANGED
@@ -8,6 +8,22 @@ module BrandDev
|
|
8
8
|
end
|
9
9
|
|
10
10
|
class ConversionError < BrandDev::Errors::Error
|
11
|
+
sig { returns(T.nilable(StandardError)) }
|
12
|
+
def cause
|
13
|
+
end
|
14
|
+
|
15
|
+
# @api private
|
16
|
+
sig do
|
17
|
+
params(
|
18
|
+
on: T::Class[StandardError],
|
19
|
+
method: Symbol,
|
20
|
+
target: T.anything,
|
21
|
+
value: T.anything,
|
22
|
+
cause: T.nilable(StandardError)
|
23
|
+
).returns(T.attached_class)
|
24
|
+
end
|
25
|
+
def self.new(on:, method:, target:, value:, cause: nil)
|
26
|
+
end
|
11
27
|
end
|
12
28
|
|
13
29
|
class APIError < BrandDev::Errors::Error
|
@@ -15,12 +15,14 @@ module BrandDev
|
|
15
15
|
CoerceState =
|
16
16
|
T.type_alias do
|
17
17
|
{
|
18
|
-
|
18
|
+
translate_names: T::Boolean,
|
19
|
+
strictness: T::Boolean,
|
19
20
|
exactness: {
|
20
21
|
yes: Integer,
|
21
22
|
no: Integer,
|
22
23
|
maybe: Integer
|
23
24
|
},
|
25
|
+
error: T::Class[StandardError],
|
24
26
|
branched: Integer
|
25
27
|
}
|
26
28
|
end
|
@@ -88,6 +90,15 @@ module BrandDev
|
|
88
90
|
def self.type_info(spec)
|
89
91
|
end
|
90
92
|
|
93
|
+
# @api private
|
94
|
+
sig do
|
95
|
+
params(translate_names: T::Boolean).returns(
|
96
|
+
BrandDev::Internal::Type::Converter::CoerceState
|
97
|
+
)
|
98
|
+
end
|
99
|
+
def self.new_coerce_state(translate_names: true)
|
100
|
+
end
|
101
|
+
|
91
102
|
# @api private
|
92
103
|
#
|
93
104
|
# Based on `target`, transform `value` into `target`, to the extent possible:
|
@@ -109,14 +120,11 @@ module BrandDev
|
|
109
120
|
def self.coerce(
|
110
121
|
target,
|
111
122
|
value,
|
112
|
-
# The `strictness` is one of `true`, `false
|
113
|
-
#
|
114
|
-
# targets:
|
123
|
+
# The `strictness` is one of `true`, `false`. This informs the coercion strategy
|
124
|
+
# when we have to decide between multiple possible conversion targets:
|
115
125
|
#
|
116
126
|
# - `true`: the conversion must be exact, with minimum coercion.
|
117
127
|
# - `false`: the conversion can be approximate, with some coercion.
|
118
|
-
# - `:strong`: the conversion must be exact, with no coercion, and raise an error
|
119
|
-
# if not possible.
|
120
128
|
#
|
121
129
|
# The `exactness` is `Hash` with keys being one of `yes`, `no`, or `maybe`. For
|
122
130
|
# any given conversion attempt, the exactness will be updated based on how closely
|
@@ -128,15 +136,7 @@ module BrandDev
|
|
128
136
|
# - `no`: the value cannot be converted to the target type.
|
129
137
|
#
|
130
138
|
# See implementation below for more details.
|
131
|
-
state:
|
132
|
-
strictness: true,
|
133
|
-
exactness: {
|
134
|
-
yes: 0,
|
135
|
-
no: 0,
|
136
|
-
maybe: 0
|
137
|
-
},
|
138
|
-
branched: 0
|
139
|
-
}
|
139
|
+
state: BrandDev::Internal::Type::Converter.new_coerce_state
|
140
140
|
)
|
141
141
|
end
|
142
142
|
|
@@ -78,6 +78,11 @@ module BrandDev
|
|
78
78
|
end
|
79
79
|
|
80
80
|
# @api private
|
81
|
+
#
|
82
|
+
# Tries to efficiently coerce the given value to one of the known variants.
|
83
|
+
#
|
84
|
+
# If the value cannot match any of the known variants, the coercion is considered
|
85
|
+
# non-viable and returns the original value.
|
81
86
|
sig do
|
82
87
|
override
|
83
88
|
.params(
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module BrandDev
|
4
|
+
module Models
|
5
|
+
class BrandRetrieveSimplifiedParams < BrandDev::Internal::Type::BaseModel
|
6
|
+
extend BrandDev::Internal::Type::RequestParameters::Converter
|
7
|
+
include BrandDev::Internal::Type::RequestParameters
|
8
|
+
|
9
|
+
OrHash =
|
10
|
+
T.type_alias do
|
11
|
+
T.any(
|
12
|
+
BrandDev::BrandRetrieveSimplifiedParams,
|
13
|
+
BrandDev::Internal::AnyHash
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Domain name to retrieve simplified brand data for
|
18
|
+
sig { returns(String) }
|
19
|
+
attr_accessor :domain
|
20
|
+
|
21
|
+
# Optional timeout in milliseconds for the request. If the request takes longer
|
22
|
+
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
23
|
+
# value is 300000ms (5 minutes).
|
24
|
+
sig { returns(T.nilable(Integer)) }
|
25
|
+
attr_reader :timeout_ms
|
26
|
+
|
27
|
+
sig { params(timeout_ms: Integer).void }
|
28
|
+
attr_writer :timeout_ms
|
29
|
+
|
30
|
+
sig do
|
31
|
+
params(
|
32
|
+
domain: String,
|
33
|
+
timeout_ms: Integer,
|
34
|
+
request_options: BrandDev::RequestOptions::OrHash
|
35
|
+
).returns(T.attached_class)
|
36
|
+
end
|
37
|
+
def self.new(
|
38
|
+
# Domain name to retrieve simplified brand data for
|
39
|
+
domain:,
|
40
|
+
# Optional timeout in milliseconds for the request. If the request takes longer
|
41
|
+
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
42
|
+
# value is 300000ms (5 minutes).
|
43
|
+
timeout_ms: nil,
|
44
|
+
request_options: {}
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
sig do
|
49
|
+
override.returns(
|
50
|
+
{
|
51
|
+
domain: String,
|
52
|
+
timeout_ms: Integer,
|
53
|
+
request_options: BrandDev::RequestOptions
|
54
|
+
}
|
55
|
+
)
|
56
|
+
end
|
57
|
+
def to_hash
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|