brand.dev 0.0.2 → 0.1.0.pre.alpha.1

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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +0 -173
  3. data/README.md +1 -1
  4. data/lib/brand_dev/errors.rb +0 -22
  5. data/lib/brand_dev/internal/transport/base_client.rb +2 -10
  6. data/lib/brand_dev/internal/type/array_of.rb +1 -6
  7. data/lib/brand_dev/internal/type/base_model.rb +25 -77
  8. data/lib/brand_dev/internal/type/boolean.rb +1 -7
  9. data/lib/brand_dev/internal/type/converter.rb +34 -42
  10. data/lib/brand_dev/internal/type/enum.rb +5 -16
  11. data/lib/brand_dev/internal/type/file_input.rb +1 -6
  12. data/lib/brand_dev/internal/type/hash_of.rb +1 -6
  13. data/lib/brand_dev/internal/type/union.rb +9 -17
  14. data/lib/brand_dev/internal/type/unknown.rb +1 -7
  15. data/lib/brand_dev/internal/util.rb +9 -8
  16. data/lib/brand_dev/models/brand_ai_query_params.rb +5 -87
  17. data/lib/brand_dev/models/brand_identify_from_transaction_params.rb +1 -14
  18. data/lib/brand_dev/models/brand_identify_from_transaction_response.rb +29 -1
  19. data/lib/brand_dev/models/brand_retrieve_by_ticker_params.rb +1 -14
  20. data/lib/brand_dev/models/brand_retrieve_by_ticker_response.rb +29 -1
  21. data/lib/brand_dev/models/brand_retrieve_naics_params.rb +1 -11
  22. data/lib/brand_dev/models/brand_retrieve_params.rb +1 -24
  23. data/lib/brand_dev/models/brand_retrieve_response.rb +29 -1
  24. data/lib/brand_dev/models/brand_search_params.rb +22 -0
  25. data/lib/brand_dev/models/brand_search_response.rb +35 -0
  26. data/lib/brand_dev/models.rb +5 -11
  27. data/lib/brand_dev/resources/brand.rb +20 -139
  28. data/lib/brand_dev/version.rb +1 -1
  29. data/lib/brand_dev.rb +2 -8
  30. data/rbi/brand_dev/errors.rbi +0 -16
  31. data/rbi/brand_dev/internal/type/boolean.rbi +0 -2
  32. data/rbi/brand_dev/internal/type/converter.rbi +15 -15
  33. data/rbi/brand_dev/internal/type/union.rbi +0 -5
  34. data/rbi/brand_dev/internal/type/unknown.rbi +0 -2
  35. data/rbi/brand_dev/internal/util.rbi +0 -2
  36. data/rbi/brand_dev/models/brand_ai_query_params.rbi +6 -141
  37. data/rbi/brand_dev/models/brand_identify_from_transaction_params.rbi +0 -15
  38. data/rbi/brand_dev/models/brand_identify_from_transaction_response.rbi +69 -0
  39. data/rbi/brand_dev/models/brand_retrieve_by_ticker_params.rbi +1 -19
  40. data/rbi/brand_dev/models/brand_retrieve_by_ticker_response.rbi +69 -0
  41. data/rbi/brand_dev/models/brand_retrieve_naics_params.rbi +1 -19
  42. data/rbi/brand_dev/models/brand_retrieve_params.rbi +0 -30
  43. data/rbi/brand_dev/models/brand_retrieve_response.rbi +65 -0
  44. data/rbi/brand_dev/models/brand_search_params.rbi +40 -0
  45. data/rbi/brand_dev/models/brand_search_response.rbi +63 -0
  46. data/rbi/brand_dev/models.rbi +1 -8
  47. data/rbi/brand_dev/resources/brand.rbi +8 -112
  48. data/sig/brand_dev/errors.rbs +0 -9
  49. data/sig/brand_dev/internal/type/converter.rbs +1 -7
  50. data/sig/brand_dev/models/brand_ai_query_params.rbs +5 -82
  51. data/sig/brand_dev/models/brand_identify_from_transaction_params.rbs +1 -7
  52. data/sig/brand_dev/models/brand_identify_from_transaction_response.rbs +25 -0
  53. data/sig/brand_dev/models/brand_retrieve_by_ticker_params.rbs +1 -8
  54. data/sig/brand_dev/models/brand_retrieve_by_ticker_response.rbs +25 -0
  55. data/sig/brand_dev/models/brand_retrieve_naics_params.rbs +1 -8
  56. data/sig/brand_dev/models/brand_retrieve_params.rbs +1 -15
  57. data/sig/brand_dev/models/brand_retrieve_response.rbs +25 -0
  58. data/sig/brand_dev/models/brand_search_params.rbs +23 -0
  59. data/sig/brand_dev/models/brand_search_response.rbs +29 -0
  60. data/sig/brand_dev/models.rbs +1 -7
  61. data/sig/brand_dev/resources/brand.rbs +4 -29
  62. metadata +10 -28
  63. data/lib/brand_dev/models/brand_prefetch_params.rb +0 -35
  64. data/lib/brand_dev/models/brand_prefetch_response.rb +0 -33
  65. data/lib/brand_dev/models/brand_retrieve_simplified_params.rb +0 -35
  66. data/lib/brand_dev/models/brand_retrieve_simplified_response.rb +0 -280
  67. data/lib/brand_dev/models/brand_screenshot_params.rb +0 -49
  68. data/lib/brand_dev/models/brand_screenshot_response.rb +0 -64
  69. data/lib/brand_dev/models/brand_styleguide_params.rb +0 -36
  70. data/lib/brand_dev/models/brand_styleguide_response.rb +0 -769
  71. data/rbi/brand_dev/models/brand_prefetch_params.rbi +0 -58
  72. data/rbi/brand_dev/models/brand_prefetch_response.rbi +0 -57
  73. data/rbi/brand_dev/models/brand_retrieve_simplified_params.rbi +0 -61
  74. data/rbi/brand_dev/models/brand_retrieve_simplified_response.rbi +0 -667
  75. data/rbi/brand_dev/models/brand_screenshot_params.rbi +0 -105
  76. data/rbi/brand_dev/models/brand_screenshot_response.rbi +0 -135
  77. data/rbi/brand_dev/models/brand_styleguide_params.rbi +0 -60
  78. data/rbi/brand_dev/models/brand_styleguide_response.rbi +0 -1648
  79. data/sig/brand_dev/models/brand_prefetch_params.rbs +0 -30
  80. data/sig/brand_dev/models/brand_prefetch_response.rbs +0 -28
  81. data/sig/brand_dev/models/brand_retrieve_simplified_params.rbs +0 -30
  82. data/sig/brand_dev/models/brand_retrieve_simplified_response.rbs +0 -292
  83. data/sig/brand_dev/models/brand_screenshot_params.rbs +0 -46
  84. data/sig/brand_dev/models/brand_screenshot_response.rbs +0 -63
  85. data/sig/brand_dev/models/brand_styleguide_params.rbs +0 -30
  86. data/sig/brand_dev/models/brand_styleguide_response.rbs +0 -925
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrandDev
4
+ module Models
5
+ class BrandSearchResponseItem < BrandDev::Internal::Type::BaseModel
6
+ # @!attribute domain
7
+ # Domain name of the brand
8
+ #
9
+ # @return [String, nil]
10
+ optional :domain, String
11
+
12
+ # @!attribute logo
13
+ # URL of the brand's logo
14
+ #
15
+ # @return [String, nil]
16
+ optional :logo, String
17
+
18
+ # @!attribute title
19
+ # Title or name of the brand
20
+ #
21
+ # @return [String, nil]
22
+ optional :title, String
23
+
24
+ # @!method initialize(domain: nil, logo: nil, title: nil)
25
+ # @param domain [String] Domain name of the brand
26
+ #
27
+ # @param logo [String] URL of the brand's logo
28
+ #
29
+ # @param title [String] Title or name of the brand
30
+ end
31
+
32
+ # @type [BrandDev::Internal::Type::Converter]
33
+ BrandSearchResponse = BrandDev::Internal::Type::ArrayOf[-> { BrandDev::Models::BrandSearchResponseItem }]
34
+ end
35
+ end
@@ -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::Boolean } }
14
+ mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T.all(T::Boolean, mod) } }
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 { Integer } }
17
+ mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { T.all(Integer, mod) } }
18
18
  mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
19
19
  in Float
20
- mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
20
+ mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { T.all(Float, mod) } }
21
21
  mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
22
22
  in Symbol
23
- mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
23
+ mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { T.all(Symbol, mod) } }
24
24
  mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
25
25
  else
26
26
  end
@@ -43,17 +43,11 @@ module BrandDev
43
43
 
44
44
  BrandIdentifyFromTransactionParams = BrandDev::Models::BrandIdentifyFromTransactionParams
45
45
 
46
- BrandPrefetchParams = BrandDev::Models::BrandPrefetchParams
47
-
48
46
  BrandRetrieveByTickerParams = BrandDev::Models::BrandRetrieveByTickerParams
49
47
 
50
48
  BrandRetrieveNaicsParams = BrandDev::Models::BrandRetrieveNaicsParams
51
49
 
52
50
  BrandRetrieveParams = BrandDev::Models::BrandRetrieveParams
53
51
 
54
- BrandRetrieveSimplifiedParams = BrandDev::Models::BrandRetrieveSimplifiedParams
55
-
56
- BrandScreenshotParams = BrandDev::Models::BrandScreenshotParams
57
-
58
- BrandStyleguideParams = BrandDev::Models::BrandStyleguideParams
52
+ BrandSearchParams = BrandDev::Models::BrandSearchParams
59
53
  end
@@ -3,21 +3,14 @@
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
- #
9
6
  # Retrieve brand data by domain
10
7
  #
11
- # @overload retrieve(domain:, force_language: nil, max_speed: nil, timeout_ms: nil, request_options: {})
8
+ # @overload retrieve(domain:, force_language: nil, request_options: {})
12
9
  #
13
10
  # @param domain [String] Domain name to retrieve brand data for
14
11
  #
15
12
  # @param force_language [Symbol, BrandDev::Models::BrandRetrieveParams::ForceLanguage] Optional parameter to force the language of the retrieved brand data
16
13
  #
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
- #
21
14
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
22
15
  #
23
16
  # @return [BrandDev::Models::BrandRetrieveResponse]
@@ -28,28 +21,23 @@ module BrandDev
28
21
  @client.request(
29
22
  method: :get,
30
23
  path: "brand/retrieve",
31
- query: parsed.transform_keys(max_speed: "maxSpeed", timeout_ms: "timeoutMS"),
24
+ query: parsed,
32
25
  model: BrandDev::Models::BrandRetrieveResponse,
33
26
  options: options
34
27
  )
35
28
  end
36
29
 
37
- # Some parameter documentations has been truncated, see
38
- # {BrandDev::Models::BrandAIQueryParams} for more details.
39
- #
40
30
  # Beta feature: Use AI to extract specific data points from a brand's website. The
41
31
  # AI will crawl the website and extract the requested information based on the
42
32
  # provided data points.
43
33
  #
44
- # @overload ai_query(data_to_extract:, domain:, specific_pages: nil, timeout_ms: nil, request_options: {})
34
+ # @overload ai_query(data_to_extract:, domain:, specific_pages: nil, request_options: {})
45
35
  #
46
36
  # @param data_to_extract [Array<BrandDev::Models::BrandAIQueryParams::DataToExtract>] Array of data points to extract from the website
47
37
  #
48
38
  # @param domain [String] The domain name to analyze
49
39
  #
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
40
+ # @param specific_pages [Array<String>] Optional array of specific pages to analyze
53
41
  #
54
42
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
55
43
  #
@@ -67,18 +55,13 @@ module BrandDev
67
55
  )
68
56
  end
69
57
 
70
- # Some parameter documentations has been truncated, see
71
- # {BrandDev::Models::BrandIdentifyFromTransactionParams} for more details.
72
- #
73
58
  # Endpoint specially designed for platforms that want to identify transaction data
74
59
  # by the transaction title.
75
60
  #
76
- # @overload identify_from_transaction(transaction_info:, timeout_ms: nil, request_options: {})
61
+ # @overload identify_from_transaction(transaction_info:, request_options: {})
77
62
  #
78
63
  # @param transaction_info [String] Transaction information to identify the brand
79
64
  #
80
- # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
81
- #
82
65
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
83
66
  #
84
67
  # @return [BrandDev::Models::BrandIdentifyFromTransactionResponse]
@@ -89,53 +72,18 @@ module BrandDev
89
72
  @client.request(
90
73
  method: :get,
91
74
  path: "brand/transaction_identifier",
92
- query: parsed.transform_keys(timeout_ms: "timeoutMS"),
75
+ query: parsed,
93
76
  model: BrandDev::Models::BrandIdentifyFromTransactionResponse,
94
77
  options: options
95
78
  )
96
79
  end
97
80
 
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
- #
131
81
  # Retrieve brand data by stock ticker (e.g. AAPL, TSLA, etc.)
132
82
  #
133
- # @overload retrieve_by_ticker(ticker:, timeout_ms: nil, request_options: {})
83
+ # @overload retrieve_by_ticker(ticker:, request_options: {})
134
84
  #
135
85
  # @param ticker [String] Stock ticker symbol to retrieve brand data for (e.g. AAPL, TSLA, etc.)
136
86
  #
137
- # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
138
- #
139
87
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
140
88
  #
141
89
  # @return [BrandDev::Models::BrandRetrieveByTickerResponse]
@@ -146,7 +94,7 @@ module BrandDev
146
94
  @client.request(
147
95
  method: :get,
148
96
  path: "brand/retrieve-by-ticker",
149
- query: parsed.transform_keys(timeout_ms: "timeoutMS"),
97
+ query: parsed,
150
98
  model: BrandDev::Models::BrandRetrieveByTickerResponse,
151
99
  options: options
152
100
  )
@@ -157,12 +105,10 @@ module BrandDev
157
105
  #
158
106
  # Endpoint to classify any brand into a 2022 NAICS code.
159
107
  #
160
- # @overload retrieve_naics(input:, timeout_ms: nil, request_options: {})
108
+ # @overload retrieve_naics(input:, request_options: {})
161
109
  #
162
110
  # @param input [String] Brand domain or title to retrieve NAICS code for. If a valid domain is provided
163
111
  #
164
- # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
165
- #
166
112
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
167
113
  #
168
114
  # @return [BrandDev::Models::BrandRetrieveNaicsResponse]
@@ -173,95 +119,30 @@ module BrandDev
173
119
  @client.request(
174
120
  method: :get,
175
121
  path: "brand/naics",
176
- query: parsed.transform_keys(timeout_ms: "timeoutMS"),
122
+ query: parsed,
177
123
  model: BrandDev::Models::BrandRetrieveNaicsResponse,
178
124
  options: options
179
125
  )
180
126
  end
181
127
 
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: {})
128
+ # Search brands by query
248
129
  #
249
- # @param domain [String] Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
130
+ # @overload search(query:, request_options: {})
250
131
  #
251
- # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
132
+ # @param query [String] Query string to search brands
252
133
  #
253
134
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
254
135
  #
255
- # @return [BrandDev::Models::BrandStyleguideResponse]
136
+ # @return [Array<BrandDev::Models::BrandSearchResponseItem>]
256
137
  #
257
- # @see BrandDev::Models::BrandStyleguideParams
258
- def styleguide(params)
259
- parsed, options = BrandDev::BrandStyleguideParams.dump_request(params)
138
+ # @see BrandDev::Models::BrandSearchParams
139
+ def search(params)
140
+ parsed, options = BrandDev::BrandSearchParams.dump_request(params)
260
141
  @client.request(
261
142
  method: :get,
262
- path: "brand/styleguide",
263
- query: parsed.transform_keys(timeout_ms: "timeoutMS"),
264
- model: BrandDev::Models::BrandStyleguideResponse,
143
+ path: "brand/search",
144
+ query: parsed,
145
+ model: BrandDev::Internal::Type::ArrayOf[BrandDev::Models::BrandSearchResponseItem],
265
146
  options: options
266
147
  )
267
148
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrandDev
4
- VERSION = "0.0.2"
4
+ VERSION = "0.1.0.pre.alpha.1"
5
5
  end
data/lib/brand_dev.rb CHANGED
@@ -54,19 +54,13 @@ require_relative "brand_dev/models/brand_ai_query_params"
54
54
  require_relative "brand_dev/models/brand_ai_query_response"
55
55
  require_relative "brand_dev/models/brand_identify_from_transaction_params"
56
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"
59
57
  require_relative "brand_dev/models/brand_retrieve_by_ticker_params"
60
58
  require_relative "brand_dev/models/brand_retrieve_by_ticker_response"
61
59
  require_relative "brand_dev/models/brand_retrieve_naics_params"
62
60
  require_relative "brand_dev/models/brand_retrieve_naics_response"
63
61
  require_relative "brand_dev/models/brand_retrieve_params"
64
62
  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"
69
- require_relative "brand_dev/models/brand_styleguide_params"
70
- require_relative "brand_dev/models/brand_styleguide_response"
63
+ require_relative "brand_dev/models/brand_search_params"
64
+ require_relative "brand_dev/models/brand_search_response"
71
65
  require_relative "brand_dev/models"
72
66
  require_relative "brand_dev/resources/brand"
@@ -8,22 +8,6 @@ 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
27
11
  end
28
12
 
29
13
  class APIError < BrandDev::Errors::Error
@@ -22,8 +22,6 @@ 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.
27
25
  sig do
28
26
  override
29
27
  .params(
@@ -15,14 +15,12 @@ module BrandDev
15
15
  CoerceState =
16
16
  T.type_alias do
17
17
  {
18
- translate_names: T::Boolean,
19
- strictness: T::Boolean,
18
+ strictness: T.any(T::Boolean, Symbol),
20
19
  exactness: {
21
20
  yes: Integer,
22
21
  no: Integer,
23
22
  maybe: Integer
24
23
  },
25
- error: T::Class[StandardError],
26
24
  branched: Integer
27
25
  }
28
26
  end
@@ -90,15 +88,6 @@ module BrandDev
90
88
  def self.type_info(spec)
91
89
  end
92
90
 
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
-
102
91
  # @api private
103
92
  #
104
93
  # Based on `target`, transform `value` into `target`, to the extent possible:
@@ -120,11 +109,14 @@ module BrandDev
120
109
  def self.coerce(
121
110
  target,
122
111
  value,
123
- # The `strictness` is one of `true`, `false`. This informs the coercion strategy
124
- # when we have to decide between multiple possible conversion targets:
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:
125
115
  #
126
116
  # - `true`: the conversion must be exact, with minimum coercion.
127
117
  # - `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.
128
120
  #
129
121
  # The `exactness` is `Hash` with keys being one of `yes`, `no`, or `maybe`. For
130
122
  # any given conversion attempt, the exactness will be updated based on how closely
@@ -136,7 +128,15 @@ module BrandDev
136
128
  # - `no`: the value cannot be converted to the target type.
137
129
  #
138
130
  # See implementation below for more details.
139
- state: BrandDev::Internal::Type::Converter.new_coerce_state
131
+ state: {
132
+ strictness: true,
133
+ exactness: {
134
+ yes: 0,
135
+ no: 0,
136
+ maybe: 0
137
+ },
138
+ branched: 0
139
+ }
140
140
  )
141
141
  end
142
142
 
@@ -78,11 +78,6 @@ 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.
86
81
  sig do
87
82
  override
88
83
  .params(
@@ -22,8 +22,6 @@ module BrandDev
22
22
 
23
23
  class << self
24
24
  # @api private
25
- #
26
- # No coercion needed for Unknown type.
27
25
  sig do
28
26
  override
29
27
  .params(
@@ -332,8 +332,6 @@ 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
337
335
  sig do
338
336
  params(body: T.anything).returns([String, T::Enumerable[String]])
339
337
  end
@@ -19,33 +19,19 @@ module BrandDev
19
19
  sig { returns(String) }
20
20
  attr_accessor :domain
21
21
 
22
- # Optional object specifying which pages to analyze
23
- sig { returns(T.nilable(BrandDev::BrandAIQueryParams::SpecificPages)) }
22
+ # Optional array of specific pages to analyze
23
+ sig { returns(T.nilable(T::Array[String])) }
24
24
  attr_reader :specific_pages
25
25
 
26
- sig do
27
- params(
28
- specific_pages: BrandDev::BrandAIQueryParams::SpecificPages::OrHash
29
- ).void
30
- end
26
+ sig { params(specific_pages: T::Array[String]).void }
31
27
  attr_writer :specific_pages
32
28
 
33
- # Optional timeout in milliseconds for the request. If the request takes longer
34
- # than this value, it will be aborted with a 408 status code. Maximum allowed
35
- # value is 300000ms (5 minutes).
36
- sig { returns(T.nilable(Integer)) }
37
- attr_reader :timeout_ms
38
-
39
- sig { params(timeout_ms: Integer).void }
40
- attr_writer :timeout_ms
41
-
42
29
  sig do
43
30
  params(
44
31
  data_to_extract:
45
32
  T::Array[BrandDev::BrandAIQueryParams::DataToExtract::OrHash],
46
33
  domain: String,
47
- specific_pages: BrandDev::BrandAIQueryParams::SpecificPages::OrHash,
48
- timeout_ms: Integer,
34
+ specific_pages: T::Array[String],
49
35
  request_options: BrandDev::RequestOptions::OrHash
50
36
  ).returns(T.attached_class)
51
37
  end
@@ -54,12 +40,8 @@ module BrandDev
54
40
  data_to_extract:,
55
41
  # The domain name to analyze
56
42
  domain:,
57
- # Optional object specifying which pages to analyze
43
+ # Optional array of specific pages to analyze
58
44
  specific_pages: nil,
59
- # Optional timeout in milliseconds for the request. If the request takes longer
60
- # than this value, it will be aborted with a 408 status code. Maximum allowed
61
- # value is 300000ms (5 minutes).
62
- timeout_ms: nil,
63
45
  request_options: {}
64
46
  )
65
47
  end
@@ -70,8 +52,7 @@ module BrandDev
70
52
  data_to_extract:
71
53
  T::Array[BrandDev::BrandAIQueryParams::DataToExtract],
72
54
  domain: String,
73
- specific_pages: BrandDev::BrandAIQueryParams::SpecificPages,
74
- timeout_ms: Integer,
55
+ specific_pages: T::Array[String],
75
56
  request_options: BrandDev::RequestOptions
76
57
  }
77
58
  )
@@ -198,122 +179,6 @@ module BrandDev
198
179
  end
199
180
  end
200
181
  end
201
-
202
- class SpecificPages < BrandDev::Internal::Type::BaseModel
203
- OrHash =
204
- T.type_alias do
205
- T.any(
206
- BrandDev::BrandAIQueryParams::SpecificPages,
207
- BrandDev::Internal::AnyHash
208
- )
209
- end
210
-
211
- # Whether to analyze the about us page
212
- sig { returns(T.nilable(T::Boolean)) }
213
- attr_reader :about_us
214
-
215
- sig { params(about_us: T::Boolean).void }
216
- attr_writer :about_us
217
-
218
- # Whether to analyze the blog
219
- sig { returns(T.nilable(T::Boolean)) }
220
- attr_reader :blog
221
-
222
- sig { params(blog: T::Boolean).void }
223
- attr_writer :blog
224
-
225
- # Whether to analyze the careers page
226
- sig { returns(T.nilable(T::Boolean)) }
227
- attr_reader :careers
228
-
229
- sig { params(careers: T::Boolean).void }
230
- attr_writer :careers
231
-
232
- # Whether to analyze the contact us page
233
- sig { returns(T.nilable(T::Boolean)) }
234
- attr_reader :contact_us
235
-
236
- sig { params(contact_us: T::Boolean).void }
237
- attr_writer :contact_us
238
-
239
- # Whether to analyze the FAQ page
240
- sig { returns(T.nilable(T::Boolean)) }
241
- attr_reader :faq
242
-
243
- sig { params(faq: T::Boolean).void }
244
- attr_writer :faq
245
-
246
- # Whether to analyze the home page
247
- sig { returns(T.nilable(T::Boolean)) }
248
- attr_reader :home_page
249
-
250
- sig { params(home_page: T::Boolean).void }
251
- attr_writer :home_page
252
-
253
- # Whether to analyze the privacy policy page
254
- sig { returns(T.nilable(T::Boolean)) }
255
- attr_reader :privacy_policy
256
-
257
- sig { params(privacy_policy: T::Boolean).void }
258
- attr_writer :privacy_policy
259
-
260
- # Whether to analyze the terms and conditions page
261
- sig { returns(T.nilable(T::Boolean)) }
262
- attr_reader :terms_and_conditions
263
-
264
- sig { params(terms_and_conditions: T::Boolean).void }
265
- attr_writer :terms_and_conditions
266
-
267
- # Optional object specifying which pages to analyze
268
- sig do
269
- params(
270
- about_us: T::Boolean,
271
- blog: T::Boolean,
272
- careers: T::Boolean,
273
- contact_us: T::Boolean,
274
- faq: T::Boolean,
275
- home_page: T::Boolean,
276
- privacy_policy: T::Boolean,
277
- terms_and_conditions: T::Boolean
278
- ).returns(T.attached_class)
279
- end
280
- def self.new(
281
- # Whether to analyze the about us page
282
- about_us: nil,
283
- # Whether to analyze the blog
284
- blog: nil,
285
- # Whether to analyze the careers page
286
- careers: nil,
287
- # Whether to analyze the contact us page
288
- contact_us: nil,
289
- # Whether to analyze the FAQ page
290
- faq: nil,
291
- # Whether to analyze the home page
292
- home_page: nil,
293
- # Whether to analyze the privacy policy page
294
- privacy_policy: nil,
295
- # Whether to analyze the terms and conditions page
296
- terms_and_conditions: nil
297
- )
298
- end
299
-
300
- sig do
301
- override.returns(
302
- {
303
- about_us: T::Boolean,
304
- blog: T::Boolean,
305
- careers: T::Boolean,
306
- contact_us: T::Boolean,
307
- faq: T::Boolean,
308
- home_page: T::Boolean,
309
- privacy_policy: T::Boolean,
310
- terms_and_conditions: T::Boolean
311
- }
312
- )
313
- end
314
- def to_hash
315
- end
316
- end
317
182
  end
318
183
  end
319
184
  end