@microsoft/webiq 0.1.3 → 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 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +3 -0
- package/dist/index.mjs +3 -0
- 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,6 +176,8 @@ interface WebSearchParams {
|
|
|
171
176
|
contentFormat?: ContentFormat;
|
|
172
177
|
/** Max characters in content (1-500000, default 10000). */
|
|
173
178
|
maxLength?: number;
|
|
179
|
+
/** Safe search mode: use SafeSearch.OFF or .STRICT. */
|
|
180
|
+
safeSearch?: SafeSearch;
|
|
174
181
|
/** Per-request timeout in milliseconds (overrides client default). */
|
|
175
182
|
timeout?: number;
|
|
176
183
|
/**
|
|
@@ -233,6 +240,10 @@ type NewsItem = {
|
|
|
233
240
|
* The last updated date of the news, in UTC ISO8601 format.
|
|
234
241
|
*/
|
|
235
242
|
lastUpdatedAt?: string | null;
|
|
243
|
+
/**
|
|
244
|
+
* The last crawled date of the news, follows ISO8601 format.
|
|
245
|
+
*/
|
|
246
|
+
crawledAt?: string | null;
|
|
236
247
|
/**
|
|
237
248
|
* Publisher name, such as 'USA TODAY | MSN', 'CNN', etc.
|
|
238
249
|
*/
|
|
@@ -315,11 +326,6 @@ declare class NewsResource {
|
|
|
315
326
|
search(query: string, options?: NewsSearchOptions): Promise<NewsResponse>;
|
|
316
327
|
}
|
|
317
328
|
|
|
318
|
-
declare enum SafeSearch {
|
|
319
|
-
OFF = "off",
|
|
320
|
-
STRICT = "strict"
|
|
321
|
-
}
|
|
322
|
-
|
|
323
329
|
declare enum VideoDuration {
|
|
324
330
|
SHORT = "short",
|
|
325
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,6 +176,8 @@ interface WebSearchParams {
|
|
|
171
176
|
contentFormat?: ContentFormat;
|
|
172
177
|
/** Max characters in content (1-500000, default 10000). */
|
|
173
178
|
maxLength?: number;
|
|
179
|
+
/** Safe search mode: use SafeSearch.OFF or .STRICT. */
|
|
180
|
+
safeSearch?: SafeSearch;
|
|
174
181
|
/** Per-request timeout in milliseconds (overrides client default). */
|
|
175
182
|
timeout?: number;
|
|
176
183
|
/**
|
|
@@ -233,6 +240,10 @@ type NewsItem = {
|
|
|
233
240
|
* The last updated date of the news, in UTC ISO8601 format.
|
|
234
241
|
*/
|
|
235
242
|
lastUpdatedAt?: string | null;
|
|
243
|
+
/**
|
|
244
|
+
* The last crawled date of the news, follows ISO8601 format.
|
|
245
|
+
*/
|
|
246
|
+
crawledAt?: string | null;
|
|
236
247
|
/**
|
|
237
248
|
* Publisher name, such as 'USA TODAY | MSN', 'CNN', etc.
|
|
238
249
|
*/
|
|
@@ -315,11 +326,6 @@ declare class NewsResource {
|
|
|
315
326
|
search(query: string, options?: NewsSearchOptions): Promise<NewsResponse>;
|
|
316
327
|
}
|
|
317
328
|
|
|
318
|
-
declare enum SafeSearch {
|
|
319
|
-
OFF = "off",
|
|
320
|
-
STRICT = "strict"
|
|
321
|
-
}
|
|
322
|
-
|
|
323
329
|
declare enum VideoDuration {
|
|
324
330
|
SHORT = "short",
|
|
325
331
|
MEDIUM = "medium",
|
package/dist/index.js
CHANGED
|
@@ -84,6 +84,9 @@ var WebResource = class {
|
|
|
84
84
|
if (options?.maxLength !== void 0) {
|
|
85
85
|
payload.maxLength = options.maxLength;
|
|
86
86
|
}
|
|
87
|
+
if (options?.safeSearch !== void 0) {
|
|
88
|
+
payload.safeSearch = options.safeSearch;
|
|
89
|
+
}
|
|
87
90
|
const result = await this.transport.request({
|
|
88
91
|
method: "POST",
|
|
89
92
|
path: "/search/web",
|
package/dist/index.mjs
CHANGED
|
@@ -82,6 +82,9 @@ var WebResource = class {
|
|
|
82
82
|
if (options?.maxLength !== void 0) {
|
|
83
83
|
payload.maxLength = options.maxLength;
|
|
84
84
|
}
|
|
85
|
+
if (options?.safeSearch !== void 0) {
|
|
86
|
+
payload.safeSearch = options.safeSearch;
|
|
87
|
+
}
|
|
85
88
|
const result = await this.transport.request({
|
|
86
89
|
method: "POST",
|
|
87
90
|
path: "/search/web",
|