@microsoft/webiq 0.1.2 → 0.1.4
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/README.md +4 -1
- package/dist/index.d.mts +11 -17
- package/dist/index.d.ts +11 -17
- package/dist/index.js +2 -8
- package/dist/index.mjs +2 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -92,6 +92,8 @@ const client = new WebIQClient({
|
|
|
92
92
|
### Web Search
|
|
93
93
|
|
|
94
94
|
```typescript
|
|
95
|
+
import { ContentFormat, SafeSearch } from '@microsoft/webiq';
|
|
96
|
+
|
|
95
97
|
const results = await client.web.search(query, {
|
|
96
98
|
maxResults: 10, // 1-50, default 10
|
|
97
99
|
language: 'en', // ISO 639-1 code
|
|
@@ -99,6 +101,7 @@ const results = await client.web.search(query, {
|
|
|
99
101
|
location: 'lat:40.7;long:-74.0', // Optional
|
|
100
102
|
contentFormat: ContentFormat.HTML, // PASSAGE, TEXT, HTML, MARKDOWN
|
|
101
103
|
maxLength: 10000, // 1-500000
|
|
104
|
+
safeSearch: SafeSearch.STRICT, // OFF, STRICT
|
|
102
105
|
customSearchConfigId: 'my-config', // Optional custom search config
|
|
103
106
|
includeDomains: ['example.com'], // Optional allowlist (max 250)
|
|
104
107
|
excludeDomains: ['spam.example'], // Optional blocklist (max 250)
|
|
@@ -117,7 +120,7 @@ const results = await client.news.search(query, {
|
|
|
117
120
|
contentFormat: ContentFormat.TEXT,
|
|
118
121
|
maxLength: 10000,
|
|
119
122
|
});
|
|
120
|
-
// results.newsResults → [{title, url, content, source, lastUpdatedAt, thumbnail, isAdult}]
|
|
123
|
+
// results.newsResults → [{title, url, content, source, lastUpdatedAt, crawledAt, thumbnail, isAdult}]
|
|
121
124
|
```
|
|
122
125
|
|
|
123
126
|
### Video Search
|
package/dist/index.d.mts
CHANGED
|
@@ -84,6 +84,11 @@ declare enum ContentFormat {
|
|
|
84
84
|
MARKDOWN = "markdown"
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
declare enum SafeSearch {
|
|
88
|
+
OFF = "off",
|
|
89
|
+
STRICT = "strict"
|
|
90
|
+
}
|
|
91
|
+
|
|
87
92
|
declare enum ContentTier {
|
|
88
93
|
STANDARD = "standard",
|
|
89
94
|
ENTITLED = "entitled",
|
|
@@ -171,18 +176,8 @@ interface WebSearchParams {
|
|
|
171
176
|
contentFormat?: ContentFormat;
|
|
172
177
|
/** Max characters in content (1-500000, default 10000). */
|
|
173
178
|
maxLength?: number;
|
|
174
|
-
/**
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Domains to include in results (max 250). For allow-lists longer than ~20
|
|
178
|
-
* domains, use `customSearchConfigId` instead.
|
|
179
|
-
*/
|
|
180
|
-
includeDomains?: string[];
|
|
181
|
-
/**
|
|
182
|
-
* Domains to exclude from results (max 250). For deny-lists longer than ~20
|
|
183
|
-
* domains, use `customSearchConfigId` instead.
|
|
184
|
-
*/
|
|
185
|
-
excludeDomains?: string[];
|
|
179
|
+
/** Safe search mode: use SafeSearch.OFF or .STRICT. */
|
|
180
|
+
safeSearch?: SafeSearch;
|
|
186
181
|
/** Per-request timeout in milliseconds (overrides client default). */
|
|
187
182
|
timeout?: number;
|
|
188
183
|
/**
|
|
@@ -245,6 +240,10 @@ type NewsItem = {
|
|
|
245
240
|
* The last updated date of the news, in UTC ISO8601 format.
|
|
246
241
|
*/
|
|
247
242
|
lastUpdatedAt?: string | null;
|
|
243
|
+
/**
|
|
244
|
+
* The last crawled date of the news, follows ISO8601 format.
|
|
245
|
+
*/
|
|
246
|
+
crawledAt?: string | null;
|
|
248
247
|
/**
|
|
249
248
|
* Publisher name, such as 'USA TODAY | MSN', 'CNN', etc.
|
|
250
249
|
*/
|
|
@@ -327,11 +326,6 @@ declare class NewsResource {
|
|
|
327
326
|
search(query: string, options?: NewsSearchOptions): Promise<NewsResponse>;
|
|
328
327
|
}
|
|
329
328
|
|
|
330
|
-
declare enum SafeSearch {
|
|
331
|
-
OFF = "off",
|
|
332
|
-
STRICT = "strict"
|
|
333
|
-
}
|
|
334
|
-
|
|
335
329
|
declare enum VideoDuration {
|
|
336
330
|
SHORT = "short",
|
|
337
331
|
MEDIUM = "medium",
|
package/dist/index.d.ts
CHANGED
|
@@ -84,6 +84,11 @@ declare enum ContentFormat {
|
|
|
84
84
|
MARKDOWN = "markdown"
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
declare enum SafeSearch {
|
|
88
|
+
OFF = "off",
|
|
89
|
+
STRICT = "strict"
|
|
90
|
+
}
|
|
91
|
+
|
|
87
92
|
declare enum ContentTier {
|
|
88
93
|
STANDARD = "standard",
|
|
89
94
|
ENTITLED = "entitled",
|
|
@@ -171,18 +176,8 @@ interface WebSearchParams {
|
|
|
171
176
|
contentFormat?: ContentFormat;
|
|
172
177
|
/** Max characters in content (1-500000, default 10000). */
|
|
173
178
|
maxLength?: number;
|
|
174
|
-
/**
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Domains to include in results (max 250). For allow-lists longer than ~20
|
|
178
|
-
* domains, use `customSearchConfigId` instead.
|
|
179
|
-
*/
|
|
180
|
-
includeDomains?: string[];
|
|
181
|
-
/**
|
|
182
|
-
* Domains to exclude from results (max 250). For deny-lists longer than ~20
|
|
183
|
-
* domains, use `customSearchConfigId` instead.
|
|
184
|
-
*/
|
|
185
|
-
excludeDomains?: string[];
|
|
179
|
+
/** Safe search mode: use SafeSearch.OFF or .STRICT. */
|
|
180
|
+
safeSearch?: SafeSearch;
|
|
186
181
|
/** Per-request timeout in milliseconds (overrides client default). */
|
|
187
182
|
timeout?: number;
|
|
188
183
|
/**
|
|
@@ -245,6 +240,10 @@ type NewsItem = {
|
|
|
245
240
|
* The last updated date of the news, in UTC ISO8601 format.
|
|
246
241
|
*/
|
|
247
242
|
lastUpdatedAt?: string | null;
|
|
243
|
+
/**
|
|
244
|
+
* The last crawled date of the news, follows ISO8601 format.
|
|
245
|
+
*/
|
|
246
|
+
crawledAt?: string | null;
|
|
248
247
|
/**
|
|
249
248
|
* Publisher name, such as 'USA TODAY | MSN', 'CNN', etc.
|
|
250
249
|
*/
|
|
@@ -327,11 +326,6 @@ declare class NewsResource {
|
|
|
327
326
|
search(query: string, options?: NewsSearchOptions): Promise<NewsResponse>;
|
|
328
327
|
}
|
|
329
328
|
|
|
330
|
-
declare enum SafeSearch {
|
|
331
|
-
OFF = "off",
|
|
332
|
-
STRICT = "strict"
|
|
333
|
-
}
|
|
334
|
-
|
|
335
329
|
declare enum VideoDuration {
|
|
336
330
|
SHORT = "short",
|
|
337
331
|
MEDIUM = "medium",
|
package/dist/index.js
CHANGED
|
@@ -84,14 +84,8 @@ var WebResource = class {
|
|
|
84
84
|
if (options?.maxLength !== void 0) {
|
|
85
85
|
payload.maxLength = options.maxLength;
|
|
86
86
|
}
|
|
87
|
-
if (options?.
|
|
88
|
-
payload.
|
|
89
|
-
}
|
|
90
|
-
if (options?.includeDomains !== void 0) {
|
|
91
|
-
payload.includeDomains = options.includeDomains;
|
|
92
|
-
}
|
|
93
|
-
if (options?.excludeDomains !== void 0) {
|
|
94
|
-
payload.excludeDomains = options.excludeDomains;
|
|
87
|
+
if (options?.safeSearch !== void 0) {
|
|
88
|
+
payload.safeSearch = options.safeSearch;
|
|
95
89
|
}
|
|
96
90
|
const result = await this.transport.request({
|
|
97
91
|
method: "POST",
|
package/dist/index.mjs
CHANGED
|
@@ -82,14 +82,8 @@ var WebResource = class {
|
|
|
82
82
|
if (options?.maxLength !== void 0) {
|
|
83
83
|
payload.maxLength = options.maxLength;
|
|
84
84
|
}
|
|
85
|
-
if (options?.
|
|
86
|
-
payload.
|
|
87
|
-
}
|
|
88
|
-
if (options?.includeDomains !== void 0) {
|
|
89
|
-
payload.includeDomains = options.includeDomains;
|
|
90
|
-
}
|
|
91
|
-
if (options?.excludeDomains !== void 0) {
|
|
92
|
-
payload.excludeDomains = options.excludeDomains;
|
|
85
|
+
if (options?.safeSearch !== void 0) {
|
|
86
|
+
payload.safeSearch = options.safeSearch;
|
|
93
87
|
}
|
|
94
88
|
const result = await this.transport.request({
|
|
95
89
|
method: "POST",
|