context.dev-mcp 0.3.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs-search-tool.d.mts +2 -0
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts +2 -0
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.js +35 -4
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +34 -4
- package/docs-search-tool.mjs.map +1 -1
- package/http.d.mts.map +1 -1
- package/http.d.ts.map +1 -1
- package/http.js +2 -1
- package/http.js.map +1 -1
- package/http.mjs +2 -1
- package/http.mjs.map +1 -1
- package/instructions.d.mts +4 -1
- package/instructions.d.mts.map +1 -1
- package/instructions.d.ts +4 -1
- package/instructions.d.ts.map +1 -1
- package/instructions.js +23 -4
- package/instructions.js.map +1 -1
- package/instructions.mjs +20 -4
- package/instructions.mjs.map +1 -1
- package/local-docs-search.d.mts +28 -0
- package/local-docs-search.d.mts.map +1 -0
- package/local-docs-search.d.ts +28 -0
- package/local-docs-search.d.ts.map +1 -0
- package/local-docs-search.js +544 -0
- package/local-docs-search.js.map +1 -0
- package/local-docs-search.mjs +504 -0
- package/local-docs-search.mjs.map +1 -0
- package/options.d.mts +3 -0
- package/options.d.mts.map +1 -1
- package/options.d.ts +3 -0
- package/options.d.ts.map +1 -1
- package/options.js +19 -0
- package/options.js.map +1 -1
- package/options.mjs +19 -0
- package/options.mjs.map +1 -1
- package/package.json +15 -4
- package/server.d.mts +4 -1
- package/server.d.mts.map +1 -1
- package/server.d.ts +4 -1
- package/server.d.ts.map +1 -1
- package/server.js +10 -3
- package/server.js.map +1 -1
- package/server.mjs +10 -3
- package/server.mjs.map +1 -1
- package/src/docs-search-tool.ts +56 -10
- package/src/http.ts +2 -1
- package/src/instructions.ts +27 -4
- package/src/local-docs-search.ts +614 -0
- package/src/options.ts +24 -0
- package/src/server.ts +17 -3
- package/src/stdio.ts +4 -1
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts.map +1 -1
- package/stdio.js +4 -1
- package/stdio.js.map +1 -1
- package/stdio.mjs +4 -1
- package/stdio.mjs.map +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-docs-search.js","sourceRoot":"","sources":["src/local-docs-search.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,4DAAoC;AACpC,qDAAuC;AACvC,gDAAkC;AAClC,wCAAqC;AAwCrC,MAAM,gBAAgB,GAAkB;IACtC;QACE,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,mBAAmB;QAC7B,UAAU,EAAE,KAAK;QACjB,OAAO,EAAE,4BAA4B;QACrC,WAAW,EACT,gSAAgS;QAClS,aAAa,EAAE,sCAAsC;QACrD,SAAS,EAAE,uBAAuB;QAClC,MAAM,EAAE;YACN,iBAAiB;YACjB,oCAAoC;YACpC,+FAA+F;YAC/F,mCAAmC;SACpC;QACD,QAAQ,EACN,qHAAqH;QACvH,QAAQ,EACN,+pEAA+pE;KAClqE;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,kBAAkB;QAC5B,UAAU,EAAE,KAAK;QACjB,OAAO,EAAE,4BAA4B;QACrC,WAAW,EAAE,qEAAqE;QAClF,aAAa,EAAE,2CAA2C;QAC1D,SAAS,EAAE,0BAA0B;QACrC,MAAM,EAAE,CAAC,cAAc,CAAC;QACxB,QAAQ,EAAE,+CAA+C;QACzD,QAAQ,EACN,0pBAA0pB;KAC7pB;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,oBAAoB;QAC9B,UAAU,EAAE,KAAK;QACjB,OAAO,EAAE,0BAA0B;QACnC,WAAW,EACT,4KAA4K;QAC9K,aAAa,EAAE,6CAA6C;QAC5D,SAAS,EAAE,4BAA4B;QACvC,MAAM,EAAE,CAAC,cAAc,CAAC;QACxB,QAAQ,EACN,4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. See CONTRIBUTING.md for details.
|
|
2
|
+
import MiniSearch from 'minisearch';
|
|
3
|
+
import * as fs from 'node:fs/promises';
|
|
4
|
+
import * as path from 'node:path';
|
|
5
|
+
import { getLogger } from "./logger.mjs";
|
|
6
|
+
const EMBEDDED_METHODS = [
|
|
7
|
+
{
|
|
8
|
+
name: 'screenshot',
|
|
9
|
+
endpoint: '/brand/screenshot',
|
|
10
|
+
httpMethod: 'get',
|
|
11
|
+
summary: 'Take screenshot of website',
|
|
12
|
+
description: '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.',
|
|
13
|
+
stainlessPath: '(resource) web > (method) screenshot',
|
|
14
|
+
qualified: 'client.web.screenshot',
|
|
15
|
+
params: [
|
|
16
|
+
'domain: string;',
|
|
17
|
+
"fullScreenshot?: 'true' | 'false';",
|
|
18
|
+
"page?: 'login' | 'signup' | 'blog' | 'careers' | 'pricing' | 'terms' | 'privacy' | 'contact';",
|
|
19
|
+
"prioritize?: 'speed' | 'quality';",
|
|
20
|
+
],
|
|
21
|
+
response: "{ code?: number; domain?: string; screenshot?: string; screenshotType?: 'viewport' | 'fullPage'; status?: string; }",
|
|
22
|
+
markdown: "## screenshot\n\n`client.web.screenshot(domain: string, fullScreenshot?: 'true' | 'false', page?: 'login' | 'signup' | 'blog' | 'careers' | 'pricing' | 'terms' | 'privacy' | 'contact', prioritize?: 'speed' | 'quality'): { code?: number; domain?: string; screenshot?: string; screenshotType?: 'viewport' | 'fullPage'; status?: string; }`\n\n**get** `/brand/screenshot`\n\nCapture 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.\n\n### Parameters\n\n- `domain: string`\n Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated.\n\n- `fullScreenshot?: 'true' | 'false'`\n 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).\n\n- `page?: 'login' | 'signup' | 'blog' | 'careers' | 'pricing' | 'terms' | 'privacy' | 'contact'`\n 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.\n\n- `prioritize?: 'speed' | 'quality'`\n 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.\n\n### Returns\n\n- `{ code?: number; domain?: string; screenshot?: string; screenshotType?: 'viewport' | 'fullPage'; status?: string; }`\n\n - `code?: number`\n - `domain?: string`\n - `screenshot?: string`\n - `screenshotType?: 'viewport' | 'fullPage'`\n - `status?: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.web.screenshot({ domain: 'domain' });\n\nconsole.log(response);\n```",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'web_scrape_html',
|
|
26
|
+
endpoint: '/web/scrape/html',
|
|
27
|
+
httpMethod: 'get',
|
|
28
|
+
summary: 'Scrape raw HTML from a URL',
|
|
29
|
+
description: 'Scrapes the given URL and returns the raw HTML content of the page.',
|
|
30
|
+
stainlessPath: '(resource) web > (method) web_scrape_html',
|
|
31
|
+
qualified: 'client.web.webScrapeHTML',
|
|
32
|
+
params: ['url: string;'],
|
|
33
|
+
response: '{ html: string; success: true; url: string; }',
|
|
34
|
+
markdown: "## web_scrape_html\n\n`client.web.webScrapeHTML(url: string): { html: string; success: true; url: string; }`\n\n**get** `/web/scrape/html`\n\nScrapes the given URL and returns the raw HTML content of the page.\n\n### Parameters\n\n- `url: string`\n Full URL to scrape (must include http:// or https:// protocol)\n\n### Returns\n\n- `{ html: string; success: true; url: string; }`\n\n - `html: string`\n - `success: true`\n - `url: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.web.webScrapeHTML({ url: 'https://example.com' });\n\nconsole.log(response);\n```",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'web_scrape_images',
|
|
38
|
+
endpoint: '/web/scrape/images',
|
|
39
|
+
httpMethod: 'get',
|
|
40
|
+
summary: 'Scrape images from a URL',
|
|
41
|
+
description: '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.',
|
|
42
|
+
stainlessPath: '(resource) web > (method) web_scrape_images',
|
|
43
|
+
qualified: 'client.web.webScrapeImages',
|
|
44
|
+
params: ['url: string;'],
|
|
45
|
+
response: "{ images: { alt: string; element: 'img' | 'svg' | 'link' | 'source' | 'video' | 'css' | 'object' | 'meta' | 'background'; src: string; type: 'url' | 'html' | 'base64'; }[]; success: true; url: string; }",
|
|
46
|
+
markdown: "## web_scrape_images\n\n`client.web.webScrapeImages(url: string): { images: object[]; success: true; url: string; }`\n\n**get** `/web/scrape/images`\n\nScrapes 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.\n\n### Parameters\n\n- `url: string`\n Full URL to scrape images from (must include http:// or https:// protocol)\n\n### Returns\n\n- `{ images: { alt: string; element: 'img' | 'svg' | 'link' | 'source' | 'video' | 'css' | 'object' | 'meta' | 'background'; src: string; type: 'url' | 'html' | 'base64'; }[]; success: true; url: string; }`\n\n - `images: { alt: string; element: 'img' | 'svg' | 'link' | 'source' | 'video' | 'css' | 'object' | 'meta' | 'background'; src: string; type: 'url' | 'html' | 'base64'; }[]`\n - `success: true`\n - `url: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.web.webScrapeImages({ url: 'https://example.com' });\n\nconsole.log(response);\n```",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'web_scrape_md',
|
|
50
|
+
endpoint: '/web/scrape/markdown',
|
|
51
|
+
httpMethod: 'get',
|
|
52
|
+
summary: 'Scrape URL and convert to Markdown',
|
|
53
|
+
description: 'Scrapes the given URL, converts the HTML content to Markdown, and returns the result.',
|
|
54
|
+
stainlessPath: '(resource) web > (method) web_scrape_md',
|
|
55
|
+
qualified: 'client.web.webScrapeMd',
|
|
56
|
+
params: [
|
|
57
|
+
'url: string;',
|
|
58
|
+
'includeImages?: boolean;',
|
|
59
|
+
'includeLinks?: boolean;',
|
|
60
|
+
'shortenBase64Images?: boolean;',
|
|
61
|
+
'useMainContentOnly?: boolean;',
|
|
62
|
+
],
|
|
63
|
+
response: '{ markdown: string; success: true; url: string; }',
|
|
64
|
+
markdown: "## web_scrape_md\n\n`client.web.webScrapeMd(url: string, includeImages?: boolean, includeLinks?: boolean, shortenBase64Images?: boolean, useMainContentOnly?: boolean): { markdown: string; success: true; url: string; }`\n\n**get** `/web/scrape/markdown`\n\nScrapes the given URL, converts the HTML content to Markdown, and returns the result.\n\n### Parameters\n\n- `url: string`\n Full URL to scrape and convert to markdown (must include http:// or https:// protocol)\n\n- `includeImages?: boolean`\n Include image references in Markdown output\n\n- `includeLinks?: boolean`\n Preserve hyperlinks in Markdown output\n\n- `shortenBase64Images?: boolean`\n Shorten base64-encoded image data in the Markdown output\n\n- `useMainContentOnly?: boolean`\n Extract only the main content of the page, excluding headers, footers, sidebars, and navigation\n\n### Returns\n\n- `{ markdown: string; success: true; url: string; }`\n\n - `markdown: string`\n - `success: true`\n - `url: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.web.webScrapeMd({ url: 'https://example.com' });\n\nconsole.log(response);\n```",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'web_scrape_sitemap',
|
|
68
|
+
endpoint: '/web/scrape/sitemap',
|
|
69
|
+
httpMethod: 'get',
|
|
70
|
+
summary: 'Crawl website sitemap',
|
|
71
|
+
description: '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.).',
|
|
72
|
+
stainlessPath: '(resource) web > (method) web_scrape_sitemap',
|
|
73
|
+
qualified: 'client.web.webScrapeSitemap',
|
|
74
|
+
params: ['domain: string;', 'maxLinks?: number;'],
|
|
75
|
+
response: '{ domain: string; meta: { errors: number; sitemapsDiscovered: number; sitemapsFetched: number; sitemapsSkipped: number; }; success: true; urls: string[]; }',
|
|
76
|
+
markdown: "## web_scrape_sitemap\n\n`client.web.webScrapeSitemap(domain: string, maxLinks?: number): { domain: string; meta: object; success: true; urls: string[]; }`\n\n**get** `/web/scrape/sitemap`\n\nCrawls 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.).\n\n### Parameters\n\n- `domain: string`\n Domain name to crawl sitemaps for (e.g., 'example.com'). The domain will be automatically normalized and validated.\n\n- `maxLinks?: number`\n Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Minimum is 1, maximum is 100,000.\n\n### Returns\n\n- `{ domain: string; meta: { errors: number; sitemapsDiscovered: number; sitemapsFetched: number; sitemapsSkipped: number; }; success: true; urls: string[]; }`\n\n - `domain: string`\n - `meta: { errors: number; sitemapsDiscovered: number; sitemapsFetched: number; sitemapsSkipped: number; }`\n - `success: true`\n - `urls: string[]`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.web.webScrapeSitemap({ domain: 'domain' });\n\nconsole.log(response);\n```",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'ai_query',
|
|
80
|
+
endpoint: '/brand/ai/query',
|
|
81
|
+
httpMethod: 'post',
|
|
82
|
+
summary: 'Query website data using AI',
|
|
83
|
+
description: "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.",
|
|
84
|
+
stainlessPath: '(resource) ai > (method) ai_query',
|
|
85
|
+
qualified: 'client.ai.aiQuery',
|
|
86
|
+
params: [
|
|
87
|
+
"data_to_extract: { datapoint_description: string; datapoint_example: string; datapoint_name: string; datapoint_type: 'text' | 'number' | 'date' | 'boolean' | 'list' | 'url'; datapoint_list_type?: 'string' | 'text' | 'number' | 'date' | 'boolean' | 'list' | 'url' | 'object'; datapoint_object_schema?: object; }[];",
|
|
88
|
+
'domain: string;',
|
|
89
|
+
'specific_pages?: { about_us?: boolean; blog?: boolean; careers?: boolean; contact_us?: boolean; faq?: boolean; home_page?: boolean; pricing?: boolean; privacy_policy?: boolean; terms_and_conditions?: boolean; };',
|
|
90
|
+
'timeoutMS?: number;',
|
|
91
|
+
],
|
|
92
|
+
response: '{ data_extracted?: { datapoint_name?: string; datapoint_value?: string | number | boolean | string[] | number[] | object[]; }[]; domain?: string; status?: string; urls_analyzed?: string[]; }',
|
|
93
|
+
markdown: "## ai_query\n\n`client.ai.aiQuery(data_to_extract: { datapoint_description: string; datapoint_example: string; datapoint_name: string; datapoint_type: 'text' | 'number' | 'date' | 'boolean' | 'list' | 'url'; datapoint_list_type?: 'string' | 'text' | 'number' | 'date' | 'boolean' | 'list' | 'url' | 'object'; datapoint_object_schema?: object; }[], domain: string, specific_pages?: { about_us?: boolean; blog?: boolean; careers?: boolean; contact_us?: boolean; faq?: boolean; home_page?: boolean; pricing?: boolean; privacy_policy?: boolean; terms_and_conditions?: boolean; }, timeoutMS?: number): { data_extracted?: object[]; domain?: string; status?: string; urls_analyzed?: string[]; }`\n\n**post** `/brand/ai/query`\n\nUse 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.\n\n### Parameters\n\n- `data_to_extract: { datapoint_description: string; datapoint_example: string; datapoint_name: string; datapoint_type: 'text' | 'number' | 'date' | 'boolean' | 'list' | 'url'; datapoint_list_type?: 'string' | 'text' | 'number' | 'date' | 'boolean' | 'list' | 'url' | 'object'; datapoint_object_schema?: object; }[]`\n Array of data points to extract from the website\n\n- `domain: string`\n The domain name to analyze\n\n- `specific_pages?: { about_us?: boolean; blog?: boolean; careers?: boolean; contact_us?: boolean; faq?: boolean; home_page?: boolean; pricing?: boolean; privacy_policy?: boolean; terms_and_conditions?: boolean; }`\n Optional object specifying which pages to analyze\n - `about_us?: boolean`\n Whether to analyze the about us page\n - `blog?: boolean`\n Whether to analyze the blog\n - `careers?: boolean`\n Whether to analyze the careers page\n - `contact_us?: boolean`\n Whether to analyze the contact us page\n - `faq?: boolean`\n Whether to analyze the FAQ page\n - `home_page?: boolean`\n Whether to analyze the home page\n - `pricing?: boolean`\n Whether to analyze the pricing page\n - `privacy_policy?: boolean`\n Whether to analyze the privacy policy page\n - `terms_and_conditions?: boolean`\n Whether to analyze the terms and conditions page\n\n- `timeoutMS?: number`\n 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).\n\n### Returns\n\n- `{ data_extracted?: { datapoint_name?: string; datapoint_value?: string | number | boolean | string[] | number[] | object[]; }[]; domain?: string; status?: string; urls_analyzed?: string[]; }`\n\n - `data_extracted?: { datapoint_name?: string; datapoint_value?: string | number | boolean | string[] | number[] | object[]; }[]`\n - `domain?: string`\n - `status?: string`\n - `urls_analyzed?: string[]`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.ai.aiQuery({ data_to_extract: [{\n datapoint_description: 'datapoint_description',\n datapoint_example: 'datapoint_example',\n datapoint_name: 'datapoint_name',\n datapoint_type: 'text',\n}], domain: 'domain' });\n\nconsole.log(response);\n```",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'extract_product',
|
|
97
|
+
endpoint: '/brand/ai/product',
|
|
98
|
+
httpMethod: 'post',
|
|
99
|
+
summary: 'Extract a single product from a URL',
|
|
100
|
+
description: '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.',
|
|
101
|
+
stainlessPath: '(resource) ai > (method) extract_product',
|
|
102
|
+
qualified: 'client.ai.extractProduct',
|
|
103
|
+
params: ['url: string;', 'timeoutMS?: number;'],
|
|
104
|
+
response: "{ is_product_page?: boolean; platform?: 'amazon' | 'tiktok_shop' | 'etsy' | 'generic'; product?: { description: string; features: string[]; images: string[]; name: string; tags: string[]; target_audience: string[]; billing_frequency?: 'monthly' | 'yearly' | 'one_time' | 'usage_based'; category?: string; currency?: string; image_url?: string; price?: number; pricing_model?: 'per_seat' | 'flat' | 'tiered' | 'freemium' | 'custom'; url?: string; }; }",
|
|
105
|
+
markdown: "## extract_product\n\n`client.ai.extractProduct(url: string, timeoutMS?: number): { is_product_page?: boolean; platform?: 'amazon' | 'tiktok_shop' | 'etsy' | 'generic'; product?: object; }`\n\n**post** `/brand/ai/product`\n\nBeta 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.\n\n### Parameters\n\n- `url: string`\n The product page URL to extract product data from.\n\n- `timeoutMS?: number`\n Optional timeout in milliseconds for the request. Maximum allowed value is 300000ms (5 minutes).\n\n### Returns\n\n- `{ is_product_page?: boolean; platform?: 'amazon' | 'tiktok_shop' | 'etsy' | 'generic'; product?: { description: string; features: string[]; images: string[]; name: string; tags: string[]; target_audience: string[]; billing_frequency?: 'monthly' | 'yearly' | 'one_time' | 'usage_based'; category?: string; currency?: string; image_url?: string; price?: number; pricing_model?: 'per_seat' | 'flat' | 'tiered' | 'freemium' | 'custom'; url?: string; }; }`\n\n - `is_product_page?: boolean`\n - `platform?: 'amazon' | 'tiktok_shop' | 'etsy' | 'generic'`\n - `product?: { description: string; features: string[]; images: string[]; name: string; tags: string[]; target_audience: string[]; billing_frequency?: 'monthly' | 'yearly' | 'one_time' | 'usage_based'; category?: string; currency?: string; image_url?: string; price?: number; pricing_model?: 'per_seat' | 'flat' | 'tiered' | 'freemium' | 'custom'; url?: string; }`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.ai.extractProduct({ url: 'https://example.com' });\n\nconsole.log(response);\n```",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'extract_products',
|
|
109
|
+
endpoint: '/brand/ai/products',
|
|
110
|
+
httpMethod: 'post',
|
|
111
|
+
summary: "Extract products from a brand's website",
|
|
112
|
+
description: "Beta feature: Extract product information from a brand's website. We will analyze the website and return a list of products with details such as name, description, image, pricing, features, and more.",
|
|
113
|
+
stainlessPath: '(resource) ai > (method) extract_products',
|
|
114
|
+
qualified: 'client.ai.extractProducts',
|
|
115
|
+
params: [
|
|
116
|
+
'{ domain: string; maxProducts?: number; timeoutMS?: number; } | { directUrl: string; maxProducts?: number; timeoutMS?: number; };',
|
|
117
|
+
],
|
|
118
|
+
response: "{ products?: { description: string; features: string[]; images: string[]; name: string; tags: string[]; target_audience: string[]; billing_frequency?: 'monthly' | 'yearly' | 'one_time' | 'usage_based'; category?: string; currency?: string; image_url?: string; price?: number; pricing_model?: 'per_seat' | 'flat' | 'tiered' | 'freemium' | 'custom'; url?: string; }[]; }",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'extract_fonts',
|
|
122
|
+
endpoint: '/brand/fonts',
|
|
123
|
+
httpMethod: 'get',
|
|
124
|
+
summary: 'Extract fonts from website',
|
|
125
|
+
description: "Extract font information from a brand's website including font families, usage statistics, fallbacks, and element/word counts.",
|
|
126
|
+
stainlessPath: '(resource) style > (method) extract_fonts',
|
|
127
|
+
qualified: 'client.style.extractFonts',
|
|
128
|
+
params: ['domain: string;', 'timeoutMS?: number;'],
|
|
129
|
+
response: '{ code: number; domain: string; fonts: { fallbacks: string[]; font: string; num_elements: number; num_words: number; percent_elements: number; percent_words: number; uses: string[]; }[]; status: string; }',
|
|
130
|
+
markdown: "## extract_fonts\n\n`client.style.extractFonts(domain: string, timeoutMS?: number): { code: number; domain: string; fonts: object[]; status: string; }`\n\n**get** `/brand/fonts`\n\nExtract font information from a brand's website including font families, usage statistics, fallbacks, and element/word counts.\n\n### Parameters\n\n- `domain: string`\n Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated.\n\n- `timeoutMS?: number`\n 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).\n\n### Returns\n\n- `{ code: number; domain: string; fonts: { fallbacks: string[]; font: string; num_elements: number; num_words: number; percent_elements: number; percent_words: number; uses: string[]; }[]; status: string; }`\n\n - `code: number`\n - `domain: string`\n - `fonts: { fallbacks: string[]; font: string; num_elements: number; num_words: number; percent_elements: number; percent_words: number; uses: string[]; }[]`\n - `status: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.style.extractFonts({ domain: 'domain' });\n\nconsole.log(response);\n```",
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'extract_styleguide',
|
|
134
|
+
endpoint: '/brand/styleguide',
|
|
135
|
+
httpMethod: 'get',
|
|
136
|
+
summary: 'Extract design system and styleguide from website',
|
|
137
|
+
description: "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.",
|
|
138
|
+
stainlessPath: '(resource) style > (method) extract_styleguide',
|
|
139
|
+
qualified: 'client.style.extractStyleguide',
|
|
140
|
+
params: [
|
|
141
|
+
'directUrl?: string;',
|
|
142
|
+
'domain?: string;',
|
|
143
|
+
"prioritize?: 'speed' | 'quality';",
|
|
144
|
+
'timeoutMS?: number;',
|
|
145
|
+
],
|
|
146
|
+
response: "{ code?: number; domain?: string; status?: string; styleguide?: { colors?: { accent?: string; background?: string; text?: string; }; components?: { button?: object; card?: object; }; elementSpacing?: { lg?: string; md?: string; sm?: string; xl?: string; xs?: string; }; mode?: 'light' | 'dark'; shadows?: { inner?: string; lg?: string; md?: string; sm?: string; xl?: string; }; typography?: { headings?: object; p?: object; }; }; }",
|
|
147
|
+
markdown: "## extract_styleguide\n\n`client.style.extractStyleguide(directUrl?: string, domain?: string, prioritize?: 'speed' | 'quality', timeoutMS?: number): { code?: number; domain?: string; status?: string; styleguide?: object; }`\n\n**get** `/brand/styleguide`\n\nAutomatically 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.\n\n### Parameters\n\n- `directUrl?: string`\n A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system').\n\n- `domain?: string`\n Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated.\n\n- `prioritize?: 'speed' | 'quality'`\n 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.\n\n- `timeoutMS?: number`\n 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).\n\n### Returns\n\n- `{ code?: number; domain?: string; status?: string; styleguide?: { colors?: { accent?: string; background?: string; text?: string; }; components?: { button?: object; card?: object; }; elementSpacing?: { lg?: string; md?: string; sm?: string; xl?: string; xs?: string; }; mode?: 'light' | 'dark'; shadows?: { inner?: string; lg?: string; md?: string; sm?: string; xl?: string; }; typography?: { headings?: object; p?: object; }; }; }`\n\n - `code?: number`\n - `domain?: string`\n - `status?: string`\n - `styleguide?: { colors?: { accent?: string; background?: string; text?: string; }; components?: { button?: { link?: { backgroundColor?: string; borderColor?: string; borderRadius?: string; borderStyle?: string; borderWidth?: string; boxShadow?: string; color?: string; fontSize?: string; fontWeight?: number; padding?: string; textDecoration?: string; }; primary?: { backgroundColor?: string; borderColor?: string; borderRadius?: string; borderStyle?: string; borderWidth?: string; boxShadow?: string; color?: string; fontSize?: string; fontWeight?: number; padding?: string; textDecoration?: string; }; secondary?: { backgroundColor?: string; borderColor?: string; borderRadius?: string; borderStyle?: string; borderWidth?: string; boxShadow?: string; color?: string; fontSize?: string; fontWeight?: number; padding?: string; textDecoration?: string; }; }; card?: { backgroundColor?: string; borderColor?: string; borderRadius?: string; borderStyle?: string; borderWidth?: string; boxShadow?: string; padding?: string; textColor?: string; }; }; elementSpacing?: { lg?: string; md?: string; sm?: string; xl?: string; xs?: string; }; mode?: 'light' | 'dark'; shadows?: { inner?: string; lg?: string; md?: string; sm?: string; xl?: string; }; typography?: { headings?: { h1?: { fontFamily?: string; fontSize?: string; fontWeight?: number; letterSpacing?: string; lineHeight?: string; }; h2?: { fontFamily?: string; fontSize?: string; fontWeight?: number; letterSpacing?: string; lineHeight?: string; }; h3?: { fontFamily?: string; fontSize?: string; fontWeight?: number; letterSpacing?: string; lineHeight?: string; }; h4?: { fontFamily?: string; fontSize?: string; fontWeight?: number; letterSpacing?: string; lineHeight?: string; }; }; p?: { fontFamily?: string; fontSize?: string; fontWeight?: number; letterSpacing?: string; lineHeight?: string; }; }; }`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.style.extractStyleguide();\n\nconsole.log(response);\n```",
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: 'retrieve',
|
|
151
|
+
endpoint: '/brand/retrieve',
|
|
152
|
+
httpMethod: 'get',
|
|
153
|
+
summary: 'Retrieve brand data by domain',
|
|
154
|
+
description: 'Retrieve logos, backdrops, colors, industry, description, and more from any domain',
|
|
155
|
+
stainlessPath: '(resource) brand > (method) retrieve',
|
|
156
|
+
qualified: 'client.brand.retrieve',
|
|
157
|
+
params: ['domain: string;', 'force_language?: string;', 'maxSpeed?: boolean;', 'timeoutMS?: number;'],
|
|
158
|
+
response: "{ brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: object[]; resolution?: object; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: object[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: object[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: object; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }; code?: number; status?: string; }",
|
|
159
|
+
markdown: "## retrieve\n\n`client.brand.retrieve(domain: string, force_language?: string, maxSpeed?: boolean, timeoutMS?: number): { brand?: object; code?: number; status?: string; }`\n\n**get** `/brand/retrieve`\n\nRetrieve logos, backdrops, colors, industry, description, and more from any domain\n\n### Parameters\n\n- `domain: string`\n Domain name to retrieve brand data for (e.g., 'example.com', 'google.com'). Cannot be used with name or ticker parameters.\n\n- `force_language?: string`\n Optional parameter to force the language of the retrieved brand data. Works with all three lookup methods.\n\n- `maxSpeed?: boolean`\n Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. Works with all three lookup methods.\n\n- `timeoutMS?: number`\n 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).\n\n### Returns\n\n- `{ brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: object[]; resolution?: object; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: object[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: object[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: object; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }; code?: number; status?: string; }`\n\n - `brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: { hex?: string; name?: string; }[]; resolution?: { aspect_ratio?: number; height?: number; width?: number; }; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: { industry: string; subindustry: string; }[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: { hex?: string; name?: string; }[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: { aspect_ratio?: number; height?: number; width?: number; }; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }`\n - `code?: number`\n - `status?: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst brand = await client.brand.retrieve({ domain: 'domain' });\n\nconsole.log(brand);\n```",
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: 'identify_from_transaction',
|
|
163
|
+
endpoint: '/brand/transaction_identifier',
|
|
164
|
+
httpMethod: 'get',
|
|
165
|
+
summary: 'Identify brand from transaction data',
|
|
166
|
+
description: 'Endpoint specially designed for platforms that want to identify transaction data by the transaction title.',
|
|
167
|
+
stainlessPath: '(resource) brand > (method) identify_from_transaction',
|
|
168
|
+
qualified: 'client.brand.identifyFromTransaction',
|
|
169
|
+
params: [
|
|
170
|
+
'transaction_info: string;',
|
|
171
|
+
'city?: string;',
|
|
172
|
+
'country_gl?: string;',
|
|
173
|
+
'force_language?: string;',
|
|
174
|
+
'high_confidence_only?: boolean;',
|
|
175
|
+
'maxSpeed?: boolean;',
|
|
176
|
+
'mcc?: string;',
|
|
177
|
+
'phone?: number;',
|
|
178
|
+
'timeoutMS?: number;',
|
|
179
|
+
],
|
|
180
|
+
response: "{ brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: object[]; resolution?: object; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: object[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: object[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: object; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }; code?: number; status?: string; }",
|
|
181
|
+
markdown: "## identify_from_transaction\n\n`client.brand.identifyFromTransaction(transaction_info: string, city?: string, country_gl?: string, force_language?: string, high_confidence_only?: boolean, maxSpeed?: boolean, mcc?: string, phone?: number, timeoutMS?: number): { brand?: object; code?: number; status?: string; }`\n\n**get** `/brand/transaction_identifier`\n\nEndpoint specially designed for platforms that want to identify transaction data by the transaction title.\n\n### Parameters\n\n- `transaction_info: string`\n Transaction information to identify the brand\n\n- `city?: string`\n Optional city name to prioritize when searching for the brand.\n\n- `country_gl?: string`\n Optional country code (GL parameter) to specify the country. This affects the geographic location used for search queries.\n\n- `force_language?: string`\n Optional parameter to force the language of the retrieved brand data.\n\n- `high_confidence_only?: boolean`\n When set to true, the API will perform an additional verification steps to ensure the identified brand matches the transaction with high confidence. Defaults to false.\n\n- `maxSpeed?: boolean`\n Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data.\n\n- `mcc?: string`\n Optional Merchant Category Code (MCC) to help identify the business category/industry. \n\n- `phone?: number`\n Optional phone number from the transaction to help verify brand match.\n\n- `timeoutMS?: number`\n 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).\n\n### Returns\n\n- `{ brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: object[]; resolution?: object; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: object[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: object[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: object; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }; code?: number; status?: string; }`\n\n - `brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: { hex?: string; name?: string; }[]; resolution?: { aspect_ratio?: number; height?: number; width?: number; }; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: { industry: string; subindustry: string; }[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: { hex?: string; name?: string; }[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: { aspect_ratio?: number; height?: number; width?: number; }; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }`\n - `code?: number`\n - `status?: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.brand.identifyFromTransaction({ transaction_info: 'transaction_info' });\n\nconsole.log(response);\n```",
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'retrieve_by_email',
|
|
185
|
+
endpoint: '/brand/retrieve-by-email',
|
|
186
|
+
httpMethod: 'get',
|
|
187
|
+
summary: 'Retrieve brand data by email address',
|
|
188
|
+
description: 'Retrieve brand information using an email address while detecting disposable and free email addresses. This endpoint extracts the domain from the email address and returns brand data for that domain. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error.',
|
|
189
|
+
stainlessPath: '(resource) brand > (method) retrieve_by_email',
|
|
190
|
+
qualified: 'client.brand.retrieveByEmail',
|
|
191
|
+
params: ['email: string;', 'force_language?: string;', 'maxSpeed?: boolean;', 'timeoutMS?: number;'],
|
|
192
|
+
response: "{ brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: object[]; resolution?: object; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: object[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: object[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: object; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }; code?: number; status?: string; }",
|
|
193
|
+
markdown: "## retrieve_by_email\n\n`client.brand.retrieveByEmail(email: string, force_language?: string, maxSpeed?: boolean, timeoutMS?: number): { brand?: object; code?: number; status?: string; }`\n\n**get** `/brand/retrieve-by-email`\n\nRetrieve brand information using an email address while detecting disposable and free email addresses. This endpoint extracts the domain from the email address and returns brand data for that domain. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error.\n\n### Parameters\n\n- `email: string`\n Email address to retrieve brand data for (e.g., 'contact@example.com'). The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed.\n\n- `force_language?: string`\n Optional parameter to force the language of the retrieved brand data.\n\n- `maxSpeed?: boolean`\n Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data.\n\n- `timeoutMS?: number`\n 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).\n\n### Returns\n\n- `{ brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: object[]; resolution?: object; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: object[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: object[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: object; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }; code?: number; status?: string; }`\n\n - `brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: { hex?: string; name?: string; }[]; resolution?: { aspect_ratio?: number; height?: number; width?: number; }; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: { industry: string; subindustry: string; }[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: { hex?: string; name?: string; }[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: { aspect_ratio?: number; height?: number; width?: number; }; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }`\n - `code?: number`\n - `status?: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.brand.retrieveByEmail({ email: 'dev@stainless.com' });\n\nconsole.log(response);\n```",
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'retrieve_by_isin',
|
|
197
|
+
endpoint: '/brand/retrieve-by-isin',
|
|
198
|
+
httpMethod: 'get',
|
|
199
|
+
summary: 'Retrieve brand data by ISIN',
|
|
200
|
+
description: 'Retrieve brand information using an ISIN (International Securities Identification Number). This endpoint looks up the company associated with the ISIN and returns its brand data.',
|
|
201
|
+
stainlessPath: '(resource) brand > (method) retrieve_by_isin',
|
|
202
|
+
qualified: 'client.brand.retrieveByIsin',
|
|
203
|
+
params: ['isin: string;', 'force_language?: string;', 'maxSpeed?: boolean;', 'timeoutMS?: number;'],
|
|
204
|
+
response: "{ brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: object[]; resolution?: object; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: object[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: object[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: object; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }; code?: number; status?: string; }",
|
|
205
|
+
markdown: "## retrieve_by_isin\n\n`client.brand.retrieveByIsin(isin: string, force_language?: string, maxSpeed?: boolean, timeoutMS?: number): { brand?: object; code?: number; status?: string; }`\n\n**get** `/brand/retrieve-by-isin`\n\nRetrieve brand information using an ISIN (International Securities Identification Number). This endpoint looks up the company associated with the ISIN and returns its brand data.\n\n### Parameters\n\n- `isin: string`\n ISIN (International Securities Identification Number) to retrieve brand data for (e.g., 'AU000000IMD5', 'US0378331005'). Must be exactly 12 characters: 2 letters followed by 9 alphanumeric characters and ending with a digit.\n\n- `force_language?: string`\n Optional parameter to force the language of the retrieved brand data.\n\n- `maxSpeed?: boolean`\n Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data.\n\n- `timeoutMS?: number`\n 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).\n\n### Returns\n\n- `{ brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: object[]; resolution?: object; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: object[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: object[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: object; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }; code?: number; status?: string; }`\n\n - `brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: { hex?: string; name?: string; }[]; resolution?: { aspect_ratio?: number; height?: number; width?: number; }; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: { industry: string; subindustry: string; }[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: { hex?: string; name?: string; }[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: { aspect_ratio?: number; height?: number; width?: number; }; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }`\n - `code?: number`\n - `status?: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.brand.retrieveByIsin({ isin: 'SE60513A9993' });\n\nconsole.log(response);\n```",
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: 'retrieve_by_name',
|
|
209
|
+
endpoint: '/brand/retrieve-by-name',
|
|
210
|
+
httpMethod: 'get',
|
|
211
|
+
summary: 'Retrieve brand data by company name',
|
|
212
|
+
description: 'Retrieve brand information using a company name. This endpoint searches for the company by name and returns its brand data.',
|
|
213
|
+
stainlessPath: '(resource) brand > (method) retrieve_by_name',
|
|
214
|
+
qualified: 'client.brand.retrieveByName',
|
|
215
|
+
params: [
|
|
216
|
+
'name: string;',
|
|
217
|
+
'country_gl?: string;',
|
|
218
|
+
'force_language?: string;',
|
|
219
|
+
'maxSpeed?: boolean;',
|
|
220
|
+
'timeoutMS?: number;',
|
|
221
|
+
],
|
|
222
|
+
response: "{ brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: object[]; resolution?: object; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: object[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: object[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: object; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }; code?: number; status?: string; }",
|
|
223
|
+
markdown: "## retrieve_by_name\n\n`client.brand.retrieveByName(name: string, country_gl?: string, force_language?: string, maxSpeed?: boolean, timeoutMS?: number): { brand?: object; code?: number; status?: string; }`\n\n**get** `/brand/retrieve-by-name`\n\nRetrieve brand information using a company name. This endpoint searches for the company by name and returns its brand data.\n\n### Parameters\n\n- `name: string`\n Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft Corporation'). Must be 3-30 characters.\n\n- `country_gl?: string`\n Optional country code (GL parameter) to specify the country. This affects the geographic location used for search queries.\n\n- `force_language?: string`\n Optional parameter to force the language of the retrieved brand data.\n\n- `maxSpeed?: boolean`\n Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data.\n\n- `timeoutMS?: number`\n 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).\n\n### Returns\n\n- `{ brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: object[]; resolution?: object; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: object[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: object[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: object; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }; code?: number; status?: string; }`\n\n - `brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: { hex?: string; name?: string; }[]; resolution?: { aspect_ratio?: number; height?: number; width?: number; }; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: { industry: string; subindustry: string; }[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: { hex?: string; name?: string; }[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: { aspect_ratio?: number; height?: number; width?: number; }; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }`\n - `code?: number`\n - `status?: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.brand.retrieveByName({ name: 'xxx' });\n\nconsole.log(response);\n```",
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
name: 'retrieve_by_ticker',
|
|
227
|
+
endpoint: '/brand/retrieve-by-ticker',
|
|
228
|
+
httpMethod: 'get',
|
|
229
|
+
summary: 'Retrieve brand data by stock ticker',
|
|
230
|
+
description: 'Retrieve brand information using a stock ticker symbol. This endpoint looks up the company associated with the ticker and returns its brand data.',
|
|
231
|
+
stainlessPath: '(resource) brand > (method) retrieve_by_ticker',
|
|
232
|
+
qualified: 'client.brand.retrieveByTicker',
|
|
233
|
+
params: [
|
|
234
|
+
'ticker: string;',
|
|
235
|
+
'force_language?: string;',
|
|
236
|
+
'maxSpeed?: boolean;',
|
|
237
|
+
'ticker_exchange?: string;',
|
|
238
|
+
'timeoutMS?: number;',
|
|
239
|
+
],
|
|
240
|
+
response: "{ brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: object[]; resolution?: object; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: object[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: object[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: object; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }; code?: number; status?: string; }",
|
|
241
|
+
markdown: "## retrieve_by_ticker\n\n`client.brand.retrieveByTicker(ticker: string, force_language?: string, maxSpeed?: boolean, ticker_exchange?: string, timeoutMS?: number): { brand?: object; code?: number; status?: string; }`\n\n**get** `/brand/retrieve-by-ticker`\n\nRetrieve brand information using a stock ticker symbol. This endpoint looks up the company associated with the ticker and returns its brand data.\n\n### Parameters\n\n- `ticker: string`\n Stock ticker symbol to retrieve brand data for (e.g., 'AAPL', 'GOOGL', 'BRK.A'). Must be 1-15 characters, letters/numbers/dots only.\n\n- `force_language?: string`\n Optional parameter to force the language of the retrieved brand data.\n\n- `maxSpeed?: boolean`\n Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data.\n\n- `ticker_exchange?: string`\n Optional stock exchange for the ticker. Defaults to NASDAQ if not specified.\n\n- `timeoutMS?: number`\n 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).\n\n### Returns\n\n- `{ brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: object[]; resolution?: object; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: object[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: object[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: object; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }; code?: number; status?: string; }`\n\n - `brand?: { address?: { city?: string; country?: string; country_code?: string; postal_code?: string; state_code?: string; state_province?: string; street?: string; }; backdrops?: { colors?: { hex?: string; name?: string; }[]; resolution?: { aspect_ratio?: number; height?: number; width?: number; }; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; description?: string; domain?: string; email?: string; industries?: { eic?: { industry: string; subindustry: string; }[]; }; is_nsfw?: boolean; links?: { blog?: string; careers?: string; contact?: string; pricing?: string; privacy?: string; terms?: string; }; logos?: { colors?: { hex?: string; name?: string; }[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: { aspect_ratio?: number; height?: number; width?: number; }; type?: 'icon' | 'logo'; url?: string; }[]; phone?: string; slogan?: string; socials?: { type?: string; url?: string; }[]; stock?: { exchange?: string; ticker?: string; }; title?: string; }`\n - `code?: number`\n - `status?: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.brand.retrieveByTicker({ ticker: 'ticker' });\n\nconsole.log(response);\n```",
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: 'retrieve_simplified',
|
|
245
|
+
endpoint: '/brand/retrieve-simplified',
|
|
246
|
+
httpMethod: 'get',
|
|
247
|
+
summary: 'Retrieve simplified brand data by domain',
|
|
248
|
+
description: 'Returns a simplified version of brand data containing only essential information: domain, title, colors, logos, and backdrops. This endpoint is optimized for faster responses and reduced data transfer.',
|
|
249
|
+
stainlessPath: '(resource) brand > (method) retrieve_simplified',
|
|
250
|
+
qualified: 'client.brand.retrieveSimplified',
|
|
251
|
+
params: ['domain: string;', 'timeoutMS?: number;'],
|
|
252
|
+
response: "{ brand?: { backdrops?: { colors?: object[]; resolution?: object; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; domain?: string; logos?: { colors?: object[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: object; type?: 'icon' | 'logo'; url?: string; }[]; title?: string; }; code?: number; status?: string; }",
|
|
253
|
+
markdown: "## retrieve_simplified\n\n`client.brand.retrieveSimplified(domain: string, timeoutMS?: number): { brand?: object; code?: number; status?: string; }`\n\n**get** `/brand/retrieve-simplified`\n\nReturns a simplified version of brand data containing only essential information: domain, title, colors, logos, and backdrops. This endpoint is optimized for faster responses and reduced data transfer.\n\n### Parameters\n\n- `domain: string`\n Domain name to retrieve simplified brand data for\n\n- `timeoutMS?: number`\n 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).\n\n### Returns\n\n- `{ brand?: { backdrops?: { colors?: object[]; resolution?: object; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; domain?: string; logos?: { colors?: object[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: object; type?: 'icon' | 'logo'; url?: string; }[]; title?: string; }; code?: number; status?: string; }`\n\n - `brand?: { backdrops?: { colors?: { hex?: string; name?: string; }[]; resolution?: { aspect_ratio?: number; height?: number; width?: number; }; url?: string; }[]; colors?: { hex?: string; name?: string; }[]; domain?: string; logos?: { colors?: { hex?: string; name?: string; }[]; mode?: 'light' | 'dark' | 'has_opaque_background'; resolution?: { aspect_ratio?: number; height?: number; width?: number; }; type?: 'icon' | 'logo'; url?: string; }[]; title?: string; }`\n - `code?: number`\n - `status?: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.brand.retrieveSimplified({ domain: 'domain' });\n\nconsole.log(response);\n```",
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: 'retrieve_naics',
|
|
257
|
+
endpoint: '/brand/naics',
|
|
258
|
+
httpMethod: 'get',
|
|
259
|
+
summary: 'Retrieve NAICS code for any brand',
|
|
260
|
+
description: 'Endpoint to classify any brand into a 2022 NAICS code.',
|
|
261
|
+
stainlessPath: '(resource) industry > (method) retrieve_naics',
|
|
262
|
+
qualified: 'client.industry.retrieveNaics',
|
|
263
|
+
params: ['input: string;', 'maxResults?: number;', 'minResults?: number;', 'timeoutMS?: number;'],
|
|
264
|
+
response: "{ codes?: { code: string; confidence: 'high' | 'medium' | 'low'; name: string; }[]; domain?: string; status?: string; type?: string; }",
|
|
265
|
+
markdown: "## retrieve_naics\n\n`client.industry.retrieveNaics(input: string, maxResults?: number, minResults?: number, timeoutMS?: number): { codes?: object[]; domain?: string; status?: string; type?: string; }`\n\n**get** `/brand/naics`\n\nEndpoint to classify any brand into a 2022 NAICS code.\n\n### Parameters\n\n- `input: string`\n 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.\n\n- `maxResults?: number`\n Maximum number of NAICS codes to return. Must be between 1 and 10. Defaults to 5.\n\n- `minResults?: number`\n Minimum number of NAICS codes to return. Must be at least 1. Defaults to 1.\n\n- `timeoutMS?: number`\n 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).\n\n### Returns\n\n- `{ codes?: { code: string; confidence: 'high' | 'medium' | 'low'; name: string; }[]; domain?: string; status?: string; type?: string; }`\n\n - `codes?: { code: string; confidence: 'high' | 'medium' | 'low'; name: string; }[]`\n - `domain?: string`\n - `status?: string`\n - `type?: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.industry.retrieveNaics({ input: 'input' });\n\nconsole.log(response);\n```",
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: 'prefetch',
|
|
269
|
+
endpoint: '/brand/prefetch',
|
|
270
|
+
httpMethod: 'post',
|
|
271
|
+
summary: 'Prefetch brand data for a domain',
|
|
272
|
+
description: '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]',
|
|
273
|
+
stainlessPath: '(resource) utility > (method) prefetch',
|
|
274
|
+
qualified: 'client.utility.prefetch',
|
|
275
|
+
params: ['domain: string;', 'timeoutMS?: number;'],
|
|
276
|
+
response: '{ domain?: string; message?: string; status?: string; }',
|
|
277
|
+
markdown: "## prefetch\n\n`client.utility.prefetch(domain: string, timeoutMS?: number): { domain?: string; message?: string; status?: string; }`\n\n**post** `/brand/prefetch`\n\nSignal 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]\n\n### Parameters\n\n- `domain: string`\n Domain name to prefetch brand data for\n\n- `timeoutMS?: number`\n 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).\n\n### Returns\n\n- `{ domain?: string; message?: string; status?: string; }`\n\n - `domain?: string`\n - `message?: string`\n - `status?: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.utility.prefetch({ domain: 'domain' });\n\nconsole.log(response);\n```",
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: 'prefetch_by_email',
|
|
281
|
+
endpoint: '/brand/prefetch-by-email',
|
|
282
|
+
httpMethod: 'post',
|
|
283
|
+
summary: 'Prefetch brand data by email',
|
|
284
|
+
description: "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]",
|
|
285
|
+
stainlessPath: '(resource) utility > (method) prefetch_by_email',
|
|
286
|
+
qualified: 'client.utility.prefetchByEmail',
|
|
287
|
+
params: ['email: string;', 'timeoutMS?: number;'],
|
|
288
|
+
response: '{ domain?: string; message?: string; status?: string; }',
|
|
289
|
+
markdown: "## prefetch_by_email\n\n`client.utility.prefetchByEmail(email: string, timeoutMS?: number): { domain?: string; message?: string; status?: string; }`\n\n**post** `/brand/prefetch-by-email`\n\nSignal 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]\n\n### Parameters\n\n- `email: string`\n 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.\n\n- `timeoutMS?: number`\n 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).\n\n### Returns\n\n- `{ domain?: string; message?: string; status?: string; }`\n\n - `domain?: string`\n - `message?: string`\n - `status?: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.utility.prefetchByEmail({ email: 'dev@stainless.com' });\n\nconsole.log(response);\n```",
|
|
290
|
+
},
|
|
291
|
+
];
|
|
292
|
+
const INDEX_OPTIONS = {
|
|
293
|
+
fields: [
|
|
294
|
+
'name',
|
|
295
|
+
'endpoint',
|
|
296
|
+
'summary',
|
|
297
|
+
'description',
|
|
298
|
+
'qualified',
|
|
299
|
+
'stainlessPath',
|
|
300
|
+
'content',
|
|
301
|
+
'sectionContext',
|
|
302
|
+
],
|
|
303
|
+
storeFields: ['kind', '_original'],
|
|
304
|
+
searchOptions: {
|
|
305
|
+
prefix: true,
|
|
306
|
+
fuzzy: 0.2,
|
|
307
|
+
boost: {
|
|
308
|
+
name: 3,
|
|
309
|
+
endpoint: 2,
|
|
310
|
+
summary: 2,
|
|
311
|
+
qualified: 2,
|
|
312
|
+
content: 1,
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
};
|
|
316
|
+
/**
|
|
317
|
+
* Self-contained local search engine backed by MiniSearch.
|
|
318
|
+
* Method data is embedded at SDK build time; prose documents
|
|
319
|
+
* can be loaded from an optional docs directory at runtime.
|
|
320
|
+
*/
|
|
321
|
+
export class LocalDocsSearch {
|
|
322
|
+
methodIndex;
|
|
323
|
+
proseIndex;
|
|
324
|
+
constructor() {
|
|
325
|
+
this.methodIndex = new MiniSearch(INDEX_OPTIONS);
|
|
326
|
+
this.proseIndex = new MiniSearch(INDEX_OPTIONS);
|
|
327
|
+
}
|
|
328
|
+
static async create(opts) {
|
|
329
|
+
const instance = new LocalDocsSearch();
|
|
330
|
+
instance.indexMethods(EMBEDDED_METHODS);
|
|
331
|
+
if (opts?.docsDir) {
|
|
332
|
+
await instance.loadDocsDirectory(opts.docsDir);
|
|
333
|
+
}
|
|
334
|
+
return instance;
|
|
335
|
+
}
|
|
336
|
+
// Note: Language is accepted for interface consistency with remote search, but currently has no
|
|
337
|
+
// effect since this local search only supports TypeScript docs.
|
|
338
|
+
search(props) {
|
|
339
|
+
const { query, detail = 'default', maxResults = 5, maxLength = 100_000 } = props;
|
|
340
|
+
const useMarkdown = detail === 'verbose' || detail === 'high';
|
|
341
|
+
// Search both indices and merge results by score
|
|
342
|
+
const methodHits = this.methodIndex
|
|
343
|
+
.search(query)
|
|
344
|
+
.map((hit) => ({ ...hit, _kind: 'http_method' }));
|
|
345
|
+
const proseHits = this.proseIndex.search(query).map((hit) => ({ ...hit, _kind: 'prose' }));
|
|
346
|
+
const merged = [...methodHits, ...proseHits].sort((a, b) => b.score - a.score);
|
|
347
|
+
const top = merged.slice(0, maxResults);
|
|
348
|
+
const fullResults = [];
|
|
349
|
+
for (const hit of top) {
|
|
350
|
+
const original = hit['_original'];
|
|
351
|
+
if (hit._kind === 'http_method') {
|
|
352
|
+
const m = original;
|
|
353
|
+
if (useMarkdown && m.markdown) {
|
|
354
|
+
fullResults.push(m.markdown);
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
fullResults.push({
|
|
358
|
+
method: m.qualified,
|
|
359
|
+
summary: m.summary,
|
|
360
|
+
description: m.description,
|
|
361
|
+
endpoint: `${m.httpMethod.toUpperCase()} ${m.endpoint}`,
|
|
362
|
+
...(m.params ? { params: m.params } : {}),
|
|
363
|
+
...(m.response ? { response: m.response } : {}),
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
const c = original;
|
|
369
|
+
fullResults.push({
|
|
370
|
+
content: c.content,
|
|
371
|
+
...(c.source ? { source: c.source } : {}),
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
let totalLength = 0;
|
|
376
|
+
const results = [];
|
|
377
|
+
for (const result of fullResults) {
|
|
378
|
+
const len = typeof result === 'string' ? result.length : JSON.stringify(result).length;
|
|
379
|
+
totalLength += len;
|
|
380
|
+
if (totalLength > maxLength)
|
|
381
|
+
break;
|
|
382
|
+
results.push(result);
|
|
383
|
+
}
|
|
384
|
+
if (results.length < fullResults.length) {
|
|
385
|
+
results.unshift(`Truncated; showing ${results.length} of ${fullResults.length} results.`);
|
|
386
|
+
}
|
|
387
|
+
return { results };
|
|
388
|
+
}
|
|
389
|
+
indexMethods(methods) {
|
|
390
|
+
const docs = methods.map((m, i) => ({
|
|
391
|
+
id: `method-${i}`,
|
|
392
|
+
kind: 'http_method',
|
|
393
|
+
name: m.name,
|
|
394
|
+
endpoint: m.endpoint,
|
|
395
|
+
summary: m.summary,
|
|
396
|
+
description: m.description,
|
|
397
|
+
qualified: m.qualified,
|
|
398
|
+
stainlessPath: m.stainlessPath,
|
|
399
|
+
_original: m,
|
|
400
|
+
}));
|
|
401
|
+
if (docs.length > 0) {
|
|
402
|
+
this.methodIndex.addAll(docs);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
async loadDocsDirectory(docsDir) {
|
|
406
|
+
let entries;
|
|
407
|
+
try {
|
|
408
|
+
entries = await fs.readdir(docsDir, { withFileTypes: true });
|
|
409
|
+
}
|
|
410
|
+
catch (err) {
|
|
411
|
+
getLogger().warn({ err, docsDir }, 'Could not read docs directory');
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
const files = entries
|
|
415
|
+
.filter((e) => e.isFile())
|
|
416
|
+
.filter((e) => e.name.endsWith('.md') || e.name.endsWith('.markdown') || e.name.endsWith('.json'));
|
|
417
|
+
for (const file of files) {
|
|
418
|
+
try {
|
|
419
|
+
const filePath = path.join(docsDir, file.name);
|
|
420
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
421
|
+
if (file.name.endsWith('.json')) {
|
|
422
|
+
const texts = extractTexts(JSON.parse(content));
|
|
423
|
+
if (texts.length > 0) {
|
|
424
|
+
this.indexProse(texts.join('\n\n'), file.name);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
this.indexProse(content, file.name);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
catch (err) {
|
|
432
|
+
getLogger().warn({ err, file: file.name }, 'Failed to index docs file');
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
indexProse(markdown, source) {
|
|
437
|
+
const chunks = chunkMarkdown(markdown);
|
|
438
|
+
const baseId = this.proseIndex.documentCount;
|
|
439
|
+
const docs = chunks.map((chunk, i) => ({
|
|
440
|
+
id: `prose-${baseId + i}`,
|
|
441
|
+
kind: 'prose',
|
|
442
|
+
content: chunk.content,
|
|
443
|
+
...(chunk.sectionContext != null ? { sectionContext: chunk.sectionContext } : {}),
|
|
444
|
+
_original: { ...chunk, source },
|
|
445
|
+
}));
|
|
446
|
+
if (docs.length > 0) {
|
|
447
|
+
this.proseIndex.addAll(docs);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
/** Lightweight markdown chunker — splits on headers, chunks by word count. */
|
|
452
|
+
function chunkMarkdown(markdown) {
|
|
453
|
+
// Strip YAML frontmatter
|
|
454
|
+
const stripped = markdown.replace(/^---\n[\s\S]*?\n---\n?/, '');
|
|
455
|
+
const lines = stripped.split('\n');
|
|
456
|
+
const chunks = [];
|
|
457
|
+
const headers = [];
|
|
458
|
+
let current = [];
|
|
459
|
+
const flush = () => {
|
|
460
|
+
const text = current.join('\n').trim();
|
|
461
|
+
if (!text)
|
|
462
|
+
return;
|
|
463
|
+
const sectionContext = headers.length > 0 ? headers.join(' > ') : undefined;
|
|
464
|
+
// Split into ~200-word chunks
|
|
465
|
+
const words = text.split(/\s+/);
|
|
466
|
+
for (let i = 0; i < words.length; i += 200) {
|
|
467
|
+
const slice = words.slice(i, i + 200).join(' ');
|
|
468
|
+
if (slice) {
|
|
469
|
+
chunks.push({ content: slice, tag: 'p', ...(sectionContext != null ? { sectionContext } : {}) });
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
current = [];
|
|
473
|
+
};
|
|
474
|
+
for (const line of lines) {
|
|
475
|
+
const headerMatch = line.match(/^(#{1,6})\s+(.+)/);
|
|
476
|
+
if (headerMatch) {
|
|
477
|
+
flush();
|
|
478
|
+
const level = headerMatch[1].length;
|
|
479
|
+
const text = headerMatch[2].trim();
|
|
480
|
+
while (headers.length >= level)
|
|
481
|
+
headers.pop();
|
|
482
|
+
headers.push(text);
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
current.push(line);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
flush();
|
|
489
|
+
return chunks;
|
|
490
|
+
}
|
|
491
|
+
/** Recursively extracts string values from a JSON structure. */
|
|
492
|
+
function extractTexts(data, depth = 0) {
|
|
493
|
+
if (depth > 10)
|
|
494
|
+
return [];
|
|
495
|
+
if (typeof data === 'string')
|
|
496
|
+
return data.trim() ? [data] : [];
|
|
497
|
+
if (Array.isArray(data))
|
|
498
|
+
return data.flatMap((item) => extractTexts(item, depth + 1));
|
|
499
|
+
if (typeof data === 'object' && data !== null) {
|
|
500
|
+
return Object.values(data).flatMap((v) => extractTexts(v, depth + 1));
|
|
501
|
+
}
|
|
502
|
+
return [];
|
|
503
|
+
}
|
|
504
|
+
//# sourceMappingURL=local-docs-search.mjs.map
|