From dc135a5c4a01de856d7ee19efa958af62ff4e132 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Mar 2026 01:24:18 +0000 Subject: [PATCH 1/4] feat(api): api update --- .stats.yml | 4 ++-- src/resources/brand.ts | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index bc49c22..e2bfe66 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 20 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-c5d5abb4b31f6e352e3e02b47120e3f444377c1c564f141ebe0988b86ba5932e.yml -openapi_spec_hash: 8ef4803fbe33ae6472a4b8f660be7921 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-c2e94e0c758b1aaba120c2a4231842fff0a120acc471fe24c7a81221e13a0482.yml +openapi_spec_hash: aabc231b46b1ca3375882f96c378c665 config_hash: a144af00e5e74176674d0ea954cc02c5 diff --git a/src/resources/brand.ts b/src/resources/brand.ts index d8287e3..2fc4a7f 100644 --- a/src/resources/brand.ts +++ b/src/resources/brand.ts @@ -4875,6 +4875,7 @@ export interface BrandRetrieveParams { | 'azeri' | 'bengali' | 'bulgarian' + | 'cantonese' | 'cebuano' | 'croatian' | 'czech' @@ -4894,6 +4895,7 @@ export interface BrandRetrieveParams { | 'indonesian' | 'italian' | 'kazakh' + | 'korean' | 'kyrgyz' | 'latin' | 'latvian' @@ -4916,6 +4918,7 @@ export interface BrandRetrieveParams { | 'swahili' | 'swedish' | 'tagalog' + | 'thai' | 'turkish' | 'ukrainian' | 'urdu' @@ -5382,6 +5385,7 @@ export interface BrandIdentifyFromTransactionParams { | 'azeri' | 'bengali' | 'bulgarian' + | 'cantonese' | 'cebuano' | 'croatian' | 'czech' @@ -5401,6 +5405,7 @@ export interface BrandIdentifyFromTransactionParams { | 'indonesian' | 'italian' | 'kazakh' + | 'korean' | 'kyrgyz' | 'latin' | 'latvian' @@ -5423,6 +5428,7 @@ export interface BrandIdentifyFromTransactionParams { | 'swahili' | 'swedish' | 'tagalog' + | 'thai' | 'turkish' | 'ukrainian' | 'urdu' @@ -5510,6 +5516,7 @@ export interface BrandRetrieveByEmailParams { | 'azeri' | 'bengali' | 'bulgarian' + | 'cantonese' | 'cebuano' | 'croatian' | 'czech' @@ -5529,6 +5536,7 @@ export interface BrandRetrieveByEmailParams { | 'indonesian' | 'italian' | 'kazakh' + | 'korean' | 'kyrgyz' | 'latin' | 'latvian' @@ -5551,6 +5559,7 @@ export interface BrandRetrieveByEmailParams { | 'swahili' | 'swedish' | 'tagalog' + | 'thai' | 'turkish' | 'ukrainian' | 'urdu' @@ -5590,6 +5599,7 @@ export interface BrandRetrieveByIsinParams { | 'azeri' | 'bengali' | 'bulgarian' + | 'cantonese' | 'cebuano' | 'croatian' | 'czech' @@ -5609,6 +5619,7 @@ export interface BrandRetrieveByIsinParams { | 'indonesian' | 'italian' | 'kazakh' + | 'korean' | 'kyrgyz' | 'latin' | 'latvian' @@ -5631,6 +5642,7 @@ export interface BrandRetrieveByIsinParams { | 'swahili' | 'swedish' | 'tagalog' + | 'thai' | 'turkish' | 'ukrainian' | 'urdu' @@ -5914,6 +5926,7 @@ export interface BrandRetrieveByNameParams { | 'azeri' | 'bengali' | 'bulgarian' + | 'cantonese' | 'cebuano' | 'croatian' | 'czech' @@ -5933,6 +5946,7 @@ export interface BrandRetrieveByNameParams { | 'indonesian' | 'italian' | 'kazakh' + | 'korean' | 'kyrgyz' | 'latin' | 'latvian' @@ -5955,6 +5969,7 @@ export interface BrandRetrieveByNameParams { | 'swahili' | 'swedish' | 'tagalog' + | 'thai' | 'turkish' | 'ukrainian' | 'urdu' @@ -5993,6 +6008,7 @@ export interface BrandRetrieveByTickerParams { | 'azeri' | 'bengali' | 'bulgarian' + | 'cantonese' | 'cebuano' | 'croatian' | 'czech' @@ -6012,6 +6028,7 @@ export interface BrandRetrieveByTickerParams { | 'indonesian' | 'italian' | 'kazakh' + | 'korean' | 'kyrgyz' | 'latin' | 'latvian' @@ -6034,6 +6051,7 @@ export interface BrandRetrieveByTickerParams { | 'swahili' | 'swedish' | 'tagalog' + | 'thai' | 'turkish' | 'ukrainian' | 'urdu' From 6f77533b4bdf4ca48092d378f883d01f8142a779 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Mar 2026 20:25:53 +0000 Subject: [PATCH 2/4] feat(api): manual updates --- .stats.yml | 2 +- api.md | 24 +- packages/mcp-server/src/code-tool-worker.ts | 8 +- packages/mcp-server/src/methods.ts | 48 ++-- src/client.ts | 41 ++-- src/resources/brand.ts | 221 ------------------- src/resources/index.ts | 19 +- src/resources/web.ts | 233 ++++++++++++++++++++ tests/api-resources/brand.test.ts | 73 ------ tests/api-resources/web.test.ts | 83 +++++++ 10 files changed, 397 insertions(+), 355 deletions(-) create mode 100644 src/resources/web.ts create mode 100644 tests/api-resources/web.test.ts diff --git a/.stats.yml b/.stats.yml index e2bfe66..ffc3312 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 20 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-c2e94e0c758b1aaba120c2a4231842fff0a120acc471fe24c7a81221e13a0482.yml openapi_spec_hash: aabc231b46b1ca3375882f96c378c665 -config_hash: a144af00e5e74176674d0ea954cc02c5 +config_hash: c6eb5818596f9926ef1225a0c7a855db diff --git a/api.md b/api.md index 1bdf5b0..a50cabe 100644 --- a/api.md +++ b/api.md @@ -1,3 +1,19 @@ +# Web + +Types: + +- WebWebScrapeHTMLResponse +- WebWebScrapeImagesResponse +- WebWebScrapeMdResponse +- WebWebScrapeSitemapResponse + +Methods: + +- client.web.webScrapeHTML({ ...params }) -> WebWebScrapeHTMLResponse +- client.web.webScrapeImages({ ...params }) -> WebWebScrapeImagesResponse +- client.web.webScrapeMd({ ...params }) -> WebWebScrapeMdResponse +- client.web.webScrapeSitemap({ ...params }) -> WebWebScrapeSitemapResponse + # Brand Types: @@ -18,10 +34,6 @@ Types: - BrandRetrieveSimplifiedResponse - BrandScreenshotResponse - BrandStyleguideResponse -- BrandWebScrapeHTMLResponse -- BrandWebScrapeImagesResponse -- BrandWebScrapeMdResponse -- BrandWebScrapeSitemapResponse Methods: @@ -41,7 +53,3 @@ Methods: - client.brand.retrieveSimplified({ ...params }) -> BrandRetrieveSimplifiedResponse - client.brand.screenshot({ ...params }) -> BrandScreenshotResponse - client.brand.styleguide({ ...params }) -> BrandStyleguideResponse -- client.brand.webScrapeHTML({ ...params }) -> BrandWebScrapeHTMLResponse -- client.brand.webScrapeImages({ ...params }) -> BrandWebScrapeImagesResponse -- client.brand.webScrapeMd({ ...params }) -> BrandWebScrapeMdResponse -- client.brand.webScrapeSitemap({ ...params }) -> BrandWebScrapeSitemapResponse diff --git a/packages/mcp-server/src/code-tool-worker.ts b/packages/mcp-server/src/code-tool-worker.ts index 0d8fcfd..755d7de 100644 --- a/packages/mcp-server/src/code-tool-worker.ts +++ b/packages/mcp-server/src/code-tool-worker.ts @@ -104,6 +104,10 @@ function getTSDiagnostics(code: string): string[] { const fuse = new Fuse( [ + 'client.web.webScrapeHTML', + 'client.web.webScrapeImages', + 'client.web.webScrapeMd', + 'client.web.webScrapeSitemap', 'client.brand.aiProduct', 'client.brand.aiProducts', 'client.brand.aiQuery', @@ -120,10 +124,6 @@ const fuse = new Fuse( 'client.brand.retrieveSimplified', 'client.brand.screenshot', 'client.brand.styleguide', - 'client.brand.webScrapeHTML', - 'client.brand.webScrapeImages', - 'client.brand.webScrapeMd', - 'client.brand.webScrapeSitemap', ], { threshold: 1, shouldSort: true }, ); diff --git a/packages/mcp-server/src/methods.ts b/packages/mcp-server/src/methods.ts index c5ab8ae..0bb0cfb 100644 --- a/packages/mcp-server/src/methods.ts +++ b/packages/mcp-server/src/methods.ts @@ -10,6 +10,30 @@ export type SdkMethod = { }; export const sdkMethods: SdkMethod[] = [ + { + clientCallName: 'client.web.webScrapeHTML', + fullyQualifiedName: 'web.webScrapeHTML', + httpMethod: 'get', + httpPath: '/web/scrape/html', + }, + { + clientCallName: 'client.web.webScrapeImages', + fullyQualifiedName: 'web.webScrapeImages', + httpMethod: 'get', + httpPath: '/web/scrape/images', + }, + { + clientCallName: 'client.web.webScrapeMd', + fullyQualifiedName: 'web.webScrapeMd', + httpMethod: 'get', + httpPath: '/web/scrape/markdown', + }, + { + clientCallName: 'client.web.webScrapeSitemap', + fullyQualifiedName: 'web.webScrapeSitemap', + httpMethod: 'get', + httpPath: '/web/scrape/sitemap', + }, { clientCallName: 'client.brand.retrieve', fullyQualifiedName: 'brand.retrieve', @@ -106,30 +130,6 @@ export const sdkMethods: SdkMethod[] = [ httpMethod: 'get', httpPath: '/brand/styleguide', }, - { - clientCallName: 'client.brand.webScrapeHTML', - fullyQualifiedName: 'brand.webScrapeHTML', - httpMethod: 'get', - httpPath: '/web/scrape/html', - }, - { - clientCallName: 'client.brand.webScrapeImages', - fullyQualifiedName: 'brand.webScrapeImages', - httpMethod: 'get', - httpPath: '/web/scrape/images', - }, - { - clientCallName: 'client.brand.webScrapeMd', - fullyQualifiedName: 'brand.webScrapeMd', - httpMethod: 'get', - httpPath: '/web/scrape/markdown', - }, - { - clientCallName: 'client.brand.webScrapeSitemap', - fullyQualifiedName: 'brand.webScrapeSitemap', - httpMethod: 'get', - httpPath: '/web/scrape/sitemap', - }, ]; function allowedMethodsForCodeTool(options: McpOptions | undefined): SdkMethod[] | undefined { diff --git a/src/client.ts b/src/client.ts index 5465959..2f1a76c 100644 --- a/src/client.ts +++ b/src/client.ts @@ -51,15 +51,18 @@ import { BrandScreenshotResponse, BrandStyleguideParams, BrandStyleguideResponse, - BrandWebScrapeHTMLParams, - BrandWebScrapeHTMLResponse, - BrandWebScrapeImagesParams, - BrandWebScrapeImagesResponse, - BrandWebScrapeMdParams, - BrandWebScrapeMdResponse, - BrandWebScrapeSitemapParams, - BrandWebScrapeSitemapResponse, } from './resources/brand'; +import { + Web, + WebWebScrapeHTMLParams, + WebWebScrapeHTMLResponse, + WebWebScrapeImagesParams, + WebWebScrapeImagesResponse, + WebWebScrapeMdParams, + WebWebScrapeMdResponse, + WebWebScrapeSitemapParams, + WebWebScrapeSitemapResponse, +} from './resources/web'; import { type Fetch } from './internal/builtin-types'; import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers'; import { FinalRequestOptions, RequestOptions } from './internal/request-options'; @@ -760,14 +763,28 @@ export class ContextDev { static toFile = Uploads.toFile; + web: API.Web = new API.Web(this); brand: API.Brand = new API.Brand(this); } +ContextDev.Web = Web; ContextDev.Brand = Brand; export declare namespace ContextDev { export type RequestOptions = Opts.RequestOptions; + export { + Web as Web, + type WebWebScrapeHTMLResponse as WebWebScrapeHTMLResponse, + type WebWebScrapeImagesResponse as WebWebScrapeImagesResponse, + type WebWebScrapeMdResponse as WebWebScrapeMdResponse, + type WebWebScrapeSitemapResponse as WebWebScrapeSitemapResponse, + type WebWebScrapeHTMLParams as WebWebScrapeHTMLParams, + type WebWebScrapeImagesParams as WebWebScrapeImagesParams, + type WebWebScrapeMdParams as WebWebScrapeMdParams, + type WebWebScrapeSitemapParams as WebWebScrapeSitemapParams, + }; + export { Brand as Brand, type BrandRetrieveResponse as BrandRetrieveResponse, @@ -786,10 +803,6 @@ export declare namespace ContextDev { type BrandRetrieveSimplifiedResponse as BrandRetrieveSimplifiedResponse, type BrandScreenshotResponse as BrandScreenshotResponse, type BrandStyleguideResponse as BrandStyleguideResponse, - type BrandWebScrapeHTMLResponse as BrandWebScrapeHTMLResponse, - type BrandWebScrapeImagesResponse as BrandWebScrapeImagesResponse, - type BrandWebScrapeMdResponse as BrandWebScrapeMdResponse, - type BrandWebScrapeSitemapResponse as BrandWebScrapeSitemapResponse, type BrandRetrieveParams as BrandRetrieveParams, type BrandAIProductParams as BrandAIProductParams, type BrandAIProductsParams as BrandAIProductsParams, @@ -806,9 +819,5 @@ export declare namespace ContextDev { type BrandRetrieveSimplifiedParams as BrandRetrieveSimplifiedParams, type BrandScreenshotParams as BrandScreenshotParams, type BrandStyleguideParams as BrandStyleguideParams, - type BrandWebScrapeHTMLParams as BrandWebScrapeHTMLParams, - type BrandWebScrapeImagesParams as BrandWebScrapeImagesParams, - type BrandWebScrapeMdParams as BrandWebScrapeMdParams, - type BrandWebScrapeSitemapParams as BrandWebScrapeSitemapParams, }; } diff --git a/src/resources/brand.ts b/src/resources/brand.ts index 2fc4a7f..7f78867 100644 --- a/src/resources/brand.ts +++ b/src/resources/brand.ts @@ -175,50 +175,6 @@ export class Brand extends APIResource { ): APIPromise { return this._client.get('/brand/styleguide', { query, ...options }); } - - /** - * Scrapes the given URL and returns the raw HTML content of the page. Uses - * automatic proxy escalation to handle blocked sites. - */ - webScrapeHTML( - query: BrandWebScrapeHTMLParams, - options?: RequestOptions, - ): APIPromise { - return this._client.get('/web/scrape/html', { query, ...options }); - } - - /** - * Scrapes all images from the given URL. Extracts images from img, svg, - * picture/source, link, and video elements including inline SVGs, base64 data - * URIs, and standard URLs. - */ - webScrapeImages( - query: BrandWebScrapeImagesParams, - options?: RequestOptions, - ): APIPromise { - return this._client.get('/web/scrape/images', { query, ...options }); - } - - /** - * Scrapes the given URL, converts the HTML content to GitHub Flavored Markdown - * (GFM), and returns the result. Uses automatic proxy escalation to handle blocked - * sites. - */ - webScrapeMd(query: BrandWebScrapeMdParams, options?: RequestOptions): APIPromise { - return this._client.get('/web/scrape/markdown', { query, ...options }); - } - - /** - * Crawls the sitemap of the given domain and returns all discovered page URLs. - * Supports sitemap index files (recursive), parallel fetching with concurrency - * control, deduplication, and filters out non-page resources (images, PDFs, etc.). - */ - webScrapeSitemap( - query: BrandWebScrapeSitemapParams, - options?: RequestOptions, - ): APIPromise { - return this._client.get('/web/scrape/sitemap', { query, ...options }); - } } export interface BrandRetrieveResponse { @@ -4734,130 +4690,6 @@ export namespace BrandStyleguideResponse { } } -export interface BrandWebScrapeHTMLResponse { - /** - * Raw HTML content of the page - */ - html: string; - - /** - * Indicates success - */ - success: true; - - /** - * The URL that was scraped - */ - url: string; -} - -export interface BrandWebScrapeImagesResponse { - /** - * Array of scraped images - */ - images: Array; - - /** - * Indicates success - */ - success: true; - - /** - * The URL that was scraped - */ - url: string; -} - -export namespace BrandWebScrapeImagesResponse { - export interface Image { - /** - * Alt text of the image, or null if not present - */ - alt: string | null; - - /** - * The HTML element the image was found in - */ - element: 'img' | 'svg' | 'link' | 'source' | 'video'; - - /** - * The image source - can be a URL, inline HTML (for SVGs), or a base64 data URI - */ - src: string; - - /** - * The type/format of the src value - */ - type: 'url' | 'html' | 'base64'; - } -} - -export interface BrandWebScrapeMdResponse { - /** - * Page content converted to GitHub Flavored Markdown - */ - markdown: string; - - /** - * Indicates success - */ - success: true; - - /** - * The URL that was scraped - */ - url: string; -} - -export interface BrandWebScrapeSitemapResponse { - /** - * The normalized domain that was crawled - */ - domain: string; - - /** - * Metadata about the sitemap crawl operation - */ - meta: BrandWebScrapeSitemapResponse.Meta; - - /** - * Indicates success - */ - success: true; - - /** - * Array of discovered page URLs from the sitemap (max 500) - */ - urls: Array; -} - -export namespace BrandWebScrapeSitemapResponse { - /** - * Metadata about the sitemap crawl operation - */ - export interface Meta { - /** - * Number of errors encountered during crawling - */ - errors: number; - - /** - * Total number of sitemap files discovered - */ - sitemapsDiscovered: number; - - /** - * Number of sitemap files successfully fetched and parsed - */ - sitemapsFetched: number; - - /** - * Number of sitemap files skipped (due to errors, timeouts, or limits) - */ - sitemapsSkipped: number; - } -} - export interface BrandRetrieveParams { /** * Domain name to retrieve brand data for (e.g., 'example.com', 'google.com'). @@ -6251,51 +6083,6 @@ export interface BrandStyleguideParams { timeoutMS?: number; } -export interface BrandWebScrapeHTMLParams { - /** - * Full URL to scrape (must include http:// or https:// protocol) - */ - url: string; -} - -export interface BrandWebScrapeImagesParams { - /** - * Full URL to scrape images from (must include http:// or https:// protocol) - */ - url: string; -} - -export interface BrandWebScrapeMdParams { - /** - * Full URL to scrape and convert to markdown (must include http:// or https:// - * protocol) - */ - url: string; - - /** - * Include image references in Markdown output - */ - includeImages?: boolean; - - /** - * Preserve hyperlinks in Markdown output - */ - includeLinks?: boolean; - - /** - * Shorten base64-encoded image data in the Markdown output - */ - shortenBase64Images?: boolean; -} - -export interface BrandWebScrapeSitemapParams { - /** - * Domain name to crawl sitemaps for (e.g., 'example.com'). The domain will be - * automatically normalized and validated. - */ - domain: string; -} - export declare namespace Brand { export { type BrandRetrieveResponse as BrandRetrieveResponse, @@ -6314,10 +6101,6 @@ export declare namespace Brand { type BrandRetrieveSimplifiedResponse as BrandRetrieveSimplifiedResponse, type BrandScreenshotResponse as BrandScreenshotResponse, type BrandStyleguideResponse as BrandStyleguideResponse, - type BrandWebScrapeHTMLResponse as BrandWebScrapeHTMLResponse, - type BrandWebScrapeImagesResponse as BrandWebScrapeImagesResponse, - type BrandWebScrapeMdResponse as BrandWebScrapeMdResponse, - type BrandWebScrapeSitemapResponse as BrandWebScrapeSitemapResponse, type BrandRetrieveParams as BrandRetrieveParams, type BrandAIProductParams as BrandAIProductParams, type BrandAIProductsParams as BrandAIProductsParams, @@ -6334,9 +6117,5 @@ export declare namespace Brand { type BrandRetrieveSimplifiedParams as BrandRetrieveSimplifiedParams, type BrandScreenshotParams as BrandScreenshotParams, type BrandStyleguideParams as BrandStyleguideParams, - type BrandWebScrapeHTMLParams as BrandWebScrapeHTMLParams, - type BrandWebScrapeImagesParams as BrandWebScrapeImagesParams, - type BrandWebScrapeMdParams as BrandWebScrapeMdParams, - type BrandWebScrapeSitemapParams as BrandWebScrapeSitemapParams, }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index 7031f6b..ad9fee0 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -18,10 +18,6 @@ export { type BrandRetrieveSimplifiedResponse, type BrandScreenshotResponse, type BrandStyleguideResponse, - type BrandWebScrapeHTMLResponse, - type BrandWebScrapeImagesResponse, - type BrandWebScrapeMdResponse, - type BrandWebScrapeSitemapResponse, type BrandRetrieveParams, type BrandAIProductParams, type BrandAIProductsParams, @@ -38,8 +34,15 @@ export { type BrandRetrieveSimplifiedParams, type BrandScreenshotParams, type BrandStyleguideParams, - type BrandWebScrapeHTMLParams, - type BrandWebScrapeImagesParams, - type BrandWebScrapeMdParams, - type BrandWebScrapeSitemapParams, } from './brand'; +export { + Web, + type WebWebScrapeHTMLResponse, + type WebWebScrapeImagesResponse, + type WebWebScrapeMdResponse, + type WebWebScrapeSitemapResponse, + type WebWebScrapeHTMLParams, + type WebWebScrapeImagesParams, + type WebWebScrapeMdParams, + type WebWebScrapeSitemapParams, +} from './web'; diff --git a/src/resources/web.ts b/src/resources/web.ts new file mode 100644 index 0000000..d859cdf --- /dev/null +++ b/src/resources/web.ts @@ -0,0 +1,233 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../core/resource'; +import { APIPromise } from '../core/api-promise'; +import { RequestOptions } from '../internal/request-options'; + +export class Web extends APIResource { + /** + * Scrapes the given URL and returns the raw HTML content of the page. Uses + * automatic proxy escalation to handle blocked sites. + */ + webScrapeHTML( + query: WebWebScrapeHTMLParams, + options?: RequestOptions, + ): APIPromise { + return this._client.get('/web/scrape/html', { query, ...options }); + } + + /** + * Scrapes all images from the given URL. Extracts images from img, svg, + * picture/source, link, and video elements including inline SVGs, base64 data + * URIs, and standard URLs. + */ + webScrapeImages( + query: WebWebScrapeImagesParams, + options?: RequestOptions, + ): APIPromise { + return this._client.get('/web/scrape/images', { query, ...options }); + } + + /** + * Scrapes the given URL, converts the HTML content to GitHub Flavored Markdown + * (GFM), and returns the result. Uses automatic proxy escalation to handle blocked + * sites. + */ + webScrapeMd(query: WebWebScrapeMdParams, options?: RequestOptions): APIPromise { + return this._client.get('/web/scrape/markdown', { query, ...options }); + } + + /** + * Crawls the sitemap of the given domain and returns all discovered page URLs. + * Supports sitemap index files (recursive), parallel fetching with concurrency + * control, deduplication, and filters out non-page resources (images, PDFs, etc.). + */ + webScrapeSitemap( + query: WebWebScrapeSitemapParams, + options?: RequestOptions, + ): APIPromise { + return this._client.get('/web/scrape/sitemap', { query, ...options }); + } +} + +export interface WebWebScrapeHTMLResponse { + /** + * Raw HTML content of the page + */ + html: string; + + /** + * Indicates success + */ + success: true; + + /** + * The URL that was scraped + */ + url: string; +} + +export interface WebWebScrapeImagesResponse { + /** + * Array of scraped images + */ + images: Array; + + /** + * Indicates success + */ + success: true; + + /** + * The URL that was scraped + */ + url: string; +} + +export namespace WebWebScrapeImagesResponse { + export interface Image { + /** + * Alt text of the image, or null if not present + */ + alt: string | null; + + /** + * The HTML element the image was found in + */ + element: 'img' | 'svg' | 'link' | 'source' | 'video'; + + /** + * The image source - can be a URL, inline HTML (for SVGs), or a base64 data URI + */ + src: string; + + /** + * The type/format of the src value + */ + type: 'url' | 'html' | 'base64'; + } +} + +export interface WebWebScrapeMdResponse { + /** + * Page content converted to GitHub Flavored Markdown + */ + markdown: string; + + /** + * Indicates success + */ + success: true; + + /** + * The URL that was scraped + */ + url: string; +} + +export interface WebWebScrapeSitemapResponse { + /** + * The normalized domain that was crawled + */ + domain: string; + + /** + * Metadata about the sitemap crawl operation + */ + meta: WebWebScrapeSitemapResponse.Meta; + + /** + * Indicates success + */ + success: true; + + /** + * Array of discovered page URLs from the sitemap (max 500) + */ + urls: Array; +} + +export namespace WebWebScrapeSitemapResponse { + /** + * Metadata about the sitemap crawl operation + */ + export interface Meta { + /** + * Number of errors encountered during crawling + */ + errors: number; + + /** + * Total number of sitemap files discovered + */ + sitemapsDiscovered: number; + + /** + * Number of sitemap files successfully fetched and parsed + */ + sitemapsFetched: number; + + /** + * Number of sitemap files skipped (due to errors, timeouts, or limits) + */ + sitemapsSkipped: number; + } +} + +export interface WebWebScrapeHTMLParams { + /** + * Full URL to scrape (must include http:// or https:// protocol) + */ + url: string; +} + +export interface WebWebScrapeImagesParams { + /** + * Full URL to scrape images from (must include http:// or https:// protocol) + */ + url: string; +} + +export interface WebWebScrapeMdParams { + /** + * Full URL to scrape and convert to markdown (must include http:// or https:// + * protocol) + */ + url: string; + + /** + * Include image references in Markdown output + */ + includeImages?: boolean; + + /** + * Preserve hyperlinks in Markdown output + */ + includeLinks?: boolean; + + /** + * Shorten base64-encoded image data in the Markdown output + */ + shortenBase64Images?: boolean; +} + +export interface WebWebScrapeSitemapParams { + /** + * Domain name to crawl sitemaps for (e.g., 'example.com'). The domain will be + * automatically normalized and validated. + */ + domain: string; +} + +export declare namespace Web { + export { + type WebWebScrapeHTMLResponse as WebWebScrapeHTMLResponse, + type WebWebScrapeImagesResponse as WebWebScrapeImagesResponse, + type WebWebScrapeMdResponse as WebWebScrapeMdResponse, + type WebWebScrapeSitemapResponse as WebWebScrapeSitemapResponse, + type WebWebScrapeHTMLParams as WebWebScrapeHTMLParams, + type WebWebScrapeImagesParams as WebWebScrapeImagesParams, + type WebWebScrapeMdParams as WebWebScrapeMdParams, + type WebWebScrapeSitemapParams as WebWebScrapeSitemapParams, + }; +} diff --git a/tests/api-resources/brand.test.ts b/tests/api-resources/brand.test.ts index 777601b..6f56f04 100644 --- a/tests/api-resources/brand.test.ts +++ b/tests/api-resources/brand.test.ts @@ -375,77 +375,4 @@ describe('resource brand', () => { ), ).rejects.toThrow(ContextDev.NotFoundError); }); - - // Mock server tests are disabled - test.skip('webScrapeHTML: only required params', async () => { - const responsePromise = client.brand.webScrapeHTML({ url: 'https://example.com' }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // Mock server tests are disabled - test.skip('webScrapeHTML: required and optional params', async () => { - const response = await client.brand.webScrapeHTML({ url: 'https://example.com' }); - }); - - // Mock server tests are disabled - test.skip('webScrapeImages: only required params', async () => { - const responsePromise = client.brand.webScrapeImages({ url: 'https://example.com' }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // Mock server tests are disabled - test.skip('webScrapeImages: required and optional params', async () => { - const response = await client.brand.webScrapeImages({ url: 'https://example.com' }); - }); - - // Mock server tests are disabled - test.skip('webScrapeMd: only required params', async () => { - const responsePromise = client.brand.webScrapeMd({ url: 'https://example.com' }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // Mock server tests are disabled - test.skip('webScrapeMd: required and optional params', async () => { - const response = await client.brand.webScrapeMd({ - url: 'https://example.com', - includeImages: true, - includeLinks: true, - shortenBase64Images: true, - }); - }); - - // Mock server tests are disabled - test.skip('webScrapeSitemap: only required params', async () => { - const responsePromise = client.brand.webScrapeSitemap({ domain: 'domain' }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // Mock server tests are disabled - test.skip('webScrapeSitemap: required and optional params', async () => { - const response = await client.brand.webScrapeSitemap({ domain: 'domain' }); - }); }); diff --git a/tests/api-resources/web.test.ts b/tests/api-resources/web.test.ts new file mode 100644 index 0000000..2e3f11d --- /dev/null +++ b/tests/api-resources/web.test.ts @@ -0,0 +1,83 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import ContextDev from 'context.dev'; + +const client = new ContextDev({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource web', () => { + // Mock server tests are disabled + test.skip('webScrapeHTML: only required params', async () => { + const responsePromise = client.web.webScrapeHTML({ url: 'https://example.com' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('webScrapeHTML: required and optional params', async () => { + const response = await client.web.webScrapeHTML({ url: 'https://example.com' }); + }); + + // Mock server tests are disabled + test.skip('webScrapeImages: only required params', async () => { + const responsePromise = client.web.webScrapeImages({ url: 'https://example.com' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('webScrapeImages: required and optional params', async () => { + const response = await client.web.webScrapeImages({ url: 'https://example.com' }); + }); + + // Mock server tests are disabled + test.skip('webScrapeMd: only required params', async () => { + const responsePromise = client.web.webScrapeMd({ url: 'https://example.com' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('webScrapeMd: required and optional params', async () => { + const response = await client.web.webScrapeMd({ + url: 'https://example.com', + includeImages: true, + includeLinks: true, + shortenBase64Images: true, + }); + }); + + // Mock server tests are disabled + test.skip('webScrapeSitemap: only required params', async () => { + const responsePromise = client.web.webScrapeSitemap({ domain: 'domain' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('webScrapeSitemap: required and optional params', async () => { + const response = await client.web.webScrapeSitemap({ domain: 'domain' }); + }); +}); From 7cb981dbb19152fc272b33b119a7099410e48c50 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Mar 2026 20:31:14 +0000 Subject: [PATCH 3/4] feat(api): manual updates --- .stats.yml | 2 +- api.md | 68 +- packages/mcp-server/src/code-tool-worker.ts | 18 +- packages/mcp-server/src/methods.ts | 80 +- src/client.ts | 104 +- src/resources/ai.ts | 417 +++++++ src/resources/brand.ts | 1160 +------------------ src/resources/index.ts | 44 +- src/resources/industry.ts | 92 ++ src/resources/style.ts | 522 +++++++++ src/resources/utility.ts | 105 ++ src/resources/web.ts | 69 ++ tests/api-resources/ai.test.ts | 99 ++ tests/api-resources/brand.test.ts | 212 ---- tests/api-resources/industry.test.ts | 32 + tests/api-resources/style.test.ts | 55 + tests/api-resources/utility.test.ts | 44 + tests/api-resources/web.test.ts | 22 + 18 files changed, 1657 insertions(+), 1488 deletions(-) create mode 100644 src/resources/ai.ts create mode 100644 src/resources/industry.ts create mode 100644 src/resources/style.ts create mode 100644 src/resources/utility.ts create mode 100644 tests/api-resources/ai.test.ts create mode 100644 tests/api-resources/industry.test.ts create mode 100644 tests/api-resources/style.test.ts create mode 100644 tests/api-resources/utility.test.ts diff --git a/.stats.yml b/.stats.yml index ffc3312..c4d3922 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 20 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-c2e94e0c758b1aaba120c2a4231842fff0a120acc471fe24c7a81221e13a0482.yml openapi_spec_hash: aabc231b46b1ca3375882f96c378c665 -config_hash: c6eb5818596f9926ef1225a0c7a855db +config_hash: ab5135cc119f83ae2821f9445ed99d16 diff --git a/api.md b/api.md index a50cabe..c024bc3 100644 --- a/api.md +++ b/api.md @@ -2,6 +2,7 @@ Types: +- WebScreenshotResponse - WebWebScrapeHTMLResponse - WebWebScrapeImagesResponse - WebWebScrapeMdResponse @@ -9,47 +10,78 @@ Types: Methods: +- client.web.screenshot({ ...params }) -> WebScreenshotResponse - client.web.webScrapeHTML({ ...params }) -> WebWebScrapeHTMLResponse - client.web.webScrapeImages({ ...params }) -> WebWebScrapeImagesResponse - client.web.webScrapeMd({ ...params }) -> WebWebScrapeMdResponse - client.web.webScrapeSitemap({ ...params }) -> WebWebScrapeSitemapResponse +# AI + +Types: + +- AIAIQueryResponse +- AIExtractProductResponse +- AIExtractProductsResponse + +Methods: + +- client.ai.aiQuery({ ...params }) -> AIAIQueryResponse +- client.ai.extractProduct({ ...params }) -> AIExtractProductResponse +- client.ai.extractProducts({ ...params }) -> AIExtractProductsResponse + +# Style + +Types: + +- StyleExtractFontsResponse +- StyleExtractStyleguideResponse + +Methods: + +- client.style.extractFonts({ ...params }) -> StyleExtractFontsResponse +- client.style.extractStyleguide({ ...params }) -> StyleExtractStyleguideResponse + # Brand Types: - BrandRetrieveResponse -- BrandAIProductResponse -- BrandAIProductsResponse -- BrandAIQueryResponse -- BrandFontsResponse - BrandIdentifyFromTransactionResponse -- BrandPrefetchResponse -- BrandPrefetchByEmailResponse - BrandRetrieveByEmailResponse - BrandRetrieveByIsinResponse - BrandRetrieveByNameResponse - BrandRetrieveByTickerResponse -- BrandRetrieveNaicsResponse - BrandRetrieveSimplifiedResponse -- BrandScreenshotResponse -- BrandStyleguideResponse Methods: - client.brand.retrieve({ ...params }) -> BrandRetrieveResponse -- client.brand.aiProduct({ ...params }) -> BrandAIProductResponse -- client.brand.aiProducts({ ...params }) -> BrandAIProductsResponse -- client.brand.aiQuery({ ...params }) -> BrandAIQueryResponse -- client.brand.fonts({ ...params }) -> BrandFontsResponse - client.brand.identifyFromTransaction({ ...params }) -> BrandIdentifyFromTransactionResponse -- client.brand.prefetch({ ...params }) -> BrandPrefetchResponse -- client.brand.prefetchByEmail({ ...params }) -> BrandPrefetchByEmailResponse - client.brand.retrieveByEmail({ ...params }) -> BrandRetrieveByEmailResponse - client.brand.retrieveByIsin({ ...params }) -> BrandRetrieveByIsinResponse - client.brand.retrieveByName({ ...params }) -> BrandRetrieveByNameResponse - client.brand.retrieveByTicker({ ...params }) -> BrandRetrieveByTickerResponse -- client.brand.retrieveNaics({ ...params }) -> BrandRetrieveNaicsResponse - client.brand.retrieveSimplified({ ...params }) -> BrandRetrieveSimplifiedResponse -- client.brand.screenshot({ ...params }) -> BrandScreenshotResponse -- client.brand.styleguide({ ...params }) -> BrandStyleguideResponse + +# Industry + +Types: + +- IndustryRetrieveNaicsResponse + +Methods: + +- client.industry.retrieveNaics({ ...params }) -> IndustryRetrieveNaicsResponse + +# Utility + +Types: + +- UtilityPrefetchResponse +- UtilityPrefetchByEmailResponse + +Methods: + +- client.utility.prefetch({ ...params }) -> UtilityPrefetchResponse +- client.utility.prefetchByEmail({ ...params }) -> UtilityPrefetchByEmailResponse diff --git a/packages/mcp-server/src/code-tool-worker.ts b/packages/mcp-server/src/code-tool-worker.ts index 755d7de..b84440b 100644 --- a/packages/mcp-server/src/code-tool-worker.ts +++ b/packages/mcp-server/src/code-tool-worker.ts @@ -104,26 +104,26 @@ function getTSDiagnostics(code: string): string[] { const fuse = new Fuse( [ + 'client.web.screenshot', 'client.web.webScrapeHTML', 'client.web.webScrapeImages', 'client.web.webScrapeMd', 'client.web.webScrapeSitemap', - 'client.brand.aiProduct', - 'client.brand.aiProducts', - 'client.brand.aiQuery', - 'client.brand.fonts', + 'client.ai.aiQuery', + 'client.ai.extractProduct', + 'client.ai.extractProducts', + 'client.style.extractFonts', + 'client.style.extractStyleguide', 'client.brand.identifyFromTransaction', - 'client.brand.prefetch', - 'client.brand.prefetchByEmail', 'client.brand.retrieve', 'client.brand.retrieveByEmail', 'client.brand.retrieveByIsin', 'client.brand.retrieveByName', 'client.brand.retrieveByTicker', - 'client.brand.retrieveNaics', 'client.brand.retrieveSimplified', - 'client.brand.screenshot', - 'client.brand.styleguide', + 'client.industry.retrieveNaics', + 'client.utility.prefetch', + 'client.utility.prefetchByEmail', ], { threshold: 1, shouldSort: true }, ); diff --git a/packages/mcp-server/src/methods.ts b/packages/mcp-server/src/methods.ts index 0bb0cfb..9a8c516 100644 --- a/packages/mcp-server/src/methods.ts +++ b/packages/mcp-server/src/methods.ts @@ -10,6 +10,12 @@ export type SdkMethod = { }; export const sdkMethods: SdkMethod[] = [ + { + clientCallName: 'client.web.screenshot', + fullyQualifiedName: 'web.screenshot', + httpMethod: 'get', + httpPath: '/brand/screenshot', + }, { clientCallName: 'client.web.webScrapeHTML', fullyQualifiedName: 'web.webScrapeHTML', @@ -35,52 +41,46 @@ export const sdkMethods: SdkMethod[] = [ httpPath: '/web/scrape/sitemap', }, { - clientCallName: 'client.brand.retrieve', - fullyQualifiedName: 'brand.retrieve', - httpMethod: 'get', - httpPath: '/brand/retrieve', + clientCallName: 'client.ai.aiQuery', + fullyQualifiedName: 'ai.aiQuery', + httpMethod: 'post', + httpPath: '/brand/ai/query', }, { - clientCallName: 'client.brand.aiProduct', - fullyQualifiedName: 'brand.aiProduct', + clientCallName: 'client.ai.extractProduct', + fullyQualifiedName: 'ai.extractProduct', httpMethod: 'post', httpPath: '/brand/ai/product', }, { - clientCallName: 'client.brand.aiProducts', - fullyQualifiedName: 'brand.aiProducts', + clientCallName: 'client.ai.extractProducts', + fullyQualifiedName: 'ai.extractProducts', httpMethod: 'post', httpPath: '/brand/ai/products', }, { - clientCallName: 'client.brand.aiQuery', - fullyQualifiedName: 'brand.aiQuery', - httpMethod: 'post', - httpPath: '/brand/ai/query', - }, - { - clientCallName: 'client.brand.fonts', - fullyQualifiedName: 'brand.fonts', + clientCallName: 'client.style.extractFonts', + fullyQualifiedName: 'style.extractFonts', httpMethod: 'get', httpPath: '/brand/fonts', }, { - clientCallName: 'client.brand.identifyFromTransaction', - fullyQualifiedName: 'brand.identifyFromTransaction', + clientCallName: 'client.style.extractStyleguide', + fullyQualifiedName: 'style.extractStyleguide', httpMethod: 'get', - httpPath: '/brand/transaction_identifier', + httpPath: '/brand/styleguide', }, { - clientCallName: 'client.brand.prefetch', - fullyQualifiedName: 'brand.prefetch', - httpMethod: 'post', - httpPath: '/brand/prefetch', + clientCallName: 'client.brand.retrieve', + fullyQualifiedName: 'brand.retrieve', + httpMethod: 'get', + httpPath: '/brand/retrieve', }, { - clientCallName: 'client.brand.prefetchByEmail', - fullyQualifiedName: 'brand.prefetchByEmail', - httpMethod: 'post', - httpPath: '/brand/prefetch-by-email', + clientCallName: 'client.brand.identifyFromTransaction', + fullyQualifiedName: 'brand.identifyFromTransaction', + httpMethod: 'get', + httpPath: '/brand/transaction_identifier', }, { clientCallName: 'client.brand.retrieveByEmail', @@ -106,12 +106,6 @@ export const sdkMethods: SdkMethod[] = [ httpMethod: 'get', httpPath: '/brand/retrieve-by-ticker', }, - { - clientCallName: 'client.brand.retrieveNaics', - fullyQualifiedName: 'brand.retrieveNaics', - httpMethod: 'get', - httpPath: '/brand/naics', - }, { clientCallName: 'client.brand.retrieveSimplified', fullyQualifiedName: 'brand.retrieveSimplified', @@ -119,16 +113,22 @@ export const sdkMethods: SdkMethod[] = [ httpPath: '/brand/retrieve-simplified', }, { - clientCallName: 'client.brand.screenshot', - fullyQualifiedName: 'brand.screenshot', + clientCallName: 'client.industry.retrieveNaics', + fullyQualifiedName: 'industry.retrieveNaics', httpMethod: 'get', - httpPath: '/brand/screenshot', + httpPath: '/brand/naics', }, { - clientCallName: 'client.brand.styleguide', - fullyQualifiedName: 'brand.styleguide', - httpMethod: 'get', - httpPath: '/brand/styleguide', + clientCallName: 'client.utility.prefetch', + fullyQualifiedName: 'utility.prefetch', + httpMethod: 'post', + httpPath: '/brand/prefetch', + }, + { + clientCallName: 'client.utility.prefetchByEmail', + fullyQualifiedName: 'utility.prefetchByEmail', + httpMethod: 'post', + httpPath: '/brand/prefetch-by-email', }, ]; diff --git a/src/client.ts b/src/client.ts index 2f1a76c..6bd7f61 100644 --- a/src/client.ts +++ b/src/client.ts @@ -17,22 +17,19 @@ import * as Errors from './core/error'; import * as Uploads from './core/uploads'; import * as API from './resources/index'; import { APIPromise } from './core/api-promise'; +import { + AI, + AIAIQueryParams, + AIAIQueryResponse, + AIExtractProductParams, + AIExtractProductResponse, + AIExtractProductsParams, + AIExtractProductsResponse, +} from './resources/ai'; import { Brand, - BrandAIProductParams, - BrandAIProductResponse, - BrandAIProductsParams, - BrandAIProductsResponse, - BrandAIQueryParams, - BrandAIQueryResponse, - BrandFontsParams, - BrandFontsResponse, BrandIdentifyFromTransactionParams, BrandIdentifyFromTransactionResponse, - BrandPrefetchByEmailParams, - BrandPrefetchByEmailResponse, - BrandPrefetchParams, - BrandPrefetchResponse, BrandRetrieveByEmailParams, BrandRetrieveByEmailResponse, BrandRetrieveByIsinParams, @@ -41,19 +38,30 @@ import { BrandRetrieveByNameResponse, BrandRetrieveByTickerParams, BrandRetrieveByTickerResponse, - BrandRetrieveNaicsParams, - BrandRetrieveNaicsResponse, BrandRetrieveParams, BrandRetrieveResponse, BrandRetrieveSimplifiedParams, BrandRetrieveSimplifiedResponse, - BrandScreenshotParams, - BrandScreenshotResponse, - BrandStyleguideParams, - BrandStyleguideResponse, } from './resources/brand'; +import { Industry, IndustryRetrieveNaicsParams, IndustryRetrieveNaicsResponse } from './resources/industry'; +import { + Style, + StyleExtractFontsParams, + StyleExtractFontsResponse, + StyleExtractStyleguideParams, + StyleExtractStyleguideResponse, +} from './resources/style'; +import { + Utility, + UtilityPrefetchByEmailParams, + UtilityPrefetchByEmailResponse, + UtilityPrefetchParams, + UtilityPrefetchResponse, +} from './resources/utility'; import { Web, + WebScreenshotParams, + WebScreenshotResponse, WebWebScrapeHTMLParams, WebWebScrapeHTMLResponse, WebWebScrapeImagesParams, @@ -764,60 +772,84 @@ export class ContextDev { static toFile = Uploads.toFile; web: API.Web = new API.Web(this); + ai: API.AI = new API.AI(this); + style: API.Style = new API.Style(this); brand: API.Brand = new API.Brand(this); + industry: API.Industry = new API.Industry(this); + utility: API.Utility = new API.Utility(this); } ContextDev.Web = Web; +ContextDev.AI = AI; +ContextDev.Style = Style; ContextDev.Brand = Brand; +ContextDev.Industry = Industry; +ContextDev.Utility = Utility; export declare namespace ContextDev { export type RequestOptions = Opts.RequestOptions; export { Web as Web, + type WebScreenshotResponse as WebScreenshotResponse, type WebWebScrapeHTMLResponse as WebWebScrapeHTMLResponse, type WebWebScrapeImagesResponse as WebWebScrapeImagesResponse, type WebWebScrapeMdResponse as WebWebScrapeMdResponse, type WebWebScrapeSitemapResponse as WebWebScrapeSitemapResponse, + type WebScreenshotParams as WebScreenshotParams, type WebWebScrapeHTMLParams as WebWebScrapeHTMLParams, type WebWebScrapeImagesParams as WebWebScrapeImagesParams, type WebWebScrapeMdParams as WebWebScrapeMdParams, type WebWebScrapeSitemapParams as WebWebScrapeSitemapParams, }; + export { + AI as AI, + type AIAIQueryResponse as AIAIQueryResponse, + type AIExtractProductResponse as AIExtractProductResponse, + type AIExtractProductsResponse as AIExtractProductsResponse, + type AIAIQueryParams as AIAIQueryParams, + type AIExtractProductParams as AIExtractProductParams, + type AIExtractProductsParams as AIExtractProductsParams, + }; + + export { + Style as Style, + type StyleExtractFontsResponse as StyleExtractFontsResponse, + type StyleExtractStyleguideResponse as StyleExtractStyleguideResponse, + type StyleExtractFontsParams as StyleExtractFontsParams, + type StyleExtractStyleguideParams as StyleExtractStyleguideParams, + }; + export { Brand as Brand, type BrandRetrieveResponse as BrandRetrieveResponse, - type BrandAIProductResponse as BrandAIProductResponse, - type BrandAIProductsResponse as BrandAIProductsResponse, - type BrandAIQueryResponse as BrandAIQueryResponse, - type BrandFontsResponse as BrandFontsResponse, type BrandIdentifyFromTransactionResponse as BrandIdentifyFromTransactionResponse, - type BrandPrefetchResponse as BrandPrefetchResponse, - type BrandPrefetchByEmailResponse as BrandPrefetchByEmailResponse, type BrandRetrieveByEmailResponse as BrandRetrieveByEmailResponse, type BrandRetrieveByIsinResponse as BrandRetrieveByIsinResponse, type BrandRetrieveByNameResponse as BrandRetrieveByNameResponse, type BrandRetrieveByTickerResponse as BrandRetrieveByTickerResponse, - type BrandRetrieveNaicsResponse as BrandRetrieveNaicsResponse, type BrandRetrieveSimplifiedResponse as BrandRetrieveSimplifiedResponse, - type BrandScreenshotResponse as BrandScreenshotResponse, - type BrandStyleguideResponse as BrandStyleguideResponse, type BrandRetrieveParams as BrandRetrieveParams, - type BrandAIProductParams as BrandAIProductParams, - type BrandAIProductsParams as BrandAIProductsParams, - type BrandAIQueryParams as BrandAIQueryParams, - type BrandFontsParams as BrandFontsParams, type BrandIdentifyFromTransactionParams as BrandIdentifyFromTransactionParams, - type BrandPrefetchParams as BrandPrefetchParams, - type BrandPrefetchByEmailParams as BrandPrefetchByEmailParams, type BrandRetrieveByEmailParams as BrandRetrieveByEmailParams, type BrandRetrieveByIsinParams as BrandRetrieveByIsinParams, type BrandRetrieveByNameParams as BrandRetrieveByNameParams, type BrandRetrieveByTickerParams as BrandRetrieveByTickerParams, - type BrandRetrieveNaicsParams as BrandRetrieveNaicsParams, type BrandRetrieveSimplifiedParams as BrandRetrieveSimplifiedParams, - type BrandScreenshotParams as BrandScreenshotParams, - type BrandStyleguideParams as BrandStyleguideParams, + }; + + export { + Industry as Industry, + type IndustryRetrieveNaicsResponse as IndustryRetrieveNaicsResponse, + type IndustryRetrieveNaicsParams as IndustryRetrieveNaicsParams, + }; + + export { + Utility as Utility, + type UtilityPrefetchResponse as UtilityPrefetchResponse, + type UtilityPrefetchByEmailResponse as UtilityPrefetchByEmailResponse, + type UtilityPrefetchParams as UtilityPrefetchParams, + type UtilityPrefetchByEmailParams as UtilityPrefetchByEmailParams, }; } diff --git a/src/resources/ai.ts b/src/resources/ai.ts new file mode 100644 index 0000000..aabc835 --- /dev/null +++ b/src/resources/ai.ts @@ -0,0 +1,417 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../core/resource'; +import { APIPromise } from '../core/api-promise'; +import { RequestOptions } from '../internal/request-options'; + +export class AI extends APIResource { + /** + * Use AI to extract specific data points from a brand's website. The AI will crawl + * the website and extract the requested information based on the provided data + * points. + */ + aiQuery(body: AIAIQueryParams, options?: RequestOptions): APIPromise { + return this._client.post('/brand/ai/query', { body, ...options }); + } + + /** + * Beta feature: Given a single URL, determines if it is a product detail page, + * classifies the platform/product type, and extracts the product information. + * Supports Amazon, TikTok Shop, Etsy, and generic ecommerce sites. + */ + extractProduct( + body: AIExtractProductParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/brand/ai/product', { body, ...options }); + } + + /** + * Beta feature: Extract product information from a brand's website. Brand.dev will + * analyze the website and return a list of products with details such as name, + * description, image, pricing, features, and more. + */ + extractProducts( + body: AIExtractProductsParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/brand/ai/products', { body, ...options }); + } +} + +export interface AIAIQueryResponse { + /** + * Array of extracted data points + */ + data_extracted?: Array; + + /** + * The domain that was analyzed + */ + domain?: string; + + /** + * Status of the response, e.g., 'ok' + */ + status?: string; + + /** + * List of URLs that were analyzed + */ + urls_analyzed?: Array; +} + +export namespace AIAIQueryResponse { + export interface DataExtracted { + /** + * Name of the extracted data point + */ + datapoint_name?: string; + + /** + * Value of the extracted data point. Can be a primitive type, an array of + * primitives, or an array of objects when datapoint_list_type is 'object'. + */ + datapoint_value?: string | number | boolean | Array | Array | Array; + } +} + +export interface AIExtractProductResponse { + /** + * Whether the given URL is a product detail page + */ + is_product_page?: boolean; + + /** + * The detected ecommerce platform, or null if not a product page + */ + platform?: 'amazon' | 'tiktok_shop' | 'etsy' | 'generic' | null; + + /** + * The extracted product data, or null if not a product page + */ + product?: AIExtractProductResponse.Product | null; +} + +export namespace AIExtractProductResponse { + /** + * The extracted product data, or null if not a product page + */ + export interface Product { + /** + * Description of the product + */ + description: string; + + /** + * List of product features + */ + features: Array; + + /** + * URLs to product images on the page (up to 7) + */ + images: Array; + + /** + * Name of the product + */ + name: string; + + /** + * Tags associated with the product + */ + tags: Array; + + /** + * Target audience for the product (array of strings) + */ + target_audience: Array; + + /** + * Billing frequency for the product + */ + billing_frequency?: 'monthly' | 'yearly' | 'one_time' | 'usage_based' | null; + + /** + * Category of the product + */ + category?: string | null; + + /** + * Currency code for the price (e.g., USD, EUR) + */ + currency?: string | null; + + /** + * URL to the product image + */ + image_url?: string | null; + + /** + * Price of the product + */ + price?: number | null; + + /** + * Pricing model for the product + */ + pricing_model?: 'per_seat' | 'flat' | 'tiered' | 'freemium' | 'custom' | null; + + /** + * URL to the product page + */ + url?: string | null; + } +} + +export interface AIExtractProductsResponse { + /** + * Array of products extracted from the website + */ + products?: Array; +} + +export namespace AIExtractProductsResponse { + export interface Product { + /** + * Description of the product + */ + description: string; + + /** + * List of product features + */ + features: Array; + + /** + * URLs to product images on the page (up to 7) + */ + images: Array; + + /** + * Name of the product + */ + name: string; + + /** + * Tags associated with the product + */ + tags: Array; + + /** + * Target audience for the product (array of strings) + */ + target_audience: Array; + + /** + * Billing frequency for the product + */ + billing_frequency?: 'monthly' | 'yearly' | 'one_time' | 'usage_based' | null; + + /** + * Category of the product + */ + category?: string | null; + + /** + * Currency code for the price (e.g., USD, EUR) + */ + currency?: string | null; + + /** + * URL to the product image + */ + image_url?: string | null; + + /** + * Price of the product + */ + price?: number | null; + + /** + * Pricing model for the product + */ + pricing_model?: 'per_seat' | 'flat' | 'tiered' | 'freemium' | 'custom' | null; + + /** + * URL to the product page + */ + url?: string | null; + } +} + +export interface AIAIQueryParams { + /** + * Array of data points to extract from the website + */ + data_to_extract: Array; + + /** + * The domain name to analyze + */ + domain: string; + + /** + * Optional object specifying which pages to analyze + */ + specific_pages?: AIAIQueryParams.SpecificPages; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer + * than this value, it will be aborted with a 408 status code. Maximum allowed + * value is 300000ms (5 minutes). + */ + timeoutMS?: number; +} + +export namespace AIAIQueryParams { + export interface DataToExtract { + /** + * Description of what to extract + */ + datapoint_description: string; + + /** + * Example of the expected value + */ + datapoint_example: string; + + /** + * Name of the data point to extract + */ + datapoint_name: string; + + /** + * Type of the data point + */ + datapoint_type: 'text' | 'number' | 'date' | 'boolean' | 'list' | 'url'; + + /** + * Type of items in the list when datapoint_type is 'list'. Defaults to 'string'. + * Use 'object' to extract an array of objects matching a schema. + */ + datapoint_list_type?: 'string' | 'text' | 'number' | 'date' | 'boolean' | 'list' | 'url' | 'object'; + + /** + * Schema definition for objects when datapoint_list_type is 'object'. Provide a + * map of field names to their scalar types. + */ + datapoint_object_schema?: { [key: string]: 'string' | 'number' | 'date' | 'boolean' }; + } + + /** + * Optional object specifying which pages to analyze + */ + export interface SpecificPages { + /** + * Whether to analyze the about us page + */ + about_us?: boolean; + + /** + * Whether to analyze the blog + */ + blog?: boolean; + + /** + * Whether to analyze the careers page + */ + careers?: boolean; + + /** + * Whether to analyze the contact us page + */ + contact_us?: boolean; + + /** + * Whether to analyze the FAQ page + */ + faq?: boolean; + + /** + * Whether to analyze the home page + */ + home_page?: boolean; + + /** + * Whether to analyze the pricing page + */ + pricing?: boolean; + + /** + * Whether to analyze the privacy policy page + */ + privacy_policy?: boolean; + + /** + * Whether to analyze the terms and conditions page + */ + terms_and_conditions?: boolean; + } +} + +export interface AIExtractProductParams { + /** + * The product page URL to extract product data from. + */ + url: string; + + /** + * Optional timeout in milliseconds for the request. Maximum allowed value is + * 300000ms (5 minutes). + */ + timeoutMS?: number; +} + +export type AIExtractProductsParams = AIExtractProductsParams.ByDomain | AIExtractProductsParams.ByDirectURL; + +export declare namespace AIExtractProductsParams { + export interface ByDomain { + /** + * The domain name to analyze. + */ + domain: string; + + /** + * Maximum number of products to extract. + */ + maxProducts?: number; + + /** + * Optional timeout in milliseconds for the request. Maximum allowed value is + * 300000ms (5 minutes). + */ + timeoutMS?: number; + } + + export interface ByDirectURL { + /** + * A specific URL to use directly as the starting point for extraction without + * domain resolution. + */ + directUrl: string; + + /** + * Maximum number of products to extract. + */ + maxProducts?: number; + + /** + * Optional timeout in milliseconds for the request. Maximum allowed value is + * 300000ms (5 minutes). + */ + timeoutMS?: number; + } +} + +export declare namespace AI { + export { + type AIAIQueryResponse as AIAIQueryResponse, + type AIExtractProductResponse as AIExtractProductResponse, + type AIExtractProductsResponse as AIExtractProductsResponse, + type AIAIQueryParams as AIAIQueryParams, + type AIExtractProductParams as AIExtractProductParams, + type AIExtractProductsParams as AIExtractProductsParams, + }; +} diff --git a/src/resources/brand.ts b/src/resources/brand.ts index 7f78867..517b5d5 100644 --- a/src/resources/brand.ts +++ b/src/resources/brand.ts @@ -13,41 +13,6 @@ export class Brand extends APIResource { return this._client.get('/brand/retrieve', { query, ...options }); } - /** - * Beta feature: Given a single URL, determines if it is a product detail page, - * classifies the platform/product type, and extracts the product information. - * Supports Amazon, TikTok Shop, Etsy, and generic ecommerce sites. - */ - aiProduct(body: BrandAIProductParams, options?: RequestOptions): APIPromise { - return this._client.post('/brand/ai/product', { body, ...options }); - } - - /** - * Beta feature: Extract product information from a brand's website. Brand.dev will - * analyze the website and return a list of products with details such as name, - * description, image, pricing, features, and more. - */ - aiProducts(body: BrandAIProductsParams, options?: RequestOptions): APIPromise { - return this._client.post('/brand/ai/products', { body, ...options }); - } - - /** - * Use AI to extract specific data points from a brand's website. The AI will crawl - * the website and extract the requested information based on the provided data - * points. - */ - aiQuery(body: BrandAIQueryParams, options?: RequestOptions): APIPromise { - return this._client.post('/brand/ai/query', { body, ...options }); - } - - /** - * Extract font information from a brand's website including font families, usage - * statistics, fallbacks, and element/word counts. - */ - fonts(query: BrandFontsParams, options?: RequestOptions): APIPromise { - return this._client.get('/brand/fonts', { query, ...options }); - } - /** * Endpoint specially designed for platforms that want to identify transaction data * by the transaction title. @@ -59,31 +24,6 @@ export class Brand extends APIResource { return this._client.get('/brand/transaction_identifier', { query, ...options }); } - /** - * Signal that you may fetch brand data for a particular domain soon to improve - * latency. This endpoint does not charge credits and is available for paid - * customers to optimize future requests. [You must be on a paid plan to use this - * endpoint] - */ - prefetch(body: BrandPrefetchParams, options?: RequestOptions): APIPromise { - return this._client.post('/brand/prefetch', { body, ...options }); - } - - /** - * Signal that you may fetch brand data for a particular domain soon to improve - * latency. This endpoint accepts an email address, extracts the domain from it, - * validates that it's not a disposable or free email provider, and queues the - * domain for prefetching. This endpoint does not charge credits and is available - * for paid customers to optimize future requests. [You must be on a paid plan to - * use this endpoint] - */ - prefetchByEmail( - body: BrandPrefetchByEmailParams, - options?: RequestOptions, - ): APIPromise { - return this._client.post('/brand/prefetch-by-email', { body, ...options }); - } - /** * Retrieve brand information using an email address while detecting disposable and * free email addresses. This endpoint extracts the domain from the email address @@ -131,16 +71,6 @@ export class Brand extends APIResource { return this._client.get('/brand/retrieve-by-ticker', { query, ...options }); } - /** - * Endpoint to classify any brand into a 2022 NAICS code. - */ - retrieveNaics( - query: BrandRetrieveNaicsParams, - options?: RequestOptions, - ): APIPromise { - return this._client.get('/brand/naics', { query, ...options }); - } - /** * Returns a simplified version of brand data containing only essential * information: domain, title, colors, logos, and backdrops. This endpoint is @@ -152,29 +82,6 @@ export class Brand extends APIResource { ): APIPromise { return this._client.get('/brand/retrieve-simplified', { query, ...options }); } - - /** - * Capture a screenshot of a website. Supports both viewport (standard browser - * view) and full-page screenshots. Can also screenshot specific page types (login, - * pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to - * the uploaded screenshot image hosted on our CDN. - */ - screenshot(query: BrandScreenshotParams, options?: RequestOptions): APIPromise { - return this._client.get('/brand/screenshot', { query, ...options }); - } - - /** - * Automatically extract comprehensive design system information from a brand's - * website including colors, typography, spacing, shadows, and UI components. - * Either 'domain' or 'directUrl' must be provided as a query parameter, but not - * both. - */ - styleguide( - query: BrandStyleguideParams | null | undefined = {}, - options?: RequestOptions, - ): APIPromise { - return this._client.get('/brand/styleguide', { query, ...options }); - } } export interface BrandRetrieveResponse { @@ -776,269 +683,6 @@ export namespace BrandRetrieveResponse { } } -export interface BrandAIProductResponse { - /** - * Whether the given URL is a product detail page - */ - is_product_page?: boolean; - - /** - * The detected ecommerce platform, or null if not a product page - */ - platform?: 'amazon' | 'tiktok_shop' | 'etsy' | 'generic' | null; - - /** - * The extracted product data, or null if not a product page - */ - product?: BrandAIProductResponse.Product | null; -} - -export namespace BrandAIProductResponse { - /** - * The extracted product data, or null if not a product page - */ - export interface Product { - /** - * Description of the product - */ - description: string; - - /** - * List of product features - */ - features: Array; - - /** - * URLs to product images on the page (up to 7) - */ - images: Array; - - /** - * Name of the product - */ - name: string; - - /** - * Tags associated with the product - */ - tags: Array; - - /** - * Target audience for the product (array of strings) - */ - target_audience: Array; - - /** - * Billing frequency for the product - */ - billing_frequency?: 'monthly' | 'yearly' | 'one_time' | 'usage_based' | null; - - /** - * Category of the product - */ - category?: string | null; - - /** - * Currency code for the price (e.g., USD, EUR) - */ - currency?: string | null; - - /** - * URL to the product image - */ - image_url?: string | null; - - /** - * Price of the product - */ - price?: number | null; - - /** - * Pricing model for the product - */ - pricing_model?: 'per_seat' | 'flat' | 'tiered' | 'freemium' | 'custom' | null; - - /** - * URL to the product page - */ - url?: string | null; - } -} - -export interface BrandAIProductsResponse { - /** - * Array of products extracted from the website - */ - products?: Array; -} - -export namespace BrandAIProductsResponse { - export interface Product { - /** - * Description of the product - */ - description: string; - - /** - * List of product features - */ - features: Array; - - /** - * URLs to product images on the page (up to 7) - */ - images: Array; - - /** - * Name of the product - */ - name: string; - - /** - * Tags associated with the product - */ - tags: Array; - - /** - * Target audience for the product (array of strings) - */ - target_audience: Array; - - /** - * Billing frequency for the product - */ - billing_frequency?: 'monthly' | 'yearly' | 'one_time' | 'usage_based' | null; - - /** - * Category of the product - */ - category?: string | null; - - /** - * Currency code for the price (e.g., USD, EUR) - */ - currency?: string | null; - - /** - * URL to the product image - */ - image_url?: string | null; - - /** - * Price of the product - */ - price?: number | null; - - /** - * Pricing model for the product - */ - pricing_model?: 'per_seat' | 'flat' | 'tiered' | 'freemium' | 'custom' | null; - - /** - * URL to the product page - */ - url?: string | null; - } -} - -export interface BrandAIQueryResponse { - /** - * Array of extracted data points - */ - data_extracted?: Array; - - /** - * The domain that was analyzed - */ - domain?: string; - - /** - * Status of the response, e.g., 'ok' - */ - status?: string; - - /** - * List of URLs that were analyzed - */ - urls_analyzed?: Array; -} - -export namespace BrandAIQueryResponse { - export interface DataExtracted { - /** - * Name of the extracted data point - */ - datapoint_name?: string; - - /** - * Value of the extracted data point. Can be a primitive type, an array of - * primitives, or an array of objects when datapoint_list_type is 'object'. - */ - datapoint_value?: string | number | boolean | Array | Array | Array; - } -} - -export interface BrandFontsResponse { - /** - * HTTP status code, e.g., 200 - */ - code: number; - - /** - * The normalized domain that was processed - */ - domain: string; - - /** - * Array of font usage information - */ - fonts: Array; - - /** - * Status of the response, e.g., 'ok' - */ - status: string; -} - -export namespace BrandFontsResponse { - export interface Font { - /** - * Array of fallback font families - */ - fallbacks: Array; - - /** - * Font family name - */ - font: string; - - /** - * Number of elements using this font - */ - num_elements: number; - - /** - * Number of words using this font - */ - num_words: number; - - /** - * Percentage of elements using this font - */ - percent_elements: number; - - /** - * Percentage of words using this font - */ - percent_words: number; - - /** - * Array of CSS selectors or element types where this font is used - */ - uses: Array; - } -} - export interface BrandIdentifyFromTransactionResponse { /** * Detailed brand information @@ -1638,40 +1282,6 @@ export namespace BrandIdentifyFromTransactionResponse { } } -export interface BrandPrefetchResponse { - /** - * The domain that was queued for prefetching - */ - domain?: string; - - /** - * Success message - */ - message?: string; - - /** - * Status of the response, e.g., 'ok' - */ - status?: string; -} - -export interface BrandPrefetchByEmailResponse { - /** - * The domain that was queued for prefetching - */ - domain?: string; - - /** - * Success message - */ - message?: string; - - /** - * Status of the response, e.g., 'ok' - */ - status?: string; -} - export interface BrandRetrieveByEmailResponse { /** * Detailed brand information @@ -4068,47 +3678,6 @@ export namespace BrandRetrieveByTickerResponse { } } -export interface BrandRetrieveNaicsResponse { - /** - * Array of NAICS codes and titles. - */ - codes?: Array; - - /** - * Domain found for the brand - */ - domain?: string; - - /** - * Status of the response, e.g., 'ok' - */ - status?: string; - - /** - * Industry classification type, for naics api it will be `naics` - */ - type?: string; -} - -export namespace BrandRetrieveNaicsResponse { - export interface Code { - /** - * NAICS code - */ - code: string; - - /** - * Confidence level for how well this NAICS code matches the company description - */ - confidence: 'high' | 'medium' | 'low'; - - /** - * NAICS title - */ - name: string; - } -} - export interface BrandRetrieveSimplifiedResponse { /** * Simplified brand information @@ -4286,420 +3855,16 @@ export namespace BrandRetrieveSimplifiedResponse { } } -export interface BrandScreenshotResponse { +export interface BrandRetrieveParams { /** - * HTTP status code + * Domain name to retrieve brand data for (e.g., 'example.com', 'google.com'). + * Cannot be used with name or ticker parameters. */ - code?: number; + domain: string; /** - * The normalized domain that was processed - */ - domain?: string; - - /** - * Public URL of the uploaded screenshot image - */ - screenshot?: string; - - /** - * Type of screenshot that was captured - */ - screenshotType?: 'viewport' | 'fullPage'; - - /** - * Status of the response, e.g., 'ok' - */ - status?: string; -} - -export interface BrandStyleguideResponse { - /** - * HTTP status code - */ - code?: number; - - /** - * The normalized domain that was processed - */ - domain?: string; - - /** - * Status of the response, e.g., 'ok' - */ - status?: string; - - /** - * Comprehensive styleguide data extracted from the website - */ - styleguide?: BrandStyleguideResponse.Styleguide; -} - -export namespace BrandStyleguideResponse { - /** - * Comprehensive styleguide data extracted from the website - */ - export interface Styleguide { - /** - * Primary colors used on the website - */ - colors?: Styleguide.Colors; - - /** - * UI component styles - */ - components?: Styleguide.Components; - - /** - * Spacing system used on the website - */ - elementSpacing?: Styleguide.ElementSpacing; - - /** - * The primary color mode of the website design - */ - mode?: 'light' | 'dark'; - - /** - * Shadow styles used on the website - */ - shadows?: Styleguide.Shadows; - - /** - * Typography styles used on the website - */ - typography?: Styleguide.Typography; - } - - export namespace Styleguide { - /** - * Primary colors used on the website - */ - export interface Colors { - /** - * Accent color of the website (hex format) - */ - accent?: string; - - /** - * Background color of the website (hex format) - */ - background?: string; - - /** - * Text color of the website (hex format) - */ - text?: string; - } - - /** - * UI component styles - */ - export interface Components { - /** - * Button component styles - */ - button?: Components.Button; - - /** - * Card component style - */ - card?: Components.Card; - } - - export namespace Components { - /** - * Button component styles - */ - export interface Button { - /** - * Link button style - */ - link?: Button.Link; - - /** - * Primary button style - */ - primary?: Button.Primary; - - /** - * Secondary button style - */ - secondary?: Button.Secondary; - } - - export namespace Button { - /** - * Link button style - */ - export interface Link { - backgroundColor?: string; - - borderColor?: string; - - borderRadius?: string; - - borderStyle?: string; - - borderWidth?: string; - - boxShadow?: string; - - color?: string; - - fontSize?: string; - - fontWeight?: number; - - padding?: string; - - textDecoration?: string; - } - - /** - * Primary button style - */ - export interface Primary { - backgroundColor?: string; - - borderColor?: string; - - borderRadius?: string; - - borderStyle?: string; - - borderWidth?: string; - - boxShadow?: string; - - color?: string; - - fontSize?: string; - - fontWeight?: number; - - padding?: string; - - textDecoration?: string; - } - - /** - * Secondary button style - */ - export interface Secondary { - backgroundColor?: string; - - borderColor?: string; - - borderRadius?: string; - - borderStyle?: string; - - borderWidth?: string; - - boxShadow?: string; - - color?: string; - - fontSize?: string; - - fontWeight?: number; - - padding?: string; - - textDecoration?: string; - } - } - - /** - * Card component style - */ - export interface Card { - backgroundColor?: string; - - borderColor?: string; - - borderRadius?: string; - - borderStyle?: string; - - borderWidth?: string; - - boxShadow?: string; - - padding?: string; - - textColor?: string; - } - } - - /** - * Spacing system used on the website - */ - export interface ElementSpacing { - /** - * Large spacing value - */ - lg?: string; - - /** - * Medium spacing value - */ - md?: string; - - /** - * Small spacing value - */ - sm?: string; - - /** - * Extra large spacing value - */ - xl?: string; - - /** - * Extra small spacing value - */ - xs?: string; - } - - /** - * Shadow styles used on the website - */ - export interface Shadows { - /** - * Inner shadow value - */ - inner?: string; - - /** - * Large shadow value - */ - lg?: string; - - /** - * Medium shadow value - */ - md?: string; - - /** - * Small shadow value - */ - sm?: string; - - /** - * Extra large shadow value - */ - xl?: string; - } - - /** - * Typography styles used on the website - */ - export interface Typography { - /** - * Heading styles - */ - headings?: Typography.Headings; - - /** - * Paragraph text styles - */ - p?: Typography.P; - } - - export namespace Typography { - /** - * Heading styles - */ - export interface Headings { - h1?: Headings.H1; - - h2?: Headings.H2; - - h3?: Headings.H3; - - h4?: Headings.H4; - } - - export namespace Headings { - export interface H1 { - fontFamily?: string; - - fontSize?: string; - - fontWeight?: number; - - letterSpacing?: string; - - lineHeight?: string; - } - - export interface H2 { - fontFamily?: string; - - fontSize?: string; - - fontWeight?: number; - - letterSpacing?: string; - - lineHeight?: string; - } - - export interface H3 { - fontFamily?: string; - - fontSize?: string; - - fontWeight?: number; - - letterSpacing?: string; - - lineHeight?: string; - } - - export interface H4 { - fontFamily?: string; - - fontSize?: string; - - fontWeight?: number; - - letterSpacing?: string; - - lineHeight?: string; - } - } - - /** - * Paragraph text styles - */ - export interface P { - fontFamily?: string; - - fontSize?: string; - - fontWeight?: number; - - letterSpacing?: string; - - lineHeight?: string; - } - } - } -} - -export interface BrandRetrieveParams { - /** - * Domain name to retrieve brand data for (e.g., 'example.com', 'google.com'). - * Cannot be used with name or ticker parameters. - */ - domain: string; - - /** - * Optional parameter to force the language of the retrieved brand data. Works with - * all three lookup methods. + * Optional parameter to force the language of the retrieved brand data. Works with + * all three lookup methods. */ force_language?: | 'albanian' @@ -4773,185 +3938,6 @@ export interface BrandRetrieveParams { timeoutMS?: number; } -export interface BrandAIProductParams { - /** - * The product page URL to extract product data from. - */ - url: string; - - /** - * Optional timeout in milliseconds for the request. Maximum allowed value is - * 300000ms (5 minutes). - */ - timeoutMS?: number; -} - -export type BrandAIProductsParams = BrandAIProductsParams.ByDomain | BrandAIProductsParams.ByDirectURL; - -export declare namespace BrandAIProductsParams { - export interface ByDomain { - /** - * The domain name to analyze. - */ - domain: string; - - /** - * Maximum number of products to extract. - */ - maxProducts?: number; - - /** - * Optional timeout in milliseconds for the request. Maximum allowed value is - * 300000ms (5 minutes). - */ - timeoutMS?: number; - } - - export interface ByDirectURL { - /** - * A specific URL to use directly as the starting point for extraction without - * domain resolution. - */ - directUrl: string; - - /** - * Maximum number of products to extract. - */ - maxProducts?: number; - - /** - * Optional timeout in milliseconds for the request. Maximum allowed value is - * 300000ms (5 minutes). - */ - timeoutMS?: number; - } -} - -export interface BrandAIQueryParams { - /** - * Array of data points to extract from the website - */ - data_to_extract: Array; - - /** - * The domain name to analyze - */ - domain: string; - - /** - * Optional object specifying which pages to analyze - */ - specific_pages?: BrandAIQueryParams.SpecificPages; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer - * than this value, it will be aborted with a 408 status code. Maximum allowed - * value is 300000ms (5 minutes). - */ - timeoutMS?: number; -} - -export namespace BrandAIQueryParams { - export interface DataToExtract { - /** - * Description of what to extract - */ - datapoint_description: string; - - /** - * Example of the expected value - */ - datapoint_example: string; - - /** - * Name of the data point to extract - */ - datapoint_name: string; - - /** - * Type of the data point - */ - datapoint_type: 'text' | 'number' | 'date' | 'boolean' | 'list' | 'url'; - - /** - * Type of items in the list when datapoint_type is 'list'. Defaults to 'string'. - * Use 'object' to extract an array of objects matching a schema. - */ - datapoint_list_type?: 'string' | 'text' | 'number' | 'date' | 'boolean' | 'list' | 'url' | 'object'; - - /** - * Schema definition for objects when datapoint_list_type is 'object'. Provide a - * map of field names to their scalar types. - */ - datapoint_object_schema?: { [key: string]: 'string' | 'number' | 'date' | 'boolean' }; - } - - /** - * Optional object specifying which pages to analyze - */ - export interface SpecificPages { - /** - * Whether to analyze the about us page - */ - about_us?: boolean; - - /** - * Whether to analyze the blog - */ - blog?: boolean; - - /** - * Whether to analyze the careers page - */ - careers?: boolean; - - /** - * Whether to analyze the contact us page - */ - contact_us?: boolean; - - /** - * Whether to analyze the FAQ page - */ - faq?: boolean; - - /** - * Whether to analyze the home page - */ - home_page?: boolean; - - /** - * Whether to analyze the pricing page - */ - pricing?: boolean; - - /** - * Whether to analyze the privacy policy page - */ - privacy_policy?: boolean; - - /** - * Whether to analyze the terms and conditions page - */ - terms_and_conditions?: boolean; - } -} - -export interface BrandFontsParams { - /** - * Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The - * domain will be automatically normalized and validated. - */ - domain: string; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer - * than this value, it will be aborted with a 408 status code. Maximum allowed - * value is 300000ms (5 minutes). - */ - timeoutMS?: number; -} - export interface BrandIdentifyFromTransactionParams { /** * Transaction information to identify the brand @@ -5301,36 +4287,6 @@ export interface BrandIdentifyFromTransactionParams { timeoutMS?: number; } -export interface BrandPrefetchParams { - /** - * Domain name to prefetch brand data for - */ - domain: string; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer - * than this value, it will be aborted with a 408 status code. Maximum allowed - * value is 300000ms (5 minutes). - */ - timeoutMS?: number; -} - -export interface BrandPrefetchByEmailParams { - /** - * Email address to prefetch brand data for. The domain will be extracted from the - * email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email - * addresses are not allowed. - */ - email: string; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer - * than this value, it will be aborted with a 408 status code. Maximum allowed - * value is 300000ms (5 minutes). - */ - timeoutMS?: number; -} - export interface BrandRetrieveByEmailParams { /** * Email address to retrieve brand data for (e.g., 'contact@example.com'). The @@ -5983,33 +4939,6 @@ export interface BrandRetrieveByTickerParams { timeoutMS?: number; } -export interface BrandRetrieveNaicsParams { - /** - * Brand domain or title to retrieve NAICS code for. If a valid domain is provided - * in `input`, it will be used for classification, otherwise, we will search for - * the brand using the provided title. - */ - input: string; - - /** - * Maximum number of NAICS codes to return. Must be between 1 and 10. Defaults - * to 5. - */ - maxResults?: number; - - /** - * Minimum number of NAICS codes to return. Must be at least 1. Defaults to 1. - */ - minResults?: number; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer - * than this value, it will be aborted with a 408 status code. Maximum allowed - * value is 300000ms (5 minutes). - */ - timeoutMS?: number; -} - export interface BrandRetrieveSimplifiedParams { /** * Domain name to retrieve simplified brand data for @@ -6024,98 +4953,21 @@ export interface BrandRetrieveSimplifiedParams { timeoutMS?: number; } -export interface BrandScreenshotParams { - /** - * Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The - * domain will be automatically normalized and validated. - */ - domain: string; - - /** - * Optional parameter to determine screenshot type. If 'true', takes a full page - * screenshot capturing all content. If 'false' or not provided, takes a viewport - * screenshot (standard browser view). - */ - fullScreenshot?: 'true' | 'false'; - - /** - * Optional parameter to specify which page type to screenshot. If provided, the - * system will scrape the domain's links and use heuristics to find the most - * appropriate URL for the specified page type (30 supported languages). If not - * provided, screenshots the main domain landing page. - */ - page?: 'login' | 'signup' | 'blog' | 'careers' | 'pricing' | 'terms' | 'privacy' | 'contact'; - - /** - * Optional parameter to prioritize screenshot capture. If 'speed', optimizes for - * faster capture with basic quality. If 'quality', optimizes for higher quality - * with longer wait times. Defaults to 'quality' if not provided. - */ - prioritize?: 'speed' | 'quality'; -} - -export interface BrandStyleguideParams { - /** - * A specific URL to fetch the styleguide from directly, bypassing domain - * resolution (e.g., 'https://example.com/design-system'). - */ - directUrl?: string; - - /** - * Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The - * domain will be automatically normalized and validated. - */ - domain?: string; - - /** - * Optional parameter to prioritize screenshot capture for styleguide extraction. - * If 'speed', optimizes for faster capture with basic quality. If 'quality', - * optimizes for higher quality with longer wait times. Defaults to 'quality' if - * not provided. - */ - prioritize?: 'speed' | 'quality'; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer - * than this value, it will be aborted with a 408 status code. Maximum allowed - * value is 300000ms (5 minutes). - */ - timeoutMS?: number; -} - export declare namespace Brand { export { type BrandRetrieveResponse as BrandRetrieveResponse, - type BrandAIProductResponse as BrandAIProductResponse, - type BrandAIProductsResponse as BrandAIProductsResponse, - type BrandAIQueryResponse as BrandAIQueryResponse, - type BrandFontsResponse as BrandFontsResponse, type BrandIdentifyFromTransactionResponse as BrandIdentifyFromTransactionResponse, - type BrandPrefetchResponse as BrandPrefetchResponse, - type BrandPrefetchByEmailResponse as BrandPrefetchByEmailResponse, type BrandRetrieveByEmailResponse as BrandRetrieveByEmailResponse, type BrandRetrieveByIsinResponse as BrandRetrieveByIsinResponse, type BrandRetrieveByNameResponse as BrandRetrieveByNameResponse, type BrandRetrieveByTickerResponse as BrandRetrieveByTickerResponse, - type BrandRetrieveNaicsResponse as BrandRetrieveNaicsResponse, type BrandRetrieveSimplifiedResponse as BrandRetrieveSimplifiedResponse, - type BrandScreenshotResponse as BrandScreenshotResponse, - type BrandStyleguideResponse as BrandStyleguideResponse, type BrandRetrieveParams as BrandRetrieveParams, - type BrandAIProductParams as BrandAIProductParams, - type BrandAIProductsParams as BrandAIProductsParams, - type BrandAIQueryParams as BrandAIQueryParams, - type BrandFontsParams as BrandFontsParams, type BrandIdentifyFromTransactionParams as BrandIdentifyFromTransactionParams, - type BrandPrefetchParams as BrandPrefetchParams, - type BrandPrefetchByEmailParams as BrandPrefetchByEmailParams, type BrandRetrieveByEmailParams as BrandRetrieveByEmailParams, type BrandRetrieveByIsinParams as BrandRetrieveByIsinParams, type BrandRetrieveByNameParams as BrandRetrieveByNameParams, type BrandRetrieveByTickerParams as BrandRetrieveByTickerParams, - type BrandRetrieveNaicsParams as BrandRetrieveNaicsParams, type BrandRetrieveSimplifiedParams as BrandRetrieveSimplifiedParams, - type BrandScreenshotParams as BrandScreenshotParams, - type BrandStyleguideParams as BrandStyleguideParams, }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index ad9fee0..8884bad 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -1,46 +1,54 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { + AI, + type AIAIQueryResponse, + type AIExtractProductResponse, + type AIExtractProductsResponse, + type AIAIQueryParams, + type AIExtractProductParams, + type AIExtractProductsParams, +} from './ai'; export { Brand, type BrandRetrieveResponse, - type BrandAIProductResponse, - type BrandAIProductsResponse, - type BrandAIQueryResponse, - type BrandFontsResponse, type BrandIdentifyFromTransactionResponse, - type BrandPrefetchResponse, - type BrandPrefetchByEmailResponse, type BrandRetrieveByEmailResponse, type BrandRetrieveByIsinResponse, type BrandRetrieveByNameResponse, type BrandRetrieveByTickerResponse, - type BrandRetrieveNaicsResponse, type BrandRetrieveSimplifiedResponse, - type BrandScreenshotResponse, - type BrandStyleguideResponse, type BrandRetrieveParams, - type BrandAIProductParams, - type BrandAIProductsParams, - type BrandAIQueryParams, - type BrandFontsParams, type BrandIdentifyFromTransactionParams, - type BrandPrefetchParams, - type BrandPrefetchByEmailParams, type BrandRetrieveByEmailParams, type BrandRetrieveByIsinParams, type BrandRetrieveByNameParams, type BrandRetrieveByTickerParams, - type BrandRetrieveNaicsParams, type BrandRetrieveSimplifiedParams, - type BrandScreenshotParams, - type BrandStyleguideParams, } from './brand'; +export { Industry, type IndustryRetrieveNaicsResponse, type IndustryRetrieveNaicsParams } from './industry'; +export { + Style, + type StyleExtractFontsResponse, + type StyleExtractStyleguideResponse, + type StyleExtractFontsParams, + type StyleExtractStyleguideParams, +} from './style'; +export { + Utility, + type UtilityPrefetchResponse, + type UtilityPrefetchByEmailResponse, + type UtilityPrefetchParams, + type UtilityPrefetchByEmailParams, +} from './utility'; export { Web, + type WebScreenshotResponse, type WebWebScrapeHTMLResponse, type WebWebScrapeImagesResponse, type WebWebScrapeMdResponse, type WebWebScrapeSitemapResponse, + type WebScreenshotParams, type WebWebScrapeHTMLParams, type WebWebScrapeImagesParams, type WebWebScrapeMdParams, diff --git a/src/resources/industry.ts b/src/resources/industry.ts new file mode 100644 index 0000000..6030456 --- /dev/null +++ b/src/resources/industry.ts @@ -0,0 +1,92 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../core/resource'; +import { APIPromise } from '../core/api-promise'; +import { RequestOptions } from '../internal/request-options'; + +export class Industry extends APIResource { + /** + * Endpoint to classify any brand into a 2022 NAICS code. + */ + retrieveNaics( + query: IndustryRetrieveNaicsParams, + options?: RequestOptions, + ): APIPromise { + return this._client.get('/brand/naics', { query, ...options }); + } +} + +export interface IndustryRetrieveNaicsResponse { + /** + * Array of NAICS codes and titles. + */ + codes?: Array; + + /** + * Domain found for the brand + */ + domain?: string; + + /** + * Status of the response, e.g., 'ok' + */ + status?: string; + + /** + * Industry classification type, for naics api it will be `naics` + */ + type?: string; +} + +export namespace IndustryRetrieveNaicsResponse { + export interface Code { + /** + * NAICS code + */ + code: string; + + /** + * Confidence level for how well this NAICS code matches the company description + */ + confidence: 'high' | 'medium' | 'low'; + + /** + * NAICS title + */ + name: string; + } +} + +export interface IndustryRetrieveNaicsParams { + /** + * Brand domain or title to retrieve NAICS code for. If a valid domain is provided + * in `input`, it will be used for classification, otherwise, we will search for + * the brand using the provided title. + */ + input: string; + + /** + * Maximum number of NAICS codes to return. Must be between 1 and 10. Defaults + * to 5. + */ + maxResults?: number; + + /** + * Minimum number of NAICS codes to return. Must be at least 1. Defaults to 1. + */ + minResults?: number; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer + * than this value, it will be aborted with a 408 status code. Maximum allowed + * value is 300000ms (5 minutes). + */ + timeoutMS?: number; +} + +export declare namespace Industry { + export { + type IndustryRetrieveNaicsResponse as IndustryRetrieveNaicsResponse, + type IndustryRetrieveNaicsParams as IndustryRetrieveNaicsParams, + }; +} diff --git a/src/resources/style.ts b/src/resources/style.ts new file mode 100644 index 0000000..2f6be6a --- /dev/null +++ b/src/resources/style.ts @@ -0,0 +1,522 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../core/resource'; +import { APIPromise } from '../core/api-promise'; +import { RequestOptions } from '../internal/request-options'; + +export class Style extends APIResource { + /** + * Extract font information from a brand's website including font families, usage + * statistics, fallbacks, and element/word counts. + */ + extractFonts( + query: StyleExtractFontsParams, + options?: RequestOptions, + ): APIPromise { + return this._client.get('/brand/fonts', { query, ...options }); + } + + /** + * Automatically extract comprehensive design system information from a brand's + * website including colors, typography, spacing, shadows, and UI components. + * Either 'domain' or 'directUrl' must be provided as a query parameter, but not + * both. + */ + extractStyleguide( + query: StyleExtractStyleguideParams | null | undefined = {}, + options?: RequestOptions, + ): APIPromise { + return this._client.get('/brand/styleguide', { query, ...options }); + } +} + +export interface StyleExtractFontsResponse { + /** + * HTTP status code, e.g., 200 + */ + code: number; + + /** + * The normalized domain that was processed + */ + domain: string; + + /** + * Array of font usage information + */ + fonts: Array; + + /** + * Status of the response, e.g., 'ok' + */ + status: string; +} + +export namespace StyleExtractFontsResponse { + export interface Font { + /** + * Array of fallback font families + */ + fallbacks: Array; + + /** + * Font family name + */ + font: string; + + /** + * Number of elements using this font + */ + num_elements: number; + + /** + * Number of words using this font + */ + num_words: number; + + /** + * Percentage of elements using this font + */ + percent_elements: number; + + /** + * Percentage of words using this font + */ + percent_words: number; + + /** + * Array of CSS selectors or element types where this font is used + */ + uses: Array; + } +} + +export interface StyleExtractStyleguideResponse { + /** + * HTTP status code + */ + code?: number; + + /** + * The normalized domain that was processed + */ + domain?: string; + + /** + * Status of the response, e.g., 'ok' + */ + status?: string; + + /** + * Comprehensive styleguide data extracted from the website + */ + styleguide?: StyleExtractStyleguideResponse.Styleguide; +} + +export namespace StyleExtractStyleguideResponse { + /** + * Comprehensive styleguide data extracted from the website + */ + export interface Styleguide { + /** + * Primary colors used on the website + */ + colors?: Styleguide.Colors; + + /** + * UI component styles + */ + components?: Styleguide.Components; + + /** + * Spacing system used on the website + */ + elementSpacing?: Styleguide.ElementSpacing; + + /** + * The primary color mode of the website design + */ + mode?: 'light' | 'dark'; + + /** + * Shadow styles used on the website + */ + shadows?: Styleguide.Shadows; + + /** + * Typography styles used on the website + */ + typography?: Styleguide.Typography; + } + + export namespace Styleguide { + /** + * Primary colors used on the website + */ + export interface Colors { + /** + * Accent color of the website (hex format) + */ + accent?: string; + + /** + * Background color of the website (hex format) + */ + background?: string; + + /** + * Text color of the website (hex format) + */ + text?: string; + } + + /** + * UI component styles + */ + export interface Components { + /** + * Button component styles + */ + button?: Components.Button; + + /** + * Card component style + */ + card?: Components.Card; + } + + export namespace Components { + /** + * Button component styles + */ + export interface Button { + /** + * Link button style + */ + link?: Button.Link; + + /** + * Primary button style + */ + primary?: Button.Primary; + + /** + * Secondary button style + */ + secondary?: Button.Secondary; + } + + export namespace Button { + /** + * Link button style + */ + export interface Link { + backgroundColor?: string; + + borderColor?: string; + + borderRadius?: string; + + borderStyle?: string; + + borderWidth?: string; + + boxShadow?: string; + + color?: string; + + fontSize?: string; + + fontWeight?: number; + + padding?: string; + + textDecoration?: string; + } + + /** + * Primary button style + */ + export interface Primary { + backgroundColor?: string; + + borderColor?: string; + + borderRadius?: string; + + borderStyle?: string; + + borderWidth?: string; + + boxShadow?: string; + + color?: string; + + fontSize?: string; + + fontWeight?: number; + + padding?: string; + + textDecoration?: string; + } + + /** + * Secondary button style + */ + export interface Secondary { + backgroundColor?: string; + + borderColor?: string; + + borderRadius?: string; + + borderStyle?: string; + + borderWidth?: string; + + boxShadow?: string; + + color?: string; + + fontSize?: string; + + fontWeight?: number; + + padding?: string; + + textDecoration?: string; + } + } + + /** + * Card component style + */ + export interface Card { + backgroundColor?: string; + + borderColor?: string; + + borderRadius?: string; + + borderStyle?: string; + + borderWidth?: string; + + boxShadow?: string; + + padding?: string; + + textColor?: string; + } + } + + /** + * Spacing system used on the website + */ + export interface ElementSpacing { + /** + * Large spacing value + */ + lg?: string; + + /** + * Medium spacing value + */ + md?: string; + + /** + * Small spacing value + */ + sm?: string; + + /** + * Extra large spacing value + */ + xl?: string; + + /** + * Extra small spacing value + */ + xs?: string; + } + + /** + * Shadow styles used on the website + */ + export interface Shadows { + /** + * Inner shadow value + */ + inner?: string; + + /** + * Large shadow value + */ + lg?: string; + + /** + * Medium shadow value + */ + md?: string; + + /** + * Small shadow value + */ + sm?: string; + + /** + * Extra large shadow value + */ + xl?: string; + } + + /** + * Typography styles used on the website + */ + export interface Typography { + /** + * Heading styles + */ + headings?: Typography.Headings; + + /** + * Paragraph text styles + */ + p?: Typography.P; + } + + export namespace Typography { + /** + * Heading styles + */ + export interface Headings { + h1?: Headings.H1; + + h2?: Headings.H2; + + h3?: Headings.H3; + + h4?: Headings.H4; + } + + export namespace Headings { + export interface H1 { + fontFamily?: string; + + fontSize?: string; + + fontWeight?: number; + + letterSpacing?: string; + + lineHeight?: string; + } + + export interface H2 { + fontFamily?: string; + + fontSize?: string; + + fontWeight?: number; + + letterSpacing?: string; + + lineHeight?: string; + } + + export interface H3 { + fontFamily?: string; + + fontSize?: string; + + fontWeight?: number; + + letterSpacing?: string; + + lineHeight?: string; + } + + export interface H4 { + fontFamily?: string; + + fontSize?: string; + + fontWeight?: number; + + letterSpacing?: string; + + lineHeight?: string; + } + } + + /** + * Paragraph text styles + */ + export interface P { + fontFamily?: string; + + fontSize?: string; + + fontWeight?: number; + + letterSpacing?: string; + + lineHeight?: string; + } + } + } +} + +export interface StyleExtractFontsParams { + /** + * Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The + * domain will be automatically normalized and validated. + */ + domain: string; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer + * than this value, it will be aborted with a 408 status code. Maximum allowed + * value is 300000ms (5 minutes). + */ + timeoutMS?: number; +} + +export interface StyleExtractStyleguideParams { + /** + * A specific URL to fetch the styleguide from directly, bypassing domain + * resolution (e.g., 'https://example.com/design-system'). + */ + directUrl?: string; + + /** + * Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The + * domain will be automatically normalized and validated. + */ + domain?: string; + + /** + * Optional parameter to prioritize screenshot capture for styleguide extraction. + * If 'speed', optimizes for faster capture with basic quality. If 'quality', + * optimizes for higher quality with longer wait times. Defaults to 'quality' if + * not provided. + */ + prioritize?: 'speed' | 'quality'; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer + * than this value, it will be aborted with a 408 status code. Maximum allowed + * value is 300000ms (5 minutes). + */ + timeoutMS?: number; +} + +export declare namespace Style { + export { + type StyleExtractFontsResponse as StyleExtractFontsResponse, + type StyleExtractStyleguideResponse as StyleExtractStyleguideResponse, + type StyleExtractFontsParams as StyleExtractFontsParams, + type StyleExtractStyleguideParams as StyleExtractStyleguideParams, + }; +} diff --git a/src/resources/utility.ts b/src/resources/utility.ts new file mode 100644 index 0000000..df9201d --- /dev/null +++ b/src/resources/utility.ts @@ -0,0 +1,105 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../core/resource'; +import { APIPromise } from '../core/api-promise'; +import { RequestOptions } from '../internal/request-options'; + +export class Utility extends APIResource { + /** + * Signal that you may fetch brand data for a particular domain soon to improve + * latency. This endpoint does not charge credits and is available for paid + * customers to optimize future requests. [You must be on a paid plan to use this + * endpoint] + */ + prefetch(body: UtilityPrefetchParams, options?: RequestOptions): APIPromise { + return this._client.post('/brand/prefetch', { body, ...options }); + } + + /** + * Signal that you may fetch brand data for a particular domain soon to improve + * latency. This endpoint accepts an email address, extracts the domain from it, + * validates that it's not a disposable or free email provider, and queues the + * domain for prefetching. This endpoint does not charge credits and is available + * for paid customers to optimize future requests. [You must be on a paid plan to + * use this endpoint] + */ + prefetchByEmail( + body: UtilityPrefetchByEmailParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/brand/prefetch-by-email', { body, ...options }); + } +} + +export interface UtilityPrefetchResponse { + /** + * The domain that was queued for prefetching + */ + domain?: string; + + /** + * Success message + */ + message?: string; + + /** + * Status of the response, e.g., 'ok' + */ + status?: string; +} + +export interface UtilityPrefetchByEmailResponse { + /** + * The domain that was queued for prefetching + */ + domain?: string; + + /** + * Success message + */ + message?: string; + + /** + * Status of the response, e.g., 'ok' + */ + status?: string; +} + +export interface UtilityPrefetchParams { + /** + * Domain name to prefetch brand data for + */ + domain: string; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer + * than this value, it will be aborted with a 408 status code. Maximum allowed + * value is 300000ms (5 minutes). + */ + timeoutMS?: number; +} + +export interface UtilityPrefetchByEmailParams { + /** + * Email address to prefetch brand data for. The domain will be extracted from the + * email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email + * addresses are not allowed. + */ + email: string; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer + * than this value, it will be aborted with a 408 status code. Maximum allowed + * value is 300000ms (5 minutes). + */ + timeoutMS?: number; +} + +export declare namespace Utility { + export { + type UtilityPrefetchResponse as UtilityPrefetchResponse, + type UtilityPrefetchByEmailResponse as UtilityPrefetchByEmailResponse, + type UtilityPrefetchParams as UtilityPrefetchParams, + type UtilityPrefetchByEmailParams as UtilityPrefetchByEmailParams, + }; +} diff --git a/src/resources/web.ts b/src/resources/web.ts index d859cdf..5e7520d 100644 --- a/src/resources/web.ts +++ b/src/resources/web.ts @@ -5,6 +5,16 @@ import { APIPromise } from '../core/api-promise'; import { RequestOptions } from '../internal/request-options'; export class Web extends APIResource { + /** + * Capture a screenshot of a website. Supports both viewport (standard browser + * view) and full-page screenshots. Can also screenshot specific page types (login, + * pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to + * the uploaded screenshot image hosted on our CDN. + */ + screenshot(query: WebScreenshotParams, options?: RequestOptions): APIPromise { + return this._client.get('/brand/screenshot', { query, ...options }); + } + /** * Scrapes the given URL and returns the raw HTML content of the page. Uses * automatic proxy escalation to handle blocked sites. @@ -50,6 +60,33 @@ export class Web extends APIResource { } } +export interface WebScreenshotResponse { + /** + * HTTP status code + */ + code?: number; + + /** + * The normalized domain that was processed + */ + domain?: string; + + /** + * Public URL of the uploaded screenshot image + */ + screenshot?: string; + + /** + * Type of screenshot that was captured + */ + screenshotType?: 'viewport' | 'fullPage'; + + /** + * Status of the response, e.g., 'ok' + */ + status?: string; +} + export interface WebWebScrapeHTMLResponse { /** * Raw HTML content of the page @@ -174,6 +211,36 @@ export namespace WebWebScrapeSitemapResponse { } } +export interface WebScreenshotParams { + /** + * Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The + * domain will be automatically normalized and validated. + */ + domain: string; + + /** + * Optional parameter to determine screenshot type. If 'true', takes a full page + * screenshot capturing all content. If 'false' or not provided, takes a viewport + * screenshot (standard browser view). + */ + fullScreenshot?: 'true' | 'false'; + + /** + * Optional parameter to specify which page type to screenshot. If provided, the + * system will scrape the domain's links and use heuristics to find the most + * appropriate URL for the specified page type (30 supported languages). If not + * provided, screenshots the main domain landing page. + */ + page?: 'login' | 'signup' | 'blog' | 'careers' | 'pricing' | 'terms' | 'privacy' | 'contact'; + + /** + * Optional parameter to prioritize screenshot capture. If 'speed', optimizes for + * faster capture with basic quality. If 'quality', optimizes for higher quality + * with longer wait times. Defaults to 'quality' if not provided. + */ + prioritize?: 'speed' | 'quality'; +} + export interface WebWebScrapeHTMLParams { /** * Full URL to scrape (must include http:// or https:// protocol) @@ -221,10 +288,12 @@ export interface WebWebScrapeSitemapParams { export declare namespace Web { export { + type WebScreenshotResponse as WebScreenshotResponse, type WebWebScrapeHTMLResponse as WebWebScrapeHTMLResponse, type WebWebScrapeImagesResponse as WebWebScrapeImagesResponse, type WebWebScrapeMdResponse as WebWebScrapeMdResponse, type WebWebScrapeSitemapResponse as WebWebScrapeSitemapResponse, + type WebScreenshotParams as WebScreenshotParams, type WebWebScrapeHTMLParams as WebWebScrapeHTMLParams, type WebWebScrapeImagesParams as WebWebScrapeImagesParams, type WebWebScrapeMdParams as WebWebScrapeMdParams, diff --git a/tests/api-resources/ai.test.ts b/tests/api-resources/ai.test.ts new file mode 100644 index 0000000..5d6ebf3 --- /dev/null +++ b/tests/api-resources/ai.test.ts @@ -0,0 +1,99 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import ContextDev from 'context.dev'; + +const client = new ContextDev({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource ai', () => { + // Mock server tests are disabled + test.skip('aiQuery: only required params', async () => { + const responsePromise = client.ai.aiQuery({ + data_to_extract: [ + { + datapoint_description: 'datapoint_description', + datapoint_example: 'datapoint_example', + datapoint_name: 'datapoint_name', + datapoint_type: 'text', + }, + ], + domain: 'domain', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('aiQuery: required and optional params', async () => { + const response = await client.ai.aiQuery({ + data_to_extract: [ + { + datapoint_description: 'datapoint_description', + datapoint_example: 'datapoint_example', + datapoint_name: 'datapoint_name', + datapoint_type: 'text', + datapoint_list_type: 'string', + datapoint_object_schema: { testimonial_text: 'string', testimonial_author: 'string' }, + }, + ], + domain: 'domain', + specific_pages: { + about_us: true, + blog: true, + careers: true, + contact_us: true, + faq: true, + home_page: true, + pricing: true, + privacy_policy: true, + terms_and_conditions: true, + }, + timeoutMS: 1000, + }); + }); + + // Mock server tests are disabled + test.skip('extractProduct: only required params', async () => { + const responsePromise = client.ai.extractProduct({ url: 'https://example.com' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('extractProduct: required and optional params', async () => { + const response = await client.ai.extractProduct({ url: 'https://example.com', timeoutMS: 1000 }); + }); + + // Mock server tests are disabled + test.skip('extractProducts: only required params', async () => { + const responsePromise = client.ai.extractProducts({ domain: 'domain' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('extractProducts: required and optional params', async () => { + const response = await client.ai.extractProducts({ + domain: 'domain', + maxProducts: 1, + timeoutMS: 1000, + }); + }); +}); diff --git a/tests/api-resources/brand.test.ts b/tests/api-resources/brand.test.ts index 6f56f04..aff119a 100644 --- a/tests/api-resources/brand.test.ts +++ b/tests/api-resources/brand.test.ts @@ -30,112 +30,6 @@ describe('resource brand', () => { }); }); - // Mock server tests are disabled - test.skip('aiProduct: only required params', async () => { - const responsePromise = client.brand.aiProduct({ url: 'https://example.com' }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // Mock server tests are disabled - test.skip('aiProduct: required and optional params', async () => { - const response = await client.brand.aiProduct({ url: 'https://example.com', timeoutMS: 1000 }); - }); - - // Mock server tests are disabled - test.skip('aiProducts: only required params', async () => { - const responsePromise = client.brand.aiProducts({ domain: 'domain' }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // Mock server tests are disabled - test.skip('aiProducts: required and optional params', async () => { - const response = await client.brand.aiProducts({ - domain: 'domain', - maxProducts: 1, - timeoutMS: 1000, - }); - }); - - // Mock server tests are disabled - test.skip('aiQuery: only required params', async () => { - const responsePromise = client.brand.aiQuery({ - data_to_extract: [ - { - datapoint_description: 'datapoint_description', - datapoint_example: 'datapoint_example', - datapoint_name: 'datapoint_name', - datapoint_type: 'text', - }, - ], - domain: 'domain', - }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // Mock server tests are disabled - test.skip('aiQuery: required and optional params', async () => { - const response = await client.brand.aiQuery({ - data_to_extract: [ - { - datapoint_description: 'datapoint_description', - datapoint_example: 'datapoint_example', - datapoint_name: 'datapoint_name', - datapoint_type: 'text', - datapoint_list_type: 'string', - datapoint_object_schema: { testimonial_text: 'string', testimonial_author: 'string' }, - }, - ], - domain: 'domain', - specific_pages: { - about_us: true, - blog: true, - careers: true, - contact_us: true, - faq: true, - home_page: true, - pricing: true, - privacy_policy: true, - terms_and_conditions: true, - }, - timeoutMS: 1000, - }); - }); - - // Mock server tests are disabled - test.skip('fonts: only required params', async () => { - const responsePromise = client.brand.fonts({ domain: 'domain' }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // Mock server tests are disabled - test.skip('fonts: required and optional params', async () => { - const response = await client.brand.fonts({ domain: 'domain', timeoutMS: 1000 }); - }); - // Mock server tests are disabled test.skip('identifyFromTransaction: only required params', async () => { const responsePromise = client.brand.identifyFromTransaction({ transaction_info: 'transaction_info' }); @@ -163,40 +57,6 @@ describe('resource brand', () => { }); }); - // Mock server tests are disabled - test.skip('prefetch: only required params', async () => { - const responsePromise = client.brand.prefetch({ domain: 'domain' }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // Mock server tests are disabled - test.skip('prefetch: required and optional params', async () => { - const response = await client.brand.prefetch({ domain: 'domain', timeoutMS: 1000 }); - }); - - // Mock server tests are disabled - test.skip('prefetchByEmail: only required params', async () => { - const responsePromise = client.brand.prefetchByEmail({ email: 'dev@stainless.com' }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // Mock server tests are disabled - test.skip('prefetchByEmail: required and optional params', async () => { - const response = await client.brand.prefetchByEmail({ email: 'dev@stainless.com', timeoutMS: 1000 }); - }); - // Mock server tests are disabled test.skip('retrieveByEmail: only required params', async () => { const responsePromise = client.brand.retrieveByEmail({ email: 'dev@stainless.com' }); @@ -287,28 +147,6 @@ describe('resource brand', () => { }); }); - // Mock server tests are disabled - test.skip('retrieveNaics: only required params', async () => { - const responsePromise = client.brand.retrieveNaics({ input: 'input' }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // Mock server tests are disabled - test.skip('retrieveNaics: required and optional params', async () => { - const response = await client.brand.retrieveNaics({ - input: 'input', - maxResults: 1, - minResults: 1, - timeoutMS: 1000, - }); - }); - // Mock server tests are disabled test.skip('retrieveSimplified: only required params', async () => { const responsePromise = client.brand.retrieveSimplified({ domain: 'domain' }); @@ -325,54 +163,4 @@ describe('resource brand', () => { test.skip('retrieveSimplified: required and optional params', async () => { const response = await client.brand.retrieveSimplified({ domain: 'domain', timeoutMS: 1000 }); }); - - // Mock server tests are disabled - test.skip('screenshot: only required params', async () => { - const responsePromise = client.brand.screenshot({ domain: 'domain' }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // Mock server tests are disabled - test.skip('screenshot: required and optional params', async () => { - const response = await client.brand.screenshot({ - domain: 'domain', - fullScreenshot: 'true', - page: 'login', - prioritize: 'speed', - }); - }); - - // Mock server tests are disabled - test.skip('styleguide', async () => { - const responsePromise = client.brand.styleguide(); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // Mock server tests are disabled - test.skip('styleguide: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.brand.styleguide( - { - directUrl: 'https://example.com', - domain: 'domain', - prioritize: 'speed', - timeoutMS: 1000, - }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(ContextDev.NotFoundError); - }); }); diff --git a/tests/api-resources/industry.test.ts b/tests/api-resources/industry.test.ts new file mode 100644 index 0000000..5927bea --- /dev/null +++ b/tests/api-resources/industry.test.ts @@ -0,0 +1,32 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import ContextDev from 'context.dev'; + +const client = new ContextDev({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource industry', () => { + // Mock server tests are disabled + test.skip('retrieveNaics: only required params', async () => { + const responsePromise = client.industry.retrieveNaics({ input: 'input' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('retrieveNaics: required and optional params', async () => { + const response = await client.industry.retrieveNaics({ + input: 'input', + maxResults: 1, + minResults: 1, + timeoutMS: 1000, + }); + }); +}); diff --git a/tests/api-resources/style.test.ts b/tests/api-resources/style.test.ts new file mode 100644 index 0000000..16f9da3 --- /dev/null +++ b/tests/api-resources/style.test.ts @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import ContextDev from 'context.dev'; + +const client = new ContextDev({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource style', () => { + // Mock server tests are disabled + test.skip('extractFonts: only required params', async () => { + const responsePromise = client.style.extractFonts({ domain: 'domain' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('extractFonts: required and optional params', async () => { + const response = await client.style.extractFonts({ domain: 'domain', timeoutMS: 1000 }); + }); + + // Mock server tests are disabled + test.skip('extractStyleguide', async () => { + const responsePromise = client.style.extractStyleguide(); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('extractStyleguide: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.style.extractStyleguide( + { + directUrl: 'https://example.com', + domain: 'domain', + prioritize: 'speed', + timeoutMS: 1000, + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(ContextDev.NotFoundError); + }); +}); diff --git a/tests/api-resources/utility.test.ts b/tests/api-resources/utility.test.ts new file mode 100644 index 0000000..4782170 --- /dev/null +++ b/tests/api-resources/utility.test.ts @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import ContextDev from 'context.dev'; + +const client = new ContextDev({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource utility', () => { + // Mock server tests are disabled + test.skip('prefetch: only required params', async () => { + const responsePromise = client.utility.prefetch({ domain: 'domain' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('prefetch: required and optional params', async () => { + const response = await client.utility.prefetch({ domain: 'domain', timeoutMS: 1000 }); + }); + + // Mock server tests are disabled + test.skip('prefetchByEmail: only required params', async () => { + const responsePromise = client.utility.prefetchByEmail({ email: 'dev@stainless.com' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('prefetchByEmail: required and optional params', async () => { + const response = await client.utility.prefetchByEmail({ email: 'dev@stainless.com', timeoutMS: 1000 }); + }); +}); diff --git a/tests/api-resources/web.test.ts b/tests/api-resources/web.test.ts index 2e3f11d..495ea12 100644 --- a/tests/api-resources/web.test.ts +++ b/tests/api-resources/web.test.ts @@ -8,6 +8,28 @@ const client = new ContextDev({ }); describe('resource web', () => { + // Mock server tests are disabled + test.skip('screenshot: only required params', async () => { + const responsePromise = client.web.screenshot({ domain: 'domain' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Mock server tests are disabled + test.skip('screenshot: required and optional params', async () => { + const response = await client.web.screenshot({ + domain: 'domain', + fullScreenshot: 'true', + page: 'login', + prioritize: 'speed', + }); + }); + // Mock server tests are disabled test.skip('webScrapeHTML: only required params', async () => { const responsePromise = client.web.webScrapeHTML({ url: 'https://example.com' }); From 7923dfebfc26b071764c21b5948cf7595c35c3da Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Mar 2026 20:31:32 +0000 Subject: [PATCH 4/4] release: 0.3.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- packages/mcp-server/manifest.json | 2 +- packages/mcp-server/package.json | 2 +- packages/mcp-server/src/server.ts | 2 +- src/version.ts | 2 +- 7 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2be9c43..0ee8c01 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.2.0" + ".": "0.3.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 41fe81f..cb9ed38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 0.3.0 (2026-03-18) + +Full Changelog: [v0.2.0...v0.3.0](https://github.com/brand-dot-dev/context-typescript-sdk/compare/v0.2.0...v0.3.0) + +### Features + +* **api:** api update ([dc135a5](https://github.com/brand-dot-dev/context-typescript-sdk/commit/dc135a5c4a01de856d7ee19efa958af62ff4e132)) +* **api:** manual updates ([7cb981d](https://github.com/brand-dot-dev/context-typescript-sdk/commit/7cb981dbb19152fc272b33b119a7099410e48c50)) +* **api:** manual updates ([6f77533](https://github.com/brand-dot-dev/context-typescript-sdk/commit/6f77533b4bdf4ca48092d378f883d01f8142a779)) + ## 0.2.0 (2026-03-18) Full Changelog: [v0.1.0...v0.2.0](https://github.com/brand-dot-dev/context-typescript-sdk/compare/v0.1.0...v0.2.0) diff --git a/package.json b/package.json index 3c85128..05d5de0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "context.dev", - "version": "0.2.0", + "version": "0.3.0", "description": "The official TypeScript library for the Context Dev API", "author": "Context Dev ", "types": "dist/index.d.ts", diff --git a/packages/mcp-server/manifest.json b/packages/mcp-server/manifest.json index bc1e614..2a689ae 100644 --- a/packages/mcp-server/manifest.json +++ b/packages/mcp-server/manifest.json @@ -1,7 +1,7 @@ { "dxt_version": "0.2", "name": "context.dev-mcp", - "version": "0.2.0", + "version": "0.3.0", "description": "The official MCP Server for the Context Dev API", "author": { "name": "Context Dev", diff --git a/packages/mcp-server/package.json b/packages/mcp-server/package.json index 61c034a..be61359 100644 --- a/packages/mcp-server/package.json +++ b/packages/mcp-server/package.json @@ -1,6 +1,6 @@ { "name": "context.dev-mcp", - "version": "0.2.0", + "version": "0.3.0", "description": "The official MCP Server for the Context Dev API", "author": "Context Dev ", "types": "dist/index.d.ts", diff --git a/packages/mcp-server/src/server.ts b/packages/mcp-server/src/server.ts index a9749e3..cd2c30e 100644 --- a/packages/mcp-server/src/server.ts +++ b/packages/mcp-server/src/server.ts @@ -20,7 +20,7 @@ export const newMcpServer = async (stainlessApiKey: string | undefined) => new McpServer( { name: 'context_dev_api', - version: '0.2.0', + version: '0.3.0', }, { instructions: await getInstructions(stainlessApiKey), diff --git a/src/version.ts b/src/version.ts index bade2ff..88f4d40 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.2.0'; // x-release-please-version +export const VERSION = '0.3.0'; // x-release-please-version