brand.dev 0.0.1.pre.alpha.0 → 0.0.2

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 (89) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +188 -0
  3. data/README.md +7 -3
  4. data/lib/brand_dev/errors.rb +22 -0
  5. data/lib/brand_dev/internal/transport/base_client.rb +10 -2
  6. data/lib/brand_dev/internal/type/array_of.rb +6 -1
  7. data/lib/brand_dev/internal/type/base_model.rb +77 -25
  8. data/lib/brand_dev/internal/type/boolean.rb +7 -1
  9. data/lib/brand_dev/internal/type/converter.rb +42 -34
  10. data/lib/brand_dev/internal/type/enum.rb +16 -5
  11. data/lib/brand_dev/internal/type/file_input.rb +6 -1
  12. data/lib/brand_dev/internal/type/hash_of.rb +6 -1
  13. data/lib/brand_dev/internal/type/union.rb +17 -9
  14. data/lib/brand_dev/internal/type/unknown.rb +7 -1
  15. data/lib/brand_dev/internal/util.rb +8 -9
  16. data/lib/brand_dev/models/brand_ai_query_params.rb +173 -0
  17. data/lib/brand_dev/models/brand_ai_query_response.rb +80 -0
  18. data/lib/brand_dev/models/brand_identify_from_transaction_params.rb +14 -1
  19. data/lib/brand_dev/models/brand_identify_from_transaction_response.rb +1 -29
  20. data/lib/brand_dev/models/brand_prefetch_params.rb +35 -0
  21. data/lib/brand_dev/models/brand_prefetch_response.rb +33 -0
  22. data/lib/brand_dev/models/brand_retrieve_by_ticker_params.rb +14 -1
  23. data/lib/brand_dev/models/brand_retrieve_by_ticker_response.rb +1 -29
  24. data/lib/brand_dev/models/brand_retrieve_naics_params.rb +11 -1
  25. data/lib/brand_dev/models/brand_retrieve_params.rb +24 -1
  26. data/lib/brand_dev/models/brand_retrieve_response.rb +1 -29
  27. data/lib/brand_dev/models/brand_retrieve_simplified_params.rb +35 -0
  28. data/lib/brand_dev/models/brand_retrieve_simplified_response.rb +280 -0
  29. data/lib/brand_dev/models/brand_screenshot_params.rb +49 -0
  30. data/lib/brand_dev/models/brand_screenshot_response.rb +64 -0
  31. data/lib/brand_dev/models/brand_styleguide_params.rb +36 -0
  32. data/lib/brand_dev/models/brand_styleguide_response.rb +769 -0
  33. data/lib/brand_dev/models.rb +13 -5
  34. data/lib/brand_dev/resources/brand.rb +165 -18
  35. data/lib/brand_dev/version.rb +1 -1
  36. data/lib/brand_dev.rb +10 -2
  37. data/rbi/brand_dev/errors.rbi +16 -0
  38. data/rbi/brand_dev/internal/type/boolean.rbi +2 -0
  39. data/rbi/brand_dev/internal/type/converter.rbi +15 -15
  40. data/rbi/brand_dev/internal/type/union.rbi +5 -0
  41. data/rbi/brand_dev/internal/type/unknown.rbi +2 -0
  42. data/rbi/brand_dev/internal/util.rbi +2 -0
  43. data/rbi/brand_dev/models/brand_ai_query_params.rbi +319 -0
  44. data/rbi/brand_dev/models/brand_ai_query_response.rbi +182 -0
  45. data/rbi/brand_dev/models/brand_identify_from_transaction_params.rbi +15 -0
  46. data/rbi/brand_dev/models/brand_identify_from_transaction_response.rbi +0 -69
  47. data/rbi/brand_dev/models/brand_prefetch_params.rbi +58 -0
  48. data/rbi/brand_dev/models/brand_prefetch_response.rbi +57 -0
  49. data/rbi/brand_dev/models/brand_retrieve_by_ticker_params.rbi +19 -1
  50. data/rbi/brand_dev/models/brand_retrieve_by_ticker_response.rbi +0 -69
  51. data/rbi/brand_dev/models/brand_retrieve_naics_params.rbi +19 -1
  52. data/rbi/brand_dev/models/brand_retrieve_params.rbi +30 -0
  53. data/rbi/brand_dev/models/brand_retrieve_response.rbi +0 -65
  54. data/rbi/brand_dev/models/brand_retrieve_simplified_params.rbi +61 -0
  55. data/rbi/brand_dev/models/brand_retrieve_simplified_response.rbi +667 -0
  56. data/rbi/brand_dev/models/brand_screenshot_params.rbi +105 -0
  57. data/rbi/brand_dev/models/brand_screenshot_response.rbi +135 -0
  58. data/rbi/brand_dev/models/brand_styleguide_params.rbi +60 -0
  59. data/rbi/brand_dev/models/brand_styleguide_response.rbi +1648 -0
  60. data/rbi/brand_dev/models.rbi +10 -1
  61. data/rbi/brand_dev/resources/brand.rbi +133 -6
  62. data/sig/brand_dev/errors.rbs +9 -0
  63. data/sig/brand_dev/internal/type/converter.rbs +7 -1
  64. data/sig/brand_dev/models/brand_ai_query_params.rbs +162 -0
  65. data/sig/brand_dev/models/brand_ai_query_response.rbs +79 -0
  66. data/sig/brand_dev/models/brand_identify_from_transaction_params.rbs +7 -1
  67. data/sig/brand_dev/models/brand_identify_from_transaction_response.rbs +0 -25
  68. data/sig/brand_dev/models/brand_prefetch_params.rbs +30 -0
  69. data/sig/brand_dev/models/brand_prefetch_response.rbs +28 -0
  70. data/sig/brand_dev/models/brand_retrieve_by_ticker_params.rbs +8 -1
  71. data/sig/brand_dev/models/brand_retrieve_by_ticker_response.rbs +0 -25
  72. data/sig/brand_dev/models/brand_retrieve_naics_params.rbs +8 -1
  73. data/sig/brand_dev/models/brand_retrieve_params.rbs +15 -1
  74. data/sig/brand_dev/models/brand_retrieve_response.rbs +0 -25
  75. data/sig/brand_dev/models/brand_retrieve_simplified_params.rbs +30 -0
  76. data/sig/brand_dev/models/brand_retrieve_simplified_response.rbs +292 -0
  77. data/sig/brand_dev/models/brand_screenshot_params.rbs +46 -0
  78. data/sig/brand_dev/models/brand_screenshot_response.rbs +63 -0
  79. data/sig/brand_dev/models/brand_styleguide_params.rbs +30 -0
  80. data/sig/brand_dev/models/brand_styleguide_response.rbs +925 -0
  81. data/sig/brand_dev/models.rbs +9 -1
  82. data/sig/brand_dev/resources/brand.rbs +35 -3
  83. metadata +46 -22
  84. data/lib/brand_dev/models/brand_search_params.rb +0 -22
  85. data/lib/brand_dev/models/brand_search_response.rb +0 -35
  86. data/rbi/brand_dev/models/brand_search_params.rbi +0 -40
  87. data/rbi/brand_dev/models/brand_search_response.rbi +0 -63
  88. data/sig/brand_dev/models/brand_search_params.rbs +0 -23
  89. data/sig/brand_dev/models/brand_search_response.rbs +0 -29
@@ -11,16 +11,16 @@ module BrandDev
11
11
  mod.constants.each do |name|
12
12
  case mod.const_get(name)
13
13
  in true | false
14
- mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T.all(T::Boolean, mod) } }
14
+ mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
15
15
  mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
16
16
  in Integer
17
- mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { T.all(Integer, mod) } }
17
+ mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
18
18
  mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
19
19
  in Float
20
- mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { T.all(Float, mod) } }
20
+ mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
21
21
  mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
22
22
  in Symbol
23
- mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { T.all(Symbol, mod) } }
23
+ mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
24
24
  mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
25
25
  else
26
26
  end
@@ -39,13 +39,21 @@ module BrandDev
39
39
  mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
40
40
  end
41
41
 
42
+ BrandAIQueryParams = BrandDev::Models::BrandAIQueryParams
43
+
42
44
  BrandIdentifyFromTransactionParams = BrandDev::Models::BrandIdentifyFromTransactionParams
43
45
 
46
+ BrandPrefetchParams = BrandDev::Models::BrandPrefetchParams
47
+
44
48
  BrandRetrieveByTickerParams = BrandDev::Models::BrandRetrieveByTickerParams
45
49
 
46
50
  BrandRetrieveNaicsParams = BrandDev::Models::BrandRetrieveNaicsParams
47
51
 
48
52
  BrandRetrieveParams = BrandDev::Models::BrandRetrieveParams
49
53
 
50
- BrandSearchParams = BrandDev::Models::BrandSearchParams
54
+ BrandRetrieveSimplifiedParams = BrandDev::Models::BrandRetrieveSimplifiedParams
55
+
56
+ BrandScreenshotParams = BrandDev::Models::BrandScreenshotParams
57
+
58
+ BrandStyleguideParams = BrandDev::Models::BrandStyleguideParams
51
59
  end
@@ -3,14 +3,21 @@
3
3
  module BrandDev
4
4
  module Resources
5
5
  class Brand
6
+ # Some parameter documentations has been truncated, see
7
+ # {BrandDev::Models::BrandRetrieveParams} for more details.
8
+ #
6
9
  # Retrieve brand data by domain
7
10
  #
8
- # @overload retrieve(domain:, force_language: nil, request_options: {})
11
+ # @overload retrieve(domain:, force_language: nil, max_speed: nil, timeout_ms: nil, request_options: {})
9
12
  #
10
13
  # @param domain [String] Domain name to retrieve brand data for
11
14
  #
12
15
  # @param force_language [Symbol, BrandDev::Models::BrandRetrieveParams::ForceLanguage] Optional parameter to force the language of the retrieved brand data
13
16
  #
17
+ # @param max_speed [Boolean] Optional parameter to optimize the API call for maximum speed. When set to true,
18
+ #
19
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
20
+ #
14
21
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
15
22
  #
16
23
  # @return [BrandDev::Models::BrandRetrieveResponse]
@@ -21,19 +28,57 @@ module BrandDev
21
28
  @client.request(
22
29
  method: :get,
23
30
  path: "brand/retrieve",
24
- query: parsed,
31
+ query: parsed.transform_keys(max_speed: "maxSpeed", timeout_ms: "timeoutMS"),
25
32
  model: BrandDev::Models::BrandRetrieveResponse,
26
33
  options: options
27
34
  )
28
35
  end
29
36
 
37
+ # Some parameter documentations has been truncated, see
38
+ # {BrandDev::Models::BrandAIQueryParams} for more details.
39
+ #
40
+ # Beta feature: Use AI to extract specific data points from a brand's website. The
41
+ # AI will crawl the website and extract the requested information based on the
42
+ # provided data points.
43
+ #
44
+ # @overload ai_query(data_to_extract:, domain:, specific_pages: nil, timeout_ms: nil, request_options: {})
45
+ #
46
+ # @param data_to_extract [Array<BrandDev::Models::BrandAIQueryParams::DataToExtract>] Array of data points to extract from the website
47
+ #
48
+ # @param domain [String] The domain name to analyze
49
+ #
50
+ # @param specific_pages [BrandDev::Models::BrandAIQueryParams::SpecificPages] Optional object specifying which pages to analyze
51
+ #
52
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
53
+ #
54
+ # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
55
+ #
56
+ # @return [BrandDev::Models::BrandAIQueryResponse]
57
+ #
58
+ # @see BrandDev::Models::BrandAIQueryParams
59
+ def ai_query(params)
60
+ parsed, options = BrandDev::BrandAIQueryParams.dump_request(params)
61
+ @client.request(
62
+ method: :post,
63
+ path: "brand/ai/query",
64
+ body: parsed,
65
+ model: BrandDev::Models::BrandAIQueryResponse,
66
+ options: options
67
+ )
68
+ end
69
+
70
+ # Some parameter documentations has been truncated, see
71
+ # {BrandDev::Models::BrandIdentifyFromTransactionParams} for more details.
72
+ #
30
73
  # Endpoint specially designed for platforms that want to identify transaction data
31
74
  # by the transaction title.
32
75
  #
33
- # @overload identify_from_transaction(transaction_info:, request_options: {})
76
+ # @overload identify_from_transaction(transaction_info:, timeout_ms: nil, request_options: {})
34
77
  #
35
78
  # @param transaction_info [String] Transaction information to identify the brand
36
79
  #
80
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
81
+ #
37
82
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
38
83
  #
39
84
  # @return [BrandDev::Models::BrandIdentifyFromTransactionResponse]
@@ -44,18 +89,53 @@ module BrandDev
44
89
  @client.request(
45
90
  method: :get,
46
91
  path: "brand/transaction_identifier",
47
- query: parsed,
92
+ query: parsed.transform_keys(timeout_ms: "timeoutMS"),
48
93
  model: BrandDev::Models::BrandIdentifyFromTransactionResponse,
49
94
  options: options
50
95
  )
51
96
  end
52
97
 
98
+ # Some parameter documentations has been truncated, see
99
+ # {BrandDev::Models::BrandPrefetchParams} for more details.
100
+ #
101
+ # Signal that you may fetch brand data for a particular domain soon to improve
102
+ # latency. This endpoint does not charge credits and is available for paid
103
+ # customers to optimize future requests. [You must be on a paid plan to use this
104
+ # endpoint]
105
+ #
106
+ # @overload prefetch(domain:, timeout_ms: nil, request_options: {})
107
+ #
108
+ # @param domain [String] Domain name to prefetch brand data for
109
+ #
110
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
111
+ #
112
+ # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
113
+ #
114
+ # @return [BrandDev::Models::BrandPrefetchResponse]
115
+ #
116
+ # @see BrandDev::Models::BrandPrefetchParams
117
+ def prefetch(params)
118
+ parsed, options = BrandDev::BrandPrefetchParams.dump_request(params)
119
+ @client.request(
120
+ method: :post,
121
+ path: "brand/prefetch",
122
+ body: parsed,
123
+ model: BrandDev::Models::BrandPrefetchResponse,
124
+ options: options
125
+ )
126
+ end
127
+
128
+ # Some parameter documentations has been truncated, see
129
+ # {BrandDev::Models::BrandRetrieveByTickerParams} for more details.
130
+ #
53
131
  # Retrieve brand data by stock ticker (e.g. AAPL, TSLA, etc.)
54
132
  #
55
- # @overload retrieve_by_ticker(ticker:, request_options: {})
133
+ # @overload retrieve_by_ticker(ticker:, timeout_ms: nil, request_options: {})
56
134
  #
57
135
  # @param ticker [String] Stock ticker symbol to retrieve brand data for (e.g. AAPL, TSLA, etc.)
58
136
  #
137
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
138
+ #
59
139
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
60
140
  #
61
141
  # @return [BrandDev::Models::BrandRetrieveByTickerResponse]
@@ -66,7 +146,7 @@ module BrandDev
66
146
  @client.request(
67
147
  method: :get,
68
148
  path: "brand/retrieve-by-ticker",
69
- query: parsed,
149
+ query: parsed.transform_keys(timeout_ms: "timeoutMS"),
70
150
  model: BrandDev::Models::BrandRetrieveByTickerResponse,
71
151
  options: options
72
152
  )
@@ -77,10 +157,12 @@ module BrandDev
77
157
  #
78
158
  # Endpoint to classify any brand into a 2022 NAICS code.
79
159
  #
80
- # @overload retrieve_naics(input:, request_options: {})
160
+ # @overload retrieve_naics(input:, timeout_ms: nil, request_options: {})
81
161
  #
82
162
  # @param input [String] Brand domain or title to retrieve NAICS code for. If a valid domain is provided
83
163
  #
164
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
165
+ #
84
166
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
85
167
  #
86
168
  # @return [BrandDev::Models::BrandRetrieveNaicsResponse]
@@ -91,30 +173,95 @@ module BrandDev
91
173
  @client.request(
92
174
  method: :get,
93
175
  path: "brand/naics",
94
- query: parsed,
176
+ query: parsed.transform_keys(timeout_ms: "timeoutMS"),
95
177
  model: BrandDev::Models::BrandRetrieveNaicsResponse,
96
178
  options: options
97
179
  )
98
180
  end
99
181
 
100
- # Search brands by query
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
+
240
+ # Some parameter documentations has been truncated, see
241
+ # {BrandDev::Models::BrandStyleguideParams} for more details.
242
+ #
243
+ # Beta feature: Automatically extract comprehensive design system information from
244
+ # a brand's website including colors, typography, spacing, shadows, and UI
245
+ # components.
246
+ #
247
+ # @overload styleguide(domain:, timeout_ms: nil, request_options: {})
101
248
  #
102
- # @overload search(query:, request_options: {})
249
+ # @param domain [String] Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
103
250
  #
104
- # @param query [String] Query string to search brands
251
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
105
252
  #
106
253
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
107
254
  #
108
- # @return [Array<BrandDev::Models::BrandSearchResponseItem>]
255
+ # @return [BrandDev::Models::BrandStyleguideResponse]
109
256
  #
110
- # @see BrandDev::Models::BrandSearchParams
111
- def search(params)
112
- parsed, options = BrandDev::BrandSearchParams.dump_request(params)
257
+ # @see BrandDev::Models::BrandStyleguideParams
258
+ def styleguide(params)
259
+ parsed, options = BrandDev::BrandStyleguideParams.dump_request(params)
113
260
  @client.request(
114
261
  method: :get,
115
- path: "brand/search",
116
- query: parsed,
117
- model: BrandDev::Internal::Type::ArrayOf[BrandDev::Models::BrandSearchResponseItem],
262
+ path: "brand/styleguide",
263
+ query: parsed.transform_keys(timeout_ms: "timeoutMS"),
264
+ model: BrandDev::Models::BrandStyleguideResponse,
118
265
  options: options
119
266
  )
120
267
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrandDev
4
- VERSION = "0.0.1.pre.alpha.0"
4
+ VERSION = "0.0.2"
5
5
  end
data/lib/brand_dev.rb CHANGED
@@ -50,15 +50,23 @@ require_relative "brand_dev/errors"
50
50
  require_relative "brand_dev/internal/transport/base_client"
51
51
  require_relative "brand_dev/internal/transport/pooled_net_requester"
52
52
  require_relative "brand_dev/client"
53
+ require_relative "brand_dev/models/brand_ai_query_params"
54
+ require_relative "brand_dev/models/brand_ai_query_response"
53
55
  require_relative "brand_dev/models/brand_identify_from_transaction_params"
54
56
  require_relative "brand_dev/models/brand_identify_from_transaction_response"
57
+ require_relative "brand_dev/models/brand_prefetch_params"
58
+ require_relative "brand_dev/models/brand_prefetch_response"
55
59
  require_relative "brand_dev/models/brand_retrieve_by_ticker_params"
56
60
  require_relative "brand_dev/models/brand_retrieve_by_ticker_response"
57
61
  require_relative "brand_dev/models/brand_retrieve_naics_params"
58
62
  require_relative "brand_dev/models/brand_retrieve_naics_response"
59
63
  require_relative "brand_dev/models/brand_retrieve_params"
60
64
  require_relative "brand_dev/models/brand_retrieve_response"
61
- require_relative "brand_dev/models/brand_search_params"
62
- require_relative "brand_dev/models/brand_search_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"
69
+ require_relative "brand_dev/models/brand_styleguide_params"
70
+ require_relative "brand_dev/models/brand_styleguide_response"
63
71
  require_relative "brand_dev/models"
64
72
  require_relative "brand_dev/resources/brand"
@@ -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
@@ -22,6 +22,8 @@ module BrandDev
22
22
 
23
23
  class << self
24
24
  # @api private
25
+ #
26
+ # Coerce value to Boolean if possible, otherwise return the original value.
25
27
  sig do
26
28
  override
27
29
  .params(
@@ -15,12 +15,14 @@ module BrandDev
15
15
  CoerceState =
16
16
  T.type_alias do
17
17
  {
18
- strictness: T.any(T::Boolean, Symbol),
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`, or `:strong`. This informs the
113
- # coercion strategy when we have to decide between multiple possible conversion
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(
@@ -22,6 +22,8 @@ module BrandDev
22
22
 
23
23
  class << self
24
24
  # @api private
25
+ #
26
+ # No coercion needed for Unknown type.
25
27
  sig do
26
28
  override
27
29
  .params(
@@ -332,6 +332,8 @@ module BrandDev
332
332
  end
333
333
 
334
334
  # @api private
335
+ #
336
+ # https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#special-considerations-for-multipart-content
335
337
  sig do
336
338
  params(body: T.anything).returns([String, T::Enumerable[String]])
337
339
  end