context.dev 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 (194) hide show
  1. checksums.yaml +7 -0
  2. data/.ignore +2 -0
  3. data/CHANGELOG.md +10 -0
  4. data/README.md +244 -0
  5. data/SECURITY.md +27 -0
  6. data/lib/context_dev/client.rb +74 -0
  7. data/lib/context_dev/errors.rb +228 -0
  8. data/lib/context_dev/file_part.rb +58 -0
  9. data/lib/context_dev/internal/transport/base_client.rb +573 -0
  10. data/lib/context_dev/internal/transport/pooled_net_requester.rb +210 -0
  11. data/lib/context_dev/internal/type/array_of.rb +168 -0
  12. data/lib/context_dev/internal/type/base_model.rb +531 -0
  13. data/lib/context_dev/internal/type/base_page.rb +55 -0
  14. data/lib/context_dev/internal/type/boolean.rb +77 -0
  15. data/lib/context_dev/internal/type/converter.rb +327 -0
  16. data/lib/context_dev/internal/type/enum.rb +131 -0
  17. data/lib/context_dev/internal/type/file_input.rb +111 -0
  18. data/lib/context_dev/internal/type/hash_of.rb +188 -0
  19. data/lib/context_dev/internal/type/request_parameters.rb +42 -0
  20. data/lib/context_dev/internal/type/union.rb +237 -0
  21. data/lib/context_dev/internal/type/unknown.rb +81 -0
  22. data/lib/context_dev/internal/util.rb +951 -0
  23. data/lib/context_dev/internal.rb +20 -0
  24. data/lib/context_dev/models/brand_ai_product_params.rb +34 -0
  25. data/lib/context_dev/models/brand_ai_product_response.rb +193 -0
  26. data/lib/context_dev/models/brand_ai_products_params.rb +94 -0
  27. data/lib/context_dev/models/brand_ai_products_response.rb +160 -0
  28. data/lib/context_dev/models/brand_ai_query_params.rb +236 -0
  29. data/lib/context_dev/models/brand_ai_query_response.rb +98 -0
  30. data/lib/context_dev/models/brand_fonts_params.rb +36 -0
  31. data/lib/context_dev/models/brand_fonts_response.rb +100 -0
  32. data/lib/context_dev/models/brand_identify_from_transaction_params.rb +407 -0
  33. data/lib/context_dev/models/brand_identify_from_transaction_response.rb +854 -0
  34. data/lib/context_dev/models/brand_prefetch_by_email_params.rb +37 -0
  35. data/lib/context_dev/models/brand_prefetch_by_email_response.rb +33 -0
  36. data/lib/context_dev/models/brand_prefetch_params.rb +35 -0
  37. data/lib/context_dev/models/brand_prefetch_response.rb +33 -0
  38. data/lib/context_dev/models/brand_retrieve_by_email_params.rb +116 -0
  39. data/lib/context_dev/models/brand_retrieve_by_email_response.rb +851 -0
  40. data/lib/context_dev/models/brand_retrieve_by_isin_params.rb +116 -0
  41. data/lib/context_dev/models/brand_retrieve_by_isin_response.rb +850 -0
  42. data/lib/context_dev/models/brand_retrieve_by_name_params.rb +115 -0
  43. data/lib/context_dev/models/brand_retrieve_by_name_response.rb +850 -0
  44. data/lib/context_dev/models/brand_retrieve_by_ticker_params.rb +204 -0
  45. data/lib/context_dev/models/brand_retrieve_by_ticker_response.rb +852 -0
  46. data/lib/context_dev/models/brand_retrieve_naics_params.rb +54 -0
  47. data/lib/context_dev/models/brand_retrieve_naics_response.rb +83 -0
  48. data/lib/context_dev/models/brand_retrieve_params.rb +117 -0
  49. data/lib/context_dev/models/brand_retrieve_response.rb +850 -0
  50. data/lib/context_dev/models/brand_retrieve_simplified_params.rb +35 -0
  51. data/lib/context_dev/models/brand_retrieve_simplified_response.rb +307 -0
  52. data/lib/context_dev/models/brand_screenshot_params.rb +103 -0
  53. data/lib/context_dev/models/brand_screenshot_response.rb +64 -0
  54. data/lib/context_dev/models/brand_styleguide_params.rb +70 -0
  55. data/lib/context_dev/models/brand_styleguide_response.rb +790 -0
  56. data/lib/context_dev/models/brand_web_scrape_html_params.rb +22 -0
  57. data/lib/context_dev/models/brand_web_scrape_html_response.rb +45 -0
  58. data/lib/context_dev/models/brand_web_scrape_images_params.rb +22 -0
  59. data/lib/context_dev/models/brand_web_scrape_images_response.rb +111 -0
  60. data/lib/context_dev/models/brand_web_scrape_md_params.rb +50 -0
  61. data/lib/context_dev/models/brand_web_scrape_md_response.rb +45 -0
  62. data/lib/context_dev/models/brand_web_scrape_sitemap_params.rb +26 -0
  63. data/lib/context_dev/models/brand_web_scrape_sitemap_response.rb +91 -0
  64. data/lib/context_dev/models.rb +81 -0
  65. data/lib/context_dev/request_options.rb +77 -0
  66. data/lib/context_dev/resources/brand.rb +654 -0
  67. data/lib/context_dev/version.rb +5 -0
  68. data/lib/context_dev.rb +96 -0
  69. data/manifest.yaml +17 -0
  70. data/rbi/context_dev/client.rbi +49 -0
  71. data/rbi/context_dev/errors.rbi +205 -0
  72. data/rbi/context_dev/file_part.rbi +37 -0
  73. data/rbi/context_dev/internal/transport/base_client.rbi +300 -0
  74. data/rbi/context_dev/internal/transport/pooled_net_requester.rbi +84 -0
  75. data/rbi/context_dev/internal/type/array_of.rbi +104 -0
  76. data/rbi/context_dev/internal/type/base_model.rbi +308 -0
  77. data/rbi/context_dev/internal/type/base_page.rbi +42 -0
  78. data/rbi/context_dev/internal/type/boolean.rbi +58 -0
  79. data/rbi/context_dev/internal/type/converter.rbi +216 -0
  80. data/rbi/context_dev/internal/type/enum.rbi +82 -0
  81. data/rbi/context_dev/internal/type/file_input.rbi +59 -0
  82. data/rbi/context_dev/internal/type/hash_of.rbi +104 -0
  83. data/rbi/context_dev/internal/type/request_parameters.rbi +29 -0
  84. data/rbi/context_dev/internal/type/union.rbi +128 -0
  85. data/rbi/context_dev/internal/type/unknown.rbi +58 -0
  86. data/rbi/context_dev/internal/util.rbi +507 -0
  87. data/rbi/context_dev/internal.rbi +18 -0
  88. data/rbi/context_dev/models/brand_ai_product_params.rbi +56 -0
  89. data/rbi/context_dev/models/brand_ai_product_response.rbi +380 -0
  90. data/rbi/context_dev/models/brand_ai_products_params.rbi +188 -0
  91. data/rbi/context_dev/models/brand_ai_products_response.rbi +310 -0
  92. data/rbi/context_dev/models/brand_ai_query_params.rbi +504 -0
  93. data/rbi/context_dev/models/brand_ai_query_response.rbi +205 -0
  94. data/rbi/context_dev/models/brand_fonts_params.rbi +60 -0
  95. data/rbi/context_dev/models/brand_fonts_response.rbi +147 -0
  96. data/rbi/context_dev/models/brand_identify_from_transaction_params.rbi +1682 -0
  97. data/rbi/context_dev/models/brand_identify_from_transaction_response.rbi +2595 -0
  98. data/rbi/context_dev/models/brand_prefetch_by_email_params.rbi +65 -0
  99. data/rbi/context_dev/models/brand_prefetch_by_email_response.rbi +57 -0
  100. data/rbi/context_dev/models/brand_prefetch_params.rbi +58 -0
  101. data/rbi/context_dev/models/brand_prefetch_response.rbi +57 -0
  102. data/rbi/context_dev/models/brand_retrieve_by_email_params.rbi +386 -0
  103. data/rbi/context_dev/models/brand_retrieve_by_email_response.rbi +2591 -0
  104. data/rbi/context_dev/models/brand_retrieve_by_isin_params.rbi +386 -0
  105. data/rbi/context_dev/models/brand_retrieve_by_isin_response.rbi +2590 -0
  106. data/rbi/context_dev/models/brand_retrieve_by_name_params.rbi +384 -0
  107. data/rbi/context_dev/models/brand_retrieve_by_name_response.rbi +2590 -0
  108. data/rbi/context_dev/models/brand_retrieve_by_ticker_params.rbi +796 -0
  109. data/rbi/context_dev/models/brand_retrieve_by_ticker_response.rbi +2592 -0
  110. data/rbi/context_dev/models/brand_retrieve_naics_params.rbi +89 -0
  111. data/rbi/context_dev/models/brand_retrieve_naics_response.rbi +190 -0
  112. data/rbi/context_dev/models/brand_retrieve_params.rbi +382 -0
  113. data/rbi/context_dev/models/brand_retrieve_response.rbi +2574 -0
  114. data/rbi/context_dev/models/brand_retrieve_simplified_params.rbi +61 -0
  115. data/rbi/context_dev/models/brand_retrieve_simplified_response.rbi +763 -0
  116. data/rbi/context_dev/models/brand_screenshot_params.rbi +225 -0
  117. data/rbi/context_dev/models/brand_screenshot_response.rbi +135 -0
  118. data/rbi/context_dev/models/brand_styleguide_params.rbi +139 -0
  119. data/rbi/context_dev/models/brand_styleguide_response.rbi +1707 -0
  120. data/rbi/context_dev/models/brand_web_scrape_html_params.rbi +43 -0
  121. data/rbi/context_dev/models/brand_web_scrape_html_response.rbi +92 -0
  122. data/rbi/context_dev/models/brand_web_scrape_images_params.rbi +43 -0
  123. data/rbi/context_dev/models/brand_web_scrape_images_response.rbi +261 -0
  124. data/rbi/context_dev/models/brand_web_scrape_md_params.rbi +81 -0
  125. data/rbi/context_dev/models/brand_web_scrape_md_response.rbi +92 -0
  126. data/rbi/context_dev/models/brand_web_scrape_sitemap_params.rbi +45 -0
  127. data/rbi/context_dev/models/brand_web_scrape_sitemap_response.rbi +167 -0
  128. data/rbi/context_dev/models.rbi +45 -0
  129. data/rbi/context_dev/request_options.rbi +59 -0
  130. data/rbi/context_dev/resources/brand.rbi +545 -0
  131. data/rbi/context_dev/version.rbi +5 -0
  132. data/sig/context_dev/client.rbs +26 -0
  133. data/sig/context_dev/errors.rbs +117 -0
  134. data/sig/context_dev/file_part.rbs +21 -0
  135. data/sig/context_dev/internal/transport/base_client.rbs +133 -0
  136. data/sig/context_dev/internal/transport/pooled_net_requester.rbs +48 -0
  137. data/sig/context_dev/internal/type/array_of.rbs +48 -0
  138. data/sig/context_dev/internal/type/base_model.rbs +102 -0
  139. data/sig/context_dev/internal/type/base_page.rbs +24 -0
  140. data/sig/context_dev/internal/type/boolean.rbs +26 -0
  141. data/sig/context_dev/internal/type/converter.rbs +79 -0
  142. data/sig/context_dev/internal/type/enum.rbs +32 -0
  143. data/sig/context_dev/internal/type/file_input.rbs +25 -0
  144. data/sig/context_dev/internal/type/hash_of.rbs +48 -0
  145. data/sig/context_dev/internal/type/request_parameters.rbs +19 -0
  146. data/sig/context_dev/internal/type/union.rbs +52 -0
  147. data/sig/context_dev/internal/type/unknown.rbs +26 -0
  148. data/sig/context_dev/internal/util.rbs +195 -0
  149. data/sig/context_dev/internal.rbs +9 -0
  150. data/sig/context_dev/models/brand_ai_product_params.rbs +30 -0
  151. data/sig/context_dev/models/brand_ai_product_response.rbs +149 -0
  152. data/sig/context_dev/models/brand_ai_products_params.rbs +88 -0
  153. data/sig/context_dev/models/brand_ai_products_response.rbs +128 -0
  154. data/sig/context_dev/models/brand_ai_query_params.rbs +218 -0
  155. data/sig/context_dev/models/brand_ai_query_response.rbs +93 -0
  156. data/sig/context_dev/models/brand_fonts_params.rbs +30 -0
  157. data/sig/context_dev/models/brand_fonts_response.rbs +82 -0
  158. data/sig/context_dev/models/brand_identify_from_transaction_params.rbs +686 -0
  159. data/sig/context_dev/models/brand_identify_from_transaction_response.rbs +1076 -0
  160. data/sig/context_dev/models/brand_prefetch_by_email_params.rbs +30 -0
  161. data/sig/context_dev/models/brand_prefetch_by_email_response.rbs +28 -0
  162. data/sig/context_dev/models/brand_prefetch_params.rbs +30 -0
  163. data/sig/context_dev/models/brand_prefetch_response.rbs +28 -0
  164. data/sig/context_dev/models/brand_retrieve_by_email_params.rbs +162 -0
  165. data/sig/context_dev/models/brand_retrieve_by_email_response.rbs +1076 -0
  166. data/sig/context_dev/models/brand_retrieve_by_isin_params.rbs +162 -0
  167. data/sig/context_dev/models/brand_retrieve_by_isin_response.rbs +1076 -0
  168. data/sig/context_dev/models/brand_retrieve_by_name_params.rbs +162 -0
  169. data/sig/context_dev/models/brand_retrieve_by_name_response.rbs +1076 -0
  170. data/sig/context_dev/models/brand_retrieve_by_ticker_params.rbs +324 -0
  171. data/sig/context_dev/models/brand_retrieve_by_ticker_response.rbs +1076 -0
  172. data/sig/context_dev/models/brand_retrieve_naics_params.rbs +47 -0
  173. data/sig/context_dev/models/brand_retrieve_naics_response.rbs +84 -0
  174. data/sig/context_dev/models/brand_retrieve_params.rbs +162 -0
  175. data/sig/context_dev/models/brand_retrieve_response.rbs +1076 -0
  176. data/sig/context_dev/models/brand_retrieve_simplified_params.rbs +30 -0
  177. data/sig/context_dev/models/brand_retrieve_simplified_response.rbs +312 -0
  178. data/sig/context_dev/models/brand_screenshot_params.rbs +100 -0
  179. data/sig/context_dev/models/brand_screenshot_response.rbs +63 -0
  180. data/sig/context_dev/models/brand_styleguide_params.rbs +62 -0
  181. data/sig/context_dev/models/brand_styleguide_response.rbs +945 -0
  182. data/sig/context_dev/models/brand_web_scrape_html_params.rbs +23 -0
  183. data/sig/context_dev/models/brand_web_scrape_html_response.rbs +40 -0
  184. data/sig/context_dev/models/brand_web_scrape_images_params.rbs +23 -0
  185. data/sig/context_dev/models/brand_web_scrape_images_response.rbs +98 -0
  186. data/sig/context_dev/models/brand_web_scrape_md_params.rbs +47 -0
  187. data/sig/context_dev/models/brand_web_scrape_md_response.rbs +40 -0
  188. data/sig/context_dev/models/brand_web_scrape_sitemap_params.rbs +23 -0
  189. data/sig/context_dev/models/brand_web_scrape_sitemap_response.rbs +77 -0
  190. data/sig/context_dev/models.rbs +41 -0
  191. data/sig/context_dev/request_options.rbs +36 -0
  192. data/sig/context_dev/resources/brand.rbs +151 -0
  193. data/sig/context_dev/version.rbs +3 -0
  194. metadata +265 -0
@@ -0,0 +1,545 @@
1
+ # typed: strong
2
+
3
+ module ContextDev
4
+ module Resources
5
+ class Brand
6
+ # Retrieve logos, backdrops, colors, industry, description, and more from any
7
+ # domain
8
+ sig do
9
+ params(
10
+ domain: String,
11
+ force_language:
12
+ ContextDev::BrandRetrieveParams::ForceLanguage::OrSymbol,
13
+ max_speed: T::Boolean,
14
+ timeout_ms: Integer,
15
+ request_options: ContextDev::RequestOptions::OrHash
16
+ ).returns(ContextDev::Models::BrandRetrieveResponse)
17
+ end
18
+ def retrieve(
19
+ # Domain name to retrieve brand data for (e.g., 'example.com', 'google.com').
20
+ # Cannot be used with name or ticker parameters.
21
+ domain:,
22
+ # Optional parameter to force the language of the retrieved brand data. Works with
23
+ # all three lookup methods.
24
+ force_language: nil,
25
+ # Optional parameter to optimize the API call for maximum speed. When set to true,
26
+ # the API will skip time-consuming operations for faster response at the cost of
27
+ # less comprehensive data. Works with all three lookup methods.
28
+ max_speed: nil,
29
+ # Optional timeout in milliseconds for the request. If the request takes longer
30
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
31
+ # value is 300000ms (5 minutes).
32
+ timeout_ms: nil,
33
+ request_options: {}
34
+ )
35
+ end
36
+
37
+ # Beta feature: Given a single URL, determines if it is a product detail page,
38
+ # classifies the platform/product type, and extracts the product information.
39
+ # Supports Amazon, TikTok Shop, Etsy, and generic ecommerce sites.
40
+ sig do
41
+ params(
42
+ url: String,
43
+ timeout_ms: Integer,
44
+ request_options: ContextDev::RequestOptions::OrHash
45
+ ).returns(ContextDev::Models::BrandAIProductResponse)
46
+ end
47
+ def ai_product(
48
+ # The product page URL to extract product data from.
49
+ url:,
50
+ # Optional timeout in milliseconds for the request. Maximum allowed value is
51
+ # 300000ms (5 minutes).
52
+ timeout_ms: nil,
53
+ request_options: {}
54
+ )
55
+ end
56
+
57
+ # Beta feature: Extract product information from a brand's website. Brand.dev will
58
+ # analyze the website and return a list of products with details such as name,
59
+ # description, image, pricing, features, and more.
60
+ sig do
61
+ params(
62
+ body:
63
+ T.any(
64
+ ContextDev::BrandAIProductsParams::Body::ByDomain::OrHash,
65
+ ContextDev::BrandAIProductsParams::Body::ByDirectURL::OrHash
66
+ ),
67
+ request_options: ContextDev::RequestOptions::OrHash
68
+ ).returns(ContextDev::Models::BrandAIProductsResponse)
69
+ end
70
+ def ai_products(body:, request_options: {})
71
+ end
72
+
73
+ # Use AI to extract specific data points from a brand's website. The AI will crawl
74
+ # the website and extract the requested information based on the provided data
75
+ # points.
76
+ sig do
77
+ params(
78
+ data_to_extract:
79
+ T::Array[ContextDev::BrandAIQueryParams::DataToExtract::OrHash],
80
+ domain: String,
81
+ specific_pages: ContextDev::BrandAIQueryParams::SpecificPages::OrHash,
82
+ timeout_ms: Integer,
83
+ request_options: ContextDev::RequestOptions::OrHash
84
+ ).returns(ContextDev::Models::BrandAIQueryResponse)
85
+ end
86
+ def ai_query(
87
+ # Array of data points to extract from the website
88
+ data_to_extract:,
89
+ # The domain name to analyze
90
+ domain:,
91
+ # Optional object specifying which pages to analyze
92
+ specific_pages: nil,
93
+ # Optional timeout in milliseconds for the request. If the request takes longer
94
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
95
+ # value is 300000ms (5 minutes).
96
+ timeout_ms: nil,
97
+ request_options: {}
98
+ )
99
+ end
100
+
101
+ # Extract font information from a brand's website including font families, usage
102
+ # statistics, fallbacks, and element/word counts.
103
+ sig do
104
+ params(
105
+ domain: String,
106
+ timeout_ms: Integer,
107
+ request_options: ContextDev::RequestOptions::OrHash
108
+ ).returns(ContextDev::Models::BrandFontsResponse)
109
+ end
110
+ def fonts(
111
+ # Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The
112
+ # domain will be automatically normalized and validated.
113
+ domain:,
114
+ # Optional timeout in milliseconds for the request. If the request takes longer
115
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
116
+ # value is 300000ms (5 minutes).
117
+ timeout_ms: nil,
118
+ request_options: {}
119
+ )
120
+ end
121
+
122
+ # Endpoint specially designed for platforms that want to identify transaction data
123
+ # by the transaction title.
124
+ sig do
125
+ params(
126
+ transaction_info: String,
127
+ city: String,
128
+ country_gl:
129
+ ContextDev::BrandIdentifyFromTransactionParams::CountryGl::OrSymbol,
130
+ force_language:
131
+ ContextDev::BrandIdentifyFromTransactionParams::ForceLanguage::OrSymbol,
132
+ high_confidence_only: T::Boolean,
133
+ max_speed: T::Boolean,
134
+ mcc: String,
135
+ phone: Float,
136
+ timeout_ms: Integer,
137
+ request_options: ContextDev::RequestOptions::OrHash
138
+ ).returns(ContextDev::Models::BrandIdentifyFromTransactionResponse)
139
+ end
140
+ def identify_from_transaction(
141
+ # Transaction information to identify the brand
142
+ transaction_info:,
143
+ # Optional city name to prioritize when searching for the brand.
144
+ city: nil,
145
+ # Optional country code (GL parameter) to specify the country. This affects the
146
+ # geographic location used for search queries.
147
+ country_gl: nil,
148
+ # Optional parameter to force the language of the retrieved brand data.
149
+ force_language: nil,
150
+ # When set to true, the API will perform an additional verification steps to
151
+ # ensure the identified brand matches the transaction with high confidence.
152
+ # Defaults to false.
153
+ high_confidence_only: nil,
154
+ # Optional parameter to optimize the API call for maximum speed. When set to true,
155
+ # the API will skip time-consuming operations for faster response at the cost of
156
+ # less comprehensive data.
157
+ max_speed: nil,
158
+ # Optional Merchant Category Code (MCC) to help identify the business
159
+ # category/industry.
160
+ mcc: nil,
161
+ # Optional phone number from the transaction to help verify brand match.
162
+ phone: nil,
163
+ # Optional timeout in milliseconds for the request. If the request takes longer
164
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
165
+ # value is 300000ms (5 minutes).
166
+ timeout_ms: nil,
167
+ request_options: {}
168
+ )
169
+ end
170
+
171
+ # Signal that you may fetch brand data for a particular domain soon to improve
172
+ # latency. This endpoint does not charge credits and is available for paid
173
+ # customers to optimize future requests. [You must be on a paid plan to use this
174
+ # endpoint]
175
+ sig do
176
+ params(
177
+ domain: String,
178
+ timeout_ms: Integer,
179
+ request_options: ContextDev::RequestOptions::OrHash
180
+ ).returns(ContextDev::Models::BrandPrefetchResponse)
181
+ end
182
+ def prefetch(
183
+ # Domain name to prefetch brand data for
184
+ domain:,
185
+ # Optional timeout in milliseconds for the request. If the request takes longer
186
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
187
+ # value is 300000ms (5 minutes).
188
+ timeout_ms: nil,
189
+ request_options: {}
190
+ )
191
+ end
192
+
193
+ # Signal that you may fetch brand data for a particular domain soon to improve
194
+ # latency. This endpoint accepts an email address, extracts the domain from it,
195
+ # validates that it's not a disposable or free email provider, and queues the
196
+ # domain for prefetching. This endpoint does not charge credits and is available
197
+ # for paid customers to optimize future requests. [You must be on a paid plan to
198
+ # use this endpoint]
199
+ sig do
200
+ params(
201
+ email: String,
202
+ timeout_ms: Integer,
203
+ request_options: ContextDev::RequestOptions::OrHash
204
+ ).returns(ContextDev::Models::BrandPrefetchByEmailResponse)
205
+ end
206
+ def prefetch_by_email(
207
+ # Email address to prefetch brand data for. The domain will be extracted from the
208
+ # email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email
209
+ # addresses are not allowed.
210
+ email:,
211
+ # Optional timeout in milliseconds for the request. If the request takes longer
212
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
213
+ # value is 300000ms (5 minutes).
214
+ timeout_ms: nil,
215
+ request_options: {}
216
+ )
217
+ end
218
+
219
+ # Retrieve brand information using an email address while detecting disposable and
220
+ # free email addresses. This endpoint extracts the domain from the email address
221
+ # and returns brand data for that domain. Disposable and free email addresses
222
+ # (like gmail.com, yahoo.com) will throw a 422 error.
223
+ sig do
224
+ params(
225
+ email: String,
226
+ force_language:
227
+ ContextDev::BrandRetrieveByEmailParams::ForceLanguage::OrSymbol,
228
+ max_speed: T::Boolean,
229
+ timeout_ms: Integer,
230
+ request_options: ContextDev::RequestOptions::OrHash
231
+ ).returns(ContextDev::Models::BrandRetrieveByEmailResponse)
232
+ end
233
+ def retrieve_by_email(
234
+ # Email address to retrieve brand data for (e.g., 'contact@example.com'). The
235
+ # domain will be extracted from the email. Free email providers (gmail.com,
236
+ # yahoo.com, etc.) and disposable email addresses are not allowed.
237
+ email:,
238
+ # Optional parameter to force the language of the retrieved brand data.
239
+ force_language: nil,
240
+ # Optional parameter to optimize the API call for maximum speed. When set to true,
241
+ # the API will skip time-consuming operations for faster response at the cost of
242
+ # less comprehensive data.
243
+ max_speed: nil,
244
+ # Optional timeout in milliseconds for the request. If the request takes longer
245
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
246
+ # value is 300000ms (5 minutes).
247
+ timeout_ms: nil,
248
+ request_options: {}
249
+ )
250
+ end
251
+
252
+ # Retrieve brand information using an ISIN (International Securities
253
+ # Identification Number). This endpoint looks up the company associated with the
254
+ # ISIN and returns its brand data.
255
+ sig do
256
+ params(
257
+ isin: String,
258
+ force_language:
259
+ ContextDev::BrandRetrieveByIsinParams::ForceLanguage::OrSymbol,
260
+ max_speed: T::Boolean,
261
+ timeout_ms: Integer,
262
+ request_options: ContextDev::RequestOptions::OrHash
263
+ ).returns(ContextDev::Models::BrandRetrieveByIsinResponse)
264
+ end
265
+ def retrieve_by_isin(
266
+ # ISIN (International Securities Identification Number) to retrieve brand data for
267
+ # (e.g., 'AU000000IMD5', 'US0378331005'). Must be exactly 12 characters: 2 letters
268
+ # followed by 9 alphanumeric characters and ending with a digit.
269
+ isin:,
270
+ # Optional parameter to force the language of the retrieved brand data.
271
+ force_language: nil,
272
+ # Optional parameter to optimize the API call for maximum speed. When set to true,
273
+ # the API will skip time-consuming operations for faster response at the cost of
274
+ # less comprehensive data.
275
+ max_speed: nil,
276
+ # Optional timeout in milliseconds for the request. If the request takes longer
277
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
278
+ # value is 300000ms (5 minutes).
279
+ timeout_ms: nil,
280
+ request_options: {}
281
+ )
282
+ end
283
+
284
+ # Retrieve brand information using a company name. This endpoint searches for the
285
+ # company by name and returns its brand data.
286
+ sig do
287
+ params(
288
+ name: String,
289
+ force_language:
290
+ ContextDev::BrandRetrieveByNameParams::ForceLanguage::OrSymbol,
291
+ max_speed: T::Boolean,
292
+ timeout_ms: Integer,
293
+ request_options: ContextDev::RequestOptions::OrHash
294
+ ).returns(ContextDev::Models::BrandRetrieveByNameResponse)
295
+ end
296
+ def retrieve_by_name(
297
+ # Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft
298
+ # Corporation'). Must be 3-30 characters.
299
+ name:,
300
+ # Optional parameter to force the language of the retrieved brand data.
301
+ force_language: nil,
302
+ # Optional parameter to optimize the API call for maximum speed. When set to true,
303
+ # the API will skip time-consuming operations for faster response at the cost of
304
+ # less comprehensive data.
305
+ max_speed: nil,
306
+ # Optional timeout in milliseconds for the request. If the request takes longer
307
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
308
+ # value is 300000ms (5 minutes).
309
+ timeout_ms: nil,
310
+ request_options: {}
311
+ )
312
+ end
313
+
314
+ # Retrieve brand information using a stock ticker symbol. This endpoint looks up
315
+ # the company associated with the ticker and returns its brand data.
316
+ sig do
317
+ params(
318
+ ticker: String,
319
+ force_language:
320
+ ContextDev::BrandRetrieveByTickerParams::ForceLanguage::OrSymbol,
321
+ max_speed: T::Boolean,
322
+ ticker_exchange:
323
+ ContextDev::BrandRetrieveByTickerParams::TickerExchange::OrSymbol,
324
+ timeout_ms: Integer,
325
+ request_options: ContextDev::RequestOptions::OrHash
326
+ ).returns(ContextDev::Models::BrandRetrieveByTickerResponse)
327
+ end
328
+ def retrieve_by_ticker(
329
+ # Stock ticker symbol to retrieve brand data for (e.g., 'AAPL', 'GOOGL', 'BRK.A').
330
+ # Must be 1-15 characters, letters/numbers/dots only.
331
+ ticker:,
332
+ # Optional parameter to force the language of the retrieved brand data.
333
+ force_language: nil,
334
+ # Optional parameter to optimize the API call for maximum speed. When set to true,
335
+ # the API will skip time-consuming operations for faster response at the cost of
336
+ # less comprehensive data.
337
+ max_speed: nil,
338
+ # Optional stock exchange for the ticker. Defaults to NASDAQ if not specified.
339
+ ticker_exchange: nil,
340
+ # Optional timeout in milliseconds for the request. If the request takes longer
341
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
342
+ # value is 300000ms (5 minutes).
343
+ timeout_ms: nil,
344
+ request_options: {}
345
+ )
346
+ end
347
+
348
+ # Endpoint to classify any brand into a 2022 NAICS code.
349
+ sig do
350
+ params(
351
+ input: String,
352
+ max_results: Integer,
353
+ min_results: Integer,
354
+ timeout_ms: Integer,
355
+ request_options: ContextDev::RequestOptions::OrHash
356
+ ).returns(ContextDev::Models::BrandRetrieveNaicsResponse)
357
+ end
358
+ def retrieve_naics(
359
+ # Brand domain or title to retrieve NAICS code for. If a valid domain is provided
360
+ # in `input`, it will be used for classification, otherwise, we will search for
361
+ # the brand using the provided title.
362
+ input:,
363
+ # Maximum number of NAICS codes to return. Must be between 1 and 10. Defaults
364
+ # to 5.
365
+ max_results: nil,
366
+ # Minimum number of NAICS codes to return. Must be at least 1. Defaults to 1.
367
+ min_results: nil,
368
+ # Optional timeout in milliseconds for the request. If the request takes longer
369
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
370
+ # value is 300000ms (5 minutes).
371
+ timeout_ms: nil,
372
+ request_options: {}
373
+ )
374
+ end
375
+
376
+ # Returns a simplified version of brand data containing only essential
377
+ # information: domain, title, colors, logos, and backdrops. This endpoint is
378
+ # optimized for faster responses and reduced data transfer.
379
+ sig do
380
+ params(
381
+ domain: String,
382
+ timeout_ms: Integer,
383
+ request_options: ContextDev::RequestOptions::OrHash
384
+ ).returns(ContextDev::Models::BrandRetrieveSimplifiedResponse)
385
+ end
386
+ def retrieve_simplified(
387
+ # Domain name to retrieve simplified brand data for
388
+ domain:,
389
+ # Optional timeout in milliseconds for the request. If the request takes longer
390
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
391
+ # value is 300000ms (5 minutes).
392
+ timeout_ms: nil,
393
+ request_options: {}
394
+ )
395
+ end
396
+
397
+ # Capture a screenshot of a website. Supports both viewport (standard browser
398
+ # view) and full-page screenshots. Can also screenshot specific page types (login,
399
+ # pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to
400
+ # the uploaded screenshot image hosted on our CDN.
401
+ sig do
402
+ params(
403
+ domain: String,
404
+ full_screenshot:
405
+ ContextDev::BrandScreenshotParams::FullScreenshot::OrSymbol,
406
+ page: ContextDev::BrandScreenshotParams::Page::OrSymbol,
407
+ prioritize: ContextDev::BrandScreenshotParams::Prioritize::OrSymbol,
408
+ request_options: ContextDev::RequestOptions::OrHash
409
+ ).returns(ContextDev::Models::BrandScreenshotResponse)
410
+ end
411
+ def screenshot(
412
+ # Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
413
+ # domain will be automatically normalized and validated.
414
+ domain:,
415
+ # Optional parameter to determine screenshot type. If 'true', takes a full page
416
+ # screenshot capturing all content. If 'false' or not provided, takes a viewport
417
+ # screenshot (standard browser view).
418
+ full_screenshot: nil,
419
+ # Optional parameter to specify which page type to screenshot. If provided, the
420
+ # system will scrape the domain's links and use heuristics to find the most
421
+ # appropriate URL for the specified page type (30 supported languages). If not
422
+ # provided, screenshots the main domain landing page.
423
+ page: nil,
424
+ # Optional parameter to prioritize screenshot capture. If 'speed', optimizes for
425
+ # faster capture with basic quality. If 'quality', optimizes for higher quality
426
+ # with longer wait times. Defaults to 'quality' if not provided.
427
+ prioritize: nil,
428
+ request_options: {}
429
+ )
430
+ end
431
+
432
+ # Automatically extract comprehensive design system information from a brand's
433
+ # website including colors, typography, spacing, shadows, and UI components.
434
+ # Either 'domain' or 'directUrl' must be provided as a query parameter, but not
435
+ # both.
436
+ sig do
437
+ params(
438
+ direct_url: String,
439
+ domain: String,
440
+ prioritize: ContextDev::BrandStyleguideParams::Prioritize::OrSymbol,
441
+ timeout_ms: Integer,
442
+ request_options: ContextDev::RequestOptions::OrHash
443
+ ).returns(ContextDev::Models::BrandStyleguideResponse)
444
+ end
445
+ def styleguide(
446
+ # A specific URL to fetch the styleguide from directly, bypassing domain
447
+ # resolution (e.g., 'https://example.com/design-system').
448
+ direct_url: nil,
449
+ # Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
450
+ # domain will be automatically normalized and validated.
451
+ domain: nil,
452
+ # Optional parameter to prioritize screenshot capture for styleguide extraction.
453
+ # If 'speed', optimizes for faster capture with basic quality. If 'quality',
454
+ # optimizes for higher quality with longer wait times. Defaults to 'quality' if
455
+ # not provided.
456
+ prioritize: nil,
457
+ # Optional timeout in milliseconds for the request. If the request takes longer
458
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
459
+ # value is 300000ms (5 minutes).
460
+ timeout_ms: nil,
461
+ request_options: {}
462
+ )
463
+ end
464
+
465
+ # Scrapes the given URL and returns the raw HTML content of the page. Uses
466
+ # automatic proxy escalation to handle blocked sites.
467
+ sig do
468
+ params(
469
+ url: String,
470
+ request_options: ContextDev::RequestOptions::OrHash
471
+ ).returns(ContextDev::Models::BrandWebScrapeHTMLResponse)
472
+ end
473
+ def web_scrape_html(
474
+ # Full URL to scrape (must include http:// or https:// protocol)
475
+ url:,
476
+ request_options: {}
477
+ )
478
+ end
479
+
480
+ # Scrapes all images from the given URL. Extracts images from img, svg,
481
+ # picture/source, link, and video elements including inline SVGs, base64 data
482
+ # URIs, and standard URLs.
483
+ sig do
484
+ params(
485
+ url: String,
486
+ request_options: ContextDev::RequestOptions::OrHash
487
+ ).returns(ContextDev::Models::BrandWebScrapeImagesResponse)
488
+ end
489
+ def web_scrape_images(
490
+ # Full URL to scrape images from (must include http:// or https:// protocol)
491
+ url:,
492
+ request_options: {}
493
+ )
494
+ end
495
+
496
+ # Scrapes the given URL, converts the HTML content to GitHub Flavored Markdown
497
+ # (GFM), and returns the result. Uses automatic proxy escalation to handle blocked
498
+ # sites.
499
+ sig do
500
+ params(
501
+ url: String,
502
+ include_images: T::Boolean,
503
+ include_links: T::Boolean,
504
+ shorten_base64_images: T::Boolean,
505
+ request_options: ContextDev::RequestOptions::OrHash
506
+ ).returns(ContextDev::Models::BrandWebScrapeMdResponse)
507
+ end
508
+ def web_scrape_md(
509
+ # Full URL to scrape and convert to markdown (must include http:// or https://
510
+ # protocol)
511
+ url:,
512
+ # Include image references in Markdown output
513
+ include_images: nil,
514
+ # Preserve hyperlinks in Markdown output
515
+ include_links: nil,
516
+ # Shorten base64-encoded image data in the Markdown output
517
+ shorten_base64_images: nil,
518
+ request_options: {}
519
+ )
520
+ end
521
+
522
+ # Crawls the sitemap of the given domain and returns all discovered page URLs.
523
+ # Supports sitemap index files (recursive), parallel fetching with concurrency
524
+ # control, deduplication, and filters out non-page resources (images, PDFs, etc.).
525
+ sig do
526
+ params(
527
+ domain: String,
528
+ request_options: ContextDev::RequestOptions::OrHash
529
+ ).returns(ContextDev::Models::BrandWebScrapeSitemapResponse)
530
+ end
531
+ def web_scrape_sitemap(
532
+ # Domain name to crawl sitemaps for (e.g., 'example.com'). The domain will be
533
+ # automatically normalized and validated.
534
+ domain:,
535
+ request_options: {}
536
+ )
537
+ end
538
+
539
+ # @api private
540
+ sig { params(client: ContextDev::Client).returns(T.attached_class) }
541
+ def self.new(client:)
542
+ end
543
+ end
544
+ end
545
+ end
@@ -0,0 +1,5 @@
1
+ # typed: strong
2
+
3
+ module ContextDev
4
+ VERSION = T.let(T.unsafe(nil), String)
5
+ end
@@ -0,0 +1,26 @@
1
+ module ContextDev
2
+ class Client < ContextDev::Internal::Transport::BaseClient
3
+ DEFAULT_MAX_RETRIES: 2
4
+
5
+ DEFAULT_TIMEOUT_IN_SECONDS: Float
6
+
7
+ DEFAULT_INITIAL_RETRY_DELAY: Float
8
+
9
+ DEFAULT_MAX_RETRY_DELAY: Float
10
+
11
+ attr_reader api_key: String
12
+
13
+ attr_reader brand: ContextDev::Resources::Brand
14
+
15
+ private def auth_headers: -> ::Hash[String, String]
16
+
17
+ def initialize: (
18
+ ?api_key: String?,
19
+ ?base_url: String?,
20
+ ?max_retries: Integer,
21
+ ?timeout: Float,
22
+ ?initial_retry_delay: Float,
23
+ ?max_retry_delay: Float
24
+ ) -> void
25
+ end
26
+ end
@@ -0,0 +1,117 @@
1
+ module ContextDev
2
+ module Errors
3
+ class Error < StandardError
4
+ attr_accessor cause: StandardError?
5
+ end
6
+
7
+ class ConversionError < ContextDev::Errors::Error
8
+ def cause: -> StandardError?
9
+
10
+ def initialize: (
11
+ on: Class,
12
+ method: Symbol,
13
+ target: top,
14
+ value: top,
15
+ ?cause: StandardError?
16
+ ) -> void
17
+ end
18
+
19
+ class APIError < ContextDev::Errors::Error
20
+ attr_accessor url: URI::Generic
21
+
22
+ attr_accessor status: Integer?
23
+
24
+ attr_accessor headers: ::Hash[String, String]?
25
+
26
+ attr_accessor body: top?
27
+
28
+ def initialize: (
29
+ url: URI::Generic,
30
+ ?status: Integer?,
31
+ ?headers: ::Hash[String, String]?,
32
+ ?body: Object?,
33
+ ?request: nil,
34
+ ?response: nil,
35
+ ?message: String?
36
+ ) -> void
37
+ end
38
+
39
+ class APIConnectionError < ContextDev::Errors::APIError
40
+ def initialize: (
41
+ url: URI::Generic,
42
+ ?status: nil,
43
+ ?headers: ::Hash[String, String]?,
44
+ ?body: nil,
45
+ ?request: nil,
46
+ ?response: nil,
47
+ ?message: String?
48
+ ) -> void
49
+ end
50
+
51
+ class APITimeoutError < ContextDev::Errors::APIConnectionError
52
+ def initialize: (
53
+ url: URI::Generic,
54
+ ?status: nil,
55
+ ?headers: ::Hash[String, String]?,
56
+ ?body: nil,
57
+ ?request: nil,
58
+ ?response: nil,
59
+ ?message: String?
60
+ ) -> void
61
+ end
62
+
63
+ class APIStatusError < ContextDev::Errors::APIError
64
+ def self.for: (
65
+ url: URI::Generic,
66
+ status: Integer,
67
+ headers: ::Hash[String, String]?,
68
+ body: Object?,
69
+ request: nil,
70
+ response: nil,
71
+ ?message: String?
72
+ ) -> instance
73
+
74
+ def initialize: (
75
+ url: URI::Generic,
76
+ status: Integer,
77
+ headers: ::Hash[String, String]?,
78
+ body: Object?,
79
+ request: nil,
80
+ response: nil,
81
+ ?message: String?
82
+ ) -> void
83
+ end
84
+
85
+ class BadRequestError < ContextDev::Errors::APIStatusError
86
+ HTTP_STATUS: 400
87
+ end
88
+
89
+ class AuthenticationError < ContextDev::Errors::APIStatusError
90
+ HTTP_STATUS: 401
91
+ end
92
+
93
+ class PermissionDeniedError < ContextDev::Errors::APIStatusError
94
+ HTTP_STATUS: 403
95
+ end
96
+
97
+ class NotFoundError < ContextDev::Errors::APIStatusError
98
+ HTTP_STATUS: 404
99
+ end
100
+
101
+ class ConflictError < ContextDev::Errors::APIStatusError
102
+ HTTP_STATUS: 409
103
+ end
104
+
105
+ class UnprocessableEntityError < ContextDev::Errors::APIStatusError
106
+ HTTP_STATUS: 422
107
+ end
108
+
109
+ class RateLimitError < ContextDev::Errors::APIStatusError
110
+ HTTP_STATUS: 429
111
+ end
112
+
113
+ class InternalServerError < ContextDev::Errors::APIStatusError
114
+ HTTP_STATUS: Range[Integer]
115
+ end
116
+ end
117
+ end