@microsoft/webiq 0.1.5 → 0.1.7
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 +3 -37
- package/dist/index.d.mts +180 -110
- package/dist/index.d.ts +180 -110
- package/dist/index.js +33 -102
- package/dist/index.mjs +33 -100
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -47,16 +47,6 @@ const page = await client.browse.fetch('https://www.microsoft.com', {
|
|
|
47
47
|
});
|
|
48
48
|
console.log(page.content);
|
|
49
49
|
|
|
50
|
-
// Classic search with multiple answer types
|
|
51
|
-
const classic = await client.classic.search('Artificial intelligence trends', {
|
|
52
|
-
responseFilter: ['webResults'],
|
|
53
|
-
});
|
|
54
|
-
// responseFilter selects which answer types come back; the matching
|
|
55
|
-
// fields (e.g. classic.webResults) are populated dynamically and typed as `any`.
|
|
56
|
-
for (const r of classic.webResults ?? []) {
|
|
57
|
-
console.log(` - ${r.title}: ${r.url}`);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
50
|
await client.close();
|
|
61
51
|
```
|
|
62
52
|
|
|
@@ -140,11 +130,11 @@ const results = await client.videos.search(query, {
|
|
|
140
130
|
### Browse
|
|
141
131
|
|
|
142
132
|
```typescript
|
|
143
|
-
import { BrowseContentFormat,
|
|
133
|
+
import { BrowseContentFormat, LiveCrawlMode } from '@microsoft/webiq';
|
|
144
134
|
|
|
145
135
|
const page = await client.browse.fetch(url, {
|
|
146
136
|
maxLength: 10000, // 1-500000
|
|
147
|
-
liveCrawl:
|
|
137
|
+
liveCrawl: LiveCrawlMode.FALLBACK, // NONE (default), FALLBACK, FORCE
|
|
148
138
|
includeWebLinks: true,
|
|
149
139
|
includeImageLinks: true,
|
|
150
140
|
renderDynamicPages: false,
|
|
@@ -170,30 +160,6 @@ const results = await client.images.search(query, {
|
|
|
170
160
|
// results.imageResults → [{title, url, hostPageUrl, caption, width, height, thumbnailUrl, ...}]
|
|
171
161
|
```
|
|
172
162
|
|
|
173
|
-
### Classic Search
|
|
174
|
-
|
|
175
|
-
Given a query, classic search will search and retrieve content from webpages, images, videos, news, weather, sports, etc.
|
|
176
|
-
|
|
177
|
-
```typescript
|
|
178
|
-
import { ContentFormat, SafeSearch } from '@microsoft/webiq';
|
|
179
|
-
|
|
180
|
-
const response = await client.classic.search(query, {
|
|
181
|
-
maxAnswerTypes: 6, // 1-6, default 6
|
|
182
|
-
language: 'en', // ISO 639-1/2 or BCP 47
|
|
183
|
-
region: 'US', // Country/region code
|
|
184
|
-
location: 'lat:40.7;long:-74.0', // Optional
|
|
185
|
-
maxResultsWeb: 10, // 1-50, default 10
|
|
186
|
-
maxLength: 10000, // 1-500000
|
|
187
|
-
contentFormat: ContentFormat.HTML,
|
|
188
|
-
freshness: 'month', // day, week, month, year, or date range
|
|
189
|
-
responseFilter: ['webResults', 'newsResults'], // Answer types to include
|
|
190
|
-
safeSearch: SafeSearch.STRICT, // OFF, STRICT
|
|
191
|
-
});
|
|
192
|
-
// response.querySignals → {originalQuery, normalizedQuery, isDefensive, isAdult, isNav, isFresh}
|
|
193
|
-
// response.traceId → string
|
|
194
|
-
// Additional dynamic fields for different answer types
|
|
195
|
-
```
|
|
196
|
-
|
|
197
163
|
### Enum Types
|
|
198
164
|
|
|
199
165
|
Some parameters require enum values instead of plain strings. Import them from `@microsoft/webiq`:
|
|
@@ -201,7 +167,7 @@ Some parameters require enum values instead of plain strings. Import them from `
|
|
|
201
167
|
```typescript
|
|
202
168
|
import { BrowseContentFormat, ContentFormat } from '@microsoft/webiq';
|
|
203
169
|
|
|
204
|
-
// ContentFormat: format of returned content for web
|
|
170
|
+
// ContentFormat: format of returned content for web and news search
|
|
205
171
|
ContentFormat.PASSAGE; // Selected passages only (plain text)
|
|
206
172
|
ContentFormat.TEXT; // Full page text (plain text)
|
|
207
173
|
ContentFormat.HTML; // HTML format (default for web search)
|
package/dist/index.d.mts
CHANGED
|
@@ -692,7 +692,7 @@ declare enum BrowseContentFormat {
|
|
|
692
692
|
MARKDOWN = "markdown"
|
|
693
693
|
}
|
|
694
694
|
|
|
695
|
-
declare enum
|
|
695
|
+
declare enum LiveCrawlMode {
|
|
696
696
|
NONE = "none",
|
|
697
697
|
FALLBACK = "fallback",
|
|
698
698
|
FORCE = "force"
|
|
@@ -745,8 +745,8 @@ interface BrowseParams {
|
|
|
745
745
|
url: string;
|
|
746
746
|
/** Max characters in content (1-500000, default 10000). */
|
|
747
747
|
maxLength?: number;
|
|
748
|
-
/**
|
|
749
|
-
liveCrawl?:
|
|
748
|
+
/** Live crawl behavior: NONE, FALLBACK, or FORCE. */
|
|
749
|
+
liveCrawl?: LiveCrawlMode;
|
|
750
750
|
/** Include outbound hyperlinks (default false). */
|
|
751
751
|
includeWebLinks?: boolean;
|
|
752
752
|
/** Enable JS rendering for dynamic content (default false). */
|
|
@@ -782,105 +782,6 @@ declare class BrowseResource {
|
|
|
782
782
|
fetch(url: string, options?: BrowseFetchOptions): Promise<BrowseResponse>;
|
|
783
783
|
}
|
|
784
784
|
|
|
785
|
-
type QuerySignals = {
|
|
786
|
-
/**
|
|
787
|
-
* The original user query as received by the system.
|
|
788
|
-
*/
|
|
789
|
-
originalQuery?: string | null;
|
|
790
|
-
/**
|
|
791
|
-
* The normalized version of the user query after processing (e.g., lowercasing, removing stop words).
|
|
792
|
-
*/
|
|
793
|
-
normalizedQuery?: string | null;
|
|
794
|
-
/**
|
|
795
|
-
* Indicates whether the query is defensive
|
|
796
|
-
*/
|
|
797
|
-
isDefensive?: boolean | null;
|
|
798
|
-
/**
|
|
799
|
-
* Indicates whether the query is flagged as adult query
|
|
800
|
-
*/
|
|
801
|
-
isAdult?: boolean | null;
|
|
802
|
-
/**
|
|
803
|
-
* Indicates whether the query is navigational
|
|
804
|
-
*/
|
|
805
|
-
isNav?: boolean | null;
|
|
806
|
-
/**
|
|
807
|
-
* Indicates whether the query is fresh
|
|
808
|
-
*/
|
|
809
|
-
isFresh?: boolean | null;
|
|
810
|
-
};
|
|
811
|
-
|
|
812
|
-
type SearchClassicResponse = {
|
|
813
|
-
querySignals?: QuerySignals;
|
|
814
|
-
/**
|
|
815
|
-
* Base URL for click ping requests. Append an instrumentationSuffix value from a result item to form the full ping URL.
|
|
816
|
-
*/
|
|
817
|
-
instrumentationClickBase?: string | null;
|
|
818
|
-
/**
|
|
819
|
-
* Base URL for LLM log ping requests. Append a DATA payload to form the full ping URL.
|
|
820
|
-
*/
|
|
821
|
-
instrumentationCitationBase?: string | null;
|
|
822
|
-
/**
|
|
823
|
-
* Trace ID for debugging and tracking.
|
|
824
|
-
*/
|
|
825
|
-
traceId?: string | null;
|
|
826
|
-
[key: string]: any;
|
|
827
|
-
};
|
|
828
|
-
|
|
829
|
-
/**
|
|
830
|
-
* Classic search resource.
|
|
831
|
-
*/
|
|
832
|
-
|
|
833
|
-
/**
|
|
834
|
-
* Classic search request parameters.
|
|
835
|
-
*/
|
|
836
|
-
interface ClassicSearchParams {
|
|
837
|
-
/** Search query string (1-1000 chars). */
|
|
838
|
-
query: string;
|
|
839
|
-
/** Max answer types to return (1-6, default 6). */
|
|
840
|
-
maxAnswerTypes?: number;
|
|
841
|
-
/** Language code (ISO 639-1/2 or BCP 47). */
|
|
842
|
-
language?: string;
|
|
843
|
-
/** 2-letter country/region code. */
|
|
844
|
-
region?: string;
|
|
845
|
-
/** Location in format 'lat:<float>;long:<float>'. */
|
|
846
|
-
location?: string;
|
|
847
|
-
/** Max web results to return (1-50, default 10). */
|
|
848
|
-
maxResultsWeb?: number;
|
|
849
|
-
/** Max characters in content (1-500000, default 10000). */
|
|
850
|
-
maxLength?: number;
|
|
851
|
-
/** Content format: use ContentFormat.PASSAGE, .TEXT, .HTML, or .MARKDOWN. */
|
|
852
|
-
contentFormat?: ContentFormat;
|
|
853
|
-
/** Time range filter ('day', 'week', 'month', 'year', or date range). */
|
|
854
|
-
freshness?: string;
|
|
855
|
-
/** List of answer types to include in response. */
|
|
856
|
-
responseFilter?: string[];
|
|
857
|
-
/** Safe search mode: use SafeSearch.OFF or .STRICT. */
|
|
858
|
-
safeSearch?: SafeSearch;
|
|
859
|
-
/** Per-request timeout in milliseconds (overrides client default). */
|
|
860
|
-
timeout?: number;
|
|
861
|
-
/** Caller-provided cancellation signal (see `WebSearchParams.signal`). */
|
|
862
|
-
signal?: AbortSignal;
|
|
863
|
-
}
|
|
864
|
-
/** Classic search options (query is passed separately). */
|
|
865
|
-
type ClassicSearchOptions = Omit<ClassicSearchParams, 'query'>;
|
|
866
|
-
/**
|
|
867
|
-
* Classic search resource for the Web IQ API.
|
|
868
|
-
* Given a query, searches and retrieves content from webpages, images, videos,
|
|
869
|
-
* news, weather, sports, etc.
|
|
870
|
-
*/
|
|
871
|
-
declare class ClassicResource {
|
|
872
|
-
private readonly transport;
|
|
873
|
-
constructor(transport: Transport);
|
|
874
|
-
/**
|
|
875
|
-
* Perform a classic search returning grouped results across multiple answer types.
|
|
876
|
-
*
|
|
877
|
-
* @param query - Search query string (1-1000 chars)
|
|
878
|
-
* @param options - Search options
|
|
879
|
-
* @returns SearchClassicResponse with querySignals, traceId, and additional answer types
|
|
880
|
-
*/
|
|
881
|
-
search(query: string, options?: ClassicSearchOptions): Promise<SearchClassicResponse>;
|
|
882
|
-
}
|
|
883
|
-
|
|
884
785
|
/**
|
|
885
786
|
* Configuration for request retry behavior.
|
|
886
787
|
*/
|
|
@@ -1051,8 +952,6 @@ declare class WebIQClient {
|
|
|
1051
952
|
readonly images: ImagesResource;
|
|
1052
953
|
/** Browse resource */
|
|
1053
954
|
readonly browse: BrowseResource;
|
|
1054
|
-
/** Classic search resource */
|
|
1055
|
-
readonly classic: ClassicResource;
|
|
1056
955
|
private readonly _transport;
|
|
1057
956
|
private readonly _auth;
|
|
1058
957
|
constructor(options: WebIQClientOptions);
|
|
@@ -1135,11 +1034,182 @@ declare class PermissionDeniedError extends APIStatusError {
|
|
|
1135
1034
|
});
|
|
1136
1035
|
}
|
|
1137
1036
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1037
|
+
type ApiErrorResponse = {
|
|
1038
|
+
errorCode?: string | null;
|
|
1039
|
+
errorCategory?: string | null;
|
|
1040
|
+
userMessage?: string | null;
|
|
1041
|
+
technicalDetails?: string | null;
|
|
1042
|
+
retryAfter?: string | null;
|
|
1043
|
+
requestId?: string | null;
|
|
1044
|
+
traceId?: string | null;
|
|
1045
|
+
};
|
|
1046
|
+
|
|
1047
|
+
type BrowseRequest = {
|
|
1048
|
+
/**
|
|
1049
|
+
* The URL of the web page to browse.
|
|
1050
|
+
*/
|
|
1051
|
+
url: string;
|
|
1052
|
+
/**
|
|
1053
|
+
* The maximum number of characters in the content field in response. Default value is 10000 characters, and maximum value is 500000 characters.
|
|
1054
|
+
*/
|
|
1055
|
+
maxLength?: number | null;
|
|
1056
|
+
liveCrawl?: LiveCrawlMode;
|
|
1057
|
+
/**
|
|
1058
|
+
* Include outbound hyperlinks from the page. Default is false.
|
|
1059
|
+
*/
|
|
1060
|
+
includeWebLinks?: boolean | null;
|
|
1061
|
+
/**
|
|
1062
|
+
* Enable JavaScript rendering for dynamic content screenshot. Only works when liveCrawl is set to 'fallback' or 'force'. Default is false.
|
|
1063
|
+
*/
|
|
1064
|
+
renderDynamicPages?: boolean | null;
|
|
1065
|
+
/**
|
|
1066
|
+
* Include image URLs from the page. Default is false.
|
|
1067
|
+
*/
|
|
1068
|
+
includeImageLinks?: boolean | null;
|
|
1069
|
+
/**
|
|
1070
|
+
* The language code (2-letter ISO 639-1). Default is 'en'.
|
|
1071
|
+
*/
|
|
1072
|
+
language?: string | null;
|
|
1073
|
+
/**
|
|
1074
|
+
* The region code (2-letter country/region code). Default is 'US'.
|
|
1075
|
+
*/
|
|
1076
|
+
region?: string | null;
|
|
1077
|
+
contentFormat?: BrowseContentFormat;
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
type ImagesRequest = {
|
|
1081
|
+
/**
|
|
1082
|
+
* A search query string
|
|
1083
|
+
*/
|
|
1084
|
+
query: string;
|
|
1085
|
+
/**
|
|
1086
|
+
* Max number of results to return. Default is 30 and maximum value is 30.
|
|
1087
|
+
*/
|
|
1088
|
+
maxResults?: number | null;
|
|
1089
|
+
/**
|
|
1090
|
+
* A 2-letter ISO 639-1 language code for interface language in the search results. Default: 'en'.
|
|
1091
|
+
*/
|
|
1092
|
+
language?: string | null;
|
|
1093
|
+
/**
|
|
1094
|
+
* A 2-letter country/region code for where the results should come from (e.g. 'US', 'JP', 'CN'). Default is 'US'.
|
|
1095
|
+
*/
|
|
1096
|
+
region?: string | null;
|
|
1097
|
+
aspectRatio?: ImageAspectRatio;
|
|
1098
|
+
color?: ImageColor;
|
|
1099
|
+
safeSearch?: SafeSearch;
|
|
1100
|
+
imageSize?: ImageSize;
|
|
1101
|
+
/**
|
|
1102
|
+
* Exclude images with watermark. Default is false.
|
|
1103
|
+
*/
|
|
1104
|
+
watermarkFree?: boolean | null;
|
|
1105
|
+
/**
|
|
1106
|
+
* Maximum image height in pixels. Used with imageSize for custom bounds.
|
|
1107
|
+
*/
|
|
1108
|
+
maxHeight?: number | null;
|
|
1109
|
+
/**
|
|
1110
|
+
* Minimum image height in pixels.
|
|
1111
|
+
*/
|
|
1112
|
+
minHeight?: number | null;
|
|
1113
|
+
/**
|
|
1114
|
+
* Maximum image width in pixels.
|
|
1115
|
+
*/
|
|
1116
|
+
maxWidth?: number | null;
|
|
1117
|
+
/**
|
|
1118
|
+
* Minimum image width in pixels.
|
|
1119
|
+
*/
|
|
1120
|
+
minWidth?: number | null;
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1123
|
+
type NewsRequest = {
|
|
1124
|
+
/**
|
|
1125
|
+
* A search query for the news.
|
|
1126
|
+
*/
|
|
1127
|
+
query: string;
|
|
1128
|
+
/**
|
|
1129
|
+
* Max number of results to return. Default is 10 and maximum value is 20.
|
|
1130
|
+
*/
|
|
1131
|
+
maxResults?: number | null;
|
|
1132
|
+
/**
|
|
1133
|
+
* A 2-letter ISO 639-1 language code for interface language in the search results. Default: 'en'.
|
|
1134
|
+
*/
|
|
1135
|
+
language?: string | null;
|
|
1136
|
+
/**
|
|
1137
|
+
* A 2-letter country/region code for where the results should come from (e.g. 'US', 'JP', 'CN'). Default is 'US'.
|
|
1138
|
+
*/
|
|
1139
|
+
region?: string | null;
|
|
1140
|
+
/**
|
|
1141
|
+
* Location information in format 'lat:<float>;long:<float>', e.g. 'lat:40.753250;long:-74.003807'. If not specified, could infer location in query.
|
|
1142
|
+
*/
|
|
1143
|
+
location?: string | null;
|
|
1144
|
+
contentFormat?: ContentFormat;
|
|
1145
|
+
/**
|
|
1146
|
+
* The maximum number of characters in the content field in response. Default value is 10000 characters, and maximum value is 500000 characters.
|
|
1147
|
+
*/
|
|
1148
|
+
maxLength?: number | null;
|
|
1149
|
+
};
|
|
1150
|
+
|
|
1151
|
+
type VideosRequest = {
|
|
1152
|
+
/**
|
|
1153
|
+
* A search query string
|
|
1154
|
+
*/
|
|
1155
|
+
query: string;
|
|
1156
|
+
/**
|
|
1157
|
+
* Max number of results to return. Default is 30 and maximum value is 30.
|
|
1158
|
+
*/
|
|
1159
|
+
maxResults?: number | null;
|
|
1160
|
+
/**
|
|
1161
|
+
* A 2-letter ISO 639-1 language code for interface language in the search results. Default: 'en'.
|
|
1162
|
+
*/
|
|
1163
|
+
language?: string | null;
|
|
1164
|
+
/**
|
|
1165
|
+
* A 2-letter country/region code for where the results should come from (e.g. 'US', 'JP', 'CN'). Default is 'US'.
|
|
1166
|
+
*/
|
|
1167
|
+
region?: string | null;
|
|
1168
|
+
/**
|
|
1169
|
+
* Whether to include playlist results in response. Default is false.
|
|
1170
|
+
*/
|
|
1171
|
+
enablePlaylist?: boolean | null;
|
|
1172
|
+
/**
|
|
1173
|
+
* The time range to filter results based on discovery date. Supports 'week', 'month', 'year' for relative time, or ISO 8601 date interval format: 'YYYY-MM-DD/YYYY-MM-DD' or 'YYYY-MM-DDTHH:mm:ssZ/YYYY-MM-DDTHH:mm:ssZ' for a date/datetime range, use .. to omit start or end date.
|
|
1174
|
+
*/
|
|
1175
|
+
freshness?: string | null;
|
|
1176
|
+
/**
|
|
1177
|
+
* Filter videos by embedding capabilities. Allowed values: 'player' (has embeddable player). When not set, no filtering is applied.
|
|
1178
|
+
*/
|
|
1179
|
+
embeddable?: Array<string> | null;
|
|
1180
|
+
resolution?: VideoResolution;
|
|
1181
|
+
safeSearch?: SafeSearch;
|
|
1182
|
+
duration?: VideoDuration;
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
type WebRequest = {
|
|
1186
|
+
/**
|
|
1187
|
+
* A search query string. Supports 'site:' and '-site:' operators to include or exclude results from specific sites (e.g. 'query site:example.com'). Use these operators only when necessary, as they inherently reduce result relevance.
|
|
1188
|
+
*/
|
|
1189
|
+
query: string;
|
|
1190
|
+
/**
|
|
1191
|
+
* Max number of results to return. Default is 10 and maximum value is 50.
|
|
1192
|
+
*/
|
|
1193
|
+
maxResults?: number | null;
|
|
1194
|
+
/**
|
|
1195
|
+
* A 2-letter ISO 639-1 language code for interface language in the search results. Default: 'en'.
|
|
1196
|
+
*/
|
|
1197
|
+
language?: string | null;
|
|
1198
|
+
/**
|
|
1199
|
+
* A 2-letter country/region code for where the results should come from (e.g. 'US', 'JP', 'CN'). Default is 'US'.
|
|
1200
|
+
*/
|
|
1201
|
+
region?: string | null;
|
|
1202
|
+
/**
|
|
1203
|
+
* Location information in format 'lat:<float>;long:<float>'.
|
|
1204
|
+
*/
|
|
1205
|
+
location?: string | null;
|
|
1206
|
+
contentFormat?: ContentFormat;
|
|
1207
|
+
/**
|
|
1208
|
+
* The maximum number of characters in the content or passage field in response. Default value is 10000 characters, and maximum value is 500000 characters.
|
|
1209
|
+
*/
|
|
1210
|
+
maxLength?: number | null;
|
|
1211
|
+
safeSearch?: SafeSearch;
|
|
1212
|
+
};
|
|
1143
1213
|
|
|
1144
1214
|
/**
|
|
1145
1215
|
* HTTP transport implementation.
|
|
@@ -1183,4 +1253,4 @@ declare class HttpTransport implements Transport {
|
|
|
1183
1253
|
close(): Promise<void>;
|
|
1184
1254
|
}
|
|
1185
1255
|
|
|
1186
|
-
export { APIConnectionError, APIStatusError, ApiKeyAuth, type AuthProvider, AuthenticationError, BrowseContentFormat, type BrowseFetchOptions,
|
|
1256
|
+
export { APIConnectionError, APIStatusError, type ApiErrorResponse, ApiKeyAuth, type AuthProvider, AuthenticationError, BrowseContentFormat, type BrowseFetchOptions, type BrowseParams, type BrowseRequest, BrowseResource, type BrowseResponse, ContentFormat, ContentTier, DEFAULT_SCOPE, DEFAULT_TIMEOUT, EntraIDAuth, type FetchFunction, HttpTransport, type HttpTransportOptions, ImageAspectRatio, ImageColor, type ImageItem, type ImageSearchOptions, ImageSize, type ImagesRequest, ImagesResource, type ImagesResponse, type ImagesSearchParams, LiveCrawlMode, type NewsItem, type NewsRequest, NewsResource, type NewsResponse, type NewsSearchOptions, type NewsSearchParams, type NewsThumbnail, PermissionDeniedError, type PlaylistItem, type PlaylistVideo, RateLimitError, RetryPolicy, type RetryPolicyOptions, SafeSearch, type TelemetryEvent, type TelemetryHook, type TokenCredential, type Transport, type TransportRequestOptions, VideoDuration, type VideoItem, type VideoMoment, VideoResolution, type VideoSearchOptions, type VideosRequest, VideosResource, type VideosResponse, type VideosSearchParams, WebIQClient, type WebIQClientOptions, WebIQError, type WebRequest, WebResource, type WebResponse, type WebResult, type WebSearchOptions, type WebSearchParams, createAuth, createClient, createTelemetryEvent, safeCall };
|
package/dist/index.d.ts
CHANGED
|
@@ -692,7 +692,7 @@ declare enum BrowseContentFormat {
|
|
|
692
692
|
MARKDOWN = "markdown"
|
|
693
693
|
}
|
|
694
694
|
|
|
695
|
-
declare enum
|
|
695
|
+
declare enum LiveCrawlMode {
|
|
696
696
|
NONE = "none",
|
|
697
697
|
FALLBACK = "fallback",
|
|
698
698
|
FORCE = "force"
|
|
@@ -745,8 +745,8 @@ interface BrowseParams {
|
|
|
745
745
|
url: string;
|
|
746
746
|
/** Max characters in content (1-500000, default 10000). */
|
|
747
747
|
maxLength?: number;
|
|
748
|
-
/**
|
|
749
|
-
liveCrawl?:
|
|
748
|
+
/** Live crawl behavior: NONE, FALLBACK, or FORCE. */
|
|
749
|
+
liveCrawl?: LiveCrawlMode;
|
|
750
750
|
/** Include outbound hyperlinks (default false). */
|
|
751
751
|
includeWebLinks?: boolean;
|
|
752
752
|
/** Enable JS rendering for dynamic content (default false). */
|
|
@@ -782,105 +782,6 @@ declare class BrowseResource {
|
|
|
782
782
|
fetch(url: string, options?: BrowseFetchOptions): Promise<BrowseResponse>;
|
|
783
783
|
}
|
|
784
784
|
|
|
785
|
-
type QuerySignals = {
|
|
786
|
-
/**
|
|
787
|
-
* The original user query as received by the system.
|
|
788
|
-
*/
|
|
789
|
-
originalQuery?: string | null;
|
|
790
|
-
/**
|
|
791
|
-
* The normalized version of the user query after processing (e.g., lowercasing, removing stop words).
|
|
792
|
-
*/
|
|
793
|
-
normalizedQuery?: string | null;
|
|
794
|
-
/**
|
|
795
|
-
* Indicates whether the query is defensive
|
|
796
|
-
*/
|
|
797
|
-
isDefensive?: boolean | null;
|
|
798
|
-
/**
|
|
799
|
-
* Indicates whether the query is flagged as adult query
|
|
800
|
-
*/
|
|
801
|
-
isAdult?: boolean | null;
|
|
802
|
-
/**
|
|
803
|
-
* Indicates whether the query is navigational
|
|
804
|
-
*/
|
|
805
|
-
isNav?: boolean | null;
|
|
806
|
-
/**
|
|
807
|
-
* Indicates whether the query is fresh
|
|
808
|
-
*/
|
|
809
|
-
isFresh?: boolean | null;
|
|
810
|
-
};
|
|
811
|
-
|
|
812
|
-
type SearchClassicResponse = {
|
|
813
|
-
querySignals?: QuerySignals;
|
|
814
|
-
/**
|
|
815
|
-
* Base URL for click ping requests. Append an instrumentationSuffix value from a result item to form the full ping URL.
|
|
816
|
-
*/
|
|
817
|
-
instrumentationClickBase?: string | null;
|
|
818
|
-
/**
|
|
819
|
-
* Base URL for LLM log ping requests. Append a DATA payload to form the full ping URL.
|
|
820
|
-
*/
|
|
821
|
-
instrumentationCitationBase?: string | null;
|
|
822
|
-
/**
|
|
823
|
-
* Trace ID for debugging and tracking.
|
|
824
|
-
*/
|
|
825
|
-
traceId?: string | null;
|
|
826
|
-
[key: string]: any;
|
|
827
|
-
};
|
|
828
|
-
|
|
829
|
-
/**
|
|
830
|
-
* Classic search resource.
|
|
831
|
-
*/
|
|
832
|
-
|
|
833
|
-
/**
|
|
834
|
-
* Classic search request parameters.
|
|
835
|
-
*/
|
|
836
|
-
interface ClassicSearchParams {
|
|
837
|
-
/** Search query string (1-1000 chars). */
|
|
838
|
-
query: string;
|
|
839
|
-
/** Max answer types to return (1-6, default 6). */
|
|
840
|
-
maxAnswerTypes?: number;
|
|
841
|
-
/** Language code (ISO 639-1/2 or BCP 47). */
|
|
842
|
-
language?: string;
|
|
843
|
-
/** 2-letter country/region code. */
|
|
844
|
-
region?: string;
|
|
845
|
-
/** Location in format 'lat:<float>;long:<float>'. */
|
|
846
|
-
location?: string;
|
|
847
|
-
/** Max web results to return (1-50, default 10). */
|
|
848
|
-
maxResultsWeb?: number;
|
|
849
|
-
/** Max characters in content (1-500000, default 10000). */
|
|
850
|
-
maxLength?: number;
|
|
851
|
-
/** Content format: use ContentFormat.PASSAGE, .TEXT, .HTML, or .MARKDOWN. */
|
|
852
|
-
contentFormat?: ContentFormat;
|
|
853
|
-
/** Time range filter ('day', 'week', 'month', 'year', or date range). */
|
|
854
|
-
freshness?: string;
|
|
855
|
-
/** List of answer types to include in response. */
|
|
856
|
-
responseFilter?: string[];
|
|
857
|
-
/** Safe search mode: use SafeSearch.OFF or .STRICT. */
|
|
858
|
-
safeSearch?: SafeSearch;
|
|
859
|
-
/** Per-request timeout in milliseconds (overrides client default). */
|
|
860
|
-
timeout?: number;
|
|
861
|
-
/** Caller-provided cancellation signal (see `WebSearchParams.signal`). */
|
|
862
|
-
signal?: AbortSignal;
|
|
863
|
-
}
|
|
864
|
-
/** Classic search options (query is passed separately). */
|
|
865
|
-
type ClassicSearchOptions = Omit<ClassicSearchParams, 'query'>;
|
|
866
|
-
/**
|
|
867
|
-
* Classic search resource for the Web IQ API.
|
|
868
|
-
* Given a query, searches and retrieves content from webpages, images, videos,
|
|
869
|
-
* news, weather, sports, etc.
|
|
870
|
-
*/
|
|
871
|
-
declare class ClassicResource {
|
|
872
|
-
private readonly transport;
|
|
873
|
-
constructor(transport: Transport);
|
|
874
|
-
/**
|
|
875
|
-
* Perform a classic search returning grouped results across multiple answer types.
|
|
876
|
-
*
|
|
877
|
-
* @param query - Search query string (1-1000 chars)
|
|
878
|
-
* @param options - Search options
|
|
879
|
-
* @returns SearchClassicResponse with querySignals, traceId, and additional answer types
|
|
880
|
-
*/
|
|
881
|
-
search(query: string, options?: ClassicSearchOptions): Promise<SearchClassicResponse>;
|
|
882
|
-
}
|
|
883
|
-
|
|
884
785
|
/**
|
|
885
786
|
* Configuration for request retry behavior.
|
|
886
787
|
*/
|
|
@@ -1051,8 +952,6 @@ declare class WebIQClient {
|
|
|
1051
952
|
readonly images: ImagesResource;
|
|
1052
953
|
/** Browse resource */
|
|
1053
954
|
readonly browse: BrowseResource;
|
|
1054
|
-
/** Classic search resource */
|
|
1055
|
-
readonly classic: ClassicResource;
|
|
1056
955
|
private readonly _transport;
|
|
1057
956
|
private readonly _auth;
|
|
1058
957
|
constructor(options: WebIQClientOptions);
|
|
@@ -1135,11 +1034,182 @@ declare class PermissionDeniedError extends APIStatusError {
|
|
|
1135
1034
|
});
|
|
1136
1035
|
}
|
|
1137
1036
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1037
|
+
type ApiErrorResponse = {
|
|
1038
|
+
errorCode?: string | null;
|
|
1039
|
+
errorCategory?: string | null;
|
|
1040
|
+
userMessage?: string | null;
|
|
1041
|
+
technicalDetails?: string | null;
|
|
1042
|
+
retryAfter?: string | null;
|
|
1043
|
+
requestId?: string | null;
|
|
1044
|
+
traceId?: string | null;
|
|
1045
|
+
};
|
|
1046
|
+
|
|
1047
|
+
type BrowseRequest = {
|
|
1048
|
+
/**
|
|
1049
|
+
* The URL of the web page to browse.
|
|
1050
|
+
*/
|
|
1051
|
+
url: string;
|
|
1052
|
+
/**
|
|
1053
|
+
* The maximum number of characters in the content field in response. Default value is 10000 characters, and maximum value is 500000 characters.
|
|
1054
|
+
*/
|
|
1055
|
+
maxLength?: number | null;
|
|
1056
|
+
liveCrawl?: LiveCrawlMode;
|
|
1057
|
+
/**
|
|
1058
|
+
* Include outbound hyperlinks from the page. Default is false.
|
|
1059
|
+
*/
|
|
1060
|
+
includeWebLinks?: boolean | null;
|
|
1061
|
+
/**
|
|
1062
|
+
* Enable JavaScript rendering for dynamic content screenshot. Only works when liveCrawl is set to 'fallback' or 'force'. Default is false.
|
|
1063
|
+
*/
|
|
1064
|
+
renderDynamicPages?: boolean | null;
|
|
1065
|
+
/**
|
|
1066
|
+
* Include image URLs from the page. Default is false.
|
|
1067
|
+
*/
|
|
1068
|
+
includeImageLinks?: boolean | null;
|
|
1069
|
+
/**
|
|
1070
|
+
* The language code (2-letter ISO 639-1). Default is 'en'.
|
|
1071
|
+
*/
|
|
1072
|
+
language?: string | null;
|
|
1073
|
+
/**
|
|
1074
|
+
* The region code (2-letter country/region code). Default is 'US'.
|
|
1075
|
+
*/
|
|
1076
|
+
region?: string | null;
|
|
1077
|
+
contentFormat?: BrowseContentFormat;
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
type ImagesRequest = {
|
|
1081
|
+
/**
|
|
1082
|
+
* A search query string
|
|
1083
|
+
*/
|
|
1084
|
+
query: string;
|
|
1085
|
+
/**
|
|
1086
|
+
* Max number of results to return. Default is 30 and maximum value is 30.
|
|
1087
|
+
*/
|
|
1088
|
+
maxResults?: number | null;
|
|
1089
|
+
/**
|
|
1090
|
+
* A 2-letter ISO 639-1 language code for interface language in the search results. Default: 'en'.
|
|
1091
|
+
*/
|
|
1092
|
+
language?: string | null;
|
|
1093
|
+
/**
|
|
1094
|
+
* A 2-letter country/region code for where the results should come from (e.g. 'US', 'JP', 'CN'). Default is 'US'.
|
|
1095
|
+
*/
|
|
1096
|
+
region?: string | null;
|
|
1097
|
+
aspectRatio?: ImageAspectRatio;
|
|
1098
|
+
color?: ImageColor;
|
|
1099
|
+
safeSearch?: SafeSearch;
|
|
1100
|
+
imageSize?: ImageSize;
|
|
1101
|
+
/**
|
|
1102
|
+
* Exclude images with watermark. Default is false.
|
|
1103
|
+
*/
|
|
1104
|
+
watermarkFree?: boolean | null;
|
|
1105
|
+
/**
|
|
1106
|
+
* Maximum image height in pixels. Used with imageSize for custom bounds.
|
|
1107
|
+
*/
|
|
1108
|
+
maxHeight?: number | null;
|
|
1109
|
+
/**
|
|
1110
|
+
* Minimum image height in pixels.
|
|
1111
|
+
*/
|
|
1112
|
+
minHeight?: number | null;
|
|
1113
|
+
/**
|
|
1114
|
+
* Maximum image width in pixels.
|
|
1115
|
+
*/
|
|
1116
|
+
maxWidth?: number | null;
|
|
1117
|
+
/**
|
|
1118
|
+
* Minimum image width in pixels.
|
|
1119
|
+
*/
|
|
1120
|
+
minWidth?: number | null;
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1123
|
+
type NewsRequest = {
|
|
1124
|
+
/**
|
|
1125
|
+
* A search query for the news.
|
|
1126
|
+
*/
|
|
1127
|
+
query: string;
|
|
1128
|
+
/**
|
|
1129
|
+
* Max number of results to return. Default is 10 and maximum value is 20.
|
|
1130
|
+
*/
|
|
1131
|
+
maxResults?: number | null;
|
|
1132
|
+
/**
|
|
1133
|
+
* A 2-letter ISO 639-1 language code for interface language in the search results. Default: 'en'.
|
|
1134
|
+
*/
|
|
1135
|
+
language?: string | null;
|
|
1136
|
+
/**
|
|
1137
|
+
* A 2-letter country/region code for where the results should come from (e.g. 'US', 'JP', 'CN'). Default is 'US'.
|
|
1138
|
+
*/
|
|
1139
|
+
region?: string | null;
|
|
1140
|
+
/**
|
|
1141
|
+
* Location information in format 'lat:<float>;long:<float>', e.g. 'lat:40.753250;long:-74.003807'. If not specified, could infer location in query.
|
|
1142
|
+
*/
|
|
1143
|
+
location?: string | null;
|
|
1144
|
+
contentFormat?: ContentFormat;
|
|
1145
|
+
/**
|
|
1146
|
+
* The maximum number of characters in the content field in response. Default value is 10000 characters, and maximum value is 500000 characters.
|
|
1147
|
+
*/
|
|
1148
|
+
maxLength?: number | null;
|
|
1149
|
+
};
|
|
1150
|
+
|
|
1151
|
+
type VideosRequest = {
|
|
1152
|
+
/**
|
|
1153
|
+
* A search query string
|
|
1154
|
+
*/
|
|
1155
|
+
query: string;
|
|
1156
|
+
/**
|
|
1157
|
+
* Max number of results to return. Default is 30 and maximum value is 30.
|
|
1158
|
+
*/
|
|
1159
|
+
maxResults?: number | null;
|
|
1160
|
+
/**
|
|
1161
|
+
* A 2-letter ISO 639-1 language code for interface language in the search results. Default: 'en'.
|
|
1162
|
+
*/
|
|
1163
|
+
language?: string | null;
|
|
1164
|
+
/**
|
|
1165
|
+
* A 2-letter country/region code for where the results should come from (e.g. 'US', 'JP', 'CN'). Default is 'US'.
|
|
1166
|
+
*/
|
|
1167
|
+
region?: string | null;
|
|
1168
|
+
/**
|
|
1169
|
+
* Whether to include playlist results in response. Default is false.
|
|
1170
|
+
*/
|
|
1171
|
+
enablePlaylist?: boolean | null;
|
|
1172
|
+
/**
|
|
1173
|
+
* The time range to filter results based on discovery date. Supports 'week', 'month', 'year' for relative time, or ISO 8601 date interval format: 'YYYY-MM-DD/YYYY-MM-DD' or 'YYYY-MM-DDTHH:mm:ssZ/YYYY-MM-DDTHH:mm:ssZ' for a date/datetime range, use .. to omit start or end date.
|
|
1174
|
+
*/
|
|
1175
|
+
freshness?: string | null;
|
|
1176
|
+
/**
|
|
1177
|
+
* Filter videos by embedding capabilities. Allowed values: 'player' (has embeddable player). When not set, no filtering is applied.
|
|
1178
|
+
*/
|
|
1179
|
+
embeddable?: Array<string> | null;
|
|
1180
|
+
resolution?: VideoResolution;
|
|
1181
|
+
safeSearch?: SafeSearch;
|
|
1182
|
+
duration?: VideoDuration;
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
type WebRequest = {
|
|
1186
|
+
/**
|
|
1187
|
+
* A search query string. Supports 'site:' and '-site:' operators to include or exclude results from specific sites (e.g. 'query site:example.com'). Use these operators only when necessary, as they inherently reduce result relevance.
|
|
1188
|
+
*/
|
|
1189
|
+
query: string;
|
|
1190
|
+
/**
|
|
1191
|
+
* Max number of results to return. Default is 10 and maximum value is 50.
|
|
1192
|
+
*/
|
|
1193
|
+
maxResults?: number | null;
|
|
1194
|
+
/**
|
|
1195
|
+
* A 2-letter ISO 639-1 language code for interface language in the search results. Default: 'en'.
|
|
1196
|
+
*/
|
|
1197
|
+
language?: string | null;
|
|
1198
|
+
/**
|
|
1199
|
+
* A 2-letter country/region code for where the results should come from (e.g. 'US', 'JP', 'CN'). Default is 'US'.
|
|
1200
|
+
*/
|
|
1201
|
+
region?: string | null;
|
|
1202
|
+
/**
|
|
1203
|
+
* Location information in format 'lat:<float>;long:<float>'.
|
|
1204
|
+
*/
|
|
1205
|
+
location?: string | null;
|
|
1206
|
+
contentFormat?: ContentFormat;
|
|
1207
|
+
/**
|
|
1208
|
+
* The maximum number of characters in the content or passage field in response. Default value is 10000 characters, and maximum value is 500000 characters.
|
|
1209
|
+
*/
|
|
1210
|
+
maxLength?: number | null;
|
|
1211
|
+
safeSearch?: SafeSearch;
|
|
1212
|
+
};
|
|
1143
1213
|
|
|
1144
1214
|
/**
|
|
1145
1215
|
* HTTP transport implementation.
|
|
@@ -1183,4 +1253,4 @@ declare class HttpTransport implements Transport {
|
|
|
1183
1253
|
close(): Promise<void>;
|
|
1184
1254
|
}
|
|
1185
1255
|
|
|
1186
|
-
export { APIConnectionError, APIStatusError, ApiKeyAuth, type AuthProvider, AuthenticationError, BrowseContentFormat, type BrowseFetchOptions,
|
|
1256
|
+
export { APIConnectionError, APIStatusError, type ApiErrorResponse, ApiKeyAuth, type AuthProvider, AuthenticationError, BrowseContentFormat, type BrowseFetchOptions, type BrowseParams, type BrowseRequest, BrowseResource, type BrowseResponse, ContentFormat, ContentTier, DEFAULT_SCOPE, DEFAULT_TIMEOUT, EntraIDAuth, type FetchFunction, HttpTransport, type HttpTransportOptions, ImageAspectRatio, ImageColor, type ImageItem, type ImageSearchOptions, ImageSize, type ImagesRequest, ImagesResource, type ImagesResponse, type ImagesSearchParams, LiveCrawlMode, type NewsItem, type NewsRequest, NewsResource, type NewsResponse, type NewsSearchOptions, type NewsSearchParams, type NewsThumbnail, PermissionDeniedError, type PlaylistItem, type PlaylistVideo, RateLimitError, RetryPolicy, type RetryPolicyOptions, SafeSearch, type TelemetryEvent, type TelemetryHook, type TokenCredential, type Transport, type TransportRequestOptions, VideoDuration, type VideoItem, type VideoMoment, VideoResolution, type VideoSearchOptions, type VideosRequest, VideosResource, type VideosResponse, type VideosSearchParams, WebIQClient, type WebIQClientOptions, WebIQError, type WebRequest, WebResource, type WebResponse, type WebResult, type WebSearchOptions, type WebSearchParams, createAuth, createClient, createTelemetryEvent, safeCall };
|
package/dist/index.js
CHANGED
|
@@ -307,62 +307,6 @@ var BrowseResource = class {
|
|
|
307
307
|
}
|
|
308
308
|
};
|
|
309
309
|
|
|
310
|
-
// src/resources/classic.ts
|
|
311
|
-
var ClassicResource = class {
|
|
312
|
-
constructor(transport) {
|
|
313
|
-
this.transport = transport;
|
|
314
|
-
}
|
|
315
|
-
transport;
|
|
316
|
-
/**
|
|
317
|
-
* Perform a classic search returning grouped results across multiple answer types.
|
|
318
|
-
*
|
|
319
|
-
* @param query - Search query string (1-1000 chars)
|
|
320
|
-
* @param options - Search options
|
|
321
|
-
* @returns SearchClassicResponse with querySignals, traceId, and additional answer types
|
|
322
|
-
*/
|
|
323
|
-
async search(query, options) {
|
|
324
|
-
const payload = { query };
|
|
325
|
-
if (options?.language !== void 0) {
|
|
326
|
-
payload.language = options.language;
|
|
327
|
-
}
|
|
328
|
-
if (options?.region !== void 0) {
|
|
329
|
-
payload.region = options.region;
|
|
330
|
-
}
|
|
331
|
-
if (options?.maxAnswerTypes !== void 0) {
|
|
332
|
-
payload.maxAnswerTypes = options.maxAnswerTypes;
|
|
333
|
-
}
|
|
334
|
-
if (options?.location) {
|
|
335
|
-
payload.location = options.location;
|
|
336
|
-
}
|
|
337
|
-
if (options?.maxResultsWeb !== void 0) {
|
|
338
|
-
payload.maxResultsWeb = options.maxResultsWeb;
|
|
339
|
-
}
|
|
340
|
-
if (options?.maxLength !== void 0) {
|
|
341
|
-
payload.maxLength = options.maxLength;
|
|
342
|
-
}
|
|
343
|
-
if (options?.contentFormat !== void 0) {
|
|
344
|
-
payload.contentFormat = options.contentFormat;
|
|
345
|
-
}
|
|
346
|
-
if (options?.freshness !== void 0) {
|
|
347
|
-
payload.freshness = options.freshness;
|
|
348
|
-
}
|
|
349
|
-
if (options?.responseFilter !== void 0) {
|
|
350
|
-
payload.responseFilter = options.responseFilter;
|
|
351
|
-
}
|
|
352
|
-
if (options?.safeSearch !== void 0) {
|
|
353
|
-
payload.safeSearch = options.safeSearch;
|
|
354
|
-
}
|
|
355
|
-
const result = await this.transport.request({
|
|
356
|
-
method: "POST",
|
|
357
|
-
path: "/search/classic",
|
|
358
|
-
json: payload,
|
|
359
|
-
timeout: options?.timeout,
|
|
360
|
-
signal: options?.signal
|
|
361
|
-
});
|
|
362
|
-
return result;
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
|
|
366
310
|
// src/errors.ts
|
|
367
311
|
var WebIQError = class _WebIQError extends Error {
|
|
368
312
|
constructor(message, options) {
|
|
@@ -680,8 +624,6 @@ var WebIQClient = class {
|
|
|
680
624
|
images;
|
|
681
625
|
/** Browse resource */
|
|
682
626
|
browse;
|
|
683
|
-
/** Classic search resource */
|
|
684
|
-
classic;
|
|
685
627
|
_transport;
|
|
686
628
|
_auth;
|
|
687
629
|
constructor(options) {
|
|
@@ -708,7 +650,6 @@ var WebIQClient = class {
|
|
|
708
650
|
this.videos = new VideosResource(this._transport);
|
|
709
651
|
this.images = new ImagesResource(this._transport);
|
|
710
652
|
this.browse = new BrowseResource(this._transport);
|
|
711
|
-
this.classic = new ClassicResource(this._transport);
|
|
712
653
|
}
|
|
713
654
|
/**
|
|
714
655
|
* Close the client and release resources.
|
|
@@ -729,14 +670,6 @@ var BrowseContentFormat = /* @__PURE__ */ ((BrowseContentFormat2) => {
|
|
|
729
670
|
return BrowseContentFormat2;
|
|
730
671
|
})(BrowseContentFormat || {});
|
|
731
672
|
|
|
732
|
-
// src/generated-otc/models/BrowseLiveCrawl.ts
|
|
733
|
-
var BrowseLiveCrawl = /* @__PURE__ */ ((BrowseLiveCrawl2) => {
|
|
734
|
-
BrowseLiveCrawl2["NONE"] = "none";
|
|
735
|
-
BrowseLiveCrawl2["FALLBACK"] = "fallback";
|
|
736
|
-
BrowseLiveCrawl2["FORCE"] = "force";
|
|
737
|
-
return BrowseLiveCrawl2;
|
|
738
|
-
})(BrowseLiveCrawl || {});
|
|
739
|
-
|
|
740
673
|
// src/generated-otc/models/ContentFormat.ts
|
|
741
674
|
var ContentFormat = /* @__PURE__ */ ((ContentFormat2) => {
|
|
742
675
|
ContentFormat2["PASSAGE"] = "passage";
|
|
@@ -754,38 +687,6 @@ var ContentTier = /* @__PURE__ */ ((ContentTier2) => {
|
|
|
754
687
|
return ContentTier2;
|
|
755
688
|
})(ContentTier || {});
|
|
756
689
|
|
|
757
|
-
// src/generated-otc/models/SafeSearch.ts
|
|
758
|
-
var SafeSearch = /* @__PURE__ */ ((SafeSearch2) => {
|
|
759
|
-
SafeSearch2["OFF"] = "off";
|
|
760
|
-
SafeSearch2["STRICT"] = "strict";
|
|
761
|
-
return SafeSearch2;
|
|
762
|
-
})(SafeSearch || {});
|
|
763
|
-
|
|
764
|
-
// src/generated-otc/models/SafeSearchMode.ts
|
|
765
|
-
var SafeSearchMode = /* @__PURE__ */ ((SafeSearchMode2) => {
|
|
766
|
-
SafeSearchMode2["OFF"] = "off";
|
|
767
|
-
SafeSearchMode2["MODERATE"] = "moderate";
|
|
768
|
-
SafeSearchMode2["STRICT"] = "strict";
|
|
769
|
-
return SafeSearchMode2;
|
|
770
|
-
})(SafeSearchMode || {});
|
|
771
|
-
|
|
772
|
-
// src/generated-otc/models/VideoDuration.ts
|
|
773
|
-
var VideoDuration = /* @__PURE__ */ ((VideoDuration2) => {
|
|
774
|
-
VideoDuration2["SHORT"] = "short";
|
|
775
|
-
VideoDuration2["MEDIUM"] = "medium";
|
|
776
|
-
VideoDuration2["LONG"] = "long";
|
|
777
|
-
return VideoDuration2;
|
|
778
|
-
})(VideoDuration || {});
|
|
779
|
-
|
|
780
|
-
// src/generated-otc/models/VideoResolution.ts
|
|
781
|
-
var VideoResolution = /* @__PURE__ */ ((VideoResolution2) => {
|
|
782
|
-
VideoResolution2["_360P"] = "360p";
|
|
783
|
-
VideoResolution2["_480P"] = "480p";
|
|
784
|
-
VideoResolution2["_720P"] = "720p";
|
|
785
|
-
VideoResolution2["_1080P"] = "1080p";
|
|
786
|
-
return VideoResolution2;
|
|
787
|
-
})(VideoResolution || {});
|
|
788
|
-
|
|
789
690
|
// src/generated-otc/models/ImageAspectRatio.ts
|
|
790
691
|
var ImageAspectRatio = /* @__PURE__ */ ((ImageAspectRatio2) => {
|
|
791
692
|
ImageAspectRatio2["SQUARE"] = "square";
|
|
@@ -810,14 +711,44 @@ var ImageSize = /* @__PURE__ */ ((ImageSize2) => {
|
|
|
810
711
|
return ImageSize2;
|
|
811
712
|
})(ImageSize || {});
|
|
812
713
|
|
|
714
|
+
// src/generated-otc/models/LiveCrawlMode.ts
|
|
715
|
+
var LiveCrawlMode = /* @__PURE__ */ ((LiveCrawlMode2) => {
|
|
716
|
+
LiveCrawlMode2["NONE"] = "none";
|
|
717
|
+
LiveCrawlMode2["FALLBACK"] = "fallback";
|
|
718
|
+
LiveCrawlMode2["FORCE"] = "force";
|
|
719
|
+
return LiveCrawlMode2;
|
|
720
|
+
})(LiveCrawlMode || {});
|
|
721
|
+
|
|
722
|
+
// src/generated-otc/models/SafeSearch.ts
|
|
723
|
+
var SafeSearch = /* @__PURE__ */ ((SafeSearch2) => {
|
|
724
|
+
SafeSearch2["OFF"] = "off";
|
|
725
|
+
SafeSearch2["STRICT"] = "strict";
|
|
726
|
+
return SafeSearch2;
|
|
727
|
+
})(SafeSearch || {});
|
|
728
|
+
|
|
729
|
+
// src/generated-otc/models/VideoDuration.ts
|
|
730
|
+
var VideoDuration = /* @__PURE__ */ ((VideoDuration2) => {
|
|
731
|
+
VideoDuration2["SHORT"] = "short";
|
|
732
|
+
VideoDuration2["MEDIUM"] = "medium";
|
|
733
|
+
VideoDuration2["LONG"] = "long";
|
|
734
|
+
return VideoDuration2;
|
|
735
|
+
})(VideoDuration || {});
|
|
736
|
+
|
|
737
|
+
// src/generated-otc/models/VideoResolution.ts
|
|
738
|
+
var VideoResolution = /* @__PURE__ */ ((VideoResolution2) => {
|
|
739
|
+
VideoResolution2["_360P"] = "360p";
|
|
740
|
+
VideoResolution2["_480P"] = "480p";
|
|
741
|
+
VideoResolution2["_720P"] = "720p";
|
|
742
|
+
VideoResolution2["_1080P"] = "1080p";
|
|
743
|
+
return VideoResolution2;
|
|
744
|
+
})(VideoResolution || {});
|
|
745
|
+
|
|
813
746
|
exports.APIConnectionError = APIConnectionError;
|
|
814
747
|
exports.APIStatusError = APIStatusError;
|
|
815
748
|
exports.ApiKeyAuth = ApiKeyAuth;
|
|
816
749
|
exports.AuthenticationError = AuthenticationError;
|
|
817
750
|
exports.BrowseContentFormat = BrowseContentFormat;
|
|
818
|
-
exports.BrowseLiveCrawl = BrowseLiveCrawl;
|
|
819
751
|
exports.BrowseResource = BrowseResource;
|
|
820
|
-
exports.ClassicResource = ClassicResource;
|
|
821
752
|
exports.ContentFormat = ContentFormat;
|
|
822
753
|
exports.ContentTier = ContentTier;
|
|
823
754
|
exports.DEFAULT_SCOPE = DEFAULT_SCOPE;
|
|
@@ -828,12 +759,12 @@ exports.ImageAspectRatio = ImageAspectRatio;
|
|
|
828
759
|
exports.ImageColor = ImageColor;
|
|
829
760
|
exports.ImageSize = ImageSize;
|
|
830
761
|
exports.ImagesResource = ImagesResource;
|
|
762
|
+
exports.LiveCrawlMode = LiveCrawlMode;
|
|
831
763
|
exports.NewsResource = NewsResource;
|
|
832
764
|
exports.PermissionDeniedError = PermissionDeniedError;
|
|
833
765
|
exports.RateLimitError = RateLimitError;
|
|
834
766
|
exports.RetryPolicy = RetryPolicy;
|
|
835
767
|
exports.SafeSearch = SafeSearch;
|
|
836
|
-
exports.SafeSearchMode = SafeSearchMode;
|
|
837
768
|
exports.VideoDuration = VideoDuration;
|
|
838
769
|
exports.VideoResolution = VideoResolution;
|
|
839
770
|
exports.VideosResource = VideosResource;
|
package/dist/index.mjs
CHANGED
|
@@ -305,62 +305,6 @@ var BrowseResource = class {
|
|
|
305
305
|
}
|
|
306
306
|
};
|
|
307
307
|
|
|
308
|
-
// src/resources/classic.ts
|
|
309
|
-
var ClassicResource = class {
|
|
310
|
-
constructor(transport) {
|
|
311
|
-
this.transport = transport;
|
|
312
|
-
}
|
|
313
|
-
transport;
|
|
314
|
-
/**
|
|
315
|
-
* Perform a classic search returning grouped results across multiple answer types.
|
|
316
|
-
*
|
|
317
|
-
* @param query - Search query string (1-1000 chars)
|
|
318
|
-
* @param options - Search options
|
|
319
|
-
* @returns SearchClassicResponse with querySignals, traceId, and additional answer types
|
|
320
|
-
*/
|
|
321
|
-
async search(query, options) {
|
|
322
|
-
const payload = { query };
|
|
323
|
-
if (options?.language !== void 0) {
|
|
324
|
-
payload.language = options.language;
|
|
325
|
-
}
|
|
326
|
-
if (options?.region !== void 0) {
|
|
327
|
-
payload.region = options.region;
|
|
328
|
-
}
|
|
329
|
-
if (options?.maxAnswerTypes !== void 0) {
|
|
330
|
-
payload.maxAnswerTypes = options.maxAnswerTypes;
|
|
331
|
-
}
|
|
332
|
-
if (options?.location) {
|
|
333
|
-
payload.location = options.location;
|
|
334
|
-
}
|
|
335
|
-
if (options?.maxResultsWeb !== void 0) {
|
|
336
|
-
payload.maxResultsWeb = options.maxResultsWeb;
|
|
337
|
-
}
|
|
338
|
-
if (options?.maxLength !== void 0) {
|
|
339
|
-
payload.maxLength = options.maxLength;
|
|
340
|
-
}
|
|
341
|
-
if (options?.contentFormat !== void 0) {
|
|
342
|
-
payload.contentFormat = options.contentFormat;
|
|
343
|
-
}
|
|
344
|
-
if (options?.freshness !== void 0) {
|
|
345
|
-
payload.freshness = options.freshness;
|
|
346
|
-
}
|
|
347
|
-
if (options?.responseFilter !== void 0) {
|
|
348
|
-
payload.responseFilter = options.responseFilter;
|
|
349
|
-
}
|
|
350
|
-
if (options?.safeSearch !== void 0) {
|
|
351
|
-
payload.safeSearch = options.safeSearch;
|
|
352
|
-
}
|
|
353
|
-
const result = await this.transport.request({
|
|
354
|
-
method: "POST",
|
|
355
|
-
path: "/search/classic",
|
|
356
|
-
json: payload,
|
|
357
|
-
timeout: options?.timeout,
|
|
358
|
-
signal: options?.signal
|
|
359
|
-
});
|
|
360
|
-
return result;
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
|
|
364
308
|
// src/errors.ts
|
|
365
309
|
var WebIQError = class _WebIQError extends Error {
|
|
366
310
|
constructor(message, options) {
|
|
@@ -678,8 +622,6 @@ var WebIQClient = class {
|
|
|
678
622
|
images;
|
|
679
623
|
/** Browse resource */
|
|
680
624
|
browse;
|
|
681
|
-
/** Classic search resource */
|
|
682
|
-
classic;
|
|
683
625
|
_transport;
|
|
684
626
|
_auth;
|
|
685
627
|
constructor(options) {
|
|
@@ -706,7 +648,6 @@ var WebIQClient = class {
|
|
|
706
648
|
this.videos = new VideosResource(this._transport);
|
|
707
649
|
this.images = new ImagesResource(this._transport);
|
|
708
650
|
this.browse = new BrowseResource(this._transport);
|
|
709
|
-
this.classic = new ClassicResource(this._transport);
|
|
710
651
|
}
|
|
711
652
|
/**
|
|
712
653
|
* Close the client and release resources.
|
|
@@ -727,14 +668,6 @@ var BrowseContentFormat = /* @__PURE__ */ ((BrowseContentFormat2) => {
|
|
|
727
668
|
return BrowseContentFormat2;
|
|
728
669
|
})(BrowseContentFormat || {});
|
|
729
670
|
|
|
730
|
-
// src/generated-otc/models/BrowseLiveCrawl.ts
|
|
731
|
-
var BrowseLiveCrawl = /* @__PURE__ */ ((BrowseLiveCrawl2) => {
|
|
732
|
-
BrowseLiveCrawl2["NONE"] = "none";
|
|
733
|
-
BrowseLiveCrawl2["FALLBACK"] = "fallback";
|
|
734
|
-
BrowseLiveCrawl2["FORCE"] = "force";
|
|
735
|
-
return BrowseLiveCrawl2;
|
|
736
|
-
})(BrowseLiveCrawl || {});
|
|
737
|
-
|
|
738
671
|
// src/generated-otc/models/ContentFormat.ts
|
|
739
672
|
var ContentFormat = /* @__PURE__ */ ((ContentFormat2) => {
|
|
740
673
|
ContentFormat2["PASSAGE"] = "passage";
|
|
@@ -752,38 +685,6 @@ var ContentTier = /* @__PURE__ */ ((ContentTier2) => {
|
|
|
752
685
|
return ContentTier2;
|
|
753
686
|
})(ContentTier || {});
|
|
754
687
|
|
|
755
|
-
// src/generated-otc/models/SafeSearch.ts
|
|
756
|
-
var SafeSearch = /* @__PURE__ */ ((SafeSearch2) => {
|
|
757
|
-
SafeSearch2["OFF"] = "off";
|
|
758
|
-
SafeSearch2["STRICT"] = "strict";
|
|
759
|
-
return SafeSearch2;
|
|
760
|
-
})(SafeSearch || {});
|
|
761
|
-
|
|
762
|
-
// src/generated-otc/models/SafeSearchMode.ts
|
|
763
|
-
var SafeSearchMode = /* @__PURE__ */ ((SafeSearchMode2) => {
|
|
764
|
-
SafeSearchMode2["OFF"] = "off";
|
|
765
|
-
SafeSearchMode2["MODERATE"] = "moderate";
|
|
766
|
-
SafeSearchMode2["STRICT"] = "strict";
|
|
767
|
-
return SafeSearchMode2;
|
|
768
|
-
})(SafeSearchMode || {});
|
|
769
|
-
|
|
770
|
-
// src/generated-otc/models/VideoDuration.ts
|
|
771
|
-
var VideoDuration = /* @__PURE__ */ ((VideoDuration2) => {
|
|
772
|
-
VideoDuration2["SHORT"] = "short";
|
|
773
|
-
VideoDuration2["MEDIUM"] = "medium";
|
|
774
|
-
VideoDuration2["LONG"] = "long";
|
|
775
|
-
return VideoDuration2;
|
|
776
|
-
})(VideoDuration || {});
|
|
777
|
-
|
|
778
|
-
// src/generated-otc/models/VideoResolution.ts
|
|
779
|
-
var VideoResolution = /* @__PURE__ */ ((VideoResolution2) => {
|
|
780
|
-
VideoResolution2["_360P"] = "360p";
|
|
781
|
-
VideoResolution2["_480P"] = "480p";
|
|
782
|
-
VideoResolution2["_720P"] = "720p";
|
|
783
|
-
VideoResolution2["_1080P"] = "1080p";
|
|
784
|
-
return VideoResolution2;
|
|
785
|
-
})(VideoResolution || {});
|
|
786
|
-
|
|
787
688
|
// src/generated-otc/models/ImageAspectRatio.ts
|
|
788
689
|
var ImageAspectRatio = /* @__PURE__ */ ((ImageAspectRatio2) => {
|
|
789
690
|
ImageAspectRatio2["SQUARE"] = "square";
|
|
@@ -808,4 +709,36 @@ var ImageSize = /* @__PURE__ */ ((ImageSize2) => {
|
|
|
808
709
|
return ImageSize2;
|
|
809
710
|
})(ImageSize || {});
|
|
810
711
|
|
|
811
|
-
|
|
712
|
+
// src/generated-otc/models/LiveCrawlMode.ts
|
|
713
|
+
var LiveCrawlMode = /* @__PURE__ */ ((LiveCrawlMode2) => {
|
|
714
|
+
LiveCrawlMode2["NONE"] = "none";
|
|
715
|
+
LiveCrawlMode2["FALLBACK"] = "fallback";
|
|
716
|
+
LiveCrawlMode2["FORCE"] = "force";
|
|
717
|
+
return LiveCrawlMode2;
|
|
718
|
+
})(LiveCrawlMode || {});
|
|
719
|
+
|
|
720
|
+
// src/generated-otc/models/SafeSearch.ts
|
|
721
|
+
var SafeSearch = /* @__PURE__ */ ((SafeSearch2) => {
|
|
722
|
+
SafeSearch2["OFF"] = "off";
|
|
723
|
+
SafeSearch2["STRICT"] = "strict";
|
|
724
|
+
return SafeSearch2;
|
|
725
|
+
})(SafeSearch || {});
|
|
726
|
+
|
|
727
|
+
// src/generated-otc/models/VideoDuration.ts
|
|
728
|
+
var VideoDuration = /* @__PURE__ */ ((VideoDuration2) => {
|
|
729
|
+
VideoDuration2["SHORT"] = "short";
|
|
730
|
+
VideoDuration2["MEDIUM"] = "medium";
|
|
731
|
+
VideoDuration2["LONG"] = "long";
|
|
732
|
+
return VideoDuration2;
|
|
733
|
+
})(VideoDuration || {});
|
|
734
|
+
|
|
735
|
+
// src/generated-otc/models/VideoResolution.ts
|
|
736
|
+
var VideoResolution = /* @__PURE__ */ ((VideoResolution2) => {
|
|
737
|
+
VideoResolution2["_360P"] = "360p";
|
|
738
|
+
VideoResolution2["_480P"] = "480p";
|
|
739
|
+
VideoResolution2["_720P"] = "720p";
|
|
740
|
+
VideoResolution2["_1080P"] = "1080p";
|
|
741
|
+
return VideoResolution2;
|
|
742
|
+
})(VideoResolution || {});
|
|
743
|
+
|
|
744
|
+
export { APIConnectionError, APIStatusError, ApiKeyAuth, AuthenticationError, BrowseContentFormat, BrowseResource, ContentFormat, ContentTier, DEFAULT_SCOPE, DEFAULT_TIMEOUT, EntraIDAuth, HttpTransport, ImageAspectRatio, ImageColor, ImageSize, ImagesResource, LiveCrawlMode, NewsResource, PermissionDeniedError, RateLimitError, RetryPolicy, SafeSearch, VideoDuration, VideoResolution, VideosResource, WebIQClient, WebIQError, WebResource, createAuth, createClient, createTelemetryEvent, safeCall };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/webiq",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Web IQ API TypeScript SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"format": "prettier --write \"src/**/*.ts\" \"*.md\" \"*.json\" --ignore-path ../../.prettierignore",
|
|
25
25
|
"format:check": "prettier --check \"src/**/*.ts\" \"*.md\" \"*.json\" --ignore-path ../../.prettierignore",
|
|
26
26
|
"typecheck": "tsc --noEmit",
|
|
27
|
+
"smoke:examples": "tsc --noEmit -p tsconfig.examples.json",
|
|
27
28
|
"test": "vitest run",
|
|
28
29
|
"test:watch": "vitest",
|
|
29
30
|
"clean": "rimraf dist"
|